code stringlengths 1 2.01M | repo_name stringlengths 3 62 | path stringlengths 1 267 | language stringclasses 231 values | license stringclasses 13 values | size int64 1 2.01M |
|---|---|---|---|---|---|
/*******************************************************************************
* *
* F1LT - unofficial Formula 1 live timing application *
* Copyright (C) 2012-2013 Mariusz Pilarek (pieczaro@gmail.com) *
* *
* 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 *
* the Free Software Foundation, either version 3 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
* *
*******************************************************************************/
#include "driverrecordsdialog.h"
#include "ui_driverrecordsdialog.h"
#include "../core/colorsmanager.h"
#include "../main_gui/ltitemdelegate.h"
DriverRecordsDialog::DriverRecordsDialog(QWidget *parent) :
QDialog(parent/*, Qt::Window*/),
ui(new Ui::DriverRecordsDialog)
{
ui->setupUi(this);
ui->tableWidget->setItemDelegate(new LTItemDelegate());
}
DriverRecordsDialog::~DriverRecordsDialog()
{
delete ui;
}
void DriverRecordsDialog::exec(const TrackWeekendRecords &records, QString trackName)
{
driverRecords = records;
this->trackName = trackName;
loadRecords();
QDialog::show();
}
void DriverRecordsDialog::loadRecords()
{
//local class used for proper sorting columns
class MyTableWidgetItem : public QTableWidgetItem
{
public:
MyTableWidgetItem() : QTableWidgetItem() { }
MyTableWidgetItem(QString s) : QTableWidgetItem(s) { }
virtual bool operator <(const QTableWidgetItem &other) const
{
if (text().isNull() || text() == "")
return false;
if (other.text().isNull() || other.text() == "")
return true;
return text() < other.text();
}
};
setWindowTitle("Driver records: " + trackName);
int currentIndex = ui->comboBox->currentIndex();
int i = 0;
for (; i < driverRecords.driverRecords.size(); ++i)
{
if (i <= ui->tableWidget->rowCount())
ui->tableWidget->insertRow(i);
MyTableWidgetItem *item = new MyTableWidgetItem(driverRecords.driverRecords[i].driver);
item->setForeground(ColorsManager::getInstance().getColor(LTPackets::WHITE));
ui->tableWidget->setItem(i, 0, item);
item = static_cast<MyTableWidgetItem *>(ui->tableWidget->item(i, 1));
if (!item)
{
item = new MyTableWidgetItem();
ui->tableWidget->setItem(i, 1, item);
}
item->setText(driverRecords.driverRecords[i].team);
item->setForeground(ColorsManager::getInstance().getColor(LTPackets::WHITE));
QColor color = ColorsManager::getInstance().getColor(LTPackets::YELLOW);
Record rec;
if (currentIndex == 5)
rec = driverRecords.driverRecords[i].getWeekendRecord(S1_RECORD);
else
rec = driverRecords.driverRecords[i].sessionRecords[ui->comboBox->currentIndex()][S1_RECORD];
if (rec.time == driverRecords.sessionRecords[S1_RECORD].time && driverRecords.driverRecords[i].driver == driverRecords.sessionRecords[S1_RECORD].driver)
color = ColorsManager::getInstance().getColor(LTPackets::VIOLET);
QString text = rec.time.toString();
if ((currentIndex == 3 || currentIndex == 5) && text != "")
text += " (" + rec.session + ")";
item = static_cast<MyTableWidgetItem *>(ui->tableWidget->item(i, 3));
if (!item)
{
item = new MyTableWidgetItem();
ui->tableWidget->setItem(i, 3, item);
}
item->setText(text);
item->setForeground(color);
item->setTextAlignment(Qt::AlignCenter);
if (currentIndex == 5)
rec = driverRecords.driverRecords[i].getWeekendRecord(S2_RECORD);
else
rec = driverRecords.driverRecords[i].sessionRecords[ui->comboBox->currentIndex()][S2_RECORD];
if (rec.time == driverRecords.sessionRecords[S2_RECORD].time && driverRecords.driverRecords[i].driver == driverRecords.sessionRecords[S2_RECORD].driver)
color = ColorsManager::getInstance().getColor(LTPackets::VIOLET);
else
color = ColorsManager::getInstance().getColor(LTPackets::YELLOW);
text = rec.time.toString();
if ((currentIndex == 3 || currentIndex == 5) && text != "")
text += " (" + rec.session + ")";
item = static_cast<MyTableWidgetItem *>(ui->tableWidget->item(i, 4));
if (!item)
{
item = new MyTableWidgetItem();
ui->tableWidget->setItem(i, 4, item);
}
item->setText(text);
item->setForeground(color);
item->setTextAlignment(Qt::AlignCenter);
if (currentIndex == 5)
rec = driverRecords.driverRecords[i].getWeekendRecord(S3_RECORD);
else
rec = driverRecords.driverRecords[i].sessionRecords[ui->comboBox->currentIndex()][S3_RECORD];
if (rec.time == driverRecords.sessionRecords[S3_RECORD].time && driverRecords.driverRecords[i].driver == driverRecords.sessionRecords[S3_RECORD].driver)
color = ColorsManager::getInstance().getColor(LTPackets::VIOLET);
else
color = ColorsManager::getInstance().getColor(LTPackets::YELLOW);
text = rec.time.toString();
if ((currentIndex == 3 || currentIndex == 5) && text != "")
text += " (" + rec.session + ")";
item = static_cast<MyTableWidgetItem *>(ui->tableWidget->item(i, 5));
if (!item)
{
item = new MyTableWidgetItem();
ui->tableWidget->setItem(i, 5, item);
}
item->setText(text);
item->setForeground(color);
item->setTextAlignment(Qt::AlignCenter);
if (currentIndex == 5)
rec = driverRecords.driverRecords[i].getWeekendRecord(TIME_RECORD);
else
rec = driverRecords.driverRecords[i].sessionRecords[ui->comboBox->currentIndex()][TIME_RECORD];
if (rec.time == driverRecords.sessionRecords[TIME_RECORD].time && driverRecords.driverRecords[i].driver == driverRecords.sessionRecords[TIME_RECORD].driver)
color = ColorsManager::getInstance().getColor(LTPackets::VIOLET);
else
color = ColorsManager::getInstance().getColor(LTPackets::GREEN);
text = rec.time.toString();
if ((currentIndex == 3 || currentIndex == 5) && text != "")
text += " (" + rec.session + ")";
item = static_cast<MyTableWidgetItem *>(ui->tableWidget->item(i, 2));
if (!item)
{
item = new MyTableWidgetItem();
ui->tableWidget->setItem(i, 2, item);
}
item->setText(text);
item->setForeground(color);
item->setTextAlignment(Qt::AlignCenter);
}
for (int j = ui->tableWidget->rowCount()-1; j >= i; --j)
ui->tableWidget->removeRow(j);
if (ui->comboBox_2->currentIndex() > 0)
{
int col = ui->comboBox_2->currentIndex() + 1;
ui->tableWidget->sortByColumn(col, Qt::AscendingOrder);
}
}
void DriverRecordsDialog::loadRecords(const TrackWeekendRecords &records, QString trackName)
{
driverRecords = records;
this->trackName = trackName;
loadRecords();
}
void DriverRecordsDialog::setFont(const QFont &font)
{
ui->tableWidget->setFont(font);
}
void DriverRecordsDialog::saveSettings(QSettings &settings)
{
settings.setValue("ui/driver_records_geometry", saveGeometry());
settings.setValue("ui/driver_records_table", ui->tableWidget->saveGeometry());
settings.setValue("ui/driver_records_session", ui->comboBox->currentIndex());
settings.setValue("ui/driver_records_sort", ui->comboBox_2->currentIndex());
QList<QVariant> list;
for (int i = 0; i < ui->tableWidget->columnCount(); ++i)
list.append(ui->tableWidget->columnWidth(i));
settings.setValue("ui/driver_records_columns", list);
}
void DriverRecordsDialog::loadSettings(QSettings &settings)
{
restoreGeometry(settings.value("ui/driver_records_geometry").toByteArray());
ui->tableWidget->restoreGeometry(settings.value("ui/driver_records_table").toByteArray());
ui->comboBox->setCurrentIndex(settings.value("ui/driver_records_session", 5).toInt());
ui->comboBox_2->setCurrentIndex(settings.value("ui/driver_records_sort", 0).toInt());
QList<QVariant> list;
list = settings.value("ui/driver_records_columns").toList();
if (list.size() > 0 && list[0].toInt() > 0)
{
for (int i = 0; i < ui->tableWidget->columnCount(); ++i)
ui->tableWidget->setColumnWidth(i, list[i].toInt());
}
}
void DriverRecordsDialog::on_comboBox_currentIndexChanged(int)
{
loadRecords();
}
void DriverRecordsDialog::on_comboBox_2_currentIndexChanged(int index)
{
if (index > 0)
{
int col = index + 1;
ui->tableWidget->sortByColumn(col, Qt::AscendingOrder);
}
else
loadRecords();
}
| zywhlc-f1lt | src/tools/driverrecordsdialog.cpp | C++ | gpl3 | 9,973 |
/*******************************************************************************
* *
* F1LT - unofficial Formula 1 live timing application *
* Copyright (C) 2012-2013 Mariusz Pilarek (pieczaro@gmail.com) *
* *
* 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 *
* the Free Software Foundation, either version 3 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
* *
*******************************************************************************/
#include "headtoheaddialog.h"
#include "ui_headtoheaddialog.h"
#include <algorithm>
#include <QClipboard>
#include <QDebug>
#include <QKeyEvent>
#include <QStringList>
#include <QList>
#include <QLabel>
#include <QResizeEvent>
#include <QScrollBar>
#include <cmath>
#include "../core/colorsmanager.h"
#include "../main_gui/ltitemdelegate.h"
HeadToHeadDialog::HeadToHeadDialog(QWidget *parent) :
QDialog(parent, Qt::Window), ui(new Ui::HeadToHeadDialog), eventData(EventData::getInstance()), thumbnailsSize(150)
{
ui->setupUi(this);
QStringList ls;
// ls.append("");
// for (int i = 0; i < ed.driversData.size(); ++i)
// ls.append(eventData.driversData[i].driver);
comboBox[0] = ui->comboBox1;
comboBox[1] = ui->comboBox2;
// for (int i = 0; i < 4; ++i)
// {
// comboBox[i]->addItems(ls);
// comboBox[i]->setCurrentIndex(0);
// }
loadDriversList();
lapCompChart = new LapCompChart(this);
gapCompChart = new GapCompChart(this);
posCompChart = new PosCompChart(this);
posCompChart->setMinMax(1, SeasonData::getInstance().getTeams().size()*2);
connect(ui->comboBox1, SIGNAL(currentIndexChanged(int)), this, SLOT(comboBoxValueChanged(int)));
connect(ui->comboBox2, SIGNAL(currentIndexChanged(int)), this, SLOT(comboBoxValueChanged(int)));
// ui->tableWidget->setColumnWidth(0, 30);
// ui->tableWidget->setColumnWidth(1, 150);
// ui->tableWidget->setColumnWidth(2, 150);
// ui->tableWidget->setColumnWidth(3, 150);
// ui->tableWidget->setColumnWidth(4, 150);
ui->chartsTableWidget->setColumnWidth(0, 340);
ui->chartsTableWidget->setColumnWidth(1, 340);
ui->chartsTableWidget->insertRow(0);
ui->chartsTableWidget->setRowHeight(0, 20);
ui->chartsTableWidget->insertRow(1);
ui->chartsTableWidget->setRowHeight(1, 50);
ui->gapChartTableWidget->setColumnWidth(0, 340);
ui->gapChartTableWidget->setColumnWidth(1, 340);
ui->gapChartTableWidget->insertRow(0);
ui->gapChartTableWidget->setRowHeight(0, 20);
ui->gapChartTableWidget->insertRow(1);
ui->gapChartTableWidget->setRowHeight(1, 50);
ui->posChartTableWidget->setColumnWidth(0, 340);
ui->posChartTableWidget->setColumnWidth(1, 340);
ui->posChartTableWidget->insertRow(0);
ui->posChartTableWidget->setRowHeight(0, 20);
ui->posChartTableWidget->insertRow(1);
ui->posChartTableWidget->setRowHeight(1, 50);
QTableWidgetItem *item;
for (int j = 0; j < 2; ++j)
{
item = new QTableWidgetItem();
item->setFlags(Qt::NoItemFlags);
item->setTextAlignment(Qt::AlignCenter);
ui->chartsTableWidget->setItem(0, j, item);
item = new QTableWidgetItem();
item->setFlags(Qt::NoItemFlags);
item->setTextAlignment(Qt::AlignCenter);
ui->gapChartTableWidget->setItem(0, j, item);
item = new QTableWidgetItem();
item->setFlags(Qt::NoItemFlags);
item->setTextAlignment(Qt::AlignCenter);
ui->posChartTableWidget->setItem(0, j, item);
}
ui->chartsTableWidget->insertRow(2);
ui->chartsTableWidget->setCellWidget(2, 0, lapCompChart);
ui->chartsTableWidget->setSpan(2, 0, 1, 4);
ui->chartsTableWidget->setRowHeight(2, 500);
ui->gapChartTableWidget->insertRow(2);
ui->gapChartTableWidget->setCellWidget(2, 0, gapCompChart);
ui->gapChartTableWidget->setSpan(2, 0, 1, 4);
ui->gapChartTableWidget->setRowHeight(2, 500);
ui->posChartTableWidget->insertRow(2);
ui->posChartTableWidget->setCellWidget(2, 0, posCompChart);
ui->posChartTableWidget->setSpan(2, 0, 1, 4);
ui->posChartTableWidget->setRowHeight(2, 500);
ui->tableWidget->setItemDelegate(new LTItemDelegate(this));
ui->tableWidget->insertRow(0);
QLabel *lab = new QLabel();
lab->setAlignment(Qt::AlignCenter);
ui->tableWidget->setCellWidget(0, 2, lab);
lab = new QLabel();
lab->setAlignment(Qt::AlignCenter);
ui->tableWidget->setCellWidget(0, 7, lab);
ui->tableWidget->setSpan(0, 1 , 1, 5);
ui->tableWidget->setSpan(0, 7, 1, 5);
ui->tableWidget->setRowHeight(0, 50);
ui->tableWidget->insertRow(1);
item = new QTableWidgetItem("L");
item->setTextAlignment(Qt::AlignCenter);
item->setTextColor(ColorsManager::getInstance().getColor(LTPackets::DEFAULT));
ui->tableWidget->setItem(1, 0, item);
item = new QTableWidgetItem("P");
item->setTextAlignment(Qt::AlignVCenter | Qt::AlignRight);
item->setTextColor(ColorsManager::getInstance().getColor(LTPackets::DEFAULT));
ui->tableWidget->setItem(1, 1, item);
// item = new QTableWidgetItem("Gap");
// item->setTextAlignment(Qt::AlignCenter);
// item->setTextColor(SeasonData::getInstance().getColor(LTPackets::DEFAULT]);
// ui->tableWidget->setItem(1, 2, item);
item = new QTableWidgetItem("Lap time");
item->setTextAlignment(Qt::AlignCenter);
item->setTextColor(ColorsManager::getInstance().getColor(LTPackets::DEFAULT));
ui->tableWidget->setItem(1, 2, item);
item = new QTableWidgetItem("S1");
item->setTextAlignment(Qt::AlignCenter);
item->setTextColor(ColorsManager::getInstance().getColor(LTPackets::DEFAULT));
ui->tableWidget->setItem(1, 3, item);
item = new QTableWidgetItem("S2");
item->setTextAlignment(Qt::AlignCenter);
item->setTextColor(ColorsManager::getInstance().getColor(LTPackets::DEFAULT));
ui->tableWidget->setItem(1, 4, item);
item = new QTableWidgetItem("S3");
item->setTextAlignment(Qt::AlignCenter);
item->setTextColor(ColorsManager::getInstance().getColor(LTPackets::DEFAULT));
ui->tableWidget->setItem(1, 5, item);
item = new QTableWidgetItem("Gap");
item->setTextAlignment(Qt::AlignCenter);
item->setTextColor(ColorsManager::getInstance().getColor(LTPackets::DEFAULT));
ui->tableWidget->setItem(1, 6, item);
item = new QTableWidgetItem("P");
item->setTextAlignment(Qt::AlignRight | Qt::AlignVCenter);
item->setTextColor(ColorsManager::getInstance().getColor(LTPackets::DEFAULT));
ui->tableWidget->setItem(1, 7, item);
// item = new QTableWidgetItem("Gap");
// item->setTextAlignment(Qt::AlignCenter);
// item->setTextColor(SeasonData::getInstance().getColor(LTPackets::DEFAULT]);
// ui->tableWidget->setItem(1, 9, item);
item = new QTableWidgetItem("Lap time");
item->setTextAlignment(Qt::AlignCenter);
item->setTextColor(ColorsManager::getInstance().getColor(LTPackets::DEFAULT));
ui->tableWidget->setItem(1, 8, item);
item = new QTableWidgetItem("S1");
item->setTextAlignment(Qt::AlignCenter);
item->setTextColor(ColorsManager::getInstance().getColor(LTPackets::DEFAULT));
ui->tableWidget->setItem(1, 9, item);
item = new QTableWidgetItem("S2");
item->setTextAlignment(Qt::AlignCenter);
item->setTextColor(ColorsManager::getInstance().getColor(LTPackets::DEFAULT));
ui->tableWidget->setItem(1, 10, item);
item = new QTableWidgetItem("S3");
item->setTextAlignment(Qt::AlignCenter);
item->setTextColor(ColorsManager::getInstance().getColor(LTPackets::DEFAULT));
ui->tableWidget->setItem(1, 11, item);
ui->tableWidget->setRowHeight(1, 20);
}
HeadToHeadDialog::~HeadToHeadDialog()
{
delete ui;
}
void HeadToHeadDialog::loadDriversList()
{
/*smallCarImg = */ImagesFactory::getInstance().getCarThumbnailsFactory().loadCarThumbnails(thumbnailsSize);
comboBox[0]->clear();
comboBox[1]->clear();
if (comboBox[0]->itemText(1) == "")// && eventData.driversData[0].driver != "")
{
QStringList list = SeasonData::getInstance().getDriversList();
if (list.size() > 1)
{
comboBox[0]->addItems(list);
comboBox[1]->addItems(list);
}
}
// comboBox[0]->addItem("");
// comboBox[1]->addItem("");
}
void HeadToHeadDialog::updateData()
{
QString s1 = comboBox[0]->currentText() + " vs ";
if (comboBox[0]->currentText() == "")
s1 = "";
setWindowTitle("Head to head: " + s1 + comboBox[1]->currentText());
int scrollBarPosition = ui->tableWidget->verticalScrollBar()->sliderPosition();
QItemSelectionModel * selection = ui->tableWidget->selectionModel();
// for (int i = ui->tableWidget->rowCount()-1; i >= 2; --i)
// ui->tableWidget->removeRow(i);
QTableWidgetItem *item;
int firstLap = 99, lastLap = 0;
int index[2];
for (int i = 0; i < 2; ++i)
{
index[i] = 0;
int idx = eventData.getDriverId(getNumber(i));
if (idx > 0)
{
if (!eventData.getDriversData()[idx-1].getLapData().isEmpty())
{
if (eventData.getDriversData()[idx-1].getLapData()[0].getLapNumber() < firstLap)
firstLap = eventData.getDriversData()[idx-1].getLapData()[0].getLapNumber();
if (eventData.getDriversData()[idx-1].getLapData().last().getLapNumber() >= lastLap)
{
lastLap = eventData.getDriversData()[idx-1].getLapData().last().getLapNumber();
if (lastLap < eventData.getEventInfo().laps &&
!eventData.getDriversData()[idx-1].isRetired() &&
eventData.getDriversData()[idx-1].getLastLap().getSectorTime(3).toString() == "" &&
eventData.getDriversData()[idx-1].getLastLap().getTime().toString() != "IN PIT")
lastLap++;
}
}
DriverData &dd = eventData.getDriversData()[idx-1];
QLabel *lab = qobject_cast<QLabel*>(ui->tableWidget->cellWidget(0, 2+5*i));
lab->setPixmap(ImagesFactory::getInstance().getCarThumbnailsFactory().getCarThumbnail(dd.getNumber(), thumbnailsSize));//eventData.carImages[idx].scaledToWidth(120, Qt::SmoothTransformation));
}
else
{
QLabel *lab = qobject_cast<QLabel*>(ui->tableWidget->cellWidget(0, 2+5*i));
lab->clear();
}
}
int j = 0, k = firstLap;
bool scLap = false;
double interval = 0.0;
for (; k <= lastLap; ++k, ++j)
{
int lapNo = lastLap - k + firstLap;
LapTime laps[4];
if (ui->tableWidget->rowCount() <= j+2)
ui->tableWidget->insertRow(j+2);
item = ui->tableWidget->item(j+2, 0);
if (!item)
{
item = new QTableWidgetItem(QString("%1.").arg(lapNo));
item->setTextAlignment(Qt::AlignRight | Qt::AlignVCenter);
item->setTextColor(ColorsManager::getInstance().getColor(LTPackets::DEFAULT));
ui->tableWidget->setItem(j+2, 0, item);
}
else
item->setText(QString("%1.").arg(lapNo));
int driversIdx[2] = {-1, -1};
bool newLap[2] = {false, false};
scLap = false;
for (int i = 0; i < 2; ++i)
{
int idx = eventData.getDriverId(getNumber(i));
driversIdx[i] = idx-1;
if (idx > 0 && !eventData.getDriversData()[idx-1].getLapData().isEmpty())
{
// int lapIndex = (reversedOrder ? eventData.driversData[idx-1].lapData.size() - index[i] - 1 : index[i]);
DriverData &dd = eventData.getDriversData()[idx-1];
LapData ld = dd.getLapData(lapNo);
if (ld.getCarID() == -1)
ld = dd.getLapData().last();
// if (ld.carIDlapIndex >= 0 && lapIndex < dd.lapData.size())
// ld = dd.lapData[lapIndex];
// else
// ld = dd.lapData.last();
if (lapNo == (ld.getLapNumber()+1) && !dd.isRetired() && dd.getLastLap().getSectorTime(3).toString() == "" && dd.getLastLap().getTime().toString() != "IN PIT")
{
newLap[i] = true;
ld = dd.getLastLap();
ld.setLapNumber(ld.getLapNumber()+1);
}
// if (j == 0)
// {
// int idx = (dd.number > 13 ? dd.number-2 : dd.number-1) / 2;
// QLabel *lab = qobject_cast<QLabel*>(ui->tableWidget->cellWidget(0, 2+5*i));
// lab->setPixmap(smallCarImg[idx]);//eventData.carImages[idx].scaledToWidth(120, Qt::SmoothTransformation));
// }
if (dd.getLapData().size() >= index[i] && ld.getLapNumber() == lapNo)
{
item = ui->tableWidget->item(j+2, 1+i*6);
if (!item)
{
item = new QTableWidgetItem(QString::number(ld.getPosition()));
item->setTextColor(ColorsManager::getInstance().getColor(LTPackets::CYAN));
item->setTextAlignment(Qt::AlignVCenter | Qt::AlignRight);
ui->tableWidget->setItem(j+2, 1 + i*6, item);
}
else
item->setText(QString::number(ld.getPosition()));
// QString gap = dd.lapData[lapIndex].pos == 1 ? "" : ld.gap;
// item = new QTableWidgetItem(gap);
// item->setTextColor(SeasonData::getInstance().getColor(LTPackets::YELLOW]);
// item->setTextAlignment(Qt::AlignCenter);
// ui->tableWidget->setItem(j+2, 2 + i*7, item);
item = ui->tableWidget->item(j+2, 2+i*6);
QString lTime = newLap[i] ? "" : ld.getTime().toString();
laps[i] = newLap[i] ? LapTime() : ld.getTime();
if (!item)
{
item = new QTableWidgetItem(lTime);
item->setTextAlignment(Qt::AlignCenter);
ui->tableWidget->setItem(j+2, 2 + i*6, item);
}
else
item->setText(lTime);
if (lTime == "IN PIT")
{
QString pitTime = dd.getPitTime(ld.getLapNumber());
item->setText(item->text() + " (" + pitTime + ")");
item->setTextColor(ColorsManager::getInstance().getColor(LTPackets::RED));
}
else if (lTime == "RETIRED" || lTime.contains("LAP"))
item->setTextColor(ColorsManager::getInstance().getColor(LTPackets::RED));
else if (ld.getRaceLapExtraData().isSCLap())
{
item->setTextColor(ColorsManager::getInstance().getColor(LTPackets::YELLOW));
scLap = true;
}
else
item->setTextColor(ColorsManager::getInstance().getColor(LTPackets::GREEN));
item = ui->tableWidget->item(j+2, 3+i*6);
if (!item)
{
item = new QTableWidgetItem(ld.getSectorTime(1).toString());
item->setTextAlignment(Qt::AlignCenter);
ui->tableWidget->setItem(j+2, 3 + i*6, item);
}
else
item->setText(ld.getSectorTime(1).toString());
if (scLap)
item->setTextColor(ColorsManager::getInstance().getColor(LTPackets::YELLOW));
else
item->setTextColor(ColorsManager::getInstance().getColor(LTPackets::WHITE));
item = ui->tableWidget->item(j+2, 4+i*6);
if (!item)
{
item = new QTableWidgetItem(ld.getSectorTime(2).toString());
item->setTextAlignment(Qt::AlignCenter);
ui->tableWidget->setItem(j+2, 4 + i*6, item);
}
else
item->setText(ld.getSectorTime(2).toString());
if (scLap)
item->setTextColor(ColorsManager::getInstance().getColor(LTPackets::YELLOW));
else
item->setTextColor(ColorsManager::getInstance().getColor(LTPackets::WHITE));
item = ui->tableWidget->item(j+2, 5+i*6);
if (!item)
{
item = new QTableWidgetItem(ld.getSectorTime(3).toString());
item->setTextAlignment(Qt::AlignCenter);
ui->tableWidget->setItem(j+2, 5 + i*6, item);
}
else
item->setText(ld.getSectorTime(3).toString());
if (scLap)
item->setTextColor(ColorsManager::getInstance().getColor(LTPackets::YELLOW));
else
item->setTextColor(ColorsManager::getInstance().getColor(LTPackets::WHITE));
if (!newLap[i])
++index[i];
}
else
{
for (int w = i*6+1; w <= i*6+5; ++w)
{
item = ui->tableWidget->item(j+2, w);
if (item)
item->setText("");
}
}
}
else
{
// if (j == 0)
// {
// QLabel *lab = qobject_cast<QLabel*>(ui->tableWidget->cellWidget(0, 2+5*i));
// lab->clear();
// }
for (int w = i*6+1; w <= i*6+5; ++w)
{
item = ui->tableWidget->item(j+2, w);
if (item)
item->setText("");
}
}
}
int bestIdx = DriverData::lapDiff(laps);
int i = ((bestIdx+1)%2);
if (bestIdx != -1 && laps[i].toString() != "")
{
item = ui->tableWidget->item(j+2, 2 + i*6);
if (laps[i].toString() != "IN PIT" && laps[i].toString() != "RETIRED" && !laps[i].toString().contains("LAP"))
{
item->setText(item->text() + " (+"+QString::number(laps[i].toDouble(), 'f', 3)+")");
if (!scLap)
item->setTextColor(ColorsManager::getInstance().getColor(LTPackets::WHITE));
}
}
//sectors
if (!scLap)
{
double s1, s2;
for (int i = 0; i < 3; ++i)
{
if (ui->tableWidget->item(j+2, 3+i) && ui->tableWidget->item(j+2, 9+i) &&
(!ui->tableWidget->item(j+2, 3+i)->text().isNull() && !ui->tableWidget->item(j+2, 9+i)->text().isNull()))
{
s1 = ui->tableWidget->item(j+2, 3+i)->text().toDouble();
s2 = ui->tableWidget->item(j+2, 9+i)->text().toDouble();
int greenIdx = (s1 < s2) ? 3+i : 9+i;
if (s1 == s2)
greenIdx = laps[1] < laps[0] ? 3+i : 9+i;
ui->tableWidget->item(j+2, greenIdx)->setTextColor(ColorsManager::getInstance().getColor(LTPackets::GREEN));
}
}
}
//interval
QString sInterval;
if (driversIdx[0] >= 0 && driversIdx[1] >= 0 && !laps[0].toString().contains("LAP") && !laps[1].toString().contains("LAP"))
{
if (newLap[0] || newLap[1])
{
if (eventData.getEventType() == LTPackets::RACE_EVENT)
sInterval = eventData.calculateInterval(eventData.getDriversData()[driversIdx[0]], eventData.getDriversData()[driversIdx[1]], lapNo-1);
else
{
if (std::abs(eventData.getDriversData()[driversIdx[0]].getLastLap().getLapNumber() -
eventData.getDriversData()[driversIdx[1]].getLastLap().getLapNumber()) <= 1)
sInterval = "0.0";
}
double sumS[2] = {0.0, 0.0};
QString s1[2], s2[2];
if (sInterval != "" && sInterval != "-1L >" && sInterval != "+1L >")
{
for (int i = 0; i < 2; ++i)
{
item = ui->tableWidget->item(j+2, 3+i);
if (item)
s1[i] = item->text();
item = ui->tableWidget->item(j+2, 9+i);
if (item)
s2[i] = item->text();
}
if (s1[0] != "" && s2[0] != "")
sumS[0] = s1[0].toDouble() - s2[0].toDouble();
if (s1[1] != "" && s2[1] != "")
sumS[1] = s1[1].toDouble() - s2[1].toDouble();
interval = sInterval.toDouble() + sumS[0] + sumS[1];
sInterval = QString::number(interval, 'f', 1);
if (interval > 0)
sInterval = "+" + sInterval;
}
}
else
sInterval = eventData.calculateInterval(eventData.getDriversData()[driversIdx[0]], eventData.getDriversData()[driversIdx[1]], lapNo);
}
item = ui->tableWidget->item(j+2, 6);
if (!item)
{
item = new QTableWidgetItem(sInterval);
item->setTextAlignment(Qt::AlignCenter);
ui->tableWidget->setItem(j+2, 6, item);
}
else
item->setText(sInterval);
if (sInterval[0] == '-')
item->setTextColor(ColorsManager::getInstance().getColor(LTPackets::VIOLET));
else
item->setTextColor(ColorsManager::getInstance().getColor(LTPackets::RED));
ui->tableWidget->setRowHeight(j+2, 20);
}
for (int i = ui->tableWidget->rowCount()-1; i >= j+2; --i)
ui->tableWidget->removeRow(i);
ui->tableWidget->setSelectionModel(selection);
ui->tableWidget->verticalScrollBar()->setSliderPosition(scrollBarPosition);
}
void HeadToHeadDialog::updateCharts()
{
DriverData *driverData[4] = {0, 0, 0, 0};
QString driver;
for (int i = 0; i < 2; ++i)
{
int idx = eventData.getDriverId(getNumber(i));
if (idx > 0)
{
driver = eventData.getDriversData()[idx-1].getDriverName();
driverData[i] = &eventData.getDriversData()[idx-1];
// carIdx = (eventData.getDriversData()[idx-1].getNumber() > 13 ?
// eventData.getDriversData()[idx-1].getNumber() - 2 :
// eventData.getDriversData()[idx-1].getNumber() - 1) / 2;
QTableWidgetItem *item = ui->chartsTableWidget->item(0, i);
item->setText(driver);
item->setTextColor(ColorsManager::getInstance().getCarColor(driverData[i]->getNumber()));
item = ui->gapChartTableWidget->item(0, i);
item->setText(driver);
item->setTextColor(ColorsManager::getInstance().getCarColor(driverData[i]->getNumber()));
item = ui->posChartTableWidget->item(0, i);
item->setText(driver);
item->setTextColor(ColorsManager::getInstance().getCarColor(driverData[i]->getNumber()));
// if (carIdx >= 0)
{
QLabel *lab = qobject_cast<QLabel*>(ui->chartsTableWidget->cellWidget(1, i));
if (!lab)
{
lab = new QLabel();
lab->setAlignment(Qt::AlignCenter);
lab->setPixmap(ImagesFactory::getInstance().getCarThumbnailsFactory().getCarThumbnail(driverData[i]->getNumber(), thumbnailsSize));//eventData.carImages[carIdx].scaledToWidth(120, Qt::SmoothTransformation));
ui->chartsTableWidget->setCellWidget(1, i, lab);
}
else
lab->setPixmap(ImagesFactory::getInstance().getCarThumbnailsFactory().getCarThumbnail(driverData[i]->getNumber(), thumbnailsSize));//eventData.carImages[carIdx].scaledToWidth(120, Qt::SmoothTransformation));
lab = qobject_cast<QLabel*>(ui->gapChartTableWidget->cellWidget(1, i));
if (!lab)
{
lab = new QLabel();
lab->setAlignment(Qt::AlignCenter);
lab->setPixmap(ImagesFactory::getInstance().getCarThumbnailsFactory().getCarThumbnail(driverData[i]->getNumber(), thumbnailsSize));//eventData.carImages[carIdx].scaledToWidth(120, Qt::SmoothTransformation));
ui->gapChartTableWidget->setCellWidget(1, i, lab);
}
else
lab->setPixmap(ImagesFactory::getInstance().getCarThumbnailsFactory().getCarThumbnail(driverData[i]->getNumber(), thumbnailsSize));
lab = qobject_cast<QLabel*>(ui->posChartTableWidget->cellWidget(1, i));
if (!lab)
{
lab = new QLabel();
lab->setAlignment(Qt::AlignCenter);
lab->setPixmap(ImagesFactory::getInstance().getCarThumbnailsFactory().getCarThumbnail(driverData[i]->getNumber(), thumbnailsSize));//eventData.carImages[carIdx].scaledToWidth(120, Qt::SmoothTransformation));
ui->posChartTableWidget->setCellWidget(1, i, lab);
}
else
lab->setPixmap(ImagesFactory::getInstance().getCarThumbnailsFactory().getCarThumbnail(driverData[i]->getNumber(), thumbnailsSize));
}
}
else
{
QTableWidgetItem *item = ui->chartsTableWidget->item(0, i);
item->setText("");
QLabel *lab = qobject_cast<QLabel*>(ui->chartsTableWidget->cellWidget(1, i));
if (lab)
lab->clear();
item = ui->gapChartTableWidget->item(0, i);
item->setText("");
lab = qobject_cast<QLabel*>(ui->gapChartTableWidget->cellWidget(1, i));
if (lab)
lab->clear();
item = ui->posChartTableWidget->item(0, i);
item->setText("");
lab = qobject_cast<QLabel*>(ui->posChartTableWidget->cellWidget(1, i));
if (lab)
lab->clear();
}
}
lapCompChart->setData(driverData);
lapCompChart->repaint();
int tab[2] = {0, 0};
for (int i = 0; i < 2; ++i)
{
if (driverData[i] != 0)
tab[i] = driverData[i]->getCarID()-1;
}
gapCompChart->setData(tab);
gapCompChart->repaint();
posCompChart->setData(driverData);
posCompChart->repaint();
}
void HeadToHeadDialog::show(int currentDriverId)
{
// if (comboBox[0]->itemText(1) == "")// && eventData.driversData[0].driver != "")
// {
// comboBox[0]->addItems(SeasonData::getInstance().getDriversList());
// comboBox[1]->addItems(SeasonData::getInstance().getDriversList());
// }
setCurrentDriver(currentDriverId);
// if (j == 0)
{
QLabel *lab = qobject_cast<QLabel*>(ui->tableWidget->cellWidget(0, 7));
if (lab)
lab->clear();
lab = qobject_cast<QLabel*>(ui->tableWidget->cellWidget(0, 12));
if (lab)
lab->clear();
}
updateData();
updateCharts();
QDialog::show();
}
int HeadToHeadDialog::exec(int currentDriverId)
{
// if (comboBox[0]->itemText(1) == "")// && eventData.driversData[0].driver != "")
// {
// comboBox[0]->addItems(SeasonData::getInstance().getDriversList());
// comboBox[1]->addItems(SeasonData::getInstance().getDriversList());
// }
setCurrentDriver(currentDriverId);
updateData();
updateCharts();
return QDialog::exec();
}
void HeadToHeadDialog::comboBoxValueChanged(int)
{
updateData();
updateCharts();
}
void HeadToHeadDialog::on_pushButton_clicked()
{
accept();
}
void HeadToHeadDialog::resizeEvent(QResizeEvent *event)
{
for (int i = 0; i < 2; ++i)
{
ui->chartsTableWidget->setColumnWidth(i, (event->size().width()-40) / 2-5);
ui->gapChartTableWidget->setColumnWidth(i, (event->size().width()-40) / 2-5);
ui->posChartTableWidget->setColumnWidth(i, (event->size().width()-40) / 2-5);
}
int w = /*(ui->tabWidget->currentIndex() == 0) ? ui->tableWidget->viewport()->width() :*/ event->size().width()-20;
ui->tableWidget->setColumnWidth(0, 0.05*w);
ui->tableWidget->setColumnWidth(1, 0.05*w);
// ui->tableWidget->setColumnWidth(2, 0.06*w);
ui->tableWidget->setColumnWidth(2, 0.2*w);
ui->tableWidget->setColumnWidth(3, 0.05*w);
ui->tableWidget->setColumnWidth(4, 0.05*w);
ui->tableWidget->setColumnWidth(5, 0.05*w);
ui->tableWidget->setColumnWidth(6, 0.09*w);
ui->tableWidget->setColumnWidth(7, 0.05*w);
// ui->tableWidget->setColumnWidth(9, 0.06*w);
ui->tableWidget->setColumnWidth(8, 0.2*w);
ui->tableWidget->setColumnWidth(9, 0.05*w);
ui->tableWidget->setColumnWidth(10, 0.05*w);
ui->tableWidget->setColumnWidth(11, 0.05*w);
int h = /*ui->chartsTableWidget->viewport()->height()-80;*/event->size().height() - 250;
if (h < 200)
h = 200;
ui->chartsTableWidget->setRowHeight(2, h);
ui->gapChartTableWidget->setRowHeight(2, h);
ui->posChartTableWidget->setRowHeight(2, h);
}
void HeadToHeadDialog::keyPressEvent(QKeyEvent *event)
{
if (ui->tabWidget->currentIndex() == 0 && event->key() == Qt::Key_C && event->modifiers() == Qt::ControlModifier)
{
QItemSelectionModel * selection = ui->tableWidget->selectionModel();
QModelIndexList indexes = selection->selectedIndexes();
if(indexes.size() < 1)
return;
// QModelIndex::operator < sorts first by row, then by column.
// this is what we need
qSort(indexes.begin(), indexes.end());
// You need a pair of indexes to find the row changes
QModelIndex previous = indexes.first();
indexes.removeFirst();
QString selected_text;
QModelIndex current;
Q_FOREACH(current, indexes)
{
QVariant data = ui->tableWidget->model()->data(previous);
QString text = data.toString();
selected_text.append(text);
if (current.row() != previous.row())
{
selected_text.append(QLatin1Char('\n'));
}
else
{
selected_text.append(QLatin1Char('\t'));
}
previous = current;
}
selected_text.append(ui->tableWidget->model()->data(current).toString());
selected_text.append(QLatin1Char('\n'));
qApp->clipboard()->setText(selected_text);
}
if (event->key() == Qt::Key_Escape)
close();
}
void HeadToHeadDialog::setFont(const QFont &font)
{
ui->tableWidget->setFont(font);
}
void HeadToHeadDialog::setCurrentDriver(int id)
{
if (id != 0)
{
DriverData *dd = eventData.getDriverDataByIdPtr(id);
if (dd != 0 && dd->getCarID() > 0)
{
int idx = comboBox[0]->findText(QString("%1 %2").arg(dd->getNumber()).arg(dd->getDriverName()));
if (idx != -1)
comboBox[0]->setCurrentIndex(idx);
}
}
}
int HeadToHeadDialog::getNumber(int i)
{
QString text = comboBox[i]->currentText();
int no = -1;
int idx = text.indexOf(" ");
if (idx != 0)
{
bool ok;
no = text.left(idx).toInt(&ok);
if (!ok)
no = -1;
}
return no;
}
| zywhlc-f1lt | src/tools/headtoheaddialog.cpp | C++ | gpl3 | 33,137 |
/*******************************************************************************
* *
* F1LT - unofficial Formula 1 live timing application *
* Copyright (C) 2012-2013 Mariusz Pilarek (pieczaro@gmail.com) *
* *
* 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 *
* the Free Software Foundation, either version 3 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
* *
*******************************************************************************/
#ifndef DRIVERTRACKERPOSITIONER_H
#define DRIVERTRACKERPOSITIONER_H
#include "driverradarpositioner.h"
class DriverTrackerPositioner : public DriverRadarPositioner
{
public:
DriverTrackerPositioner(DriverData *dd = 0);
virtual ~DriverTrackerPositioner() { }
virtual void paint(QPainter *p, bool selected = false);
virtual QPoint getCoordinates();
virtual QPoint getSCCoordinates();
virtual void setStartupPosition();
virtual void calculatePosition();
virtual void calculatePitPosition();
void setMapCoords(int x, int y, int px, int py, int pw, int ph)
{
mapX = x;
mapY = y;
pitX = px;
pitY = py;
pitW = pw;
pitH = ph;
}
virtual int maxDeg()
{
return coordinatesCount;
}
virtual bool isSelected(QPoint p);
virtual void calculatePitOutPosition();
private:
int coordinatesCount;
int mapX, mapY;
int pitX, pitY, pitW, pitH;
};
#endif // DRIVERTRACKERPOSITIONER_H
| zywhlc-f1lt | src/tools/drivertrackerpositioner.h | C++ | gpl3 | 2,545 |
/*******************************************************************************
* *
* F1LT - unofficial Formula 1 live timing application *
* Copyright (C) 2012-2013 Mariusz Pilarek (pieczaro@gmail.com) *
* *
* 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 *
* the Free Software Foundation, either version 3 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
* *
*******************************************************************************/
#ifndef DRIVERRADAR_H
#define DRIVERRADAR_H
#include <QDebug>
#include <QVector>
#include <QWidget>
#include "driverradarpositioner.h"
#include "drivertrackerinfo.h"
#include "../core/eventdata.h"
class DriverRadar : public QWidget
{
Q_OBJECT
public:
explicit DriverRadar(QWidget *parent = 0);
virtual ~DriverRadar();
void update();
virtual void loadDriversList();
virtual void setupDrivers(int speed);
virtual void checkSetupCorrect(int speed);
signals:
void driverExcluded(int, bool);
void driverSelected(int);
public slots:
void excludeDriver(int id, bool exclude);
void selectDriver(int id)
{
selectedDriver = id;
if (dti)
{
dti->setVisible(id == -1 ? false : true);
if (id != -1)
{
DriverData *dd = EventData::getInstance().getDriverDataByIdPtr(id);
if (dd)
dti->setDriverData(dd);
}
}
repaint();
}
protected:
void resizeEvent(QResizeEvent *);
void paintEvent(QPaintEvent *);
void mousePressEvent(QMouseEvent *);
QVector<DriverRadarPositioner*> drp;
int selectedDriver;
DriverTrackerInfo *dti;
private:
int radarX, radarY;
double radarR;
double radarPitR;
double radarLappedR;
};
#endif // DRIVERRADAR_H
| zywhlc-f1lt | src/tools/driverradar.h | C++ | gpl3 | 2,918 |
/*******************************************************************************
* *
* F1LT - unofficial Formula 1 live timing application *
* Copyright (C) 2012-2013 Mariusz Pilarek (pieczaro@gmail.com) *
* *
* 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 *
* the Free Software Foundation, either version 3 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
* *
*******************************************************************************/
#include "ltfilesmanagerdialog.h"
#include "ui_ltfilesmanagerdialog.h"
#include <QDebug>
#include <QDirIterator>
#include <QMessageBox>
#include <QPushButton>
#include "../core/colorsmanager.h"
#include "../core/seasondata.h"
#include "../main_gui/ltitemdelegate.h"
class stringCmp
{
public:
bool operator()(QString ls1, QString ls2)
{
return !(ls1 < ls2);
}
};
LTFilesManagerDialog::LTFilesManagerDialog(QWidget *parent) :
QDialog(parent),
ui(new Ui::LTFilesManagerDialog)
{
ui->setupUi(this);
progress = new QProgressDialog(this);
ui->treeWidget->header()->setMovable(false);
ui->treeWidget->setItemDelegate(new LTItemDelegate(this));
connect(<FilesManager, SIGNAL(ltListObtained(QStringList)), this, SLOT(ltListObtained(QStringList)));
connect(<FilesManager, SIGNAL(ltFileObtained(QByteArray)), this, SLOT(ltFileObtained(QByteArray)));
connect(<FilesManager, SIGNAL(downloadProgress(qint64,qint64)), this, SLOT(downloadProgress(qint64,qint64)));
connect(<FilesManager, SIGNAL(error(QNetworkReply::NetworkError)), this, SLOT(error(QNetworkReply::NetworkError)));
connect(progress, SIGNAL(canceled()), <FilesManager, SLOT(cancel()));
}
LTFilesManagerDialog::~LTFilesManagerDialog()
{
delete ui;
}
QString LTFilesManagerDialog::exec()
{
currentFile = QString();
setWindowModality(Qt::WindowModal);
open();
downloadLTList();
int ret = QDialog::exec();
if (ret)
return currentFile;
return QString();
}
void LTFilesManagerDialog::downloadLTList()
{
if (ltList.isEmpty())
{
getLTListFromDisk();
updateTree(QStringList());
progress->setMinimum(0);
progress->setMaximum(0);
progress->setWindowModality(Qt::WindowModal);
progress->setLabelText("Updating database");
progress->show();
ltFilesManager.getLTList();
}
}
void LTFilesManagerDialog::ltListObtained(QStringList list)
{
if (progress->isVisible())
progress->cancel();
ltList.unite(list.toSet());
updateTree(list);
}
void LTFilesManagerDialog::ltFileObtained(QByteArray buf)
{
if (currentFile != "")
{
QFile file(currentFile);
if (file.open(QIODevice::WriteOnly))
{
file.write(buf);
QStringList arr = currentFile.split("/");
QList<QTreeWidgetItem *> list = ui->treeWidget->findItems(arr.last(), Qt::MatchContains | Qt::MatchRecursive, 4);
if (!list.isEmpty())
{
list.first()->setText(4, currentFile);
list.first()->setText(5, "On disk / Online");
list.first()->setTextColor(5, ColorsManager::getInstance().getDefaultColor(LTPackets::GREEN));
}
QDialog::accept();
}
else
QMessageBox::critical(this, "Error", "Could not save the file " + currentFile);
}
}
void LTFilesManagerDialog::downloadProgress ( qint64 bytesReceived, qint64 bytesTotal )
{
progress->setMaximum(bytesTotal);
progress->setValue(bytesReceived);
QStringList arr = progress->labelText().split("\n");
if (!arr.isEmpty())
{
progress->setLabelText(arr[0] + "\n" + QString("%1 kB/%2 kB").arg((double)(bytesReceived/1024.0), 1, 'f', 2).arg((double)(bytesTotal/1024.0), 1, 'f', 2));
}
}
void LTFilesManagerDialog::updateTree(const QStringList &onlineList)
{
ui->treeWidget->clear();
QList<QString> list = ltList.toList();
qSort(list.begin(), list.end(), stringCmp());
QTreeWidgetItem *parent = 0;
QListIterator<QString> iter(list);
while (iter.hasNext())
{
QStringList array = parseEntry(iter.next(), onlineList);
if (array.size() < 6)
continue;
QColor color = array[5].contains("On disk") ? ColorsManager::getInstance().getDefaultColor(LTPackets::GREEN) : ColorsManager::getInstance().getDefaultColor(LTPackets::CYAN);
// QTreeWidgetItem *newParent = parent;
if (!parent || parent->text(0) != array[0])
{
parent = new QTreeWidgetItem();
parent->setText(0, array[0]);
ui->treeWidget->addTopLevelItem(parent);
}
QTreeWidgetItem *child = new QTreeWidgetItem(parent);
child->setText(0, array[0]);
child->setText(1, array[1]);
child->setText(2, array[2]);
child->setText(3, array[3]);
child->setText(4, array[4]);
child->setText(5, array[5]);
child->setTextAlignment(1, Qt::AlignCenter);
child->setTextAlignment(3, Qt::AlignCenter);
child->setTextAlignment(5, Qt::AlignCenter);
child->setTextColor(5, color);
// parent = parseEntry(parent, iter.next(), onlineList);
}
}
QStringList LTFilesManagerDialog::parseEntry(QString entry, const QStringList &onlineList)
{
QStringList array = entry.split("-");
if (array.size() < 4)
return QStringList();
array[2] = SeasonData::getInstance().getEventNameFromShort(array[2]);
array[3] = getSessionType(array[3]);
QString file = entry;
bool fExists = fileExists(file, false);
array.append(file);
QString onDisk = fExists ? "On disk" : "";
if (fExists && onlineList.contains(entry))
onDisk = "On disk / Online";
else if (onlineList.contains(entry))
onDisk = "Online";
array.append(onDisk);
return array;
}
QString LTFilesManagerDialog::getSessionType(QString session)
{
QStringList array = session.split('.');
if (array.size() < 2)
return session.toUpper();
return array[0].toUpper();
}
void LTFilesManagerDialog::on_treeWidget_itemClicked(QTreeWidgetItem *item, int)
{
if (item->childCount() == 0)
{
ui->playButton->setEnabled(true);
}
else
ui->playButton->setEnabled(false);
}
void LTFilesManagerDialog::on_treeWidget_itemDoubleClicked(QTreeWidgetItem *item, int)
{
if (item->childCount() == 0)
{
ui->playButton->setEnabled(true);
on_playButton_clicked();
}
else
ui->playButton->setEnabled(false);
}
void LTFilesManagerDialog::on_refreshButton_clicked()
{
ltList.clear();
downloadLTList();
}
void LTFilesManagerDialog::on_playButton_clicked()
{
if (!ui->treeWidget->selectedItems().isEmpty())
{
QTreeWidgetItem *item = ui->treeWidget->selectedItems().first();
QString fileName = item->text(4);
if (!fileExists(fileName))
{
progress->setMinimum(0);
progress->setMaximum(0);
progress->setLabelText("Downloading file " + fileName + "\n 0/0");
progress->setWindowModality(Qt::WindowModal);
progress->show();
ltFilesManager.getLTFile(fileName);
}
else
{
if (progress->isVisible())
{
progress->cancel();
ltFilesManager.cancel();
}
QDialog::accept();
}
}
}
bool LTFilesManagerDialog::fileExists(QString &file, bool saveCurrent)
{
//check if file already contains absolute path
if (QFile::exists(file))
{
if (saveCurrent)
currentFile = file;
return true;
}
//if not, check if ltdata dir exists
QDir dir(F1LTCore::ltDataHomeDir());
if (!dir.exists())
return false;
//try to find the file there
if (QFile::exists(dir.absolutePath()+"/"+file))
{
if (saveCurrent)
currentFile = dir.absolutePath()+"/"+file;
file = dir.absolutePath()+"/"+file;
return true;
}
//if it is still not found check in subdirs
QDirIterator it(dir, QDirIterator::Subdirectories);
while (it.hasNext())
{
it.next();
if (it.fileInfo().isDir())
{
if (QFile::exists(it.filePath() + "/" + file))
{
file = it.filePath()+"/"+file;
if (saveCurrent)
currentFile = file;
return true;
}
}
}
//if the file does not exist it needs to be downloaded and saved using this path
if (saveCurrent)
currentFile = dir.absolutePath()+"/"+file;
return false;
}
void LTFilesManagerDialog::getLTListFromDisk()
{
QDir dir(F1LTCore::ltDataHomeDir());
if (!dir.exists())
return;
QDirIterator it(dir, QDirIterator::Subdirectories);
while (it.hasNext())
{
it.next();
if (it.fileInfo().completeSuffix() == "lt")
ltList.insert(it.fileName());
}
}
void LTFilesManagerDialog::error(QNetworkReply::NetworkError code)
{
if (code != QNetworkReply::OperationCanceledError)
{
currentFile = "";
QMessageBox::critical(this, "Error", "Error downloading the file!\nCheck your network connection.");
}
}
void LTFilesManagerDialog::loadSettings(QSettings *settings)
{
restoreGeometry(settings->value("ui/ltfilesmanager_geometry").toByteArray());
ui->treeWidget->header()->restoreState(settings->value("ui/ltfilesmanager_columns").toByteArray());
}
void LTFilesManagerDialog::saveSettings(QSettings *settings)
{
settings->setValue("ui/ltfilesmanager_geometry", saveGeometry());
settings->setValue("ui/ltfilesmanager_columns", ui->treeWidget->header()->saveState());
}
void LTFilesManagerDialog::on_cancelButton_clicked()
{
if (progress->isVisible())
{
progress->cancel();
ltFilesManager.cancel();
}
QDialog::reject();
}
| zywhlc-f1lt | src/tools/ltfilesmanagerdialog.cpp | C++ | gpl3 | 11,098 |
/*******************************************************************************
* *
* F1LT - unofficial Formula 1 live timing application *
* Copyright (C) 2012-2013 Mariusz Pilarek (pieczaro@gmail.com) *
* *
* 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 *
* the Free Software Foundation, either version 3 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
* *
*******************************************************************************/
#ifndef DRIVERTRACKER_H
#define DRIVERTRACKER_H
#include <QPixmap>
#include "driverradar.h"
class DriverTracker : public DriverRadar
{
Q_OBJECT
public:
DriverTracker(QWidget *parent = 0);
virtual void loadDriversList();
virtual void setupDrivers(int speed);
void paintClassification(QPainter &p);
void setDrawDriverClassification(bool val)
{
drawClassification = val;
setMinimumSize();
resizeEvent(0);
repaint();
}
bool drawDriverClassification()
{
return drawClassification;
}
void setMinimumSize();
signals:
void driverSelected(int);
protected:
virtual void paintEvent(QPaintEvent *);
void resizeEvent(QResizeEvent *);
void mousePressEvent(QMouseEvent *);
void mouseDoubleClickEvent(QMouseEvent *);
bool isExcluded(int id);
QPixmap label;
QPixmap selectedLabel;
QPixmap trackMap;
QList<int> excludedDrivers;
bool drawClassification;
};
#endif // DRIVERTRACKER_H
| zywhlc-f1lt | src/tools/drivertracker.h | C++ | gpl3 | 2,554 |
/*******************************************************************************
* *
* F1LT - unofficial Formula 1 live timing application *
* Copyright (C) 2012-2013 Mariusz Pilarek (pieczaro@gmail.com) *
* *
* 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 *
* the Free Software Foundation, either version 3 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
* *
*******************************************************************************/
#ifndef DRIVERTRACKERWIDGET_H
#define DRIVERTRACKERWIDGET_H
#include <QSettings>
#include <QTimer>
#include <QWidget>
namespace Ui {
class DriverTrackerWidget;
}
class DriverTrackerWidget : public QWidget
{
Q_OBJECT
public:
explicit DriverTrackerWidget(QWidget *parent = 0);
~DriverTrackerWidget();
void loadSettings(QSettings *);
void saveSettings(QSettings *);
void setTimerInterval(int s=1000)
{
interval = s / speed;
timer->setInterval(interval);
}
void setup();
void exec();
void drawTrackerClassification(bool val);
public slots:
void startTimer(int s=1000);
void pauseTimer(bool pause)
{
if (pause)
timer->stop();
else
timer->start(interval);
}
void stopTimer()
{
timer->stop();
}
protected:
void keyPressEvent(QKeyEvent *);
private slots:
void on_pushButton_clicked();
void update();
private:
Ui::DriverTrackerWidget *ui;
QTimer *timer;
int speed;
int interval;
};
#endif // DRIVERTRACKERWIDGET_H
| zywhlc-f1lt | src/tools/drivertrackerwidget.h | C++ | gpl3 | 2,641 |
/*******************************************************************************
* *
* F1LT - unofficial Formula 1 live timing application *
* Copyright (C) 2012-2013 Mariusz Pilarek (pieczaro@gmail.com) *
* *
* 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 *
* the Free Software Foundation, either version 3 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
* *
*******************************************************************************/
#ifndef DRIVERRECORDSDIALOG_H
#define DRIVERRECORDSDIALOG_H
#include <QDialog>
#include <QSettings>
#include "../core/trackrecords.h"
namespace Ui {
class DriverRecordsDialog;
}
class DriverRecordsDialog : public QDialog
{
Q_OBJECT
public:
explicit DriverRecordsDialog(QWidget *parent = 0);
~DriverRecordsDialog();
void exec(const TrackWeekendRecords &records, QString trackName);
void loadRecords();
void loadRecords(const TrackWeekendRecords &records, QString trackName);
void saveSettings(QSettings &settings);
void loadSettings(QSettings &settings);
void setFont(const QFont &font);
private slots:
void on_comboBox_currentIndexChanged(int);
void on_comboBox_2_currentIndexChanged(int index);
private:
Ui::DriverRecordsDialog *ui;
TrackWeekendRecords driverRecords;
QString trackName;
};
#endif // DRIVERRECORDSDIALOG_H
| zywhlc-f1lt | src/tools/driverrecordsdialog.h | C++ | gpl3 | 2,443 |
/*******************************************************************************
* *
* F1LT - unofficial Formula 1 live timing application *
* Copyright (C) 2012-2013 Mariusz Pilarek (pieczaro@gmail.com) *
* *
* 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 *
* the Free Software Foundation, either version 3 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
* *
*******************************************************************************/
#include <QMouseEvent>
#include "driverradar.h"
#include <typeinfo>
#include "../core/colorsmanager.h"
DriverRadar::DriverRadar(QWidget *parent) :
QWidget(parent), selectedDriver(-2), dti(0), radarX(0), radarY(0), radarR(0.0), radarPitR(0.0), radarLappedR(0.0)
{
loadDriversList();
QWidget::setMinimumSize(50, 200);
}
DriverRadar::~DriverRadar()
{
for (int i = 0; i < drp.size(); ++i)
delete drp[i];
}
void DriverRadar::checkSetupCorrect(int speed)
{
if (drp.isEmpty() || selectedDriver == -2)
{
setupDrivers(speed);
}
}
void DriverRadar::loadDriversList()
{
if (dti == 0)
{
dti = new DriverTrackerInfo(this);
dti->setVisible(false);
}
for (int i = 0; i < drp.size(); ++i)
delete drp[i];
drp.resize(EventData::getInstance().getDriversData().size());
for (int i = 0; i < drp.size(); ++i)
{
drp[i] = new DriverRadarPositioner(&EventData::getInstance().getDriversData()[i]);
}
}
void DriverRadar::setupDrivers(int speed)
{
if (selectedDriver != -2)
selectedDriver = -1;
for (int i = 0; i < drp.size(); ++i)
{
drp[i]->setStartupPosition();
drp[i]->setExcluded(false);
drp[i]->setSpeed(speed);
}
resizeEvent(0);
repaint();
if (dti)
{
dti->setup();
dti->repaint();
dti->setVisible(false);
// setMinimumSize(dti->minimumSize());
}
}
void DriverRadar::update()
{
if (selectedDriver == -2)
selectedDriver = -1;
for (int i = 0; i < drp.size(); ++i)
drp[i]->update();
repaint();
if (dti)
dti->repaint();
}
void DriverRadar::excludeDriver(int id, bool exclude)
{
for (int i = 0; i < drp.size(); ++i)
{
if (drp[i]->getDriverId() == id)
drp[i]->setExcluded(exclude);
}
repaint();
if (dti)
dti->repaint();
}
void DriverRadar::resizeEvent(QResizeEvent *)
{
QSize size;
if (dti)
{
size = dti->minimumSize();
}
radarR = width() < (height() - 30 - size.height()) ? (double)width() / 2.0 - 20.0 : (double)(height() - 30 - size.height()) / 2.0 - 20.0;
radarX = width()/2;
radarY = radarR + 30;
radarLappedR = radarR * 0.75;
radarPitR = radarR * 0.5;
if (dti)
{
dti->setGeometry(0, radarR*2 + 60, width(), height() - (radarR*2 + 60));
}
for (int i = 0; i < drp.size(); ++i)
{
drp[i]->setRadarCoords(radarX, radarY, radarR, radarPitR, radarLappedR);
}
}
void DriverRadar::paintEvent(QPaintEvent *)
{
QPainter p;
p.begin(this);
p.setRenderHint(QPainter::Antialiasing);
p.setBrush(QBrush(QColor(ColorsManager::getInstance().getColor(LTPackets::BACKGROUND))));
p.drawRect(0, 0, width(), height());
QPainterPath path;
QPen pen(QColor(255, 255, 255), 5);
if (EventData::getInstance().getFlagStatus() == LTPackets::SAFETY_CAR_DEPLOYED)
pen.setColor(ColorsManager::getInstance().getDefaultColor(LTPackets::YELLOW));
// path.addEllipse(QPoint(radarX, radarY), radarR, radarR);
p.setBrush(QBrush());
p.setPen(pen);
p.drawEllipse(QPoint(radarX, radarY), (int)radarR, (int)radarR);
// p.drawPath(path);
// path.addEllipse(QPoint(radarX, radarY), radarLappedR, radarLappedR);
pen.setWidth(3);
p.setPen(pen);
p.drawEllipse(QPoint(radarX, radarY), (int)radarLappedR, (int)radarLappedR);
// p.drawPath(path);
pen.setColor(QColor(255, 255, 255));
// path.addEllipse(QPoint(radarX, radarY), radarPitR, radarPitR);
pen.setWidth(5);
p.setPen(pen);
// p.drawEllipse(QPoint(radarX, radarY), radarPitR, radarPitR);
int x = radarX - radarPitR;
int y = radarY - radarPitR;
int w = radarX + radarPitR - x;
int h = radarY + radarPitR - y;
p.drawArc(x, y, w, h, 270*16, 180*16);
// p.drawPath(path);
pen.setWidth(2);
p.setPen(pen);
p.drawLine(radarX, radarY - radarR - 10, radarX, radarY - radarLappedR + 10);
// p.drawPixmap(radarX - trackMap.width()/2, radarY - trackMap.height()/2, trackMap);
int sel = -1;
for (int i = drp.size() - 1; i >= 0; --i)
{
if (drp[i]->getDriverId() != selectedDriver)
drp[i]->paint(&p);
else
sel = i;
}
if (sel >= 0)
drp[sel]->paint(&p, true);
p.end();
}
void DriverRadar::mousePressEvent(QMouseEvent *event)
{
bool found = false;
for (int i = 0; i < drp.size(); ++i)
{
if (drp[i]->isSelected(event->pos()))
{
if (selectedDriver != drp[i]->getDriverId())
selectedDriver = drp[i]->getDriverId();
else
selectedDriver = -1;
found = true;
break;
}
}
if (!found)
selectedDriver = -1;
selectDriver(selectedDriver);
emit driverSelected(selectedDriver);
repaint();
}
| zywhlc-f1lt | src/tools/driverradar.cpp | C++ | gpl3 | 6,456 |
/*******************************************************************************
* *
* F1LT - unofficial Formula 1 live timing application *
* Copyright (C) 2012-2013 Mariusz Pilarek (pieczaro@gmail.com) *
* *
* 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 *
* the Free Software Foundation, either version 3 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
* *
*******************************************************************************/
#include "sessiondefaults.h"
#include "eventdata.h"
SessionDefaults::SessionDefaults()
{
fpLengths.append(90);
fpLengths.append(90);
fpLengths.append(60);
qualiLengths.append(20);
qualiLengths.append(15);
qualiLengths.append(10);
}
int SessionDefaults::timeToMins(const QTime &time) const
{
int hour = time.hour();
int min = time.minute();
return hour * 60 + min + 1;
}
int SessionDefaults::timeToSecs(const QTime &time) const
{
int hour = time.hour();
int min = time.minute();
int sec = time.second();
return hour * 3600 + min * 60 + sec;
}
int SessionDefaults::getFPLength() const
{
return getFPLength(EventData::getInstance().getFPNumber());
}
int SessionDefaults::getFPLength(int fp) const
{
if (fp >= 1 && fp <= fpLengths.size())
return fpLengths[fp-1];
return 0;
}
QTime SessionDefaults::correctFPTime(const QTime &time) const
{
int hour = time.hour();
int min = time.minute();
int sec = time.second();
int t = getFPLength() * 60 - hour * 3600 - min * 60 - sec;
hour = t/3600;
min = (t%3600)/60;
sec = (t%3600)%60;
QTime newTime(hour, min, sec);
return newTime;
}
QTime SessionDefaults::correctQualiTime(const QTime &time, int qualiPeriod) const
{
int hour = time.hour();
int min = time.minute();
int sec = time.second();
int sLength = 10 + (qualiLengths.size() - qualiPeriod)*5;
int t = sLength * 60 - hour * 3600 - min * 60 - sec;
hour = t/3600;
min = (t%3600)/60;
sec = (t%3600)%60;
QTime newTime(hour, min, sec);
return newTime;
}
int SessionDefaults::getQualiLength(int q) const
{
if (q >= 1 && q <= qualiLengths.size())
return qualiLengths[q-1];
return 0;
}
| zywhlc-f1lt | src/core/sessiondefaults.cpp | C++ | gpl3 | 3,298 |
/*******************************************************************************
* *
* F1LT - unofficial Formula 1 live timing application *
* Copyright (C) 2012-2013 Mariusz Pilarek (pieczaro@gmail.com) *
* *
* 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 *
* the Free Software Foundation, either version 3 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
* *
*******************************************************************************/
#include "driverdata.h"
#include "eventdata.h"
#include "seasondata.h"
#include <QDebug>
int DriverData::cnt = 0;
//==================================================================
DriverData &DriverData::operator=(const DriverData &dd)
{
if (this == &dd)
return *this;
carID = dd.carID;
number = dd.number;
pos = dd.pos;
driver = dd.driver;
numPits = dd.numPits;
retired = dd.retired;
pitData = dd.pitData;
releasedFromPits = dd.releasedFromPits;
colorData = dd.colorData;
lapData.clear();
for (int i = 0; i < dd.lapData.size(); ++i)
lapData.append(dd.lapData[i]);
lastLap = dd.lastLap; //&lapData[lapData.size()-1];
sessionRecords = dd.sessionRecords;
posHistory = dd.posHistory;
for (int i = 0; i < 3; ++i)
qualiTimes[i] = dd.qualiTimes[i];
return *this;
}
//----------------------------------
//used in race - checks if the drivers numLap is correct according to the events total laps and gap to the leader
void DriverData::correctNumLap(int raceNumLap)
{
//first of all check if we are lapped
int lapped = 0;
if (lastLap.gap!= "" && lastLap.gap[lastLap.gap.size()-1] == 'L')
lapped = lastLap.gap.left(lastLap.gap.size()-1).toInt();
//now correct the lap number, raceNumLap is obtained from the leaders interval info - that's the only way here to get it
if (lastLap.lapNum + lapped != raceNumLap)
lastLap.lapNum = raceNumLap - lapped;
//sometimes, when the driver is close to being lapped server doesn't send his gap data,
//so if the lastLap.numLap is greater by 2 or more laps than lapData.last().numLap - we have to correct it...
if (lastLap.gap == "" && !lapData.isEmpty() && lastLap.lapNum > lapData.last().lapNum+1)
lastLap.lapNum = lapData.last().lapNum+1;
}
//during Q1 when the drivers time is worse than 107% lt server doesn't update his position, we have to do this manually
void DriverData::correctPosition(const EventData &ed)
{
if (ed.getQualiPeriod() == 1 && ed.getSessionRecords().getFastestLap().getTime().isValid() &&
((ed.getSessionRecords().getFastestLap().getTime().calc107p() < qualiTimes[0]) ||
!qualiTimes[0].isValid()))
{
int position = ed.correctPosition(qualiTimes[0]);
if (position >= 1)
{
pos = position;
lastLap.pos = position;
sessionRecords.bestQLaps[0].pos = position;
int idx = lapData.indexOf(sessionRecords.getBestQualiLap(1));
if (idx >= 0)
lapData[idx].pos = position;
}
// colorData.positionColor() = LTPackets::RED;
}
}
void DriverData::addLap(const EventData &ed)
{
if (ed.getEventType() == LTPackets::RACE_EVENT)
{
addRaceLap(ed);
}
else
{
addFPQLap(ed);
}
}
void DriverData::addRaceLap(const EventData &ed)
{
//ok, this looks a bit complicated, but since the LT server doesn't give us the actuall lap number for every driver during the race we have to find another way to gather laps:
//- first of all - don't append laps if driver has retired (it's rather obvious)
//- don't add empty lap time, except for the first lap of the race - it's always empty
//- if this lap is in-lap - add it, if no - add it only if we have the sector 3 time
//- if the lapData array is empty - check if lapNum is greater than 0
//- don't add the out lap - "OUT",
//- finally - check if we don't try to add the same lap again, we use the gap, interval and lap time info for this
if (!retired && ed.getCompletedLaps() > 0 && (lastLap.lapTime.toString() != "" || lastLap.lapNum == 1) &&
// ((lastLap.lapTime.toString() != "IN PIT" && lastLap.sector3.toString() != "") || lastLap.lapTime.toString() == "IN PIT") &&
((lastLap.lapNum > 0 && lapData.isEmpty()) ||
(!lapData.isEmpty() &&
// (lastLap.numLap > lapData.last().numLap) &&
(lastLap.lapTime.toString() != "OUT" /*&& !(lastLap.sector3.toString() == "STOP" && lapData.last().sector3.toString() == "STOP")*/) &&
!(lapData.last().gap == lastLap.gap && lapData.last().interval == lastLap.interval && lapData.last().lapTime == lastLap.lapTime)
)))
{
//this is tricky - if driver goes to the pits, we get this info before he crosses the finish line, but not always...
//therefore, we don't correct the lap number, assuming that everything is ok, and the lap number is last lap + 1
if ((lastLap.lapTime.toString() != "IN PIT" && !lapData.isEmpty()) || (lapData.isEmpty() && lastLap.lapTime.toString() == "OUT"))
correctNumLap(ed.getCompletedLaps());
//1st lap is always empty (excluding situations when driver goes to pit or retires), so if we got a valid time on the first lap
//it means that LT server has sent us some junk (probably time from quali)
if (lastLap.lapNum == 1 && lastLap.lapTime.isValid())
lastLap.lapTime = LapTime();
//if this is RETIRED lap, update only the lap time
if (lastLap.lapTime.toString() == "RETIRED" && !lapData.isEmpty())
{
lapData.last().lapTime = lastLap.lapTime;
return;
}
if (lastLap.lapTime.toString() == "IN PIT")
lastLap.raceLapExtraData.pitLap = true;
else
lastLap.raceLapExtraData.pitLap = false;
//if we get "IN PIT" before driver crossed the line, we get it again after he croses, in that case update only gap and interval
if (!lapData.empty() && lastLap.lapTime.toString() == "IN PIT" && lapData.last().lapTime.toString() == "IN PIT" && !releasedFromPits)
{
lapData.last().gap = lastLap.gap;
lapData.last().interval = lastLap.interval;
return;
}
//when connected to LT during the race and driver was going out of the pits we save this lap as PIT lap
if (lastLap.lapTime.toString() == "OUT")
lastLap.lapTime = LapTime("IN PIT");
lastLap.carID = carID;
if (!lapData.empty() && lapData.last().lapNum >= lastLap.lapNum)
lapData.last() = lastLap;
else
{
lapData.append(lastLap);
posHistory.append(lastLap.pos);
}
releasedFromPits = false;
if (lastLap < sessionRecords.bestLap)
sessionRecords.bestLap = lastLap;
//best sectors
// if (colorData[LTPackets::RACE_SECTOR_1] == LTPackets::GREEN || colorData[LTPackets::RACE_SECTOR_1] == LTPackets::VIOLET)
// {
// bestSectors[0].first = lapData.last().sector1;
// bestSectors[0].second = lapData.last().numLap;
// }
// if (colorData[LTPackets::RACE_SECTOR_2] == LTPackets::GREEN || colorData[LTPackets::RACE_SECTOR_2] == LTPackets::VIOLET)
// {
// bestSectors[1].first = lapData.last().sector2;
// bestSectors[1].second = lapData.last().numLap;
// }
updateSectorRecords();
if (ed.getFlagStatus() == LTPackets::SAFETY_CAR_DEPLOYED || ed.getFlagStatus() == LTPackets::RED_FLAG)
lapData.last().raceLapExtraData.scLap = true;
else
lapData.last().raceLapExtraData.scLap = false;
}
//driver was set out from the pits, if he pits again on the next lap we will add it
if (lastLap.lapTime.toString() == "OUT")
releasedFromPits = true;
}
void DriverData::addFPQLap(const EventData &ed)
{
//during practice and quali we only save timed laps
if ((lastLap.lapTime.toString() != "") && (lapData.empty() ||
(/*(lastLap.numLap > lapData.last().numLap) &&*/ lastLap.getSectorTime(1).toString() != "" && lastLap.getSectorTime(2).toString() != "" && lastLap.getSectorTime(3).toString() != "")))
{
bool correction = false;
//sometimes servers messes up with lap numbers, we catch this if the numlap is <= than the last one
if (!lapData.isEmpty() && lastLap.lapNum+1 <= lapData.last().lapNum)
{
correction = true;
bool approx = lapData.last().qualiLapExtraData.approxLap || lapData.last().practiceLapExtraData.approxLap;
int numlap = lapData.last().lapNum-1;
lapData.last() = LapData(lastLap);
lapData.last().qualiLapExtraData.approxLap = approx;
lapData.last().practiceLapExtraData.approxLap = approx;
if (lapData.size() > 1)
lapData.last().lapNum = numlap;
if (sessionRecords.bestLap.lapNum == numlap)
sessionRecords.bestLap.lapNum = lapData.last().lapNum;
}
else
{
//if decryption fails, replace the garbage we obtained with the best lap time
if (lastLap.lapTime.toString() != "" && !lastLap.lapTime.isValid())
lastLap.lapTime = sessionRecords.bestLap.lapTime;
lastLap.qualiLapExtraData.sessionTime = ed.getRemainingTime();
lastLap.practiceLapExtraData.sessionTime = ed.getRemainingTime();
lapData.append(lastLap);
lapData.last().lapNum--;
if (ed.getEventType() == LTPackets::QUALI_EVENT)
{
int qPeriod = ed.getQualiPeriod() > 0 ? ed.getQualiPeriod() : 1;
lastLap.qualiLapExtraData.qualiPeriod = qPeriod;
lapData.last().qualiLapExtraData.qualiPeriod = qPeriod;
}
updateSectorRecords();
}
if (!correction)
{
if (ed.getEventType() == LTPackets::PRACTICE_EVENT)
{
if (lastLap < sessionRecords.bestLap)
sessionRecords.bestLap = lapData.last();
else if (lastLap.lapTime == sessionRecords.bestLap.lapTime)
{
lapData.last().lapTime = LapData::sumSectors(lapData.last().getSectorTime(1).toString(), lapData.last().getSectorTime(2).toString(), lapData.last().getSectorTime(3).toString());
lapData.last().practiceLapExtraData.approxLap = true;
}
else
lapData.last().practiceLapExtraData.approxLap = false;
}
else if (ed.getEventType() == LTPackets::QUALI_EVENT)
{
if (lastLap < sessionRecords.bestLap)
sessionRecords.bestLap = lapData.last();
if (lastLap < sessionRecords.bestQLaps[lastLap.qualiLapExtraData.qualiPeriod-1] ||
!sessionRecords.bestQLaps[lastLap.qualiLapExtraData.qualiPeriod-1].getTime().isValid())
{
sessionRecords.bestQLaps[lastLap.qualiLapExtraData.qualiPeriod-1] = lapData.last();
if (sessionRecords.bestQLaps[lastLap.qualiLapExtraData.qualiPeriod-1] < sessionRecords.bestLap)
sessionRecords.bestLap = sessionRecords.bestQLaps[lastLap.qualiLapExtraData.qualiPeriod-1];
}
//if the current lap time is the same as the best lap, probably the driver hasn't improved so we have to calculate the real lap time from the sectors time
else if (lastLap.lapTime == sessionRecords.bestQLaps[lastLap.qualiLapExtraData.qualiPeriod-1].lapTime)
{
lapData.last().lapTime = LapData::sumSectors(lapData.last().getSectorTime(1).toString(), lapData.last().getSectorTime(2).toString(), lapData.last().getSectorTime(3).toString());
lapData.last().qualiLapExtraData.approxLap = true;
}
else
lapData.last().qualiLapExtraData.approxLap = false;
correctPosition(ed);
}
}
lapData.last().gap = QString::number((lapData.last().lapTime - ed.getSessionRecords().getFastestLap().getTime()).toDouble());
posHistory.append(lastLap.pos);
outLap = false;
}
//saving in and out laps
else if (lastLap.lapNum > 1)
{
if (lapData.isEmpty() || (!lapData.isEmpty() && lapData.last().lapNum < lastLap.lapNum-1))
{
if (outLap == true || inPits == false)
{
lapData.append(lastLap);
lapData.last().lapTime = LapTime("OUT LAP");
if (inPits == true)
lapData.last().lapTime = LapTime("INST. LAP");
lapData.last().lapNum--;
outLap = false;
}
else
{
lapData.append(lastLap);
lapData.last().lapTime = LapTime("IN LAP");
lapData.last().lapNum--;
}
lapData.last().qualiLapExtraData.sessionTime = ed.getRemainingTime();
lapData.last().practiceLapExtraData.sessionTime = ed.getRemainingTime();
if (ed.getEventType() == LTPackets::QUALI_EVENT)
{
int qPeriod = ed.getQualiPeriod() > 0 ? ed.getQualiPeriod() : 1;
lastLap.qualiLapExtraData.qualiPeriod = qPeriod;
lapData.last().qualiLapExtraData.qualiPeriod = qPeriod;
}
updateSectorRecords();
}
}
}
void DriverData::updatePitStatus(LTPackets::Colors pitColor, EventData &ed)
{
if (pitColor == LTPackets::PIT)
{
bool prev = inPits;
inPits = true;
if (prev == false && ed.getEventType() != LTPackets::RACE_EVENT)
addInLap(ed);
}
else
{
//if driver went out from pit, he is on his outlap
if (inPits == true)
outLap = true;
inPits = false;
}
}
void DriverData::addInLap(const EventData &ed)
{
if (lastLap.lapNum <= 0)
return;
lapData.append(lastLap);
if (outLap == true)
lapData.last().lapTime = LapTime("INST. LAP");
else
lapData.last().lapTime = LapTime("IN LAP");
lapData.last().qualiLapExtraData.sessionTime = ed.getRemainingTime();
lapData.last().practiceLapExtraData.sessionTime = ed.getRemainingTime();
if (ed.getEventType() == LTPackets::QUALI_EVENT)
{
int qPeriod = ed.getQualiPeriod() > 0 ? ed.getQualiPeriod() : 1;
lastLap.qualiLapExtraData.qualiPeriod = qPeriod;
lapData.last().qualiLapExtraData.qualiPeriod = qPeriod;
}
updateSectorRecords();
}
void DriverData::updateLastLap()
{
if (!lapData.isEmpty() && lapData.last().lapNum == lastLap.lapNum)
{
if (lapData.last().lapTime.toString() != "IN PIT" && lapData.last().getSectorTime(3).toString() == "" && lastLap.getSectorTime(3).toString() != "")
{
if (/*lapData.last().lapTime.toString() != "IN PIT" && lapData.last().sector1.toString() == "" &&*/ lastLap.getSectorTime(1).toString() != "")
lapData.last().sectorTimes[0] = lastLap.sectorTimes[0];
if (/*lapData.last().lapTime.toString() != "IN PIT" && lapData.last().sector2.toString() == "" && */lastLap.getSectorTime(2).toString() != "")
lapData.last().sectorTimes[1] = lastLap.sectorTimes[1];
lapData.last().sectorTimes[2] = lastLap.sectorTimes[2];
updateSectorRecords();
if (lapData.last().lapNum == sessionRecords.bestLap.lapNum)
{
sessionRecords.bestLap.sectorTimes[0] = lapData.last().sectorTimes[0];
sessionRecords.bestLap.sectorTimes[1] = lapData.last().sectorTimes[1];
sessionRecords.bestLap.sectorTimes[2] = lapData.last().sectorTimes[2];
}
}
}
}
void DriverData::updateInPit()
{
if (!lapData.isEmpty())
{
lapData.last().pos = lastLap.pos;
lapData.last().gap = lastLap.gap;
lapData.last().interval = lastLap.interval;
posHistory.last() = lastLap.pos;
}
}
//during quali and free practice - gap for all laps is calculated to the best session time
void DriverData::updateGaps(const EventData &ed)
{
for (int i = 0; i < lapData.size(); ++i)
lapData[i].gap = QString::number((lapData[i].lapTime - ed.getSessionRecords().getFastestLap().getTime()).toDouble());
}
void DriverData::updateSectorRecords()
{
for (int i = 0; i < 3; ++i)
{
if ( sessionRecords.bestSectors[i].second == 0 ||
(((lapData.last().getSectorTime(i + 1) < sessionRecords.bestSectors[i].first) ||
((lapData.last().getSectorTime(i + 1) == sessionRecords.bestSectors[i].first) &&
(colorData.sectorColor(i + 1) == LTPackets::VIOLET || colorData.sectorColor(i + 1) == LTPackets::GREEN))) &&
sessionRecords.bestSectors[i].second != 0))
{
sessionRecords.bestSectors[i] = QPair<LapTime, int>(LapTime(lapData.last().getSectorTime(i + 1)), lapData.last().lapNum);
}
}
}
int DriverData::lapDiff(LapTime *lap)
{
int msec;
if (!lap[0].isValid())
msec = LapTime("59:59.999").toMsecs();
else
msec = lap[0].toMsecs();
int idx = 0;
for (int i = 1; i < 4; ++i)
{
if (lap[i].isValid() && lap[i].toMsecs() < msec)
{
idx = i;
msec = lap[i].toMsecs();
}
}
for (int i = 0; i < 4; ++i)
{
if (i != idx && lap[i].isValid())
lap[i] = lap[i] - lap[idx];
}
return idx;
}
void DriverData::addPitStop(const PitData &pd)
{
if (pd.pitLap == 0)
return;
for (int i = 0; i < pitData.size(); ++i)
{
if (pitData[i].pitLap == pd.pitLap)
{
if (pitData[i].pitTime == "")
pitData[i].pitTime = pd.pitTime;
return;
}
}
pitData.append(pd);
qSort(pitData);
}
| zywhlc-f1lt | src/core/driverdata.cpp | C++ | gpl3 | 19,359 |
/*******************************************************************************
* *
* F1LT - unofficial Formula 1 live timing application *
* Copyright (C) 2012-2013 Mariusz Pilarek (pieczaro@gmail.com) *
* *
* 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 *
* the Free Software Foundation, either version 3 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
* *
*******************************************************************************/
#include "lapdata.h"
LapTime::LapTime(int ms)
{
int msec = ms;
int sec = ms / 1000;
int min = 0;
if (sec > 0)
msec = ms % (sec * 1000);
if (sec > 60)
{
min = sec / 60;
if (min > 0)
sec = sec % (min * 60);
}
time = LapTime(min, sec, msec).toString();
}
//----------------------------------
int LapTime::toMsecs() const
{
if (!isValid())
return 0;
int idx = time.indexOf(":");
int min=0, sec=0, msec=0;
if (idx > -1)
min = time.left(idx).toInt();
int idx2 = time.indexOf(".", idx < 0 ? 0 : idx);
if(idx2 > -1)
{
sec = time.mid(idx+1, idx2 - idx - 1).toInt();
QString strMS = time.right(time.size() - idx2 - 1);
msec = strMS.toInt() * (strMS.size() < 3 ? (strMS.size() < 2 ? 100 : 10) : 1);
}
msec += sec * 1000 + min * 60000;
return msec;
}
//----------------------------------
QString LapTime::toSecs() const
{
double sec = (double)(toMsecs() / 1000.0);
return QString::number(sec, 'f', 3);
}
//----------------------------------
bool LapTime::operator < (const LapTime <) const
{
if (!isValid())
return false;
if (!lt.isValid())
return true;
return toMsecs() < lt.toMsecs();
}
//----------------------------------
bool LapTime::operator <= (const LapTime <) const
{
if (!isValid())
return false;
if (!lt.isValid())
return true;
return toMsecs() <= lt.toMsecs();
}
//----------------------------------
bool LapTime::operator >(const LapTime <) const
{
return !(*this <= lt);
}
//----------------------------------
bool LapTime::operator >=(const LapTime <) const
{
return !(*this < lt);
}
//----------------------------------
bool LapTime::operator == (const LapTime <) const
{
if (isValid() && lt.isValid())
return toMsecs() == lt.toMsecs();
return false;
}
//----------------------------------
LapTime LapTime::operator - (const LapTime <) const
{
return LapTime(toMsecs() - lt.toMsecs());
}
//----------------------------------
LapTime LapTime::operator + (const LapTime <) const
{
return LapTime(toMsecs() + lt.toMsecs());
}
//----------------------------------
bool LapTime::isValid() const
{
if (time == "")
return false;
bool ok;
int idx = time.indexOf(":");
if (idx > -1)
{
time.left(idx).toInt(&ok);
if (!ok)
return false;
}
int idx2 = time.indexOf(".", (idx < 0 ? 0 : idx));
if (idx2 > -1)
{
time.mid(idx+1, idx2-idx-1).toInt(&ok);
if (!ok)
return false;
time.right(time.size() - idx2 - 1).toInt(&ok);
if (!ok)
return false;
}
else
return false;
return true;
}
| zywhlc-f1lt | src/core/lapdata.cpp | C++ | gpl3 | 4,360 |
/*******************************************************************************
* *
* F1LT - unofficial Formula 1 live timing application *
* Copyright (C) 2012-2013 Mariusz Pilarek (pieczaro@gmail.com) *
* *
* 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 *
* the Free Software Foundation, either version 3 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
* *
*******************************************************************************/
#ifndef SESSIONDEFAULTS_H
#define SESSIONDEFAULTS_H
#include <QList>
#include <QTime>
/*!
* \brief The SessionDefaults class holds default settings of Formula 1 sessions, like practice and quali lengths
*/
class SessionDefaults
{
public:
SessionDefaults();
int getFPLength() const;
int getFPLength(int fp) const;
int getQualiLength(int q) const;
QTime correctFPTime(const QTime &time) const;
QTime correctQualiTime(const QTime &time, int qualiPeriod) const;
int timeToMins(const QTime &time) const;
int timeToSecs(const QTime &time) const;
private:
QList<int> fpLengths;
QList<int> qualiLengths;
};
#endif // SESSIONDEFAULTS_H
| zywhlc-f1lt | src/core/sessiondefaults.h | C++ | gpl3 | 2,219 |
/*******************************************************************************
* *
* F1LT - unofficial Formula 1 live timing application *
* Copyright (C) 2012-2013 Mariusz Pilarek (pieczaro@gmail.com) *
* *
* 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 *
* the Free Software Foundation, either version 3 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
* *
*******************************************************************************/
#ifndef TRACKMAPSCOORDINATES_H
#define TRACKMAPSCOORDINATES_H
#include <QPoint>
#include <QString>
#include <QVector>
/*!
* \brief The TrackCoordinates struct stores coordinates of a one track map
*/
struct TrackCoordinates
{
int indexes[3]; //index of S1, S2 and pit out
QVector<QPoint> coordinates;
QString name; //track name
int year; //track version
TrackCoordinates()
{
indexes[0] = 0;
indexes[1] = 0;
indexes[2] = 0;
year = 0;
}
};
/*!
* \brief The TrackMapsCoordinates class stores track map coordinates loaded from the .dat file. It used in driver tracker.
*/
class TrackMapsCoordinates
{
public:
TrackMapsCoordinates();
TrackCoordinates getCurrentTrackCoordinates() const;
bool loadTrackDataFile();
private:
QVector<TrackCoordinates> ltTrackCoordinates;
};
#endif // TRACKMAPSCOORDINATES_H
| zywhlc-f1lt | src/core/trackmapscoordinates.h | C++ | gpl3 | 2,450 |
#include "colorsmanager.h"
#include "eventdata.h"
ColorsManager::ColorsManager()
{
for (int i = 0; i < 10; ++i)
colors.append(QColor());
colors[LTPackets::DEFAULT] = QColor(150, 150, 150);
colors[LTPackets::CYAN] = QColor(0, 255, 255);
colors[LTPackets::GREEN] = QColor(0, 255, 0);
colors[LTPackets::VIOLET] = QColor(255, 0, 255);
colors[LTPackets::WHITE] = QColor(220, 220, 220);
colors[LTPackets::YELLOW] = QColor(255, 255, 0);
colors[LTPackets::RED] = QColor(231, 31, 31);
colors[LTPackets::PIT] = QColor(231, 31, 31);
colors[LTPackets::BACKGROUND] = QColor(20, 20, 20);
colors[LTPackets::BACKGROUND2] = QColor(30, 30, 30);
defaultColors = colors;
driverColors.append(QColor(0, 255, 255));
driverColors.append(QColor(0, 0, 255));
driverColors.append(QColor(128, 0, 128));
driverColors.append(QColor(255, 0, 255));
driverColors.append(QColor(229, 30, 27));
driverColors.append(QColor(165, 25, 28));
driverColors.append(QColor(255, 255, 255));
driverColors.append(QColor(148, 148, 176));
driverColors.append(QColor(255, 209, 38));
driverColors.append(QColor(255, 104, 57));
driverColors.append(QColor(124, 196, 236));
driverColors.append(QColor(12, 163, 218));
driverColors.append(QColor(19, 139, 65));
driverColors.append(QColor(114, 183, 136));
driverColors.append(QColor(94, 93, 91));
driverColors.append(QColor(157, 155, 156));
driverColors.append(QColor(94, 109, 157));
driverColors.append(QColor(39, 72, 125));
driverColors.append(QColor(0, 255, 0));
driverColors.append(QColor(26, 98, 21));
driverColors.append(QColor(128, 64, 0));
driverColors.append(QColor(206, 103, 0));
driverColors.append(QColor(234, 78, 115));
driverColors.append(QColor(245, 146, 166));
defaultDriverColors = driverColors;
}
QColor ColorsManager::getCarColor(int no)
{
QColor color = getColor(LTPackets::BACKGROUND);
if (no > 0 && no < driverColors.size()+2)
{
color = driverColors[no <= 12 ? no-1 : no -2];
}
return color;
}
void ColorsManager::calculateDefaultDriverColors()
{
int k = 0;
for (int i = 0; i < 30 && k < driverColors.size(); ++i)
{
QPixmap car = SeasonData::getInstance().getCarImg(i);
if (!car.isNull())
{
QColor average;
if ((k % 2) == 0)
{
average = calculateAverageColor(car.toImage(), k);
}
else
{
average = defaultDriverColors[k-1];
int red = average.red() + 50 > 255 ? 255 : average.red() + 50;
int green = average.green() + 50 > 255 ? 255 : average.green() + 50;
int blue = average.blue() + 50 > 255 ? 255 : average.blue() + 50;
average = QColor(red, green, blue);
}
//if driver is using his default colors, we update theese too
if (driverColors[k] == defaultDriverColors[k])
driverColors[k] = average;
defaultDriverColors[k] = average;
++k;
}
}
}
void ColorsManager::addColor(QMap<MyColor, int> &colors, MyColor color)
{
QList<MyColor> keys = colors.keys();
for (int i = 0; i < keys.size(); ++i)
{
if ((abs(keys[i].red() - color.red()) <= 40) &&
(abs(keys[i].green() - color.green()) <= 40) &&
(abs(keys[i].blue() - color.blue()) <= 40))
{
colors[keys[i]]++;
return;
}
}
colors.insert(color, 1);
}
QColor ColorsManager::calculateAverageColor(const QImage &car, int idx)
{
QMap<MyColor, int> colors;
for (int i = 0; i < car.width(); ++i)
{
for (int j = 0; j < car.height(); ++j)
{
// if (qRed(car.pixel(i, j)) != 0)
// {
// averageR += qRed(car.pixel(i, j));
// ++rCnt;
// }
// if (qGreen(car.pixel(i, j)) != 0)
// {
// averageG += qGreen(car.pixel(i, j));
// ++gCnt;
// }
// if (qBlue(car.pixel(i, j)) != 0)
// {
// averageB += qBlue(car.pixel(i, j));
// ++bCnt;
// }
if ((qAlpha(car.pixel(i, j)) > 0) && ((qRed(car.pixel(i, j)) > 70) || (qGreen(car.pixel(i, j)) > 70) || (qBlue(car.pixel(i, j)) > 70)))
addColor(colors, static_cast<MyColor>(QColor(car.pixel(i, j))));
}
}
QList<MyColor> keys = colors.keys();
int max = colors[keys[keys.size()-1]];
QColor color = static_cast<QColor>(keys[keys.size()-1]);
for (int i = 0; i < keys.size()-1; ++i)
{
if (colors[keys[i]] > max && !isColorInTheList(keys[i], idx))
{
max = colors[keys[i]];
color = static_cast<QColor>(keys[i]);
}
}
return color;
}
bool ColorsManager::isColorInTheList(QColor color, int idx)
{
for (int i = 0; i < idx; ++i)
{
if ((abs(defaultDriverColors[i].red() - color.red()) <= 30) &&
(abs(defaultDriverColors[i].green() - color.green()) <= 30) &&
(abs(defaultDriverColors[i].blue() - color.blue()) <= 30))
return true;
}
return false;
}
| zywhlc-f1lt | src/core/colorsmanager.cpp | C++ | gpl3 | 5,294 |
/*******************************************************************************
* *
* F1LT - unofficial Formula 1 live timing application *
* Copyright (C) 2012-2013 Mariusz Pilarek (pieczaro@gmail.com) *
* *
* 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 *
* the Free Software Foundation, either version 3 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
* *
*******************************************************************************/
#include "colorsmanager.h"
#include "imagesfactory.h"
#include "seasondata.h"
#include <QPainter>
CarThumbnailsFactory::~CarThumbnailsFactory()
{
QMap<int, QList<QPixmap*> >::Iterator iter = carThumbnails.begin();
while (iter != carThumbnails.end())
{
QList<QPixmap*> *images = &iter.value();
while (!images->isEmpty())
{
delete images->takeFirst();
}
++iter;
}
}
QList<QPixmap*> *CarThumbnailsFactory::loadCarThumbnails(int size, bool clear)
{
QList<QPixmap*> *images = &carThumbnails[size];
if (!images->isEmpty())
{
if (clear)
{
for (int i = 0; i < images->size(); ++i)
{
delete (*images)[i];
}
images->clear();
}
else
return images;
}
for (int i = 0; i < SeasonData::getInstance().getTeams().size(); ++i)
{
images->append(new QPixmap(SeasonData::getInstance().getTeams()[i].carImg.scaledToWidth(size, Qt::SmoothTransformation)));
}
return images;
}
QPixmap &CarThumbnailsFactory::getCarThumbnail(int no, int size)
{
if (no < 1)
return nullPixmap;
const QList<QPixmap*> *images = loadCarThumbnails(size, false);
int idx = (no > 13 ? no-2 : no-1) / 2;
if (idx >= 0 && idx < images->size())
return *(*images)[idx];
return nullPixmap;
}
void CarThumbnailsFactory::reloadCarThumbnails()
{
QList<int> keys = carThumbnails.keys();
for (int i = 0; i < keys.size(); ++i)
loadCarThumbnails(keys[i], true);
}
//====================================================
HelmetsFactory::~HelmetsFactory()
{
QMap<int, QMap<int, QPixmap*> >::Iterator iter = helmets.begin();
while (iter != helmets.end())
{
QList<int> keys = iter.value().keys();
for (int i = 0; i < keys.size(); ++i)
{
delete iter.value().take(keys[i]);
}
++iter;
}
}
QMap<int, QPixmap *> *HelmetsFactory::loadHelmets(int size, bool clear)
{
QMap<int, QPixmap *> *images = &helmets[size];
if (!images->isEmpty())
{
if (clear)
{
QList<int> keys = images->keys();
for (int i = 0; i < keys.size(); ++i)
{
delete images->take(keys[i]);
}
}
else
return images;
}
for (int i = 0; i < SeasonData::getInstance().getTeams().size(); ++i)
{
QList<LTDriver> mainDrivers = SeasonData::getInstance().getMainDrivers(SeasonData::getInstance().getTeams()[i]);
qSort(mainDrivers);
for (int j = 0; j < mainDrivers.size(); ++j)
{
images->insert(mainDrivers[j].no, loadHelmet(mainDrivers[j], size));
}
// for (int j = )
// images->append(loadHelmet(SeasonData::getInstance().getTeams()[i].driver1No, size));
// images->append(loadHelmet(SeasonData::getInstance().getTeams()[i].driver2No, size));
}
return images;
}
QPixmap &HelmetsFactory::getHelmet(int no, int size)
{
if (no < 1)
return nullPixmap;
const QMap<int, QPixmap *> *images = loadHelmets(size, false);
if (images->contains(no))
return *(*images)[no];
return nullPixmap;
}
QPixmap *HelmetsFactory::loadHelmet(const LTDriver &driver, int size)
{
if (!driver.helmet.isNull())
return new QPixmap(driver.helmet.scaledToHeight(size, Qt::SmoothTransformation));
QImage helmet = QImage(":/ui_icons/helmet.png").scaledToHeight(size, Qt::SmoothTransformation);
QImage helmetMask = QImage(":/ui_icons/helmet_mask.png").scaledToHeight(size, Qt::SmoothTransformation);
QImage hl(helmet.size(), helmet.format());
QColor drvColor = ColorsManager::getInstance().getCarColor(driver.no);
QPainter phl;
phl.begin(&hl);
phl.setBrush(QBrush(drvColor));
phl.drawRect(0, 0, hl.width(), hl.height());
phl.setCompositionMode(QPainter::CompositionMode_DestinationOut);
phl.drawImage(0, 0, helmetMask);
phl.setCompositionMode(QPainter::CompositionMode_SourceOver);
phl.drawImage(0, 0, helmet);
phl.end();
return new QPixmap(QPixmap::fromImage(hl));
}
void HelmetsFactory::reloadHelmets()
{
QList<int> keys = helmets.keys();
for (int i = 0; i < keys.size(); ++i)
loadHelmets(keys[i], true);
}
| zywhlc-f1lt | src/core/imagesfactory.cpp | C++ | gpl3 | 5,922 |
/*******************************************************************************
* *
* F1LT - unofficial Formula 1 live timing application *
* Copyright (C) 2012-2013 Mariusz Pilarek (pieczaro@gmail.com) *
* *
* 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 *
* the Free Software Foundation, either version 3 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
* *
*******************************************************************************/
#ifndef TRACKRECORDS_H
#define TRACKRECORDS_H
#include "../core/lapdata.h"
#include "../core/eventdata.h"
const int NUM_SESSIONS=5; //FP1, FP2, FP3, Quali, Race
const int NUM_SECTORS=4; //3 sectors + lap time
enum eTrackRecord
{
QUALI_RECORD = 0,
RACE_RECORD
};
enum eSectorRecord
{
S1_RECORD = 0,
S2_RECORD,
S3_RECORD,
TIME_RECORD
};
enum eSession
{
FP1 = 0,
FP2,
FP3,
QUALI,
RACE
};
/*!
* \brief The Record struct defines a single record data including time, driver, team, year and session info.
*/
struct Record
{
LapTime time;
QString driver;
QString team;
QString year;
QString session;
};
/*!
* \brief The DriverWeekendRecords struct stores session records of a driver.
*/
struct DriverWeekendRecords
{
QString driver;
QString team;
Record sessionRecords[NUM_SESSIONS][NUM_SECTORS];
DriverWeekendRecords &operator=(const DriverWeekendRecords &dr)
{
if (this == &dr)
return *this;
driver = dr.driver;
team = dr.team;
for (int i = 0; i < NUM_SESSIONS; ++i)
{
for (int j = 0; j < NUM_SECTORS; ++j)
sessionRecords[i][j] = dr.sessionRecords[i][j];
}
return *this;
}
Record getWeekendRecord(eSectorRecord sector) const
{
Record rec = sessionRecords[0][sector];
for (int i = 1; i < NUM_SESSIONS; ++i)
{
if (sessionRecords[i][sector].time < rec.time)
rec = sessionRecords[i][sector];
}
return rec;
}
};
/*!
* \brief The TrackWeekendRecords struct stores weekend (best sector times and lap time) and driver records for a track.
*/
struct TrackWeekendRecords
{
int year;
Record sessionRecords[NUM_SECTORS];
QList<DriverWeekendRecords> driverRecords;
static TrackWeekendRecords &null()
{
static TrackWeekendRecords nullTR;
return nullTR;
}
bool operator==(const TrackWeekendRecords &tr) const
{
return year == tr.year;
}
bool operator!=(const TrackWeekendRecords &tr) const
{
return year != tr.year;
}
bool operator < (const TrackWeekendRecords &twr) const
{
return year < twr.year;
}
TrackWeekendRecords &operator=(const TrackWeekendRecords &tr)
{
if (this == &tr)
return *this;
year = tr.year;
for (int i = 0; i < NUM_SECTORS; ++i)
{
sessionRecords[i] = tr.sessionRecords[i];
}
driverRecords = tr.driverRecords;
return *this;
}
DriverWeekendRecords getDriverRecords(QString driver)
{
for (int i = 0; i < driverRecords.size(); ++i)
{
if (driver == driverRecords[i].driver)
return driverRecords[i];
}
return DriverWeekendRecords();
}
};
/*!
* \brief The TrackVersion struct stores information about a track. Since tracks are being rebuilt from time to time, one track can have many versions with different layouts and records.
*/
struct TrackVersion
{
QPixmap map;
int year;
Record trackRecords[2];
QList<TrackWeekendRecords> trackWeekendRecords;
bool operator < (const TrackVersion &tr) const
{
return year < tr.year;
}
bool operator == (const TrackVersion &tr) const
{
return (year == tr.year);
}
bool operator != (const TrackVersion &tr) const
{
return (year != tr.year);
}
TrackWeekendRecords &operator[](int idx)
{
if (idx >= 0 && idx < trackWeekendRecords.size())
return trackWeekendRecords[idx];
return TrackWeekendRecords::null();
}
int size() const
{
return trackWeekendRecords.size();
}
TrackWeekendRecords &last()
{
if (!trackWeekendRecords.isEmpty())
return trackWeekendRecords.last();
return TrackWeekendRecords::null();
}
TrackVersion &operator=(const TrackVersion &tr)
{
if (this == &tr)
return *this;
year = tr.year;
map = tr.map;
for (int i = 0; i < 2; ++i)
trackRecords[i] = tr.trackRecords[i];
trackWeekendRecords = tr.trackWeekendRecords;
return *this;
}
TrackWeekendRecords &getTrackWeekendRecords(int year)
{
for (int i = 0; i < trackWeekendRecords.size(); ++i)
{
if (trackWeekendRecords[i].year == year)
return trackWeekendRecords[i];
}
return TrackWeekendRecords::null();
}
TrackWeekendRecords &removeTrackWeekendRecords(TrackWeekendRecords &tr)
{
int idx = trackWeekendRecords.indexOf(tr);
if (idx != -1)
{
trackWeekendRecords.takeAt(idx);
if (trackWeekendRecords.isEmpty())
return TrackWeekendRecords::null();
return trackWeekendRecords.first();
}
return tr;
}
static TrackVersion &null()
{
static TrackVersion tvNull;
return tvNull;
}
};
/*!
* \brief The Track struct describes a single track with a given name and all available versions.
*/
struct Track
{
QString name;
QList<TrackVersion> trackVersions;
TrackVersion &operator[](int idx)
{
if (idx >= 0 && idx < trackVersions.size())
return trackVersions[idx];
return TrackVersion::null();
}
TrackVersion &last()
{
if (!trackVersions.isEmpty())
return trackVersions.last();
return TrackVersion::null();
}
bool operator < (const Track &tr) const
{
return name < tr.name;
}
static Track &null()
{
static Track nullTrack;
return nullTrack;
}
bool operator!=(const Track &tr)
{
return (name != tr.name || trackVersions.size() != tr.trackVersions.size());
}
TrackVersion &getTrackVersion(int year)
{
for (int i = 0; i < trackVersions.size(); ++i)
{
if (trackVersions[i].year == year)
return trackVersions[i];
}
return TrackVersion::null();
}
void getTrackRecords(TrackVersion **tv, TrackWeekendRecords **trw, int year);
TrackVersion &removeTrackVersion(TrackVersion &tv)
{
int idx = trackVersions.indexOf(tv);
if (idx != -1)
{
trackVersions.takeAt(idx);
if (trackVersions.isEmpty())
return TrackVersion::null();
return trackVersions.first();
}
return tv;
}
};
/*!
* \brief The TrackRecords class stores records from all tracks. Records are loaded from a file during application startup, updated during session (also when the session is played from a .lt file) and saved before the application quits.
*/
class TrackRecords
{
public:
static TrackRecords &getInstance()
{
static TrackRecords instance;
return instance;
}
bool loadTrackRecords(QString fileName);
bool saveTrackRecords(QString fileName);
QList<Track> &getTrackRecords() { return trackRecords; }
Track &operator[](int idx)
{
if (idx >= 0 && idx < trackRecords.size())
return trackRecords[idx];
return Track::null();
}
int size() const
{
return trackRecords.size();
}
Track &last()
{
if (!trackRecords.isEmpty())
return trackRecords.last();
return Track::null();
}
int getCurrentTrackRecords(Track **track, TrackWeekendRecords **twr, TrackVersion **tv);
void gatherSessionRecords(bool withDriverRecords = false);
void gatherDriverRecords(TrackWeekendRecords *twr, TrackVersion *tv);
QStringList getTrackList()
{
QStringList sList;
for (int i = 0; i < trackRecords.size(); ++i)
{
QString trackName = trackRecords[i].name;
sList.append(trackName);
}
sList.sort();
return sList;
}
QString getCurrentSessionAsString();
eSession getCurrentSession();
eSession getSessionFromString(QString ses);
private:
TrackRecords();
QList<Track> trackRecords;
};
#endif // TRACKRECORDS_H
| zywhlc-f1lt | src/core/trackrecords.h | C++ | gpl3 | 9,835 |
/*******************************************************************************
* *
* F1LT - unofficial Formula 1 live timing application *
* Copyright (C) 2012-2013 Mariusz Pilarek (pieczaro@gmail.com) *
* *
* 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 *
* the Free Software Foundation, either version 3 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
* *
*******************************************************************************/
#ifndef F1LTCORE_H
#define F1LTCORE_H
#define STR1(x) #x
#define STR(x) STR1(x)
#include <QCoreApplication>
#include <QDir>
#include <QDebug>
/*!
* \brief The F1LTCore class stores paths to application files. No object of this class can be created, all methods are static.
*/
class F1LTCore
{
public:
static QString programVersion() { return "2.0.2"; }
static QString programHomeDir()
{
#ifdef WIN32
return QCoreApplication::applicationDirPath();
#else
return QCoreApplication::applicationDirPath();
#endif
}
static QString iniFile()
{
#ifdef WIN32
return programHomeDir() + "/f1lt.ini";
#else
QDir dir = QDir::homePath() + "/.config/f1lt";
if (!dir.exists())
{
if (!dir.mkpath(QDir::homePath() + "/.config/f1lt"))
return QDir::homePath() + "/.f1lt.ini";
}
return QDir::homePath() + "/.config/f1lt/f1lt.ini";
#endif
}
static QString seasonDataFile()
{
#ifdef WIN32
return programHomeDir() + "/season.dat";
#else
QString prefix = STR(SHARE_PREFIX);
QDir dir;
if (dir.exists(prefix))
return prefix + "/season.dat";
else
return programHomeDir() + "/season.dat";
#endif
}
static QString trackDataFile()
{
#ifdef WIN32
return programHomeDir() + "/trackdata.dat";
#else
QString prefix = STR(SHARE_PREFIX);
QDir dir;
if (dir.exists(prefix))
return prefix + "/trackdata.dat";
else
return programHomeDir() + "/trackdata.dat";
#endif
}
static QString trackRercordsFile(bool forRead = true)
{
#ifdef WIN32
return programHomeDir() + "/trackrecords.dat";
#else
QString homeFilePath = QDir::homePath() + "/.config/f1lt/trackrecords.dat";
QFileInfo fileInfo(homeFilePath);
if (forRead && !fileInfo.exists())
{
QString prefix = STR(SHARE_PREFIX);
QDir dir;
if (dir.exists(prefix))
return prefix + "/trackrecords.dat";
else
return programHomeDir() + "/trackrecords.dat";
}
else
{
return homeFilePath;
}
#endif
}
static QString ltDataHomeDir()
{
#ifdef WIN32
QString path = programHomeDir() + "/ltdata/";
QDir dir(path);
if (!dir.exists())
dir.mkpath(path);
return path;
#else
QDir dir = QDir::homePath() + "/.config/f1lt/ltdata";
if (!dir.exists())
{
if (!dir.mkpath(QDir::homePath() + "/.config/f1lt/ltdata"))
{
return programHomeDir() + "/ltdata/";
}
}
return QDir::homePath() + "/.config/f1lt/ltdata/";
#endif
}
private:
F1LTCore();
};
#endif // F1LTCORE_H
| zywhlc-f1lt | src/core/f1ltcore.h | C++ | gpl3 | 4,408 |
/*******************************************************************************
* *
* F1LT - unofficial Formula 1 live timing application *
* Copyright (C) 2012-2013 Mariusz Pilarek (pieczaro@gmail.com) *
* *
* 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 *
* the Free Software Foundation, either version 3 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
* *
*******************************************************************************/
#ifndef IMAGESFACTORY_H
#define IMAGESFACTORY_H
#include <QList>
#include <QMap>
#include <QPixmap>
class ImagesFactory;
class LTDriver;
/*!
* \brief The CarThumbnailsFactory class stores car thumbnails of all required sizes. All objects have access to car thumbnails using this class.
* Only constructor of CarThumbnailsFactory is private, access to object of this class is available by ImagesFactory singleton only.
*/
class CarThumbnailsFactory
{
public:
~CarThumbnailsFactory();
QList<QPixmap*> *loadCarThumbnails(int size, bool clear = true);
QPixmap &getCarThumbnail(int no, int size);
void reloadCarThumbnails();
friend class ImagesFactory;
private:
CarThumbnailsFactory() { }
QMap<int, QList<QPixmap*> > carThumbnails;
QPixmap nullPixmap;
};
/*!
* \brief The HelmetsFactory class stores helmet images of all required sizes. All objects have access to helmet images using this class.
* Only constructor of CarThumbnailsFactory is private, access to object of this class is available by ImagesFactory singleton only.
*/
class HelmetsFactory
{
public:
~HelmetsFactory();
QMap<int, QPixmap*> *loadHelmets(int size, bool clear = true);
QPixmap &getHelmet(int no, int size);
QPixmap *loadHelmet(const LTDriver &driver, int size);
void reloadHelmets();
friend class ImagesFactory;
private:
HelmetsFactory() { }
QMap<int, QMap<int, QPixmap*> > helmets;
QPixmap nullPixmap;
};
/*!
* \brief The ImagesFactory class is a singleton used only to give access to HelmetsFactory and CarThumbnailsFactory objects.
*/
class ImagesFactory : public QObject
{
Q_OBJECT
public:
static ImagesFactory &getInstance()
{
static ImagesFactory imFact;
return imFact;
}
CarThumbnailsFactory &getCarThumbnailsFactory() { return carThumbnailsFactory; }
HelmetsFactory &getHelmetsFactory() { return helmetsFactory; }
public slots:
void reloadGraphics()
{
carThumbnailsFactory.reloadCarThumbnails();
helmetsFactory.reloadHelmets();
}
private:
ImagesFactory() { }
CarThumbnailsFactory carThumbnailsFactory;
HelmetsFactory helmetsFactory;
};
#endif // IMAGESFACTORY_H
| zywhlc-f1lt | src/core/imagesfactory.h | C++ | gpl3 | 3,757 |
/*******************************************************************************
* *
* F1LT - unofficial Formula 1 live timing application *
* Copyright (C) 2012-2013 Mariusz Pilarek (pieczaro@gmail.com) *
* *
* 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 *
* the Free Software Foundation, either version 3 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
* *
*******************************************************************************/
#include "eventdata.h"
#include "seasondata.h"
#include <QDebug>
void Weather::saveWeatherData(const EventData &ed)
{
WeatherData wd;
wd.lap = ed.getCompletedLaps();
wd.sessionTime = ed.getRemainingTime();
wd.qPeriod = ed.getQualiPeriod();
for (int i = 0; i < 7; ++i)
{
wd.value = currentWeather[i].value;
if (!(weatherData[i].isEmpty() && wd.value == 0.0 && i != 5))
weatherData[i].append(wd);
}
}
EventData::EventData()
{
eventId = 0;
eventInfo.laps = 0;
eventInfo.eventNo = 0;
key = 0;
frame = 0;
remainingTime = QTime();
lapsCompleted = 0;
flagStatus = LTPackets::GREEN_FLAG;
qualiPeriod = 0;
fpNumber = 0;
sessionStarted = false;
sessionFinished = false;
qualiBreak = false;
baseEventId = 7066;
baseEventInc = 6;
}
void EventData::clear()
{
// eventInfo.laps = 0;
// eventInfo.eventNo = 0;
eventId = 0;
key = 0;
frame = 0;
fpNumber = 0;
driversData.resize(SeasonData::getInstance().getTeams().size()*2);
reset();
// driversData.clear();
// for (int i = 0; i < SeasonData::getInstance().getTeams().size(); ++i)
// {
// driversData.append(DriverData());
// driversData.append(DriverData());
// }
}
/*!
* \brief EventData::reset - resets only some parameters, can be used ie. during session playback
*/
void EventData::reset()
{
lapsCompleted = 0;
remainingTime = QTime();
weather = Weather();
sessionRecords = SessionRecords();
flagStatus = LTPackets::GREEN_FLAG;
sessionStarted = false;
sessionFinished = false;
qualiPeriod = 0;
commentary = "";
for (int i = 0; i < driversData.size(); ++i)
driversData[i] = DriverData();
}
QString EventData::calculateInterval(const DriverData &d1, const DriverData &d2, int lap) const
{
LapData ld1 = d1.getLapData(lap);
LapData ld2 = d2.getLapData(lap);
if (lap == -1 && !d1.getLapData().isEmpty() && !d2.getLapData().isEmpty())
{
ld1 = d1.getLastLap();//d1.lapData.get(d1.lapData.size()-1);
ld2 = d2.getLastLap();//d2.lapData.get(d2.lapData.size()-1);
}
if (ld1.getCarID() == -1 || ld2.getCarID() == -1)
return "";
QString gap1 = ld1.getGap();
QString gap2 = ld2.getGap();
if ((ld1.getTime().toString() == "" && ld1.getGap() == "") ||
(ld2.getTime().toString() == "" && ld2.getGap() == ""))
return "";
if (ld1.getPosition() == 1)
return "-" + (gap2 == "" ? "1L <" : gap2) + (gap2.contains("L") ? " <" : "");
if (ld2.getPosition() == 1)
return "+" + (gap1 == "" ? "1L <" : gap1) + (gap1.contains("L") ? " <" : "");
if ((gap1 != "" && gap2 != "" && gap1[gap1.size()-1] != 'L' &&
gap2[gap2.size()-1] != 'L') ||
((ld1.getPosition() == 1 && gap1 == "") || (ld2.getPosition() == 1 && gap2 == "")))
{
double interval = 0.0;
interval = gap1.toDouble() - gap2.toDouble();
QString sInterval = QString::number(interval, 'f', 1);
// String sInterval = QString::number(interval, 'f', 1);
if (interval > 0)
sInterval = "+" + sInterval;
return sInterval;
}
else if ((gap1 != "" && gap1.contains("L")) ||
(gap2 != "" && gap2.contains("L")) ||
(gap1 == "" || gap2 == ""))
{
int pos1 = ld1.getPosition();
int pos2 = ld2.getPosition();
bool neg = true;
if (pos2 < pos1)
{
int tmp = pos1;
pos1 = pos2;
pos2 = tmp;
neg = false;
}
QStringList intervals;
// intervals.reserve(pos2 - pos1);
for (int i = 0; i < driversData.size(); ++i)
{
LapData ld = driversData[i].getLapData(lap);
if (lap == -1 && !driversData[i].getLapData().isEmpty())
ld = driversData[i].getLastLap();//lapData.get(driversData.get(i).lapData.size()-1);
if (ld.getCarID() == -1)
continue;
int pos = ld.getPosition();
if (pos > pos1 && pos <= pos2)
{
if (ld.getInterval() != "" && ld.getInterval().contains("L"))
return neg ? "-1L <" : "+1L <";
intervals.append(ld.getInterval());
}
}
double interval = 0.0;
for (int i = 0; i < intervals.size(); ++i)
interval += intervals[i].toDouble();
if (neg && ld1.getTime().isValid() && interval > ld1.getTime().toDouble())
return "-1L <";
if (!neg && ld2.getTime().isValid() && interval > ld2.getTime().toDouble())
return "+1L <";
QString sInterval = QString::number(interval, 'f', 1);
if (neg)
sInterval = "-" + sInterval;
else
sInterval = "+" + sInterval;
return sInterval;
}
return "";
}
int EventData::getFPNumber() const
{
if (fpNumber > 0)
return fpNumber;
if (getEventId() == 0)
return 1;
else
return (getEventId() - baseEventId) % baseEventInc;
}
int EventData::correctPosition(const LapTime &ld) const
{
QList<LapTime> timeList;
timeList << ld;
for (int i = 0; i < driversData.size(); ++i)
{
LapTime lt = driversData[i].getQualiTime(qualiPeriod);
if (!lt.isValid())
lt = driversData[i].getSessionRecords().getBestLap().getTime();
if (lt != ld)
timeList << lt;
}
qSort(timeList);
return timeList.indexOf(ld) + 1;
}
bool EventData::isFridayBeforeFP1()
{
//on friday before FP1 starts there is already next GP weekend data loaded, but server still sends race results from previous race
if ((QDateTime::currentDateTimeUtc().date() == getEventInfo().fpDate) &&
getEventType() == LTPackets::RACE_EVENT)
{
return true;
}
return false;
}
/*
EventData eventData;*/
| zywhlc-f1lt | src/core/eventdata.cpp | C++ | gpl3 | 7,192 |
/*******************************************************************************
* *
* F1LT - unofficial Formula 1 live timing application *
* Copyright (C) 2012-2013 Mariusz Pilarek (pieczaro@gmail.com) *
* *
* 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 *
* the Free Software Foundation, either version 3 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
* *
*******************************************************************************/
#include "sessiontimer.h"
#include "eventdata.h"
SessionTimer::SessionTimer(QObject *parent) :
QObject(parent), interval(1000), timerDelay(0)
{
connect(&timer, SIGNAL(timeout()), this, SLOT(timerTimeout()));
}
void SessionTimer::timerTimeout()
{
// if (!counterMode)
{
EventData &eventData = EventData::getInstance();
if (eventData.isSessionStarted() && !eventData.isQualiBreak())
{
if (timerDelay != 0)
{
--timerDelay;
emit synchronizingTimer(timerDelay != 0 ? true : false);
}
else if (!(eventData.getEventType() == LTPackets::RACE_EVENT && eventData.getCompletedLaps() == eventData.getEventInfo().laps) &&
!((eventData.getEventType() == LTPackets::QUALI_EVENT || eventData.getEventType() == LTPackets::RACE_EVENT) && eventData.getFlagStatus() == LTPackets::RED_FLAG))
{
int hours = eventData.getRemainingTime().hour();
int mins = eventData.getRemainingTime().minute();
int secs = eventData.getRemainingTime().second();
--secs;
if (secs < 0)
{
secs = 59;
--mins;
eventData.saveWeather();
emit updateWeather();
if (mins < 0)
{
--hours;
mins = 59;
if (hours < 0)
{
secs = mins = hours = 0;
if (eventData.getEventType() == LTPackets::QUALI_EVENT && eventData.getQualiPeriod() < 3)
eventData.setQualiBreak(true);
else
eventData.setSessionFinished(true);
}
}
}
eventData.setRemainingTime(QTime(hours, mins, secs));
}
}
}
emit timeout();
}
void SessionTimer::setDelay(int prevDelay, int delay)
{
EventData &eventData = EventData::getInstance();
if (!eventData.isSessionStarted() || eventData.isSessionFinished() || (prevDelay == delay))
return;
timerDelay -= prevDelay - delay;
if (delay == 0 || timerDelay < 0)
{
emit synchronizingTimer(false);
int hours = eventData.getRemainingTime().hour();
int minutes = eventData.getRemainingTime().minute();
int secs = eventData.getRemainingTime().second();
if (timerDelay < 0)
{
secs += timerDelay;
}
else if (delay == 0)
secs -= prevDelay;
timerDelay = 0;
if (secs < 0)
{
--minutes;
secs = 60 + secs;
if (minutes < 0)
{
--hours;
minutes = 60 + minutes;
if (hours < 0)
hours = minutes = secs = 0;
}
}
eventData.setRemainingTime(QTime(hours, minutes, secs));
}
}
| zywhlc-f1lt | src/core/sessiontimer.cpp | C++ | gpl3 | 4,660 |
/*******************************************************************************
* *
* F1LT - unofficial Formula 1 live timing application *
* Copyright (C) 2012-2013 Mariusz Pilarek (pieczaro@gmail.com) *
* *
* 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 *
* the Free Software Foundation, either version 3 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
* *
*******************************************************************************/
#ifndef DRIVERDATA_H
#define DRIVERDATA_H
#include "lapdata.h"
class DriverData;
class PacketParser;
/*!
* \brief The PitData class stores basic informations about a pitstop - pit time and a lap when pitstop was made.
*/
class PitData
{
public:
PitData() : pitLap (-1) { }
PitData(const QString &t, int p) : pitTime(t), pitLap(p) {}
const QString &getPitTime() const { return pitTime; }
void setPitTime (const QString &pt) { pitTime = pt; }
int getPitLap() const { return pitLap; }
void setPitLap(int pl) { pitLap = pl; }
bool operator < (const PitData pd) const
{
return pitLap < pd.pitLap ? true : false;
}
friend class DriverData;
private:
QString pitTime;
int pitLap;
};
//------------------------------------------------------
/*!
* \brief The ColorData class - a helper class used to color driver data output in the live timing view.
*/
class ColorData
{
public:
ColorData()
{
for (int i = 0; i < 15; ++i)
colorData[i] = LTPackets::DEFAULT;
}
LTPackets::Colors &positionColor() { return colorData[0]; }
LTPackets::Colors &numberColor() { return colorData[1]; }
LTPackets::Colors &driverColor() { return colorData[2]; }
LTPackets::Colors &gapColor() { return colorData[3]; }
LTPackets::Colors &intervalColor() { return colorData[4]; }
LTPackets::Colors &lapTimeColor() { return colorData[5]; }
LTPackets::Colors &qualiTimeColor(int idx)
{
switch (idx)
{
case 1: return colorData[5]; break;
case 2: return colorData[13]; break;
case 3: return colorData[14]; break;
default: return colorData[5]; break;
}
}
LTPackets::Colors §orColor(int idx)
{
if (idx >= 1 && idx <= 3)
return colorData[5+idx];
return colorData[6];
}
LTPackets::Colors &pitColor(int idx)
{
if (idx >= 1 && idx <= 3)
return colorData[8+idx];
return colorData[9];
}
LTPackets::Colors &numPitsColor() { return colorData[12]; }
LTPackets::Colors &numLapsColor() { return colorData[12]; }
private:
LTPackets::Colors colorData[15];
};
//------------------------------------------------------
/*!
* \brief The DriverRecords class stores driver records - best lap time, best sector times and best quali times from all periods.
*/
class DriverRecords
{
public:
DriverRecords()
{
for (int i = 0; i < 3; ++i)
bestSectors[i].second = 0;
}
DriverRecords &operator=(const DriverRecords &sr)
{
if (this == &sr)
return *this;
bestLap = sr.bestLap;
for (int i = 0; i < 3; ++i)
{
bestSectors[i] = sr.bestSectors[i];
bestQLaps[i] = sr.bestQLaps[i];
}
return *this;
}
QPair<LapTime, int> getBestSector(int idx) const
{
if (idx >= 1 && idx <= 3)
return bestSectors[idx-1];
return QPair<LapTime, int>();
}
int getBestSectorLapNumber(int idx) const
{
if (idx >= 1 && idx <= 3)
return bestSectors[idx-1].second;
return 0;
}
LapTime getBestSectorTime(int idx) const
{
if (idx >= 1 && idx <= 3)
return bestSectors[idx-1].first;
return LapTime();
}
const LapData &getBestLap() const { return bestLap; }
LapData getBestQualiLap(int idx) const
{
if (idx >= 1 && idx <= 3)
return bestQLaps[idx-1];
return LapData();
}
friend class DriverData;
friend class PacketParser;
private:
QPair<LapTime, int> bestSectors[3];
LapData bestLap;
LapData bestQLaps[3];
};
//------------------------------------------------------
/*!
* \brief The DriverData class contains all informations about a driver - his personal (name, number) and session (lap times, pit stops, position history, etc.) data
*/
class DriverData
{
public:
DriverData() : carID(-1), number(-1), pos(-1), numPits(0), retired(false), releasedFromPits(false), inPits(true)
{
++cnt;
lastLap.setCarID(carID);
lapData.reserve(80);
}
int getCarID() const { return carID; }
const QString &getDriverName() const { return driver; }
int getNumber() const { return number; }
int getPosition() const { return pos; }
const QVector<LapData> &getLapData() const { return lapData; }
const QVector<int> &getPositionHistory() const { return posHistory; }
const QVector<PitData> &getPitStops() const { return pitData; }
ColorData getColorData() const { return colorData; }
const LapData &getLastLap() const { return lastLap; }
bool isInPits() const
{
if ((!lastLap.getTime().toString().isEmpty() && (lastLap.getTime().toString() == "IN PIT")) ||
getColorData().numberColor() == LTPackets::PIT)
return true;
return false;
}
void updatePitStatus(LTPackets::Colors pitColor, EventData &ed);
LapTime getQualiTime(int idx) const
{
if (idx >= 1 && idx <= 3)
return qualiTimes[idx-1];
return LapTime();
}
const DriverRecords &getSessionRecords() const { return sessionRecords; }
int getNumPits() const { return numPits; }
bool isRetired() const { return retired; }
DriverData &operator=(const DriverData &dd);
bool operator<(const DriverData &dd) const
{
if (pos < 0)
return false;
if (dd.pos < 0)
return true;
return (pos < dd.pos) ? true : false;
}
static QString calculateGap(const LapTime &lap1, const LapTime &lap2)
{
if (lap1.isValid() && lap2.isValid())
{
double d = lap1.toDouble()-lap2.toDouble();
// if (d != 0)
return QString::number(d, 'f', 3);
}
return "";
}
//used in the head2head dialog - finds the best time and sets the differences between the best time and the others (max 4 lap times)
static int lapDiff(LapTime *lap);
int getStartingPos() const
{
if (!posHistory.isEmpty())
return posHistory[0];
return 0;
}
void addLap(const EventData &ed);
void addRaceLap(const EventData &ed);
void addFPQLap(const EventData &ed);
void addInLap(const EventData &ed);
void correctNumLap(int raceNumLap);
void correctPosition(const EventData &ed);
void updateLastLap();
void updateInPit();
void updateGaps(const EventData &ed);
void updateSectorRecords();
void addPitStop(const PitData &pd);
LapData getLapData(int lap) const
{
for (int i = 0; i < lapData.size(); ++i)
{
if (lap == lapData[i].lapNum)
return lapData[i];
}
return LapData();
}
LapData getFPLapData(int min) const
{
for (int i = 0; i < lapData.size(); ++i)
{
SeasonData &sd = SeasonData::getInstance();
int lapMin = sd.getSessionDefaults().timeToMins(sd.getSessionDefaults().correctFPTime(lapData[i].getPracticeLapExtraData().getSessionTime()));
if (min == lapMin)
return lapData[i];
}
return LapData();
}
LapData getQLapData(int min, int qPeriod) const
{
for (int i = 0; i < lapData.size(); ++i)
{
SeasonData &sd = SeasonData::getInstance();
if (qPeriod == lapData[i].getQualiLapExtraData().getQualiPeriod())
{
int lapMin = sd.getSessionDefaults().timeToMins(sd.getSessionDefaults().correctQualiTime(lapData[i].getQualiLapExtraData().getSessionTime(), qPeriod));
if (min == lapMin)
return lapData[i];
}
}
return LapData();
}
void setFastestLap(const LapTime &lapTime, int lapNo)
{
if (lapNo == sessionRecords.bestLap.lapNum && lapTime == sessionRecords.bestLap.lapTime)
return;
sessionRecords.bestLap.carID = carID;
sessionRecords.bestLap.lapTime = lapTime;
sessionRecords.bestLap.lapNum = lapNo;
sessionRecords.bestLap.sectorTimes[0] = LapTime();
sessionRecords.bestLap.sectorTimes[1] = LapTime();
sessionRecords.bestLap.sectorTimes[2] = LapTime();
}
QString getPitTime(int lap) const
{
for (int i = 0; i < pitData.size(); ++i)
{
if (lap == pitData[i].pitLap)
return pitData[i].pitTime;
}
return "";
}
friend class PacketParser;
private:
static int cnt;
int carID;
QString driver;
int number;
int pos;
QVector<LapData> lapData;
QVector<int> posHistory;
QVector<PitData> pitData;
ColorData colorData;
LapData lastLap;
LapTime qualiTimes[3];
DriverRecords sessionRecords;
int numPits;
bool retired;
bool releasedFromPits;
bool inPits;
bool outLap;
};
#endif // DRIVERDATA_H
| zywhlc-f1lt | src/core/driverdata.h | C++ | gpl3 | 10,706 |
/*******************************************************************************
* *
* F1LT - unofficial Formula 1 live timing application *
* Copyright (C) 2012-2013 Mariusz Pilarek (pieczaro@gmail.com) *
* *
* 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 *
* the Free Software Foundation, either version 3 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
* *
*******************************************************************************/
#include "trackrecords.h"
#include "../core/seasondata.h"
TrackRecords::TrackRecords()
{
}
bool TrackRecords::loadTrackRecords(QString fileName)
{
QFile f(fileName);
if (f.open(QIODevice::ReadOnly))
{
QDataStream stream(&f);
char *tab;
stream >> tab;
QString sbuf(tab);
delete [] tab;
if (QString(sbuf) != "F1LT2_TR")
{
f.close();
return false;
}
trackRecords.clear();
int size;
stream >> size;
for (int i = 0; i < size; ++i)
{
Track track;
stream >> track.name;
int verSize;
stream >> verSize;
for (int j = 0; j < verSize; ++j)
{
TrackVersion tv;
stream >> tv.year;
stream >> tv.map;
QString time;
for (int k = 0; k < 2; ++k)
{
stream >> time;
tv.trackRecords[k].time = LapTime(time);
stream >> tv.trackRecords[k].driver;
stream >> tv.trackRecords[k].team;
stream >> tv.trackRecords[k].year;
}
int tsSize;
stream >> tsSize;
for (int k = 0; k < tsSize; ++k)
{
TrackWeekendRecords ts;
stream >> ts.year;
for (int w = 0; w < 4; ++w)
{
stream >> time;
ts.sessionRecords[w].time = LapTime(time);
stream >> ts.sessionRecords[w].driver;
stream >> ts.sessionRecords[w].team;
stream >> ts.sessionRecords[w].session;
}
int dsSize;
stream >> dsSize;
for (int w = 0; w < dsSize; ++w)
{
DriverWeekendRecords ds;
stream >> ds.driver;
stream >> ds.team;
for (int x = 0; x < 5; ++x)
{
for (int y = 0; y < 4; ++y)
{
stream >> time;
ds.sessionRecords[x][y].time = LapTime(time);
stream >> ds.sessionRecords[x][y].session;
}
}
ts.driverRecords.append(ds);
}
tv.trackWeekendRecords.append(ts);
}
track.trackVersions.append(tv);
}
qSort(track.trackVersions);
trackRecords.append(track);
}
}
else
return false;
return true;
}
bool TrackRecords::saveTrackRecords(QString fileName)
{
QFile file(fileName);
if (file.open(QIODevice::WriteOnly))
{
QDataStream stream(&file);
const char tab[9] = "F1LT2_TR";
stream << tab;
stream << trackRecords.size();
for (int i = 0; i < trackRecords.size(); ++i)
{
Track &tr = trackRecords[i];
stream << tr.name;
stream << tr.trackVersions.size();
for (int j = 0; j < tr.trackVersions.size(); ++j)
{
TrackVersion &tv = tr.trackVersions[j];
stream << tv.year;
stream << tv.map;
for (int k = 0; k < 2; ++k)
{
stream << tv.trackRecords[k].time;
stream << tv.trackRecords[k].driver;
stream << tv.trackRecords[k].team;
stream << tv.trackRecords[k].year;
}
stream << tv.trackWeekendRecords.size();
for (int k = 0; k < tv.trackWeekendRecords.size(); ++k)
{
TrackWeekendRecords ts = tv.trackWeekendRecords[k];
stream << ts.year;
for (int w = 0; w < 4; ++w)
{
stream << ts.sessionRecords[w].time;
stream << ts.sessionRecords[w].driver;
stream << ts.sessionRecords[w].team;
stream << ts.sessionRecords[w].session;
}
stream << ts.driverRecords.size();
for (int w = 0; w < ts.driverRecords.size(); ++w)
{
DriverWeekendRecords ds = ts.driverRecords[w];
stream << ds.driver;
stream << ds.team;
for (int x = 0; x < 5; ++x)
{
for (int y = 0; y < 4; ++y)
{
stream << ds.sessionRecords[x][y].time;
stream << ds.sessionRecords[x][y].session;
}
}
}
}
}
}
}
else
return false;
return true;
}
int TrackRecords::getCurrentTrackRecords(Track **track, TrackWeekendRecords **twr, TrackVersion **tv)
{
LTEvent event = EventData::getInstance().getEventInfo();
if (event.eventNo == 0)
event = SeasonData::getInstance().getCurrentEvent();
for (int i = 0; i < trackRecords.size(); ++i)
{
if (trackRecords[i].name == event.eventPlace)
{
int j = 0;
for (; j < trackRecords[i].trackVersions.size(); ++j)
{
if (trackRecords[i].trackVersions[j].year > event.fpDate.year())
break;
TrackWeekendRecords *t = &trackRecords[i].trackVersions[j].getTrackWeekendRecords(event.fpDate.year());
if (*t != TrackWeekendRecords::null())
{
*track = &trackRecords[i];
*twr = t;
*tv = &trackRecords[i].trackVersions[j];
return i;
}
}
//if no records from this year were found, they have to be added
--j;
TrackWeekendRecords tr;
tr.year = event.fpDate.year();
trackRecords[i].trackVersions[j].trackWeekendRecords.append(tr);
qSort(trackRecords[i].trackVersions[j].trackWeekendRecords);
TrackWeekendRecords *t = &trackRecords[i].trackVersions[j].getTrackWeekendRecords(event.fpDate.year());
if (*t != TrackWeekendRecords::null())
{
*track = &trackRecords[i];
*twr = t;
*tv = &trackRecords[i].trackVersions[j];
return i;
}
}
}
return -1;
}
QString TrackRecords::getCurrentSessionAsString()
{
EventData &ed = EventData::getInstance();
QString tmp;
switch (ed.getEventType())
{
case LTPackets::PRACTICE_EVENT:
tmp = "FP" + QString::number(ed.getFPNumber());
break;
case LTPackets::QUALI_EVENT:
tmp = "Q" + QString::number(ed.getQualiPeriod());
break;
case LTPackets::RACE_EVENT:
tmp = "R";
break;
}
return tmp;
}
eSession TrackRecords::getSessionFromString(QString ses)
{
if (ses == "FP1")
return FP1;
if (ses == "FP2")
return FP2;
if (ses == "FP3")
return FP3;
if (ses.contains("Q"))
return QUALI;
if (ses == "RACE")
return RACE;
return FP1;
}
eSession TrackRecords::getCurrentSession()
{
EventData &ed = EventData::getInstance();
switch (ed.getEventType())
{
case LTPackets::PRACTICE_EVENT:
return (eSession)(ed.getFPNumber() - 1);
case LTPackets::QUALI_EVENT:
return QUALI;
case LTPackets::RACE_EVENT:
return RACE;
}
return FP1;
}
void TrackRecords::gatherSessionRecords(bool withDriverRecords)
{
EventData &ed = EventData::getInstance();
TrackWeekendRecords *twr = 0;
TrackVersion *tv = 0;
Track *track;
if (ed.isFridayBeforeFP1())
return;
getCurrentTrackRecords(&track, &twr, &tv);
if (twr != 0 && tv != 0)
{
for (int i = 0; i < NUM_SECTORS; ++i)
{
LapTime sessionRecord = ed.getSessionRecords().getSectorRecord(i+1).getTime();
if (i == 3)
sessionRecord = ed.getSessionRecords().getFastestLap().getTime();
if (sessionRecord.isValid() && sessionRecord <= twr->sessionRecords[i].time)
{
twr->sessionRecords[i].time = sessionRecord;
int no;
if (i < 3)
{
twr->sessionRecords[i].driver = ed.getSessionRecords().getSectorRecord(i+1).getDriverName();
no = ed.getSessionRecords().getSectorRecord(i+1).getNumber();
}
else
{
twr->sessionRecords[i].driver = ed.getSessionRecords().getFastestLap().getDriverName();
no = ed.getSessionRecords().getFastestLap().getNumber();
}
twr->sessionRecords[i].team = SeasonData::getInstance().getTeamName(no);
twr->sessionRecords[i].session = getCurrentSessionAsString();
}
}
if (ed.getEventType() != LTPackets::PRACTICE_EVENT)
{
LapTime sessionRecord = ed.getSessionRecords().getFastestLap().getTime();
eTrackRecord currEvent = QUALI_RECORD;
if (ed.getEventType() == LTPackets::RACE_EVENT)
currEvent = RACE_RECORD;
if (sessionRecord.isValid() && sessionRecord < tv->trackRecords[currEvent].time)
{
tv->trackRecords[currEvent].time = sessionRecord;
tv->trackRecords[currEvent].driver = ed.getSessionRecords().getFastestLap().getDriverName();
int no = ed.getSessionRecords().getFastestLap().getNumber();
tv->trackRecords[currEvent].team = SeasonData::getInstance().getTeamName(no);
tv->trackRecords[currEvent].year = QString::number(ed.getEventInfo().fpDate.year());
}
}
if (withDriverRecords)
gatherDriverRecords(twr, tv);
}
}
void TrackRecords::gatherDriverRecords(TrackWeekendRecords *twr, TrackVersion *tv)
{
EventData &ed = EventData::getInstance();
if (twr != 0 && tv != 0)
{
int k = 0;
for (int i = 0; i < 30; ++i)
{
DriverData *dd = ed.getDriverDataPtr(i+1);
if (dd == 0)
continue;
DriverWeekendRecords dsRecords;
if (k < twr->driverRecords.size())
{
dsRecords = twr->driverRecords[k];
//to keep the records of test drivers too, we have to insert them between usual drivers
if (dsRecords.driver != dd->getDriverName())
++k;
if (k < twr->driverRecords.size())
{
dsRecords = twr->driverRecords[k];
if (dsRecords.driver != dd->getDriverName())
twr->driverRecords.insert(k, dsRecords);
}
}
dsRecords.driver = dd->getDriverName();
dsRecords.team = SeasonData::getInstance().getTeamName(i+1);
for (int j = 0; j < 4; ++j)
{
LapTime driverRecord = dd->getSessionRecords().getBestSector(j+1).first;
if (j == 3)
{
driverRecord = dd->getSessionRecords().getBestLap().getTime();
}
if (driverRecord.isValid() && driverRecord <= dsRecords.sessionRecords[getCurrentSession()][j].time)
{
dsRecords.sessionRecords[getCurrentSession()][j].time = driverRecord;
dsRecords.sessionRecords[getCurrentSession()][j].session = getCurrentSessionAsString();
if (ed.getEventType() == LTPackets::QUALI_EVENT)
{
dsRecords.sessionRecords[getCurrentSession()][j].session = "Q" +
QString::number(dd->getSessionRecords().getBestLap().getQualiLapExtraData().getQualiPeriod());
}
}
}
if (twr->driverRecords.size() <= k)
twr->driverRecords.append(dsRecords);
else
twr->driverRecords[k] = dsRecords;
++k;
}
}
}
//TrackRecordsAtom TrackRecords::nullRecord;
void Track::getTrackRecords(TrackVersion **tv, TrackWeekendRecords **trw, int year)
{
int j = 0;
for (; j < trackVersions.size(); ++j)
{
if (trackVersions[j].year > year)
break;
TrackWeekendRecords *t = &trackVersions[j].getTrackWeekendRecords(year);
if (*t != TrackWeekendRecords::null())
{
*trw = t;
*tv = &trackVersions[j];
return;
}
}
}
| zywhlc-f1lt | src/core/trackrecords.cpp | C++ | gpl3 | 14,933 |
/*******************************************************************************
* *
* F1LT - unofficial Formula 1 live timing application *
* Copyright (C) 2012-2013 Mariusz Pilarek (pieczaro@gmail.com) *
* *
* 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 *
* the Free Software Foundation, either version 3 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
* *
*******************************************************************************/
#ifndef LAPDATA_H
#define LAPDATA_H
#include <QDebug>
#include <QMetaType>
#include <QPair>
#include <QTime>
#include <cmath>
#include "seasondata.h"
struct EventData;
class DriverData;
class PacketParser;
/*!
* \brief The LapTime class stores lap and sector times. Contains methods to easily manipulate time data, including conversion to and from seconds and miliseconds.
* LapTime objects can be constructed using a QString in format "m:ss.zzz" (minutes, seconds, miliseconds) or from integer values.
*/
class LapTime
{
public:
LapTime() { }
~LapTime() { }
LapTime(const QString &t) { time = t; }
LapTime(const LapTime &t) { time = t.time; }
LapTime(int msecs);
LapTime(int m, int s, int ms)
{
QString strM = QString::number(m);
QString strS = QString::number(s);
QString strMS = QString::number(ms);
time = strM + (s < 10 ? ":0": ":") + strS + (ms < 100 ? (ms < 10 ? ".00" : ".0") : ".") + strMS;
}
const QString &toString() const { return time; }
int toMsecs() const;
QString toSecs() const;
double toDouble() const
{
if (isValid())
return (double)(toMsecs() / 1000.0);
return 0.0;
}
LapTime calc107p() const
{
double msecs = toMsecs();
msecs = msecs * 1.07;
return LapTime((int)(round(msecs)));
}
bool isValid() const;
bool operator < (const LapTime &) const;
bool operator <= (const LapTime &) const;
bool operator > (const LapTime &) const;
bool operator >= (const LapTime &) const;
operator QString() const
{
return toString();
}
bool operator == (const LapTime &) const;
bool operator != (const LapTime <) const
{
return !(*this == lt);
}
LapTime operator - (const LapTime&) const;
LapTime operator + (const LapTime&) const;
private:
QString time;
};
Q_DECLARE_METATYPE(LapTime)
//-----------------------------------------------------------
/*!
* \brief The PracticeLapExtraData class stores extra information about practice session used in LapData
*/
class PracticeLapExtraData
{
public:
PracticeLapExtraData() : approxLap(false) { }
const QTime &getSessionTime() const { return sessionTime; }
void setSessionTime(QTime s) { sessionTime = s; }
bool isApproxLap() const { return approxLap; }
void setApproxLap(bool ap) { approxLap = ap; }
friend class LapData;
friend class DriverData;
protected:
QTime sessionTime; //the time when driver set this lap (as remaining time)
bool approxLap; //if the current lap was worse than the best lap we can only calculate approximate lap time from the sectors time
};
//-----------------------------------------------------------
/*!
* \brief The QualiLapExtraData class stores extra information about quali session used in LapData
*/
class QualiLapExtraData : public PracticeLapExtraData
{
public:
QualiLapExtraData() : qualiPeriod(1) { }
int getQualiPeriod() const { return qualiPeriod; }
void setQualiPeriod(int q) { qualiPeriod = q; }
friend class LapData;
friend class DriverData;
protected:
int qualiPeriod;
};
//-----------------------------------------------------------
/*!
* \brief The RaceLapExtraData class stores extra information about race session used in LapData
*/
class RaceLapExtraData
{
public:
RaceLapExtraData() : scLap(false), pitLap(false) { }
bool isSCLap() const { return scLap; }
void setSCLap(bool sc) { scLap = sc; }
bool isPitLap() const { return pitLap; }
friend class LapData;
friend class DriverData;
protected:
bool scLap;
bool pitLap;
};
//-----------------------------------------------------------
/*!
* \brief The LapData class stores all necessary informations about a lap - lap time, sector times, lap number, gap to leader, gap to driver in front, etc.
*/
class LapData
{
public:
LapData() : carID(-1), pos(-1), lapNum(0), gap(), interval() {}
int getCarID() const { return carID; }
void setCarID(int id) { carID = id; }
int getPosition() const { return pos; }
void setPosition(int p) { pos = p; }
int getLapNumber() const { return lapNum; }
void setLapNumber(int lap) { lapNum = lap; }
const LapTime &getTime() const { return lapTime; }
void setTime(const LapTime <) { lapTime = lt; }
const QString &getGap() const { return gap; }
void setGap(QString g) { gap = g; }
const QString &getInterval() const { return interval; }
void setInterval(QString i) { interval = i; }
LapTime getSectorTime(int idx) const
{
if (idx >= 1 && idx <= 3)
return sectorTimes[idx-1];
return LapTime();
}
const PracticeLapExtraData &getPracticeLapExtraData() const { return practiceLapExtraData; }
void setPracticeLapExtraData(const PracticeLapExtraData &ed) { practiceLapExtraData = ed; }
const QualiLapExtraData &getQualiLapExtraData() const { return qualiLapExtraData; }
void setQualiLapExtraData(const QualiLapExtraData &ed) { qualiLapExtraData = ed; }
const RaceLapExtraData &getRaceLapExtraData() const { return raceLapExtraData; }
void setRaceLapExtraData(const RaceLapExtraData &ed) { raceLapExtraData = ed; }
LapTime &operator[](int idx)
{
if (idx >= 0 && idx <= 3)
return sectorTimes[idx];
}
bool operator!=(const LapData &ld)
{
if (gap != ld.gap ||
interval != ld.interval ||
lapTime.toString().compare(ld.lapTime.toString()) != 0 ||
sectorTimes[0].toString().compare(ld.sectorTimes[0].toString()) != 0 ||
sectorTimes[1].toString().compare(ld.sectorTimes[1].toString()) != 0 ||
sectorTimes[2].toString().compare(ld.sectorTimes[2].toString()) != 0
)
return true;
return false;
}
bool operator<(const LapData &ld) const
{
return lapTime < ld.lapTime;
}
bool operator==(const LapData &ld) const
{
return lapTime == ld.lapTime;
}
static QString sumSectors(const QString &s1, const QString &s2, const QString &s3)
{
LapTime ls1(s1);
LapTime ls2(s2);
LapTime ls3(s3);
return (ls1 + ls2 + ls3).toString();
}
QTime toTime() const
{
return QTime::fromString(lapTime.toString(), "m:ss.zzz");
}
friend class DriverData;
friend class PacketParser;
private:
int carID;
int pos;
int lapNum;
LapTime lapTime;
QString gap;
QString interval;
LapTime sectorTimes[3];
PracticeLapExtraData practiceLapExtraData;
QualiLapExtraData qualiLapExtraData;
RaceLapExtraData raceLapExtraData;
};
#endif // LAPDATA_H
| zywhlc-f1lt | src/core/lapdata.h | C++ | gpl3 | 8,324 |
/*******************************************************************************
* *
* F1LT - unofficial Formula 1 live timing application *
* Copyright (C) 2012-2013 Mariusz Pilarek (pieczaro@gmail.com) *
* *
* 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 *
* the Free Software Foundation, either version 3 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
* *
*******************************************************************************/
#ifndef COLORSMANAGER_H
#define COLORSMANAGER_H
#include <QColor>
#include <QImage>
#include <QList>
#include "ltpackets.h"
class MyColor : public QColor
{
public:
MyColor(QColor c) : QColor(c) { }
bool operator<(const QColor &color) const
{
return ((red() < color.red()));// && (blue() < color.blue()) && (green() < color.green()));
}
};
/*!
* \brief This class is responsible for holding interace and driver colors. This is a singleton.
*/
class ColorsManager : public QObject
{
Q_OBJECT
public:
static ColorsManager &getInstance()
{
static ColorsManager instance;
return instance;
}
QColor getColor(LTPackets::Colors color)
{
return colors[color];
}
QColor getDefaultColor(LTPackets::Colors color)
{
return defaultColors[color];
}
QList<QColor> getColors()
{
return colors;
}
QList<QColor> getDefaultColors()
{
return defaultColors;
}
void setColors(QList<QColor> col)
{
colors = col;
}
void setColor(LTPackets::Colors colorCode, QColor color)
{
colors[colorCode] = color;
}
void setDefaultColor(LTPackets::Colors colorCode)
{
colors[colorCode] = defaultColors[colorCode];
}
void setAllDefaultColors()
{
colors = defaultColors;
}
QColor getCarColor(int no);
QList<QColor> getDriverColors()
{
return driverColors;
}
void setDriverColors(QList<QColor> colors)
{
driverColors = colors;
}
QList<QColor> getDefaultDriverColors()
{
return defaultDriverColors;
}
QColor calculateAverageColor(const QImage &car, int idx);
bool isColorInTheList(QColor color, int idx);
void addColor(QMap<MyColor, int> &colors, MyColor color);
public slots:
void calculateDefaultDriverColors();
private:
ColorsManager();
QList<QColor> colors;
QList<QColor> defaultColors;
QList<QColor> driverColors;
QList<QColor> defaultDriverColors;
};
#endif // COLORSMANAGER_H
| zywhlc-f1lt | src/core/colorsmanager.h | C++ | gpl3 | 3,629 |
/*******************************************************************************
* *
* F1LT - unofficial Formula 1 live timing application *
* Copyright (C) 2012-2013 Mariusz Pilarek (pieczaro@gmail.com) *
* *
* 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 *
* the Free Software Foundation, either version 3 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
* *
*******************************************************************************/
#ifndef SESSIONTIMER_H
#define SESSIONTIMER_H
#include <QDebug>
#include <QObject>
#include <QTime>
#include <QTimer>
/*!
* \brief The SessionTimer class defines a session timer.
*/
class SessionTimer : public QObject
{
Q_OBJECT
public:
explicit SessionTimer(QObject *parent = 0);
bool isCounterMode() { return counterMode; }
bool isActive() { return timer.isActive(); }
bool isSynchronizing() { return timerDelay > 0; }
signals:
void timeout();
void synchronizingTimer(bool);
void updateWeather();
public slots:
void setTime(const QTime &t)
{
sessionTime = t;
}
void start(int t = 1000)
{
interval = t;
timer.stop();
counterMode = false;
timer.start(interval);
}
void stop()
{
timer.stop();
}
void setCounterMode(bool m)
{
counterMode = m;
}
void setDelay(int prevDelay, int delay);
private slots:
void timerTimeout();
private:
int interval;
QTimer timer;
QTime sessionTime;
bool counterMode; //in this mode timer will still be running but will not change the session time
int timerDelay;
};
#endif // SESSIONTIMER_H
| zywhlc-f1lt | src/core/sessiontimer.h | C++ | gpl3 | 2,769 |
/*******************************************************************************
* *
* F1LT - unofficial Formula 1 live timing application *
* Copyright (C) 2012-2013 Mariusz Pilarek (pieczaro@gmail.com) *
* *
* 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 *
* the Free Software Foundation, either version 3 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
* *
*******************************************************************************/
#ifndef LTDATA_H
#define LTDATA_H
/*!
* \brief The LTPackets class defines enums and methods used to manipulate data obtained from the LT server.
*/
class LTPackets
{
public:
enum CarPacket
{
CAR_POSITION_UPDATE = 0,
CAR_POSITION_HISTORY = 15
};
enum RacePacket
{
RACE_POSITION = 1,
RACE_NUMBER,
RACE_DRIVER,
RACE_GAP,
RACE_INTERVAL,
RACE_LAP_TIME,
RACE_SECTOR_1,
RACE_PIT_LAP_1,
RACE_SECTOR_2,
RACE_PIT_LAP_2,
RACE_SECTOR_3,
RACE_PIT_LAP_3,
RACE_NUM_PITS
};
enum PracticePacket
{
PRACTICE_POSITION = 1,
PRACTICE_NUMBER,
PRACTICE_DRIVER,
PRACTICE_BEST,
PRACTICE_GAP,
PRACTICE_SECTOR_1,
PRACTICE_SECTOR_2,
PRACTICE_SECTOR_3,
PRACTICE_LAP
};
enum QualifyingPacket
{
QUALI_POSITION= 1,
QUALI_NUMBER,
QUALI_DRIVER,
QUALI_PERIOD_1,
QUALI_PERIOD_2,
QUALI_PERIOD_3,
QUALI_SECTOR_1,
QUALI_SECTOR_2,
QUALI_SECTOR_3,
QUALI_LAP
};
enum SystemPacket
{
SYS_EVENT_ID = 1,
SYS_KEY_FRAME = 2,
SYS_VALID_MARKER = 3,
SYS_COMMENTARY = 4,
SYS_REFRESH_RATE = 5,
SYS_NOTICE = 6,
SYS_TIMESTAMP = 7,
SYS_WEATHER = 9,
SYS_SPEED = 10,
SYS_TRACK_STATUS = 11,
SYS_COPYRIGHT = 12
};
enum WeatherPacket
{
WEATHER_SESSION_CLOCK = 0,
WEATHER_TRACK_TEMP,
WEATHER_AIR_TEMP,
WEATHER_WET_TRACK,
WEATHER_WIND_SPEED,
WEATHER_HUMIDITY,
WEATHER_PRESSURE,
WEATHER_WIND_DIRECTION
};
enum SpeedPacket
{
SPEED_SECTOR1 = 1,
SPEED_SECTOR2,
SPEED_SECTOR3,
SPEED_TRAP,
FL_CAR,
FL_DRIVER,
FL_TIME,
FL_LAP
};
enum EventType
{
RACE_EVENT = 1,
PRACTICE_EVENT,
QUALI_EVENT
};
enum FlagStatus
{
GREEN_FLAG = 1,
YELLOW_FLAG,
SAFETY_CAR_STANDBY,
SAFETY_CAR_DEPLOYED,
RED_FLAG
};
enum Colors
{
DEFAULT,
WHITE,
PIT,
GREEN,
VIOLET,
CYAN,
YELLOW,
RED,
BACKGROUND,
BACKGROUND2
};
static int getPacketType(const QByteArray &buf)
{
unsigned char arr[2] = {(unsigned char)(buf[0]), (unsigned char)(buf[1])};
return (arr[0] >> 5) | ((arr[1] & 0x01) << 3);
}
static int getCarPacket(const QByteArray &buf)
{
unsigned char arr[2] = {(unsigned char)(buf[0]), (unsigned char)(buf[1])};
return arr[0] & 0x1f;
}
static int getLongPacketData(const QByteArray &)
{
return 0;
}
static int getShortPacketData(const QByteArray &buf)
{
unsigned char arr[2] = {(unsigned char)(buf[0]), (unsigned char)(buf[1])};
return (arr[1] & 0x0e) >> 1;
}
static int getSpecialPacketData(const QByteArray &buf)
{
unsigned char arr[2] = {(unsigned char)(buf[0]), (unsigned char)(buf[1])};
return arr[1] >> 1;
}
static int getLongPacketLength(const QByteArray &buf)
{
unsigned char arr[2] = {(unsigned char)(buf[0]), (unsigned char)(buf[1])};
return arr[1] >> 1;
}
static int getShortPacketLength(const QByteArray &buf)
{
unsigned char arr[2] = {(unsigned char)(buf[0]), (unsigned char)(buf[1])};
return (arr[1] & 0xf0) == 0xf0 ? -1 : (arr[1] >> 4);
}
static int getSpecialPacketLength(const QByteArray &)
{
return 0;
}
};
#endif // LTDATA_H
| zywhlc-f1lt | src/core/ltpackets.h | C++ | gpl3 | 5,329 |
/*******************************************************************************
* *
* F1LT - unofficial Formula 1 live timing application *
* Copyright (C) 2012-2013 Mariusz Pilarek (pieczaro@gmail.com) *
* *
* 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 *
* the Free Software Foundation, either version 3 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
* *
*******************************************************************************/
#ifndef EVENTDATA_H
#define EVENTDATA_H
#include "driverdata.h"
class DataStreamReader;
class EventData;
class PacketParser;
class SessionRecords;
class Weather;
/*!
* \brief The WeatherData class stores single value of weather data, including informations when this value was stored (lap, session time).
*/
class WeatherData
{
public:
WeatherData() : value(0.0), lap(0), sessionTime(), qPeriod(1) { }
double getValue() const { return value; }
int getLap() const { return lap; }
const QTime &getSessionTime() const { return sessionTime; }
int getQualiPeriod() const { return qPeriod; }
friend class Weather;
friend class EventData;
friend class PackerParser;
private:
double value;
int lap;
QTime sessionTime;
int qPeriod;
};
/*!
* \brief The Weather class stores all weather data that is gathered during a session, including air and track temperatures, wind speed and direction, pressure, humidity and wether the track is dry or wet.
*/
class Weather
{
public:
const WeatherData &getAirTemp() const { return currentWeather[0]; }
const WeatherData &getTrackTemp() const { return currentWeather[1]; }
const WeatherData &getWindSpeed() const { return currentWeather[2]; }
const WeatherData &getPressure() const { return currentWeather[3]; }
const WeatherData &getHumidity() const { return currentWeather[4]; }
const WeatherData &getWetDry() const { return currentWeather[5]; }
const WeatherData &getWindDirection() const { return currentWeather[6]; }
void setAirTemp(double val) { currentWeather[0].value = val; }
void setTrackTemp(double val) { currentWeather[1].value = val; }
void setWindSpeed(double val) { currentWeather[2].value = val; }
void setPressure(double val) { currentWeather[3].value = val; }
void setHumidity(double val) { currentWeather[4].value = val; }
void setWetDry(double val) { currentWeather[5].value = val; }
void setWindDirection(double val) { currentWeather[6].value = val; }
QList<WeatherData> getWeatherData(int idx) const
{
if (idx >= 0 && idx < 7)
return weatherData[idx];
return weatherData[0];
}
int getSize(int idx) const
{
if (idx >= 0 && idx < 7)
return weatherData[idx].size();
return 0;
}
void saveWeatherData(const EventData &);
friend class EventData;
friend class PackerParser;
private:
//this list records the weather from whole session
QList<WeatherData> weatherData[7]; //0 air temp, 1 track temp, 2 wind speed, 3 pressure, 4 humidity, 5 wet-dry, 6 wind direction
//this list stores the current weather data
WeatherData currentWeather[7];
};
/*!
* \brief The SectorRecordData class stores session record from a single sector or a lap time, including driver name and number, lap time and when the record was stored (lap number, session time).
*/
class SectorRecordData
{
public:
const QString &getDriverName() const { return driver; }
int getNumber() const { return number; }
const LapTime &getTime() const { return lapTime; }
int getLapNumber() const { return lapNum; }
const QTime &getSessionTime() const { return sessionTime; }
int getQualiPeriod() const { return qPeriod; }
friend class EventData;
friend class PacketParser;
friend class SessionRecords;
private:
QString driver;
int number;
LapTime lapTime;
int lapNum;
QTime sessionTime;
int qPeriod;
};
/*!
* \brief The SpeedRecordData class stores single speed record data (driver name and speed).
*/
class SpeedRecordData
{
public:
const QString &getDriverName() const { return driver; }
double getSpeed() const { return speed; }
friend class EventData;
friend class PacketParser;
friend class SessionRecords;
private:
QString driver;
double speed;
};
/*!
* \brief The SessionRecords class stores session records, including sector records, fastest lap, and speed records.
*/
class SessionRecords
{
public:
SpeedRecordData getSectorSpeed(int sector, int idx) const
{
if (sector >= 1 && sector <= 3 &&
idx >= 0 && idx < 6)
return secSpeed[sector-1][idx];
return SpeedRecordData();
}
SpeedRecordData getSpeedTrap(int idx) const
{
if (idx >= 0 && idx < 6)
return speedTrap[idx];
return SpeedRecordData();
}
const SectorRecordData &getFastestLap() const { return fastestLap; }
SectorRecordData getSectorRecord(int idx) const
{
if (idx >= 1 && idx <= 3)
return secRecord[idx-1];
return SectorRecordData();
}
LapTime getQualiBestTime(int period) const
{
if (period >= 1 && period <= 3)
return qualiRecords[period-1];
return LapTime();
}
friend class EventData;
friend class PacketParser;
private:
SpeedRecordData secSpeed[3][6];
SpeedRecordData speedTrap[6];
SectorRecordData fastestLap;
SectorRecordData secRecord[3];
LapTime qualiRecords[3];
};
/*!
* \brief The EventData class contains all informations about an event. Access to all drivers data, weather and session records data, event type (practice, quali, race), commentary, etc.
* is available through this singleton.
*/
class EventData
{
public:
static EventData &getInstance()
{
static EventData ed;
if (ed.driversData.isEmpty())
{
ed.driversData = QVector<DriverData>(SeasonData::getInstance().getTeams().size()*2);
for (int i = 0; i < ed.driversData.size(); ++i)
{
ed.driversData[i] = DriverData();
// ed.driversData.append(DriverData());
// ed.driversData.append(DriverData());
}
}
return ed;
}
void clear();
void reset();
int getDriverId(const QString&) const;
int getDriverId(int no) const;
DriverData getDriverData(int no) const;
DriverData *getDriverDataPtr(int no);
DriverData getDriverDataByPos(int pos) const;
DriverData *getDriverDataByPosPtr(int pos);
DriverData getDriverDataById(int id) const;
DriverData *getDriverDataByIdPtr(int id);
QString calculateInterval(const DriverData &d1, const DriverData &d2, int lap) const;
int correctPosition(const LapTime &ld) const;
const LTEvent &getEventInfo() const { return eventInfo; }
void setEventInfo(const LTEvent &ev)
{
eventInfo = ev;
SeasonData::getInstance().getTrackMap(eventInfo);
}
int getEventId() const { return eventId; }
LTPackets::EventType getEventType() const { return eventType; }
void setEventType(LTPackets::EventType type)
{
eventType = type;
}
LTPackets::FlagStatus getFlagStatus() const { return flagStatus; }
const QTime &getRemainingTime() const { return remainingTime; }
void setRemainingTime(const QTime &t) { remainingTime = t; }
int getCompletedLaps() const { return lapsCompleted; }
const Weather &getWeather() const { return weather; }
void saveWeather() { weather.saveWeatherData(*this); }
bool isSessionStarted() const { return sessionStarted; }
void setSessionStarted(bool st) { sessionStarted = st; }
bool isSessionFinished() const { return sessionFinished; }
void setSessionFinished(bool st) { sessionFinished = st; }
bool isQualiBreak() const { return qualiBreak; }
void setQualiBreak(bool qb) { qualiBreak = qb; }
const QString &getCommentary() const { return commentary; }
int getQualiPeriod() const { return qualiPeriod; }
int getFPNumber() const;
void setFPNumber(int fp)
{
fpNumber = fp;
}
const SessionRecords &getSessionRecords() const { return sessionRecords; }
QVector<DriverData> &getDriversData() { return driversData; }
bool isFridayBeforeFP1();
friend class PacketParser;
friend class DataStreamReader;
private:
EventData();
EventData(const EventData&) {}
void operator=(const EventData&) {}
unsigned int key;
unsigned int frame;
QString cookie;
LTEvent eventInfo;
int eventId;
LTPackets::EventType eventType;
LTPackets::FlagStatus flagStatus;
QTime remainingTime;
int lapsCompleted;
Weather weather;
bool sessionStarted;
bool sessionFinished;
bool qualiBreak;
QString commentary;
SessionRecords sessionRecords;
QVector<DriverData> driversData;
int qualiPeriod;
int fpNumber;
int baseEventId;
int baseEventInc;
};
inline int EventData::getDriverId(const QString &name) const
{
for (int i = 0; i < driversData.size(); ++i)
{
if (driversData[i].getDriverName() == name)
return driversData[i].getCarID();
}
return -1;
}
inline int EventData::getDriverId(int no) const
{
for (int i = 0; i < driversData.size(); ++i)
{
if (driversData[i].getNumber() == no)
return driversData[i].getCarID();
}
return -1;
}
inline DriverData EventData::getDriverData(int no) const
{
int id = getDriverId(no);
if (id > 0 && id <= driversData.size())
return driversData[id-1];
return DriverData();
}
inline DriverData *EventData::getDriverDataPtr(int no)
{
int id = getDriverId(no);
if (id > 0 && id <= driversData.size())
return &driversData[id-1];
return 0;
}
inline DriverData EventData::getDriverDataByPos(int pos) const
{
for (int i = 0; i < driversData.size(); ++i)
{
if (driversData[i].getPosition() == pos)
return driversData[i];
}
return DriverData();
}
inline DriverData *EventData::getDriverDataByPosPtr(int pos)
{
for (int i = 0; i < driversData.size(); ++i)
{
if (driversData[i].getPosition() == pos)
return &driversData[i];
}
return 0;
}
inline DriverData EventData::getDriverDataById(int id) const
{
if (id > 0 && id <= driversData.size())
return driversData[id-1];
return DriverData();
}
inline DriverData *EventData::getDriverDataByIdPtr(int id)
{
if (id > 0 && id <= driversData.size())
return &driversData[id-1];
return 0;
}
//extern EventData eventData;
#endif // EVENTDATA_H
| zywhlc-f1lt | src/core/eventdata.h | C++ | gpl3 | 12,185 |
/*******************************************************************************
* *
* F1LT - unofficial Formula 1 live timing application *
* Copyright (C) 2012-2013 Mariusz Pilarek (pieczaro@gmail.com) *
* *
* 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 *
* the Free Software Foundation, either version 3 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
* *
*******************************************************************************/
#ifndef SEASONDATA_H
#define SEASONDATA_H
#include <QMap>
#include <QPixmap>
#include <QString>
#include <QTime>
#include <QVector>
#include "f1ltcore.h"
#include "imagesfactory.h"
#include "ltpackets.h"
#include "sessiondefaults.h"
#include "trackmapscoordinates.h"
class DriverData;
/*!
* \brief The LTDriver struct stores basic informations about a driver loaded from the season.dat file.
*/
struct LTDriver
{
QString name;
QString shortName;
int no;
QPixmap helmet;
bool mainDriver; //during a session team contains 2 main drivers, however it can have more than 2 saved in the file (test drivers, reserved, etc.)
bool operator==(const LTDriver &drv) const
{
return name == drv.name;
}
bool operator < (const LTDriver &drv) const
{
return no < drv.no;
}
};
/*!
* \brief The LTTeam struct stores informations about a team loaded from the season.dat file.
*/
struct LTTeam
{
QString teamName;
QVector<LTDriver> drivers;
QPixmap carImg;
//used for sorting
bool operator < (const LTTeam <) const
{
if (!drivers.isEmpty() && !lt.drivers.isEmpty())
return drivers.first().no < lt.drivers.first().no;
if (lt.drivers.isEmpty())
return true;
return false;
}
bool operator==(const LTTeam &team) const
{
return teamName == team.teamName;
}
};
/*!
* \brief The LTEvent struct stores informations about an event loaded from the season.dat file.
*/
struct LTEvent
{
LTEvent() : eventNo(0), laps(0), trackImg(100,100) { }
int eventNo;
QString eventName;
QString eventShortName;
QString eventPlace;
int laps;
QDate fpDate;
QDate raceDate;
QPixmap trackImg;
bool operator<(const LTEvent &event) const
{
return fpDate < event.fpDate;
}
bool operator==(const LTEvent &event) const
{
if (eventNo == event.eventNo &&
eventName == event.eventName &&
event.fpDate == event.fpDate &&
event.raceDate == event.raceDate)
return true;
return false;
}
bool operator!=(const LTEvent &event) const
{
return !this->operator ==(event);
}
// LTTrackCoordinates trackCoordinates;
};
/*!
* \brief The SeasonData class stores all basic informations loaded from season.dat file plus it gives access to session defaults and track map coordinates.
* This is a singleton.
*/
class SeasonData : public QObject
{
Q_OBJECT
public:
static SeasonData &getInstance()
{
static SeasonData instance;
return instance;
}
bool loadSeasonFile();
bool loadSeasonData(int season);
void loadSeasonData(QDataStream &stream);
void checkSeasonData();
void updateTeamList(const QVector<LTTeam> &teams);
void updateTeamList(const DriverData &dd);
QPixmap getCarImg(int no);
int getEventNo(QDate);
LTEvent getEvent(int);
const LTEvent &getEvent(const QDate&) const;
const LTEvent &getCurrentEvent() const;
const LTEvent &getNextEvent() const;
QString getDriverName(QString &name);
QString getDriverLastName(const QString &name);
QString getDriverShortName(const QString &name);
QString getDriverNameFromShort(const QString &name);
QString getEventNameFromShort(const QString &shortName);
int getDriverNo(const QString &name);
QString getTeamName(int no);
QString getTeamName(const QString &driver);
QList<LTDriver> getMainDrivers(const LTTeam &team);
QStringList getDriversList();
QStringList getDriversListShort();
const SessionDefaults &getSessionDefaults() const
{
return sessionDefaults;
}
const TrackMapsCoordinates &getTrackMapsCoordinates() const
{
return trackMapsCoordinates;
}
QVector<LTTeam> &getTeams() { return ltTeams; }
QVector<LTTeam> getTeamsFromCurrentSession();
QVector<LTEvent> &getEvents() { return ltEvents; }
void getTrackMap(LTEvent &ev);
void fillEventNamesMap();
signals:
void seasonDataChanged();
private:
SeasonData();
SeasonData(const SeasonData &) : QObject() { }
int season;
QMap<int, int> seasonOffsets; //only one season data from season.dat file will be kept in the memory during runtime, this map holds offsets of all seasons in the file
QVector<LTTeam> ltTeams;
QVector<LTEvent> ltEvents;
SessionDefaults sessionDefaults;
TrackMapsCoordinates trackMapsCoordinates;
QMap<QString, QString> eventNamesMap;
};
#endif // SEASONDATA_H
| zywhlc-f1lt | src/core/seasondata.h | C++ | gpl3 | 6,164 |
/*******************************************************************************
* *
* F1LT - unofficial Formula 1 live timing application *
* Copyright (C) 2012-2013 Mariusz Pilarek (pieczaro@gmail.com) *
* *
* 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 *
* the Free Software Foundation, either version 3 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
* *
*******************************************************************************/
#include "seasondata.h"
#include "ltpackets.h"
#include <QDataStream>
#include <QFile>
#include "colorsmanager.h"
#include "eventdata.h"
#include "trackrecords.h"
SeasonData::SeasonData() : season(2013)
{
ltTeams.clear();
fillEventNamesMap();
}
bool SeasonData::loadSeasonFile()
{
ltTeams.clear();
season = 0;
bool ok[3];
//on startup try to load current seasons data
ok[0] = loadSeasonData(QDate::currentDate().year());
ok[1] = trackMapsCoordinates.loadTrackDataFile();
ok[2] = TrackRecords::getInstance().loadTrackRecords(F1LTCore::trackRercordsFile(true));
return (ok[0] && ok[1] && ok[2]);
}
bool SeasonData::loadSeasonData(int season)
{
if (this->season != season)
{
ltTeams.clear();
QString fName = F1LTCore::seasonDataFile();
if (!fName.isNull())
{
QFile f(fName);
if (f.open(QIODevice::ReadOnly))
{
QDataStream stream(&f);
char *tab;
stream >> tab; //F1LT2_SD
QString sbuf(tab);
delete [] tab;
if (sbuf != "F1LT2_SD")
return false;
int size;
stream >> size;
//first load offsets
for (int i = 0; i < size; ++i)
{
int season, offset;
stream >> season;
stream >> offset;
seasonOffsets.insert(season, offset);
}
//store current position
int headerPos = f.pos();
if (!seasonOffsets.contains(season))
return false;
int offset = seasonOffsets[season];
f.seek(headerPos + offset);
loadSeasonData(stream);
}
else
return false;
}
else
return false;
qSort(ltTeams);
qSort(ltEvents);
emit seasonDataChanged();
}
return true;
}
void SeasonData::loadSeasonData(QDataStream &stream)
{
int size;
stream >> season;
stream >> size;
ltEvents.resize(size);
for (int i = 0; i < size; ++i)
{
stream >> ltEvents[i].eventNo;
stream >> ltEvents[i].eventName;
stream >> ltEvents[i].eventShortName;
stream >> ltEvents[i].eventPlace;
stream >> ltEvents[i].laps;
QString sbuf;
stream >> sbuf;
ltEvents[i].fpDate = QDate::fromString(sbuf, "dd-MM-yyyy");
stream >> sbuf;
ltEvents[i].raceDate = QDate::fromString(sbuf, "dd-MM-yyyy");
stream >> ltEvents[i].trackImg;
}
stream >> size;
ltTeams.resize(size);
for (int i = 0; i < size; ++i)
{
stream >> ltTeams[i].teamName;
stream >> ltTeams[i].carImg;
int dsize;
stream >> dsize;
ltTeams[i].drivers.resize(dsize);
for (int j = 0; j < dsize; ++j)
{
stream >> ltTeams[i].drivers[j].name;
stream >> ltTeams[i].drivers[j].shortName;
stream >> ltTeams[i].drivers[j].no;
stream >> ltTeams[i].drivers[j].helmet;
//first 2 drivers are always main by default
if (j < 2)
ltTeams[i].drivers[j].mainDriver = true;
else
ltTeams[i].drivers[j].mainDriver = false;
}
}
}
/*!
* \brief SeasonData::checkSeasonData - checks if current season is loaded. If current date is < than first race FP1 date - loads last years data
*/
void SeasonData::checkSeasonData()
{
if (season != QDate::currentDate().year())
loadSeasonData(QDate::currentDate().year());
LTEvent ev = getEvent(1);
if (ev.eventNo > 0)
{
if ((ev.fpDate.year() == QDate::currentDate().year()) &&
(ev.fpDate.month() == QDate::currentDate().month()) &&
(ev.fpDate.day() > QDate::currentDate().day()))
{
loadSeasonData(QDate::currentDate().year() - 1);
}
}
}
void SeasonData::updateTeamList(const QVector<LTTeam> &teams)
{
for (int i = 0; i < teams.size(); ++i)
{
if (!ltTeams.contains(teams[i]))
ltTeams.append(teams[i]);
int idx = ltTeams.indexOf(teams[i]);
if (teams[i].teamName == ltTeams[idx].teamName)
{
//clear main drivers
for (int k = 0; k < ltTeams[idx].drivers.size(); ++k)
{
ltTeams[idx].drivers[k].mainDriver = false;
}
for (int k = 0; k < teams[i].drivers.size(); ++k)
{
int didx = ltTeams[idx].drivers.indexOf(teams[i].drivers[k]);
if (didx == -1)
{
ltTeams[idx].drivers.append(teams[i].drivers[k]);
ltTeams[idx].drivers.last().mainDriver = true;
}
else
{
ltTeams[idx].drivers[didx].mainDriver = true;
}
}
}
}
ImagesFactory::getInstance().getHelmetsFactory().reloadHelmets();
}
//this updates team list from eventdata drivers list
void SeasonData::updateTeamList(const DriverData &dd)
{
for (int j = 0; j < ltTeams.size(); ++j)
{
bool foundNumberWithoutName = false, foundAlready = false;
for (int k = 0; k < ltTeams[j].drivers.size(); ++k)
{
if (ltTeams[j].drivers[k].no == dd.getNumber())
{
if (ltTeams[j].drivers[k].name == dd.getDriverName())
{
ltTeams[j].drivers[k].mainDriver = true;
foundNumberWithoutName = false;
foundAlready = true;
}
else
{
ltTeams[j].drivers[k].mainDriver = false;
foundNumberWithoutName = true;
}
}
}
if (foundNumberWithoutName && !foundAlready)
{
LTDriver driver;
driver.name = dd.getDriverName();
driver.no = dd.getNumber();
driver.shortName = getDriverShortName(dd.getDriverName());
driver.mainDriver = true;
ltTeams[j].drivers.append(driver);
}
}
}
QPixmap SeasonData::getCarImg(int no)
{
for (int i = 0; i < ltTeams.size(); ++i)
{
for (int j = 0; j < ltTeams[i].drivers.size(); ++j)
{
if (ltTeams[i].drivers[j].no == no)
{
return ltTeams[i].carImg;
}
}
}
return QPixmap();
}
QString SeasonData::getDriverName(QString &name)
{
for (int i = 0; i < ltTeams.size(); ++i)
{
for (int j = 0; j < ltTeams[i].drivers.size(); ++j)
{
if (ltTeams[i].drivers[j].name.toUpper() == name.toUpper())
return ltTeams[i].drivers[j].name;
//size of data that holds driver name is stored on 4 bytes only, and van der Garde name is shortened by server
if (name.toUpper() == "G. VAN DER GAR" && ltTeams[i].drivers[j].name.toUpper().contains(name.toUpper()))
return ltTeams[i].drivers[j].name;
}
}
name = name.left(4) + name.right(name.size()-4).toLower();
int idx = name.indexOf(" ");
while (idx != -1)
{
name.replace(name[idx+1], name[idx+1].toUpper());
idx = name.indexOf(" ", idx+1);
}
return name;
}
QString SeasonData::getDriverLastName(const QString &name)
{
if (name.size() > 3)
return name.right(name.size()-3);
return name;
}
QString SeasonData::getDriverShortName(const QString &name)
{
for (int i = 0; i < ltTeams.size(); ++i)
{
for (int j = 0; j < ltTeams[i].drivers.size(); ++j)
{
if (ltTeams[i].drivers[j].name.toUpper() == name.toUpper())
return ltTeams[i].drivers[j].shortName;
}
}
return name.toUpper().mid(3, 3);
}
QString SeasonData::getDriverNameFromShort(const QString &name)
{
for (int i = 0; i < ltTeams.size(); ++i)
{
for (int j = 0; j < ltTeams[i].drivers.size(); ++j)
{
if (ltTeams[i].drivers[j].shortName.toUpper() == name.toUpper())
return ltTeams[i].drivers[j].name;
}
}
return name.left(1) + name.right(name.size()-1).toLower();
}
QString SeasonData::getTeamName(const QString &driver)
{
for (int i = 0; i < ltTeams.size(); ++i)
{
for (int j = 0; j < ltTeams[i].drivers.size(); ++j)
{
if (ltTeams[i].drivers[j].name.toUpper() == driver.toUpper())
return ltTeams[i].teamName;
}
}
return QString();
}
QList<LTDriver> SeasonData::getMainDrivers(const LTTeam &team)
{
int idx = ltTeams.indexOf(team);
if (idx == -1)
return QList<LTDriver>();
QList<LTDriver> drivers;
for (int i = 0; i < ltTeams[idx].drivers.size(); ++i)
{
if (ltTeams[idx].drivers[i].mainDriver == true)
drivers.append(ltTeams[idx].drivers[i]);
if (drivers.size() == 2)
break;
}
return drivers;
}
QString SeasonData::getTeamName(int no)
{
for (int i = 0; i < ltTeams.size(); ++i)
{
for (int j = 0; j < ltTeams[i].drivers.size(); ++j)
{
if (ltTeams[i].drivers[j].no == no)
return ltTeams[i].teamName;
}
}
return QString();
}
LTEvent SeasonData::getEvent(int ev)
{
for (int i = 0; i < ltEvents.size(); ++i)
{
if (ltEvents[i].eventNo == ev)
return ltEvents[i];
}
return LTEvent();
}
int SeasonData::getEventNo(QDate date)
{
for (int i = 1; i < ltEvents.size(); ++i)
{
if (date >= ltEvents[i-1].fpDate && date < ltEvents[i].fpDate)
return ltEvents[i-1].eventNo;
}
return 1;
}
const LTEvent &SeasonData::getEvent(const QDate &date) const
{
for (int i = 1; i < ltEvents.size(); ++i)
{
if (date >= ltEvents[i-1].fpDate && date < ltEvents[i].fpDate)
return ltEvents[i-1];
}
if (date >= ltEvents.last().fpDate && date <= ltEvents.last().raceDate)
return ltEvents.last();
return ltEvents[0];
}
const LTEvent &SeasonData::getCurrentEvent()const
{
return getEvent(QDateTime::currentDateTimeUtc().date());
}
const LTEvent &SeasonData::getNextEvent() const
{
QDate date = QDate::currentDate();
for (int i = 1; i < ltEvents.size(); ++i)
{
if (date > ltEvents[i-1].raceDate && date <= ltEvents[i].raceDate)
return ltEvents[i];
}
return ltEvents[0];
}
int SeasonData::getDriverNo(const QString &name)
{
for (int i = 0; i < ltTeams.size(); ++i)
{
for (int j = 0; j < ltTeams[i].drivers.size(); ++j)
{
if (ltTeams[i].drivers[j].name.toUpper() == name.toUpper())
return ltTeams[i].drivers[j].no;
}
}
return -1;
}
QStringList SeasonData::getDriversList()
{
QStringList list;
list.append("");
for (int i = 0; i < 30; ++i)
{
DriverData dd = EventData::getInstance().getDriverData(i);
if (dd.getCarID() != -1)
{
list.append(QString::number(dd.getNumber()) + " " + dd.getDriverName());
}
}
if (list.size() == 1)
{
for (int i = 0; i < ltTeams.size(); ++i)
{
QList<LTDriver> drivers = getMainDrivers(ltTeams[i]);
for (int j = 0; j < drivers.size(); ++j)
list.append(QString::number(drivers[j].no) + " " + drivers[j].name);
}
}
return list;
}
QStringList SeasonData::getDriversListShort()
{
QStringList list;
for (int i = 0; i < 30; ++i)
{
DriverData dd = EventData::getInstance().getDriverData(i);
if (dd.getCarID() != -1)
{
list.append(QString::number(dd.getNumber()) + " " + SeasonData::getDriverShortName(dd.getDriverName()));
}
}
if (list.isEmpty())
{
for (int i = 0; i < ltTeams.size(); ++i)
{
QList<LTDriver> drivers = getMainDrivers(ltTeams[i]);
for (int j = 0; j < drivers.size(); ++j)
list.append(QString::number(drivers[j].no) + " " + drivers[j].shortName);
}
}
return list;
}
QVector<LTTeam> SeasonData::getTeamsFromCurrentSession()
{
QVector<LTTeam> teams;
for (int i = 0; i < ltTeams.size(); ++i)
{
LTTeam team;
team.teamName = ltTeams[i].teamName;
for (int j = 0; j < ltTeams[i].drivers.size(); ++j)
{
if (ltTeams[i].drivers[j].mainDriver)
team.drivers.append(ltTeams[i].drivers[j]);
}
teams.append(team);
}
return teams;
}
void SeasonData::getTrackMap(LTEvent &ev)
{
for (int i = 0; i < ltEvents.size(); ++i)
{
if (ltEvents[i] == ev)
{
ev.trackImg = ltEvents[i].trackImg;
return;
}
}
}
QString SeasonData::getEventNameFromShort(const QString &shortName)
{
return eventNamesMap[shortName.toLower()] + " Grand Prix";
// for (int i = 0; i < ltEvents.size(); ++i)
// {
// if (ltEvents[i].eventShortName.toLower() == shortName.toLower())
// return ltEvents[i].eventName;
// }
// return shortName;
}
void SeasonData::fillEventNamesMap()
{
eventNamesMap.insert("aus", "Australian");
eventNamesMap.insert("mal", "Malaysian");
eventNamesMap.insert("chn", "Chinese");
eventNamesMap.insert("bah", "Bahrain");
eventNamesMap.insert("spa", "Spanish");
eventNamesMap.insert("mon", "Monaco");
eventNamesMap.insert("can", "Canadian");
eventNamesMap.insert("eur", "European");
eventNamesMap.insert("val", "European");
eventNamesMap.insert("gbr", "British");
eventNamesMap.insert("ger", "German");
eventNamesMap.insert("hun", "Hungarian");
eventNamesMap.insert("bel", "Belgian");
eventNamesMap.insert("ita", "Italian");
eventNamesMap.insert("sgp", "Singapore");
eventNamesMap.insert("jpn", "Japanese");
eventNamesMap.insert("kor", "Korean");
eventNamesMap.insert("ind", "Indian");
eventNamesMap.insert("abu", "Abu Dhabi");
eventNamesMap.insert("usa", "US");
eventNamesMap.insert("bra", "Brazilian");
}
| zywhlc-f1lt | src/core/seasondata.cpp | C++ | gpl3 | 15,968 |
/*******************************************************************************
* *
* F1LT - unofficial Formula 1 live timing application *
* Copyright (C) 2012-2013 Mariusz Pilarek (pieczaro@gmail.com) *
* *
* 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 *
* the Free Software Foundation, either version 3 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
* *
*******************************************************************************/
#include "f1ltcore.h"
F1LTCore::F1LTCore()
{
}
| zywhlc-f1lt | src/core/f1ltcore.cpp | C++ | gpl3 | 1,590 |
/*******************************************************************************
* *
* F1LT - unofficial Formula 1 live timing application *
* Copyright (C) 2012-2013 Mariusz Pilarek (pieczaro@gmail.com) *
* *
* 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 *
* the Free Software Foundation, either version 3 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
* *
*******************************************************************************/
#include "trackmapscoordinates.h"
#include "eventdata.h"
TrackMapsCoordinates::TrackMapsCoordinates()
{
}
bool TrackMapsCoordinates::loadTrackDataFile()
{
QString fName = F1LTCore::trackDataFile();
if (!fName.isNull())
{
QFile f(fName);
if (f.open(QIODevice::ReadOnly))
{
QDataStream stream(&f);
char *cbuf;
stream >> cbuf;
QString sbuf(cbuf);
delete [] cbuf;
if (sbuf != "F1LT_TD")
return false;
int size;
stream >> size;
for (int i = 0; i < size; ++i)
{
TrackCoordinates trackCoordinates;
int coordSize;
stream >> cbuf;
trackCoordinates.name = QString(cbuf);
delete [] cbuf;
stream >> trackCoordinates.year;
stream >> trackCoordinates.indexes[0];
stream >> trackCoordinates.indexes[1];
stream >> trackCoordinates.indexes[2];
stream >> coordSize;
for (int j = 0; j < coordSize; ++j)
{
QPoint p;
stream >> p;
trackCoordinates.coordinates.append(p);
}
ltTrackCoordinates.append(trackCoordinates);
// for (int j = 0; j < ltEvents.size(); ++j)
// {
// if (ltEvents[j].eventShortName.toLower() == trackCoordinates.name.toLower())
// {
// ltEvents[j].trackCoordinates = trackCoordinates;
// break;
// }
// }
}
return true;
}
}
return false;
}
TrackCoordinates TrackMapsCoordinates::getCurrentTrackCoordinates() const
{
EventData &ed = EventData::getInstance();
TrackCoordinates currentTrackCoordinates;
for (int i = 0; i < ltTrackCoordinates.size(); ++i)
{
if (ed.getEventInfo().eventPlace.contains(ltTrackCoordinates[i].name))
{
int year = ed.getEventInfo().fpDate.year();
if (year == ltTrackCoordinates[i].year)
{
return ltTrackCoordinates[i];
}
//if we don't have this years track coordinates, let's search for the newest ones
if ((year > ltTrackCoordinates[i].year) &&
(currentTrackCoordinates.year < ltTrackCoordinates[i].year))
{
currentTrackCoordinates = ltTrackCoordinates[i];
}
}
}
return currentTrackCoordinates;
}
| zywhlc-f1lt | src/core/trackmapscoordinates.cpp | C++ | gpl3 | 4,213 |
/*******************************************************************************
* *
* F1LT - unofficial Formula 1 live timing application *
* Copyright (C) 2012-2013 Mariusz Pilarek (pieczaro@gmail.com) *
* *
* 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 *
* the Free Software Foundation, either version 3 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
* *
*******************************************************************************/
#include "weatherchart.h"
#include <QPainter>
#include "../core/colorsmanager.h"
void WeatherChart::drawAxes(QPainter *p)
{
p->setPen(QColor(ColorsManager::getInstance().getDefaultColor(LTPackets::WHITE)));
//x axe
p->drawLine(paintRect.left(), paintRect.bottom(), paintRect.right(), paintRect.bottom());
//y axe
p->drawLine(paintRect.left(), paintRect.bottom(), paintRect.left(), paintRect.top());
p->setFont(QFont("Arial", 10, QFont::Bold, false));
p->setPen(QColor(ColorsManager::getInstance().getDefaultColor(LTPackets::WHITE)));
double yFactor = (double)(((double)paintRect.height()-40.0)/6.0);
double yFactor2 = (double)((tMax-tMin)/6.0);
double j = tMin;
for (int i = paintRect.bottom(); i >= 50; i-= yFactor, j += yFactor2)
{
p->setPen(QColor(ColorsManager::getInstance().getDefaultColor(LTPackets::WHITE)));
p->drawText(5, i+5, QString::number(j, 'f', 1));
if (i != paintRect.bottom())
{
QPen pen(QColor(ColorsManager::getInstance().getDefaultColor(LTPackets::DEFAULT)));
pen.setStyle(Qt::DashLine);
p->setPen(pen);
p->drawLine(paintRect.left(), i, paintRect.right(), i);
}
}
EventData &ed = EventData::getInstance();
if (ed.getWeather().getSize(weatherId)>1)
{
int sz = last - first + 1;
double xFactor = ((double)paintRect.width()) / (double)sz;
double j = first, jWD = first-1;
double i = paintRect.left();
int prevJ = first;
double jFactor = sz < 5 ? 1.0 : (double)((sz-1)/6.0);
double jWDFactor = /*ed.getWeather().getSize(wetDryId)-1*/sz < 5 ? 1.0 : (double)((/*ed.getWeather().getSize(wetDryId)-1*/sz)/6.0);
QPixmap dryPix;
if ((jFactor * xFactor) < 40)
dryPix = QPixmap(":/ui_icons/weather_dry.png").scaledToWidth((jFactor * xFactor)*0.95, Qt::SmoothTransformation);
else
dryPix = QPixmap(":/ui_icons/weather_dry.png").scaledToWidth(40, Qt::SmoothTransformation);
QPixmap wetPix;
if ((jFactor * xFactor) < 40)
wetPix = QPixmap(":/ui_icons/weather_wet.png").scaledToWidth((jFactor * xFactor)*0.95, Qt::SmoothTransformation);
else
wetPix = QPixmap(":/ui_icons/weather_wet.png").scaledToWidth(40, Qt::SmoothTransformation);
// j = 0.0;
// prevJ = 0;
for (; i < width()-15.0 && round(j) < last + 1 && round(j) < ed.getWeather().getSize(weatherId); /*i += xFactor,*/ j += jFactor, jWD += jWDFactor)
{
if (round(j) == prevJ && prevJ != first)
continue;
i += (double)(round(j) - prevJ) * xFactor;
prevJ = round(j);
p->setPen(QColor(ColorsManager::getInstance().getDefaultColor(LTPackets::WHITE)));
if (i > paintRect.left() && i < paintRect.right()-xFactor)
{
QString text = getSessionTime(ed.getWeather().getWeatherData(weatherId)[round(j)]);
p->drawText(round(i)-10, paintRect.bottom()+15, text);
QPen pen(QColor(ColorsManager::getInstance().getDefaultColor(LTPackets::DEFAULT)));
pen.setStyle(Qt::DashLine);
p->setPen(pen);
p->drawLine(round(i), paintRect.bottom(), round(i), paintRect.top());
}
if (/*round(jWD) < last && */round(jWD) < ed.getWeather().getSize(wetDryId) && /*round(j) < last-1 &&*/ round(j) < ed.getWeather().getSize(weatherId)-1)
{
int nextI = i + xFactor*jFactor;
int cnt = 0;
for (int k = round(jWD); k < round(jWD+jWDFactor) && k < ed.getWeather().getSize(wetDryId); ++k)
{
if (ed.getWeather().getWeatherData(wetDryId)[k].getValue() == 1)
++cnt;
else
--cnt;
}
p->drawPixmap(round(i)+(nextI-round(i)-dryPix.width())/2, 5, cnt > 0 ? wetPix : dryPix);
}
}
}
}
void WeatherChart::drawChart(QPainter *p)
{
EventData &ed = EventData::getInstance();
int sz = last - first + 1;
if (sz > 1 && first < ed.getWeather().getSize(weatherId))
{
p->setBrush(QBrush(color));
QPen pen(color);
pen.setWidth(2);
p->setPen(pen);
p->setRenderHint(QPainter::Antialiasing);
double xFactor = ((double)paintRect.width()) / ((double)sz);
double yFactor = (((double)paintRect.height()-40.0) / (tMax - tMin));
double x = paintRect.left(), j = x + xFactor;
double y = (double)paintRect.bottom() - (double)(ed.getWeather().getWeatherData(weatherId)[first-1].getValue()-tMin) * yFactor;
int i = first;
for (; i < last + 1 && i < ed.getWeather().getSize(weatherId); ++i, j += xFactor)
{
double y2 = (double)paintRect.bottom() - (double)(ed.getWeather().getWeatherData(weatherId)[i].getValue()-tMin) * yFactor;
if (ed.getWeather().getWeatherData(weatherId)[i].getValue() <= 0)
{
y2 = y;
}
double ty = y, ty2 = y2;
drawLine(p, x, ty, j, ty2);
x = j;
y = y2;
}
}
}
void WeatherChart::drawLine(QPainter *p, int x1, int y1, int x2, int y2)
{
int top = paintRect.top()+35;
int bottom = paintRect.bottom();
bool noTopMid = false;
bool noBottomMid = false;
if ((y2 < top && y1 < top) || (y2 > bottom && y1 > bottom))
return;
if (y2 < top)
{
noTopMid = true;
y2 = top;
}
if (y2 > bottom)
{
noBottomMid = true;
y2 = bottom;
}
if (y1 < top)
{
noTopMid = true;
y1 = top;
}
if (y1 > bottom)
{
noBottomMid = true;
y1 = bottom;
}
double midx = (x1 + x2)/2;
if ((y1 >= y2 && !noBottomMid) || (y2 >= y1 && !noTopMid))
p->drawLine(x1, y1, midx, y1);
p->drawLine(midx, y1, midx, y2);
if ((y1 >= y2 && !noTopMid) || (y2 >= y1 && !noBottomMid))
p->drawLine(midx, y2, x2, y2);
}
void WeatherChart::paintEvent(QPaintEvent *)
{
resetPaintRect();
QPainter p;
p.begin(this);
if (scaleRect.width() == 0 && scaleRect.height() == 0)
{
setMinMax();
resetZoom();
}
p.setBrush(QColor(20,20,20));
p.setPen(QColor(20,20,20));
p.drawRect(0, 0, width(), height());
drawAxes(&p);
drawChart(&p);
if (scaling)
drawScaleRect(&p);
p.end();
}
void WeatherChart::setMinMax()
{
EventData &ed = EventData::getInstance();
for (int i = 0; i < ed.getWeather().getSize(weatherId); ++i)
{
if (i == 0)
{
min = ed.getWeather().getWeatherData(weatherId)[i].getValue();
max = ed.getWeather().getWeatherData(weatherId)[i].getValue();
}
else
{
if (ed.getWeather().getWeatherData(weatherId)[i].getValue() > 0)
{
if (ed.getWeather().getWeatherData(weatherId)[i].getValue() < min)
min = ed.getWeather().getWeatherData(weatherId)[i].getValue();
if (ed.getWeather().getWeatherData(weatherId)[i].getValue() > max)
max = ed.getWeather().getWeatherData(weatherId)[i].getValue();
}
}
}
// min -= min * 0.01;
// max += max * 0.01;
if (min < allowedMin)
min = allowedMin;
if ((max - min) < 0.6)
{
max += 0.3;
min -= 0.3;
}
}
void WeatherChart::resetZoom()
{
setMinMax();
first = 1;
last = EventData::getInstance().getWeather().getSize(weatherId);
tMin = min;
tMax = max;
}
void WeatherChart::calculateTransformFactors()
{
int sz = last-first+1;
double xFactor = ((double)paintRect.width()) / ((double)sz);
double yFactor = (((double)paintRect.height()-40) / (double)(tMax - tMin));
first = first + ceil((scaleRect.left() - paintRect.left()) / xFactor);
if (first < 1)
first = 1;
if (first >= EventData::getInstance().getWeather().getSize(weatherId))
first = EventData::getInstance().getWeather().getSize(weatherId) - 1;
last = first + ceil((scaleRect.right() - scaleRect.left()) / xFactor);
if (last >= EventData::getInstance().getWeather().getSize(weatherId))
last = EventData::getInstance().getWeather().getSize(weatherId) - 1;
tMin = tMin + ceil((paintRect.bottom() - scaleRect.bottom()) / yFactor)-1;
if (tMin < min)
tMin = min;
tMax = tMin + ceil((scaleRect.bottom() - scaleRect.top()) / yFactor);
}
void TempChart::drawAxes(QPainter *p)
{
p->setPen(QColor(ColorsManager::getInstance().getDefaultColor(LTPackets::WHITE)));
//x axe
p->drawLine(paintRect.left(), paintRect.bottom(), paintRect.right(), paintRect.bottom());
//y axe
p->drawLine(paintRect.left(), paintRect.bottom(), paintRect.left(), paintRect.top());
p->setFont(QFont("Arial", 10, QFont::Bold, false));
p->setPen(QColor(ColorsManager::getInstance().getDefaultColor(LTPackets::WHITE)));
double yFactor = (double)(((double)paintRect.height()-40.0)/8.0);
double yFactor2 = (double)((tMax-tMin)/8.0);
double j = tMin;
for (int i = height()-25; i >= 50; i-= yFactor, j += yFactor2)
{
p->setPen(QColor(ColorsManager::getInstance().getDefaultColor(LTPackets::WHITE)));
p->drawText(5, i+5, QString::number(j, 'f', 1));
if (i != height()-25)
{
QPen pen(QColor(ColorsManager::getInstance().getDefaultColor(LTPackets::DEFAULT)));
pen.setStyle(Qt::DashLine);
p->setPen(pen);
p->drawLine(paintRect.left(), i, paintRect.right(), i);
}
}
EventData &ed = EventData::getInstance();
if (ed.getWeather().getSize(weatherId)>1 || ed.getWeather().getSize(trackTempId)>1)
{
// int end = std::max(ed.getWeather().getSize(weatherId), ed.weatherData[trackTempId].size());
int id = ed.getWeather().getSize(weatherId) > ed.getWeather().getSize(trackTempId) ? weatherId : trackTempId;
int sz = last - first + 1;
double xFactor = ((double)paintRect.width()) / (double)sz;
double j = first, jWD = first-1;
double i = paintRect.left();
int prevJ = first;
double jFactor = sz < 5 ? 1.0 : (double)((sz-1)/6.0);
double jWDFactor = jFactor;//ed.getWeather().getSize(wetDryId)-1 < 5 ? 1.0 : (double)((ed.getWeather().getSize(wetDryId)-1)/6.0);
QPixmap dryPix;
if ((jFactor * xFactor) < 40)
dryPix = QPixmap(":/ui_icons/weather_dry.png").scaledToWidth((jFactor * xFactor)*0.95, Qt::SmoothTransformation);
else
dryPix = QPixmap(":/ui_icons/weather_dry.png").scaledToWidth(40, Qt::SmoothTransformation);
QPixmap wetPix;
if ((jFactor * xFactor) < 40)
wetPix = QPixmap(":/ui_icons/weather_wet.png").scaledToWidth((jFactor * xFactor)*0.95, Qt::SmoothTransformation);
else
wetPix = QPixmap(":/ui_icons/weather_wet.png").scaledToWidth(40, Qt::SmoothTransformation);
for (; i < width()-15.0 && round(j) < last+1; /*i += xFactor,*/ j += jFactor, jWD += jWDFactor)
{
if (round(j) == prevJ && prevJ != first)
continue;
i += (double)(round(j) - prevJ) * xFactor;
prevJ = round(j);
p->setPen(QColor(ColorsManager::getInstance().getDefaultColor(LTPackets::WHITE)));
if (i > paintRect.left() && i < paintRect.right()-xFactor)
{
QString text = getSessionTime(ed.getWeather().getWeatherData(id)[round(j)]);
p->drawText(round(i)-10, paintRect.bottom()+15, text);
QPen pen(QColor(ColorsManager::getInstance().getDefaultColor(LTPackets::DEFAULT)));
pen.setStyle(Qt::DashLine);
p->setPen(pen);
p->drawLine(round(i), paintRect.bottom(), round(i), paintRect.top());
}
if (round(jWD) < ed.getWeather().getSize(wetDryId) && round(j) < last-1)
{
int nextI = i + xFactor*jFactor;
int cnt = 0;
for (int k = round(jWD); k < round(jWD+jWDFactor) && k < ed.getWeather().getSize(wetDryId); ++k)
{
if (ed.getWeather().getWeatherData(wetDryId)[k].getValue() == 1)
++cnt;
else
--cnt;
}
p->drawPixmap(round(i)+(nextI-round(i)-dryPix.width())/2, 5, cnt > 0 ? wetPix : dryPix);
}
}
}
}
void TempChart::drawChart(QPainter *p)
{
EventData &ed = EventData::getInstance();
// if (ed.getWeather().getSize(weatherId)>1)
{
p->setBrush(QBrush(color));
QPen pen(color);
pen.setWidth(2);
p->setPen(pen);
p->setRenderHint(QPainter::Antialiasing);
int sz = last - first + 1;
if (sz <= 0)
return;
double xFactor1 = ((double)paintRect.width()) / (double)sz;//(ed.getWeather().getSize(weatherId));
double yFactor = ((double)paintRect.height()-40.0) / (double)(tMax-tMin);
double x = paintRect.left(), j1 = x + xFactor1;
double y1 = (double)paintRect.bottom();// - (double)(ed.getWeather().getWeatherData(weatherId)[first].getValue()-tMin) * yFactor;
double y2 = (double)paintRect.bottom();// - (double)(ed.getWeather().getWeatherData(trackTempId)[first].getValue()-tMin) * yFactor;
if (first < ed.getWeather().getWeatherData(weatherId).size())
y1 -= (double)(ed.getWeather().getWeatherData(weatherId)[first].getValue()-tMin) * yFactor;
if (first < ed.getWeather().getWeatherData(trackTempId).size())
y2 -= (double)(ed.getWeather().getWeatherData(trackTempId)[first].getValue()-tMin) * yFactor;
int i = first;
pen.setColor(color);
p->setPen(pen);
int end = ed.getWeather().getWeatherData(weatherId).size() > ed.getWeather().getWeatherData(trackTempId).size() ?
ed.getWeather().getWeatherData(weatherId).size() : ed.getWeather().getWeatherData(trackTempId).size();
for (; i < last + 1 && i < end; ++i, j1 += xFactor1)
{
double y3 = (double)paintRect.bottom();// - (double)(ed.getWeather().getWeatherData(weatherId)[i].getValue()-tMin) * yFactor;
double y4 = (double)paintRect.bottom();// - (double)(ed.getWeather().getWeatherData(trackTempId)[i].getValue()-tMin) * yFactor;
if (i < ed.getWeather().getWeatherData(weatherId).size())
y3 -= (double)(ed.getWeather().getWeatherData(weatherId)[i].getValue()-tMin) * yFactor;
if (i < ed.getWeather().getWeatherData(trackTempId).size())
y4 -= (double)(ed.getWeather().getWeatherData(trackTempId)[i].getValue()-tMin) * yFactor;
double ty1 = y1, ty3 = y3, ty2 = y2, ty4 = y4;
pen.setColor(color);
p->setPen(pen);
drawLine(p, x, ty1, j1, ty3);
pen.setColor(trackTempCol);
p->setPen(pen);
drawLine(p, x, ty2, j1, ty4);
x = j1;
y1 = y3;
y2 = y4;
}
// i = 1;
// x = paintRect.left();
// pen.setColor(trackTempCol);
// p->setPen(pen);
// for (; i < ed.weatherData[trackTempId].size(); ++i, j2 += xFactor2)
// {
// double y4 = (double)paintRect.width() - (double)(ed.weatherData[trackTempId][i].getValue()-tMin) * yFactor;
// double midx = (j2 + x)/2;
// p->drawLine(x, y2, midx, y2);
// p->drawLine(midx, y2, midx, y4);
// p->drawLine(midx, y4, j2, y4);
// x = j2;
// y2 = y4;
// }
}
}
void TempChart::drawLegend(QPainter *p)
{
p->setFont(QFont("Arial", 10, QFont::Bold, false));
p->setRenderHint(QPainter::Antialiasing, false);
p->setBrush(QColor(20, 20, 20));
p->setPen(ColorsManager::getInstance().getDefaultColor(LTPackets::DEFAULT));
p->drawRect(width()-85, height()-80, 80, 50);
p->setPen(color);
p->drawText(width()-80, height()-60, "Air temp");
p->setPen(trackTempCol);
p->drawText(width()-80, height()-40, "Track temp");
}
void TempChart::paintEvent(QPaintEvent *pe)
{
WeatherChart::paintEvent(pe);
// resetPaintRect();
QPainter p;
p.begin(this);
// p.setBrush(QColor(20,20,20));
// p.setPen(QColor(20,20,20));
// p.drawRect(0, 0, width(), height());
// setMinMax();
// drawAxes(&p);
// drawChart(&p);
drawLegend(&p);
p.end();
}
void TempChart::setMinMax()
{
EventData &ed = EventData::getInstance();
int end = std::max(ed.getWeather().getSize(weatherId), ed.getWeather().getSize(trackTempId));
max = 0.0;
min = 100.0;
for (int i = 0; i < end; ++i)
{
// if (i == 0)
// {
// max = std::max(ed.getWeather().getWeatherData(weatherId)[i].getValue(), ed.getWeather().getWeatherData(trackTempId)[i].getValue());
// }
// else
{
if (i < ed.getWeather().getSize(weatherId) && ed.getWeather().getWeatherData(weatherId)[i].getValue() > max)
max = ed.getWeather().getWeatherData(weatherId)[i].getValue();
if (i < ed.getWeather().getSize(trackTempId) && ed.getWeather().getWeatherData(trackTempId)[i].getValue() > max)
max = ed.getWeather().getWeatherData(trackTempId)[i].getValue();
if (i < ed.getWeather().getSize(weatherId) && ed.getWeather().getWeatherData(weatherId)[i].getValue() < min)
min = ed.getWeather().getWeatherData(weatherId)[i].getValue();
if (i < ed.getWeather().getSize(trackTempId) && ed.getWeather().getWeatherData(trackTempId)[i].getValue() < min)
min = ed.getWeather().getWeatherData(trackTempId)[i].getValue();
}
}
max += max * 0.05;
min -= min * 0.15;
}
void WetDryChart::drawAxes(QPainter *p)
{
p->setPen(QColor(ColorsManager::getInstance().getDefaultColor(LTPackets::WHITE)));
//x axe
p->drawLine(40, height()-25, width()-5, height()-25);
//y axe
p->drawLine(40, height()-25, 40, 10);
p->setFont(QFont("Arial", 10, QFont::Bold, false));
p->setPen(QColor(ColorsManager::getInstance().getDefaultColor(LTPackets::WHITE)));
double yFactor = (double)((height()-75.0)/2.0);
p->setPen(QColor(ColorsManager::getInstance().getDefaultColor(LTPackets::WHITE)));
p->drawText(5, yFactor+yFactor*0.5, "Dry");
p->drawText(5, yFactor-yFactor*0.5, "Wet");
QPen pen(QColor(ColorsManager::getInstance().getDefaultColor(LTPackets::DEFAULT)));
pen.setStyle(Qt::DashLine);
p->setPen(pen);
p->drawLine(40, yFactor+yFactor*0.5, width()-5, yFactor+yFactor*0.5);
p->drawLine(40, yFactor-yFactor*0.5, width()-5, yFactor-yFactor*0.5);
EventData &ed = EventData::getInstance();
if (ed.getWeather().getSize(weatherId)>1)
{
double xFactor = ((double)width()-45.0) / (double)ed.getWeather().getSize(weatherId);
double j = 1.0, jWD = 0.0;
double i = 40.0;
int prevJ = 1;
double jFactor = ed.getWeather().getSize(weatherId) < 5 ? 1.0 : (double)((ed.getWeather().getSize(weatherId)-1)/6.0);
double jWDFactor = ed.getWeather().getSize(wetDryId)-1 < 5 ? 1.0 : (double)((ed.getWeather().getSize(wetDryId)-1)/6.0);
QPixmap dryPix;
if ((jFactor * xFactor) < 40)
dryPix = QPixmap(":/ui_icons/weather_dry.png").scaledToWidth((jFactor * xFactor)*0.95, Qt::SmoothTransformation);
else
dryPix = QPixmap(":/ui_icons/weather_dry.png").scaledToWidth(40, Qt::SmoothTransformation);
QPixmap wetPix;
if ((jFactor * xFactor) < 40)
wetPix = QPixmap(":/ui_icons/weather_wet.png").scaledToWidth((jFactor * xFactor)*0.95, Qt::SmoothTransformation);
else
wetPix = QPixmap(":/ui_icons/weather_wet.png").scaledToWidth(40, Qt::SmoothTransformation);
j = 0.0;
prevJ = 0;
for (; i < width()-15.0 && round(j) < ed.getWeather().getSize(weatherId); /*i += xFactor,*/ j += jFactor, jWD += jWDFactor)
{
if (round(j) == prevJ && prevJ != 0)
continue;
i += (double)(round(j) - prevJ) * xFactor;
prevJ = round(j);
p->setPen(QColor(ColorsManager::getInstance().getDefaultColor(LTPackets::WHITE)));
// p->drawText(round(i)-5, height()-10, QString("%1").arg(ed.getWeather().getWeatherData(weatherId)[round(j)]));
if (i > 40 && i < paintRect.right()-xFactor)
{
QString text = getSessionTime(ed.getWeather().getWeatherData(weatherId)[round(j)]);
p->drawText(round(i)-10, paintRect.bottom()+15, text);
QPen pen(QColor(ColorsManager::getInstance().getDefaultColor(LTPackets::DEFAULT)));
pen.setStyle(Qt::DashLine);
p->setPen(pen);
p->drawLine(round(i), height()-25, round(i), 10);
}
if (round(jWD) < ed.getWeather().getSize(wetDryId) && round(j) < ed.getWeather().getSize(weatherId)-1)
{
int nextI = i + xFactor*jFactor;
int cnt = 0;
for (int k = round(jWD); k < round(jWD+jWDFactor) && k < ed.getWeather().getSize(wetDryId); ++k)
{
if (ed.getWeather().getWeatherData(wetDryId)[k].getValue() == 1)
++cnt;
else
--cnt;
}
p->drawPixmap(round(i)+(nextI-round(i)-dryPix.width())/2, 5, cnt > 0 ? wetPix : dryPix);
}
}
}
}
void WetDryChart::drawChart(QPainter *p)
{
EventData &ed = EventData::getInstance();
if (ed.getWeather().getSize(weatherId)>1)
{
p->setBrush(QBrush(color));
QPen pen(color);
pen.setWidth(2);
p->setPen(pen);
p->setRenderHint(QPainter::Antialiasing);
double xFactor = ((double)width()-45.0) / ((double)ed.getWeather().getSize(weatherId));
double yFactor = (((double)height()-75.0) / 2.0);
double x = 40.0, j = x + xFactor;
double y;
if (ed.getWeather().getWeatherData(weatherId)[0].getValue() == 0)
y = yFactor + yFactor*0.5;
else
y = yFactor - yFactor*0.5;
int i = 1;
for (; i < ed.getWeather().getSize(weatherId); ++i, j += xFactor)
{
double y2 = (double)(height())-25.0 - (double)(ed.getWeather().getWeatherData(weatherId)[i].getValue()-min) * yFactor;
if (ed.getWeather().getWeatherData(weatherId)[i].getValue() == 0)
y2 = yFactor + yFactor*0.5;
else
y2 = yFactor - yFactor*0.5;
double midx = (j + x)/2;
p->drawLine(x, y, midx, y);
p->drawLine(midx, y, midx, y2);
p->drawLine(midx, y2, j, y2);
// p->drawLine(x, y, j, y2);
x = j;
y = y2;
}
}
}
void WetDryChart::paintEvent(QPaintEvent *)
{
resetPaintRect();
setMinMax();
QPainter p;
p.begin(this);
p.setBrush(QColor(20,20,20));
p.setPen(QColor(20,20,20));
p.drawRect(0, 0, width(), height());
drawAxes(&p);
drawChart(&p);
p.end();
}
| zywhlc-f1lt | src/charts/weatherchart.cpp | C++ | gpl3 | 25,144 |
/*******************************************************************************
* *
* F1LT - unofficial Formula 1 live timing application *
* Copyright (C) 2012-2013 Mariusz Pilarek (pieczaro@gmail.com) *
* *
* 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 *
* the Free Software Foundation, either version 3 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
* *
*******************************************************************************/
#ifndef FPLAPTIMESCHART_H
#define FPLAPTIMESCHART_H
#include "sessionlaptimeschart.h"
class FPLapTimesChart : public SessionLapTimesChart
{
Q_OBJECT
public:
FPLapTimesChart(QWidget *parent) : SessionLapTimesChart(parent)
{
popupBox = new PopupDriversLapTimesInfoBox();
}
virtual int getSessionLength()
{
return SeasonData::getInstance().getSessionDefaults().getFPLength();
}
virtual void drawAxes(QPainter *p, int firstLap, int lastLap);
virtual void drawChart(QPainter *p);
// virtual void drawScaleRect(QPainter *p);
virtual void calculateTransformFactors();
virtual void resetZoom();
virtual void findFirstAndLastLap(int &firstLap, int &lastLap, int &size);
virtual int checkLapDataCoordinates(int x, int y);
//signals:
// void zoomChanged(int, int, double, double);
protected:
virtual void paintEvent(QPaintEvent *);
void resetPaintRect()
{
paintRect = QRect(42, 10, width()-47, height()-35);
}
};
class QualiLapTimesChart : public FPLapTimesChart
{
public:
QualiLapTimesChart(QWidget *parent) : FPLapTimesChart(parent)
{
qualiPeriod = 1;
first = 0;
last = getSessionLength();
tMin = min;
tMax = max;
}
int getMin() { return tMin == min ? -1 : tMin; }
int getMax() { return tMax == max ? -1 : tMax; }
virtual int getSessionLength()
{
return SeasonData::getInstance().getSessionDefaults().getQualiLength(qualiPeriod);
}
virtual int checkLapDataCoordinates(int x, int y);
// virtual void drawAxes(QPainter *p, int firstLap, int lastLap);
virtual void drawChart(QPainter *p);
void setQualiPeriod(int q) { qualiPeriod = q; }
virtual void findFirstAndLastLap(int &firstLap, int &lastLap, int &size);
protected:
int qualiPeriod;
};
class AllQualiLapTimesChart : public QualiLapTimesChart
{
public:
AllQualiLapTimesChart(QWidget *parent) : QualiLapTimesChart(parent)
{
first = 0;
last = getSessionLength();
tMin = min;
tMax = max;
qualiPeriod = 1;
}
virtual int getSessionLength()
{
int sessionLength = 0;
for (int i = 0; i < 3; ++i)
sessionLength += SeasonData::getInstance().getSessionDefaults().getQualiLength(i+1);
return sessionLength;
}
int getMin() { return tMin == min ? -1 : tMin; }
int getMax() { return tMax == max ? -1 : tMax; }
virtual int checkLapDataCoordinates(int x, int y);
virtual void drawAxes(QPainter *p, int firstMin, int lastMin);
virtual void drawChart(QPainter *p);
virtual void findFirstAndLastLap(int &firstLap, int &lastLap, int &size);
protected:
};
#endif // FPLAPTIMESCHART_H
| zywhlc-f1lt | src/charts/fplaptimeschart.h | C++ | gpl3 | 4,307 |
/*******************************************************************************
* *
* F1LT - unofficial Formula 1 live timing application *
* Copyright (C) 2012-2013 Mariusz Pilarek (pieczaro@gmail.com) *
* *
* 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 *
* the Free Software Foundation, either version 3 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
* *
*******************************************************************************/
#ifndef DriverDataChart_H
#define DriverDataChart_H
#include <QList>
#include <QWidget>
#include "chartwidget.h"
#include "../core/eventdata.h"
struct PopupInfoBox
{
PopupInfoBox() : width(0) { }
PopupInfoBox(int w) : width(w) { }
virtual ~PopupInfoBox() { }
void paint(QPainter *p, int x, int y, const QRect &paintRect);
virtual int getSize()
{
return values.size();
}
virtual QString getInfo(int i) = 0;
class SortPred
{
public:
virtual bool operator()(LapData &ld1, LapData &ld2)
{
return ld1.getPosition() < ld2.getPosition();
}
};
virtual void sortValues()
{
qSort(values.begin(), values.end(), SortPred());
}
QList< LapData > values;
int width;
QString title;
};
struct PopupGapInfoBox : public PopupInfoBox
{
PopupGapInfoBox() : PopupInfoBox() { width = 110; }
virtual QString getInfo(int i)
{
QString gap = values[i].getGap();
if (values[i].getPosition() == 1)
gap = "Leader";
if (gap == "")
gap = "1L";
return QString("LAP %1: %2").arg(values[i].getLapNumber()).arg(gap);
}
};
struct PopupLapTimeInfoBox : public PopupInfoBox
{
PopupLapTimeInfoBox() : PopupInfoBox() { width = 150; }
virtual QString getInfo(int i)
{
QString lap = values[i].getTime().toString();
return QString("LAP %1: %2").arg(values[i].getLapNumber()).arg(lap);
}
};
struct LapDataCoordinates
{
LapDataCoordinates() : idx(0), x(0), y(0) { }
LapDataCoordinates(int a, int b, int c) : idx(a), x(b), y(c) { }
int idx;
int x, y;
};
class DriverDataChart : public ChartWidget
{
Q_OBJECT
public:
// explicit DriverDataChart(QWidget *parent = 0);
DriverDataChart(double, double, QColor, QWidget *parent = 0);
virtual ~DriverDataChart() { if (popupBox != 0) delete popupBox; }
virtual void setData(DriverData *d) { driverData = d; }
virtual void clearData() { driverData = 0; }
void setMinMax(double min, double max) { this->min = min, this->max = max; }
virtual void drawAxes(QPainter *p);
virtual void drawChart(QPainter *p);
virtual void drawLegend(QPainter *p);
virtual void drawSCLap(QPainter *p, const LapData &ld, double xFactor);
virtual void drawRetire(QPainter *p, int x, int y, int r, const LapData &ld);
virtual void drawIntoImage(QImage &img);
virtual void calculateTransformFactors();
virtual void resetZoom();
void pushScaleRect();
virtual int checkLapDataCoordinates(int x, int y);
virtual void clearLapDataCoordinates(int to)
{
for (int i = lapDataCoordinates.size()-1; i >= to; --i)
lapDataCoordinates.removeAt(i);
}
protected:
virtual void mouseMoveEvent(QMouseEvent *ev);
virtual void paintEvent(QPaintEvent *);
virtual void resetPaintRect()
{
paintRect = QRect(27, 10, width()-32, height()-35);
}
DriverData *driverData;
QList<LapDataCoordinates> lapDataCoordinates;
int mousePosX, mousePosY;
PopupInfoBox *popupBox;
bool repaintPopup;
};
class LapTimeChart : public DriverDataChart
{
Q_OBJECT
public:
LapTimeChart(QColor *col, QWidget *parent = 0) : DriverDataChart(0, 180, col[0], parent)
{
for (int i = 0; i < 5; ++i)
colors[i] = col[i];
popupBox = new PopupLapTimeInfoBox();
}
void drawAxes(QPainter *p);
void drawChart(QPainter *p);
void drawLegend(QPainter *p);
void setData(DriverData *dd);
void resetZoom();
protected:
void paintEvent(QPaintEvent *);
virtual void resetPaintRect()
{
paintRect = QRect(28, 10, width()-33, height()-35);
}
private:
QColor colors[5];
};
class GapChart : public DriverDataChart
{
Q_OBJECT
public:
GapChart(QColor col, QWidget *parent = 0) : DriverDataChart(0, 60, col, parent)
{
popupBox = new PopupGapInfoBox;
}
void drawAxes(QPainter *p);
void drawChart(QPainter *p);
void resetZoom();
protected:
void paintEvent(QPaintEvent *);
virtual void resetPaintRect()
{
paintRect = QRect(28, 10, width()-33, height()-35);
}
};
#endif // DriverDataChart_H
| zywhlc-f1lt | src/charts/driverdatachart.h | C++ | gpl3 | 5,823 |
/*******************************************************************************
* *
* F1LT - unofficial Formula 1 live timing application *
* Copyright (C) 2012-2013 Mariusz Pilarek (pieczaro@gmail.com) *
* *
* 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 *
* the Free Software Foundation, either version 3 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
* *
*******************************************************************************/
#ifndef LAPCOMPCHART_H
#define LAPCOMPCHART_H
#include "driverdatachart.h"
#include <QPair>
struct LapDataCompCoordinates : public LapDataCoordinates
{
int driverIdx;
LapDataCompCoordinates() : LapDataCoordinates(), driverIdx(0) { }
LapDataCompCoordinates(int a, int b, int c, int d) : LapDataCoordinates(a, b, c), driverIdx(d) { }
};
struct LapDataGapCompCoordinates : public LapDataCompCoordinates
{
double gap;
LapDataGapCompCoordinates() : LapDataCompCoordinates(), gap(0.0) { }
LapDataGapCompCoordinates(int a, int b, int c, int d, double g) : LapDataCompCoordinates(a, b, c, d), gap(g) { }
};
//------------------------------------------------
struct PopupLapTimeCompInfoBox : public PopupInfoBox
{
PopupLapTimeCompInfoBox() : PopupInfoBox() { width = 180; }
virtual QString getInfo(int i)
{
DriverData dd = EventData::getInstance().getDriverDataById(values[i].getCarID());
if (dd.getCarID() > 0)
return QString("%1: %2").arg(dd.getDriverName()).arg(values[i].getTime().toString());
return QString();
}
virtual bool sortPred(LapData &ld1, LapData &ld2)
{
return ld1.getTime() < ld2.getTime();
}
};
struct PopupGapCompInfoBox : public PopupInfoBox
{
PopupGapCompInfoBox() : PopupInfoBox() { width = 180; }
virtual int getSize()
{
return gapValues.size();
}
virtual QString getInfo(int i)
{
DriverData dd = EventData::getInstance().getDriverDataById(values[i].getCarID());
if (dd.getCarID() > 0)
{
if (gapValues[i] == 0.0)
return dd.getDriverName();
if (gapValues[i] == 1000.0)
return dd.getDriverName() + ": +1L <";
return dd.getDriverName() + ": +" + QString::number(gapValues[i], 'f', 1);
}
return QString();
}
QList< double > gapValues;
};
//----------------------------------------------
class LapCompChart : public DriverDataChart
{
Q_OBJECT
public:
explicit LapCompChart(QWidget *parent = 0) : DriverDataChart(0, 180, QColor(), parent)
{
for (int i = 0; i < 4; ++i)
{
driverData[i] = 0;
}
popupBox = new PopupLapTimeCompInfoBox();
}
void setData(DriverData **ld);
void drawAxes(QPainter *p, int, int);
void drawChart(QPainter *p);
void drawLegend(QPainter *p);
void drawIntoImage(QImage &img);
void findFirstAndLastLap(int &firstLap, int &lastLap);
void calculateTransformFactors();
void resetZoom();
virtual int checkLapDataCoordinates(int x, int y);
virtual void clearLapDataCoordinates(int to)
{
for (int i = lapDataCompCoordinates.size()-1; i >= to; --i)
lapDataCompCoordinates.removeAt(i);
}
protected:
void paintEvent(QPaintEvent *);
virtual void resetPaintRect()
{
paintRect = QRect(37, 10, width()-42, height()-35);
}
private:
DriverData *driverData[4];
QList<LapDataCompCoordinates> lapDataCompCoordinates;
};
class GapCompChart : public DriverDataChart
{
Q_OBJECT
public:
explicit GapCompChart(QWidget *parent = 0) : DriverDataChart(0, 0, QColor(), parent), eventData(EventData::getInstance())
{
popupBox = new PopupGapCompInfoBox();
}
void setData(int *idx) { driverIdx[0] = idx[0]; driverIdx[1] = idx[1]; }
void drawAxes(QPainter *p, int, int);
void drawChart(QPainter *p);
void drawLegend(QPainter *p);
void drawIntoImage(QImage &img);
void findFirstAndLastLap(int &firstLap, int &lastLap);
virtual int checkLapDataCoordinates(int x, int y);
virtual void clearLapDataCoordinates(int to)
{
for (int i = lapDataGapCompCoordinates.size()-1; i >= to; --i)
lapDataGapCompCoordinates.removeAt(i);
}
void calculateTransformFactors();
void resetZoom();
protected:
void paintEvent(QPaintEvent *);
virtual void resetPaintRect()
{
paintRect = QRect(37, 10, width()-42, height()-35);
}
private:
EventData &eventData;
int driverIdx[2];
QList<LapDataGapCompCoordinates> lapDataGapCompCoordinates;
};
class PosCompChart : public DriverDataChart
{
Q_OBJECT
public:
explicit PosCompChart(QWidget *parent = 0) : DriverDataChart(0, 180, QColor(), parent)
{
for (int i = 0; i < 2; ++i)
{
driverData[i] = 0;
}
}
void setData(DriverData **ld)
{
for (int i = 0; i < 2; ++i)
driverData[i] = ld[i];
}
void drawAxes(QPainter *p, int, int);
void drawChart(QPainter *p);
void drawLegend(QPainter *p);
void drawIntoImage(QImage &img);
void findFirstAndLastLap(int &firstLap, int &lastLap);
void calculateTransformFactors();
void resetZoom();
protected:
virtual void resetPaintRect()
{
paintRect = QRect(37, 10, width()-42, height()-35);
}
void paintEvent(QPaintEvent *);
private:
DriverData *driverData[2];
};
#endif // LAPCOMPCHART_H
| zywhlc-f1lt | src/charts/lapcompchart.h | C++ | gpl3 | 6,602 |
/*******************************************************************************
* *
* F1LT - unofficial Formula 1 live timing application *
* Copyright (C) 2012-2013 Mariusz Pilarek (pieczaro@gmail.com) *
* *
* 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 *
* the Free Software Foundation, either version 3 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
* *
*******************************************************************************/
#ifndef SESSIONLAPTIMESCHART_H
#define SESSIONLAPTIMESCHART_H
#include <QColor>
#include <QList>
#include "driverdatachart.h"
#include "../core/driverdata.h"
extern bool lessThan(LapData ld1, LapData ld2);
struct PopupDriversGapsInfoBox : public PopupInfoBox
{
PopupDriversGapsInfoBox() : PopupInfoBox() { width = 200; }
virtual QString getInfo(int i)
{
QString gap = values[i].getGap();
if (values[i].getPosition() == 1)
gap = "Leader";
if (gap == "")
gap = "+1L";
DriverData dd = EventData::getInstance().getDriverDataById(values[i].getCarID());
if (dd.getCarID() > 0)
return QString("%1. %2: %3").arg(values[i].getPosition()).arg(dd.getDriverName()).arg(gap);
return QString();
}
};
struct PopupDriversLapTimesInfoBox : public PopupInfoBox
{
PopupDriversLapTimesInfoBox() : PopupInfoBox() { width = 200; }
virtual QString getInfo(int i)
{
DriverData dd = EventData::getInstance().getDriverDataById(values[i].getCarID());
if (dd.getCarID() > 0)
return QString("%1. %2: %3").arg(values[i].getPosition()).arg(dd.getDriverName()).arg(values[i].getTime().toString());
return QString();
}
};
class SessionLapTimesChart : public DriverDataChart
{
Q_OBJECT
public:
SessionLapTimesChart(QWidget *parent) : DriverDataChart(0, 180, QColor(), parent)
{
setMouseTracking(true);
mousePosX = 0;
mousePosY = 0;
repaintPopup = false;
popupBox = new PopupDriversLapTimesInfoBox();
}
virtual void setData(const QList<LapData> ld) { lapDataArray = ld; qSort(lapDataArray.begin(), lapDataArray.end(), lessThan);}
virtual void setMinMax(double min, double max) { this->min = min, this->max = max; }
virtual void drawAxes(QPainter *p, int firstLap, int lastLap);
virtual void drawChart(QPainter *p);
virtual void drawIntoImage(QImage &img);
virtual void drawImage(QPainter *p);
virtual void drawLegend(QPainter *) { }
// virtual void drawRetire(QPainter *p, int x, int y, const LapData &ld, QColor color);
// virtual void drawScaleRect(QPainter *p);
virtual void calculateTransformFactors();
virtual void resetZoom();
virtual void findFirstAndLastLap(int &firstLap, int &lastLap, int &size);
QColor getCarColor(const LapData &ld);
QColor getCarColor(const DriverData &dd);
virtual int checkLapDataCoordinates(int x, int y);
virtual int getPopupWidth()
{
return 200;
}
friend class PredXYPos;
protected:
virtual void mouseDoubleClickEvent (QMouseEvent *);
virtual void mouseMoveEvent(QMouseEvent *);
virtual void resetPaintRect()
{
paintRect = QRect(42, 10, width()-47, height()-35);
}
signals:
void zoomChanged(int, int, double, double);
public slots:
virtual void onZoomOut();
protected:
void paintEvent(QPaintEvent *);
QList<LapData> lapDataArray;
QImage chartImg;
};
class SessionPositionsChart : public SessionLapTimesChart
{
public:
SessionPositionsChart(QWidget *parent) : SessionLapTimesChart(parent)
{
min = 1;
max = 24;
}
virtual void drawAxes(QPainter *p, int firstLap, int lastLap);
virtual void drawChart(QPainter *p);
void drawDriversLegend(QPainter *p, const LapData &ld, double y);
void findFirstAndLastLap(int &firstLap, int &lastLap, int &size);
virtual void calculateTransformFactors();
protected:
void paintEvent(QPaintEvent *);
virtual void resetPaintRect()
{
paintRect = QRect(60, 20, width()-65, height()-20);
}
struct DriverPosAtom
{
int pos;
int id;
DriverPosAtom(int p, int i) : pos(p), id(i) { }
bool operator < (const DriverPosAtom &p)const
{
if (pos <= 0)
return false;
if (p.pos <= 0)
return true;
return pos < p.pos;
}
};
QList<DriverPosAtom> getDriverStartingPositions();
int getDriverStartingPosition(const LapData &ld);
};
class SessionGapsChart : public SessionLapTimesChart
{
public:
SessionGapsChart(QWidget *parent) : SessionLapTimesChart(parent)
{
min = 0;
max = 90;
popupBox = new PopupDriversGapsInfoBox();
}
virtual void drawAxes(QPainter *p, int firstLap, int lastLap);
virtual void drawChart(QPainter *p);
void findFirstAndLastLap(int &firstLap, int &lastLap, int &size);
protected:
void paintEvent(QPaintEvent *);
void resetPaintRect()
{
paintRect = QRect(30, 10, width()-35, height()-35);
}
};
#endif // SESSIONLAPTIMESCHART_H
| zywhlc-f1lt | src/charts/sessionlaptimeschart.h | C++ | gpl3 | 6,268 |
/*******************************************************************************
* *
* F1LT - unofficial Formula 1 live timing application *
* Copyright (C) 2012-2013 Mariusz Pilarek (pieczaro@gmail.com) *
* *
* 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 *
* the Free Software Foundation, either version 3 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
* *
*******************************************************************************/
#include "lapcompchart.h"
#include <QPainter>
#include "../core/colorsmanager.h"
void LapCompChart::setData(DriverData **dd)
{
double lMin = 99999999.0, lMax = 0.0;
for (int i = 0; i < 4; ++i)
{
driverData[i] = dd[i];
if (driverData[i] != 0)
{
for (int j = 0; j < driverData[i]->getLapData().size(); ++j)
{
double secs = driverData[i]->getLapData()[j].getTime().toDouble();//-QTime::fromString(driverData[i].getLapData()[j].getTime(), "m:ss.zzz").secsTo(QTime::fromString("0:00.000", "m:ss.zzz"));
if (secs == 0 && j > 0)
secs = driverData[i]->getLapData()[j-1].getTime().toDouble();//-QTime::fromString(driverData[i].getLapData()[j-1].getTime(), "m:ss.zzz").secsTo(QTime::fromString("0:00.000", "m:ss.zzz"));
if (secs == 0 && j < driverData[i]->getLapData().size()-1)
{
secs = driverData[i]->getLapData()[j+1].getTime().toDouble();//-QTime::fromString(driverData[i].getLapData()[j+1].getTime(), "m:ss.zzz").secsTo(QTime::fromString("0:00.000", "m:ss.zzz"));
if (driverData[i]->getLapData()[j].getTime().toString() == "IN PIT")
{
LapTime pl(driverData[i]->getPitTime(driverData[i]->getLapData()[j].getLapNumber()));
secs = (driverData[i]->getLapData()[j+1].getTime() - pl + LapTime(5000)).toDouble();
}
}
if (secs < lMin)
lMin = secs;
if (secs > lMax)
lMax = secs;
}
}
}
if (lMax != 0)
{
max = (double)(lMax + lMax * 0.01);
min = (double)(lMin - lMin * 0.01);
if (max > 180)
max = 180;
if (min < 0)
min = 0;
}
}
void LapCompChart::drawAxes(QPainter *p, int firstLap, int lastLap)
{
p->setPen(QColor(ColorsManager::getInstance().getDefaultColor(LTPackets::WHITE)));
//x axe
p->drawLine(paintRect.left(), paintRect.bottom(), paintRect.right(), paintRect.bottom());
//y axe
p->drawLine(paintRect.left(), paintRect.bottom(), paintRect.left(), paintRect.top());
p->setFont(QFont("Arial", 10));
p->setPen(QColor(ColorsManager::getInstance().getDefaultColor(LTPackets::WHITE)));
double yFactor = (double)((paintRect.height())/6.0);
double yFactor2 = (double)((tMax-tMin)/6.0);
double j = tMin;
for (int i = paintRect.bottom(); i >= 10; i-= yFactor, j += yFactor2)
{
p->setPen(QColor(ColorsManager::getInstance().getDefaultColor(LTPackets::WHITE)));
p->drawText(5, i+5, QString("%1").arg(j, 0, 'f', 1));
if (i != paintRect.bottom())
{
QPen pen(QColor(ColorsManager::getInstance().getDefaultColor(LTPackets::DEFAULT)));
pen.setStyle(Qt::DashLine);
p->setPen(pen);
p->drawLine(paintRect.left(), i, paintRect.right(), i);
}
}
if (lastLap - firstLap > 0)
{
double xFactor = ((double)paintRect.width()) / /*((lapData.size() < 5) ?*/ (double)(lastLap - firstLap) /*: 5)*/;
double j = firstLap;
double i = paintRect.left();
int prevJ = firstLap;
double jFactor = (lastLap - firstLap) < 6 ? 1.0 : (double)((lastLap - firstLap)/6.0);
for (; i < width()-15.0 && round(j) < lastLap; /*i += xFactor,*/ j += jFactor)
{
i += (double)(round(j) - prevJ) * xFactor;
prevJ = round(j);
p->setPen(QColor(ColorsManager::getInstance().getDefaultColor(LTPackets::WHITE)));
p->drawText(round(i)-5, height()-10, QString("L%1").arg(round(j)));
if (i > paintRect.left())
{
QPen pen(QColor(ColorsManager::getInstance().getDefaultColor(LTPackets::DEFAULT)));
pen.setStyle(Qt::DashLine);
p->setPen(pen);
p->drawLine(round(i), paintRect.bottom(), round(i), paintRect.top());
}
}
}
// if (lastLap - firstLap > 0)
// {
// double xFactor = (width()-42) / ((lastLap - firstLap < 5) ? lastLap - firstLap : 5);
// double j = firstLap;
// double jFactor = lastLap - firstLap < 5 ? 1.0 : (double)((lastLap - firstLap)/5.0);
// for (int i = 37; i < width()-15 && round(j) < lastLap; i += xFactor, j += jFactor)
// {
// p->setPen(QColor(ColorsManager::getInstance().getDefaultColor(LTPackets::WHITE]));
// p->drawText(i-5, height()-10, QString("L%1").arg(round(j)));
// if (i > 37)
// {
// QPen pen(QColor(ColorsManager::getInstance().getDefaultColor(LTPackets::DEFAULT]));
// pen.setStyle(Qt::DashLine);
// p->setPen(pen);
// p->drawLine(i, height()-25, i, 10);
// }
// }
// }
}
void LapCompChart::findFirstAndLastLap(int &firstLap, int &lastLap)
{
firstLap = 99, lastLap = 0;
for (int i = 0; i < 4; ++i)
{
if (driverData[i] != 0 && !driverData[i]->getLapData().isEmpty())
{
for (int j = 0; j < driverData[i]->getLapData().size(); ++j)
{
if (driverData[i]->getLapData()[j].getLapNumber() < firstLap && driverData[i]->getLapData()[j].getLapNumber() >= first)
firstLap = driverData[i]->getLapData()[j].getLapNumber();
if (driverData[i]->getLapData()[j].getLapNumber() > lastLap && driverData[i]->getLapData()[j].getLapNumber() <= last)
lastLap = driverData[i]->getLapData()[j].getLapNumber();
}
// msecs = -QTime::fromString(driverData[i].getLapData()[0].getTime(), "m:ss.zzz").msecsTo(QTime::fromString("0:00.000", "m:ss.zzz"));
// secs = (double)(msecs / 1000.0);
//
// if (secs > max) secs = max;
// if (secs < min) secs = min;
}
}
}
void LapCompChart::drawChart(QPainter *p)
{
int firstLap = 99, lastLap = 0;
double x[4] = {(double)paintRect.left(), (double)paintRect.left(), (double)paintRect.left(), (double)paintRect.left()};
double y1[4];
double y2[4];
double yFactor = (((double)paintRect.height()) / (double)(tMax-tMin));
int msecs;
double secs;
for (int i = 0; i < 4; ++i)
{
if (driverData[i] != 0 && !driverData[i]->getLapData().isEmpty())
{
// if (driverData[i].getLapData()[0].getLapNumber() < firstLap)
// firstLap = driverData[i].getLapData()[0].getLapNumber();
//
// if (driverData[i].lapData.last().getLapNumber() > lastLap)
// lastLap = driverData[i].lapData.last().getLapNumber();
//
msecs = -QTime::fromString(driverData[i]->getLapData()[0].getTime(), "m:ss.zzz").msecsTo(QTime::fromString("0:00.000", "m:ss.zzz"));
secs = (double)(msecs / 1000.0);
if (secs > max) secs = max;
if (secs < min) secs = min;
y1[i] = (double)(paintRect.bottom() - (double)(secs-tMin) * yFactor);
}
}
findFirstAndLastLap(firstLap, lastLap);
// firstLap = first; lastLap = last;
drawAxes(p, firstLap, lastLap);
if (lastLap - firstLap == 0)
return;
double xFactor = ((double)paintRect.width()) / (double)(lastLap - firstLap);
p->setRenderHint(QPainter::Antialiasing);
int index[4] = {0,0,0,0};
double j[4] = {(x[0]), (x[0]), (x[0]), (x[0])};
int lapsInWindow = 0;
int lastPaintedSC = 0;
for (int i = firstLap; i <= lastLap; ++i)
{
for (int k = 0; k < 4; ++k)
{
if (driverData[k] == 0)
continue;
LapData ld = driverData[k]->getLapData(i);
// if (!driverData[k]->lapData.empty() && index[k] < driverData[k]->lapData.size() && driverData[k]->getLapData()[index[k]].getLapNumber() == i)
if (ld.getCarID() == driverData[k]->getCarID() && ld.getLapNumber() == i && !ld.getTime().toString().contains("LAP"))
{
LapTime lapTime = ld.getTime();//driverData[k]->getLapData()[index[k]].getTime();
if (ld.getRaceLapExtraData().isSCLap() && ld.getLapNumber() > lastPaintedSC)
{
drawSCLap(p, ld, xFactor);
lastPaintedSC = ld.getLapNumber();
}
QPen pen;
pen.setWidth(2);
pen.setColor(ColorsManager::getInstance().getCarColor(driverData[k]->getNumber()));
p->setPen(pen);
if (lapTime.toString() == "IN PIT")
{
LapData ldtmp = driverData[k]->getLapData(i-1);
if (ldtmp.getCarID() == driverData[k]->getCarID())
lapTime = ldtmp.getTime();
else
{
ldtmp = driverData[k]->getLapData(i+1);
if (ldtmp.getCarID() == driverData[k]->getCarID())
{
LapTime pl(driverData[k]->getPitTime(ld.getLapNumber()));
lapTime = lapTime - pl + LapTime(5000);
}
if (lapTime.toString() == "IN PIT")
{
ldtmp = driverData[k]->getLapData(i+2);
if (ldtmp.getCarID() == driverData[k]->getCarID())
{
LapTime pl(driverData[k]->getPitTime(ld.getLapNumber()+1));
lapTime = lapTime - pl + LapTime(5000);
}
}
}
}
msecs = -QTime::fromString(lapTime, "m:ss.zzz").msecsTo(QTime::fromString("0:00.000", "m:ss.zzz"));
secs = (double)(msecs / 1000.0);
if (secs > max) secs = max;
if (secs < min) secs = min;
y2[k] = (double)(paintRect.bottom() - (double)(secs-tMin) * yFactor);
if (index[k] == 0)
y1[k] = y2[k];
double dx1 = x[k], dx2 = j[k], dy1 = y1[k], dy2 = y2[k];
if (dy1 <= paintRect.bottom() || dy2 <= paintRect.bottom())
{
checkX1(dx1, dy1, dx2, dy2);
checkX2(dx1, dy1, dx2, dy2);
if (!scaling)
{
if (lapsInWindow >= lapDataCompCoordinates.size())
lapDataCompCoordinates.append(LapDataCompCoordinates(i, (int)dx2, (int)dy2, k));
else
lapDataCompCoordinates[lapsInWindow] = LapDataCompCoordinates(i, (int)dx2, (int)dy2, k);
}
++lapsInWindow;
int pointSize = 3;
if (EventData::getInstance().getEventType() == LTPackets::RACE_EVENT)
{
p->drawLine(dx1, dy1, dx2, dy2);
pointSize = 2;
}
p->setBrush(QBrush(ColorsManager::getInstance().getCarColor(driverData[k]->getNumber())));
QPainterPath path;
if (y2[k] <= paintRect.bottom())
{
if (ld.getTime().toString() == "IN PIT")
path.addEllipse(QPoint(j[k], y2[k]), 6, 6);
else
path.addEllipse(QPoint(j[k], y2[k]), pointSize, pointSize);
p->drawPath(path);
}
drawRetire(p, dx2, dy2, 6, ld);
}
y1[k] = y2[k];
x[k] = j[k];
j[k] += xFactor;
++index[k];
}
else
{
x[k] += xFactor;
j[k] = x[k];
}
}
}
clearLapDataCoordinates(lapsInWindow);
}
void LapCompChart::paintEvent(QPaintEvent *)
{
resetPaintRect();
if (scaleRect.width() == 0 && scaleRect.height() == 0)
{
resetZoom();
}
QPainter p;
p.begin(this);
drawChart(&p);
if (scaling)
drawScaleRect(&p);
else
{
if (!repaintPopup)
checkLapDataCoordinates(mousePosX, mousePosY);
popupBox->paint(&p, mousePosX, mousePosY, paintRect);
}
p.end();
}
void LapCompChart::drawLegend(QPainter *p)
{
p->setRenderHint(QPainter::Antialiasing, false);
p->setBrush(QColor(20, 20, 20));
int yy = 0;
for (int i = 0; i < 4; ++i)
{
if (driverData[i] != 0 && driverData[i]->getCarID() > 0)
{
p->setPen(QColor(20, 20, 20));
p->drawRect(40, yy, 115, 20);
p->setPen(ColorsManager::getInstance().getCarColor(driverData[i]->getNumber()));
p->drawText(45, yy+20, driverData[i]->getDriverName());
yy += 20;
}
}
if (yy > 5)
{
p->setBrush(QBrush());
p->setPen(ColorsManager::getInstance().getDefaultColor(LTPackets::DEFAULT));
p->drawRect(40, 5, 115, yy);
}
}
int LapCompChart::checkLapDataCoordinates(int x, int y)
{
if (popupBox != 0)
{
popupBox->values.clear();
for (int i = 0; i < lapDataCompCoordinates.size(); ++i)
{
if (std::abs((float)(lapDataCompCoordinates[i].x - x)) <= 3 && std::abs((float)(lapDataCompCoordinates[i].y - y)) <= 3 &&
driverData[lapDataCompCoordinates[i].driverIdx] != 0)
{
LapData ld = driverData[lapDataCompCoordinates[i].driverIdx]->getLapData(lapDataCompCoordinates[i].idx);
popupBox->values.append(ld);
popupBox->title = "LAP: " + QString::number(ld.getLapNumber());
}
}
popupBox->sortValues();
return popupBox->values.size();
}
return 0;
}
void LapCompChart::drawIntoImage(QImage &img)
{
QPainter p;
p.begin(&img);
p.setBrush(QColor(20,20,20));
p.setPen(QColor(20,20,20));
p.drawRect(0, 0, width(), height());
drawChart(&p);
drawLegend(&p);
p.end();
}
void LapCompChart::resetZoom()
{
ChartWidget::resetZoom();
first = 1; last = 99;
}
void LapCompChart::calculateTransformFactors()
{
int firstLap, lastLap;
findFirstAndLastLap(firstLap, lastLap);
int sz = lastLap-firstLap+1;
double xFactor = ((double)paintRect.width()) / ((double)sz);
double yFactor = (((double)paintRect.height()) / (double)(tMax - tMin));
first = firstLap + ceil((scaleRect.left() - paintRect.left()) / xFactor);
if (first < 1)
first = 1;
last = first + ceil((scaleRect.right() - scaleRect.left()) / xFactor);
if (first >= last)
first = last - 1;
tMin = tMin + ceil((paintRect.bottom() - scaleRect.bottom()) / yFactor)-1;
if (tMin < min)
tMin = min;
tMax = tMin + ceil((scaleRect.bottom() - scaleRect.top()) / yFactor);
}
//========================================================================
//double GapCompChart::calculateInterval(int lap)
//{
// LapData ld1 = (driverIdx[0] >= 0) ? eventData.getDriversData()[driverIdx[0]].getLapData(lap) : LapData();
// LapData ld2 = (driverIdx[1] >= 0) ? eventData.getDriversData()[driverIdx[1]].getLapData(lap) : LapData();
// QString gap1 = ld1.getGap();
// QString gap2 = ld2.getGap();
// if ((ld1.getTime().toString() == "" && ld1.getGap() == "") || (ld2.getTime().toString() == "" && ld2.getGap() == ""))
// return 0.0;
// if ((gap1 != "" && gap2 != "" && gap1[gap1.size()-1] != 'L' && gap2[gap2.size()-1] != 'L') ||
// ((ld1.getPosition() == 1 && gap1.isNull()) || (ld2.getPosition() == 1 && gap2.isNull())))
// {
// double interval = gap1.toDouble() - gap2.toDouble();
// return interval;
// }
// else if ((gap1 != "" && gap1[gap1.size()-1] == 'L') || (gap2 != "" && gap2[gap2.size()-1] == 'L'))
// {
// int pos1 = ld1.getPosition();
// int pos2 = ld2.getPosition();
// bool neg = true;
// if (pos2 < pos1)
// {
// int tmp = pos1;
// pos1 = pos2;
// pos2 = tmp;
// neg = false;
// }
// QList<QString> intervals;
//// intervals.reserve(pos2 - pos1);
// for (int i = 0; i < eventData.getDriversData().size(); ++i)
// {
// LapData ld = eventData.getDriversData()[i].getLapData(lap);
// int pos = ld.getPosition();
// if (pos > pos1 && pos <= pos2)
// {
// if (ld.getInterval() != "" && ld.getInterval()[ld.getInterval().size()-1] == 'L')
// return neg ? -1000.0 : 1000.0;
// intervals.append(ld.getInterval());
// }
// }
// double interval = 0.0;
// for (int i = 0; i < intervals.size(); ++i)
// interval += intervals[i].toDouble();
// if (neg && ld1.getTime().isValid() && interval > ld1.getTime().toDouble())
// return -1000.0;
// if (!neg && ld2.getTime().isValid() && interval > ld2.getTime().toDouble())
// return 1000.0;
// return neg ? -interval : interval;
// }
// return 0.0;
//}
void GapCompChart::drawAxes(QPainter *p, int firstLap, int lastLap)
{
p->setPen(QColor(ColorsManager::getInstance().getDefaultColor(LTPackets::WHITE)));
//x axe
p->drawLine(paintRect.left(), paintRect.bottom(), paintRect.right(), paintRect.bottom());
//y axe
p->drawLine(paintRect.left(), paintRect.bottom(), paintRect.left(), paintRect.top());
p->setFont(QFont("Arial", 10));
p->setPen(QColor(ColorsManager::getInstance().getDefaultColor(LTPackets::WHITE)));
if (tMax == max && max >= 60)
{
max = 60;
tMax = 60;
}
double yFactor = (double)(paintRect.height()/6.0);
double yFactor2 = (double)((tMax-tMin)/6.0);
double j = tMin;
for (int i = paintRect.bottom(); i > 10; i-= yFactor, j += yFactor2)
{
p->setPen(QColor(ColorsManager::getInstance().getDefaultColor(LTPackets::WHITE)));
p->drawText(5, i+5, QString("%1").arg(j, 0, 'f', 1));
if (i != paintRect.bottom())
{
QPen pen(QColor(ColorsManager::getInstance().getDefaultColor(LTPackets::DEFAULT)));
pen.setStyle(Qt::DashLine);
p->setPen(pen);
p->drawLine(paintRect.left(), i, paintRect.right(), i);
}
}
if (max == 60)
{
p->setPen(QColor(ColorsManager::getInstance().getDefaultColor(LTPackets::WHITE)));
p->drawText(5, 15, ">60");
QPen pen(QColor(ColorsManager::getInstance().getDefaultColor(LTPackets::DEFAULT)));
pen.setStyle(Qt::DashLine);
p->setPen(pen);
p->drawLine(paintRect.left(), 10, paintRect.right(), 10);
}
if (lastLap - firstLap > 0)
{
double xFactor = ((double)paintRect.width()) / /*((lapData.size() < 5) ?*/ (double)(lastLap - firstLap) /*: 5)*/;
double j = firstLap;
double i = paintRect.left();
int prevJ = firstLap;
double jFactor = (lastLap - firstLap) < 6 ? 1.0 : (double)((lastLap - firstLap)/6.0);
for (; i < width()-15.0 && round(j) < lastLap; /*i += xFactor,*/ j += jFactor)
{
i += (double)(round(j) - prevJ) * xFactor;
prevJ = round(j);
p->setPen(QColor(ColorsManager::getInstance().getDefaultColor(LTPackets::WHITE)));
p->drawText(round(i)-5, height()-10, QString("L%1").arg(round(j)));
if (i > paintRect.left())
{
QPen pen(QColor(ColorsManager::getInstance().getDefaultColor(LTPackets::DEFAULT)));
pen.setStyle(Qt::DashLine);
p->setPen(pen);
p->drawLine(round(i), paintRect.bottom(), round(i), paintRect.top());
}
}
}
}
void GapCompChart::findFirstAndLastLap(int &firstLap, int &lastLap)
{
firstLap = 99, lastLap = 0;
for (int i = 0; i < 2; ++i)
{
DriverData *dd = driverIdx[i] >= 0 ? &eventData.getDriversData()[driverIdx[i]] : 0;
if (dd != 0 && !dd->getLapData().isEmpty())
{
for (int j = 0; j < dd->getLapData().size(); ++j)
{
if (dd->getLapData()[j].getLapNumber() < firstLap && dd->getLapData()[j].getLapNumber() >= first)
firstLap = dd->getLapData()[j].getLapNumber();
if (dd->getLapData()[j].getLapNumber() > lastLap && dd->getLapData()[j].getLapNumber() <= last)
lastLap = dd->getLapData()[j].getLapNumber();
}
}
}
}
void GapCompChart::drawChart(QPainter *p)
{
int firstLap = 99, lastLap = 0;
double x[2] = {(double)paintRect.left(), (double)paintRect.left()};
double y1[2];
double y2[2];
findFirstAndLastLap(firstLap, lastLap);
int index[2] = {0,0};
min = 0.0; max = 0.0;
QList<QString> intervals;
for (int i = firstLap; i <= lastLap; ++i)
{
DriverData *dd1 = (driverIdx[0] >= 0) ? &eventData.getDriversData()[driverIdx[0]] : 0;
DriverData *dd2 = (driverIdx[1] >= 0) ? &eventData.getDriversData()[driverIdx[1]] : 0;
if (dd1 != 0 && dd2 != 0)
{
intervals.append(eventData.calculateInterval(*dd1, *dd2, i));
if (intervals.last() == "-1L <")
intervals.last() = "-1000.0";
else if (intervals.last() == "+1L <")
intervals.last() = "1000.0";
else if (intervals.last() == "")
intervals.last() = "0.0";
double interval = fabs(intervals.last().toDouble());
if (interval > max)
{
max = interval;
tMax = max;
}
}
}
if (max != 1000)
{
max += max * 0.05;
tMax = max;
}
drawAxes(p, firstLap, lastLap);
if (lastLap - firstLap == 0)
return;
double xFactor = ((double)paintRect.width()) / (double)(lastLap - firstLap);
double yFactor = (((double)paintRect.height()) / (double)(tMax-tMin));
p->setRenderHint(QPainter::Antialiasing);
double j[2] = {(x[0]), (x[0])};
int lapsInWindow = 0;
int lastPaintedSC= 0;
for (int i = firstLap; i <= lastLap; ++i)
{
for (int k = 0; k < 2; ++k)
{
DriverData *dd = (driverIdx[k] >= 0) ? &eventData.getDriversData()[driverIdx[k]] : 0;
if (dd == 0)
continue;
LapData ld = dd->getLapData(i);
// if (!dd.lapData.empty() && index[k] < dd.lapData.size() && dd.getLapData()[index[k]].getLapNumber() == i)
if (ld.getCarID() == dd->getCarID() && ld.getLapNumber() == i && !ld.getTime().toString().contains("LAP"))
{
if (ld.getRaceLapExtraData().isSCLap() && ld.getLapNumber() > lastPaintedSC)
{
drawSCLap(p, ld, xFactor);
lastPaintedSC = ld.getLapNumber();
}
QPen pen;
pen.setWidth(2);
pen.setColor(ColorsManager::getInstance().getCarColor(dd->getNumber()));
p->setPen(pen);
double driverY = fabs(intervals[i-firstLap].toDouble());
double gap = driverY;
int idx = i - firstLap;
if (driverY == 0 && (i+1-firstLap) < intervals.size())
{
idx = i + 1 - firstLap;
driverY = fabs(intervals[idx].toDouble());
}
if ((k == 0 && intervals[idx].toDouble() < 0) || (k == 1 && intervals[idx].toDouble() > 0))
{
gap = 0;
driverY = 0;
}
if (driverY > max) driverY = max;
y2[k] = (double)(paintRect.bottom() - (driverY - tMin) * yFactor);
if (index[k] == 0)
y1[k] = y2[k];
if (!(y1[k] > paintRect.bottom() && y2[k] > paintRect.bottom()))
{
double dx1 = x[k], dx2 = j[k], dy1 = y1[k], dy2 = y2[k];
checkX1(dx1, dy1, dx2, dy2);
checkX2(dx1, dy1, dx2, dy2);
int pointSize = 3;
if (EventData::getInstance().getEventType() == LTPackets::RACE_EVENT)
{
pointSize = 2;
p->drawLine(dx1, dy1, dx2, dy2);
}
QPainterPath path;
p->setBrush(QBrush(ColorsManager::getInstance().getCarColor(dd->getNumber())));
if (y2[k] <= paintRect.bottom())
{
if (ld.getTime().toString() == "IN PIT")
path.addEllipse(QPoint(j[k], y2[k]), 6, 6);
else
path.addEllipse(QPoint(j[k], y2[k]), pointSize, pointSize);
p->drawPath(path);
if (!scaling)
{
if (lapsInWindow >= lapDataGapCompCoordinates.size())
lapDataGapCompCoordinates.append(LapDataGapCompCoordinates(i, (int)dx2, (int)dy2, k, gap));
else
lapDataGapCompCoordinates[lapsInWindow] = LapDataGapCompCoordinates(i, (int)dx2, (int)dy2, k, gap);
}
++lapsInWindow;
}
drawRetire(p, dx2, dy2, 6, ld);
}
y1[k] = y2[k];
x[k] = j[k];
j[k] += xFactor;
++index[k];
}
else
{
x[k] += xFactor;
j[k] = x[k];
}
}
}
clearLapDataCoordinates(lapsInWindow);
}
void GapCompChart::paintEvent(QPaintEvent *)
{
resetPaintRect();
if (scaleRect.width() == 0 && scaleRect.height() == 0)
{
resetZoom();
}
QPainter p;
p.begin(this);
drawChart(&p);
if (scaling)
drawScaleRect(&p);
else
{
if (!repaintPopup)
checkLapDataCoordinates(mousePosX, mousePosY);
popupBox->paint(&p, mousePosX, mousePosY, paintRect);
}
p.end();
}
void GapCompChart::drawLegend(QPainter *p)
{
p->setRenderHint(QPainter::Antialiasing, false);
p->setBrush(QColor(20, 20, 20));
p->setPen(ColorsManager::getInstance().getDefaultColor(LTPackets::DEFAULT));
p->drawRect(40, 5, 115, 45);
double yy = 0.0;
for (int i = 0; i < 2; ++i)
{
DriverData *dd = driverIdx[i] >= 0 ? &eventData.getDriversData()[driverIdx[i]] : 0;
if (dd != 0 && dd->getCarID() > 0)
{
p->setPen(ColorsManager::getInstance().getCarColor(dd->getNumber()));
p->drawText(45, yy+20, dd->getDriverName());
yy += 20;
}
}
}
int GapCompChart::checkLapDataCoordinates(int x, int y)
{
if (popupBox != 0)
{
PopupGapCompInfoBox *box = static_cast<PopupGapCompInfoBox*>(popupBox);
box->values.clear();
box->gapValues.clear();
for (int i = 0; i < lapDataGapCompCoordinates.size(); ++i)
{
if (std::abs((float)(lapDataGapCompCoordinates[i].x - x)) <= 3 && std::abs((float)(lapDataGapCompCoordinates[i].y - y)) <= 3)
{
DriverData *dd = driverIdx[lapDataGapCompCoordinates[i].driverIdx] >= 0 ?
&EventData::getInstance().getDriversData()[driverIdx[lapDataGapCompCoordinates[i].driverIdx]] : 0;
if (dd != 0 && dd->getCarID() != -1)
{
LapData ld = dd->getLapData(lapDataGapCompCoordinates[i].idx);
box->values.append(ld);
box->gapValues.append(lapDataGapCompCoordinates[i].gap);
box->title = "LAP: " + QString::number(ld.getLapNumber());
}
}
}
box->sortValues();
return box->values.size();
}
return 0;
}
void GapCompChart::drawIntoImage(QImage &img)
{
QPainter p;
p.begin(&img);
p.setBrush(QColor(20,20,20));
p.setPen(QColor(20,20,20));
p.drawRect(0, 0, width(), height());
drawChart(&p);
drawLegend(&p);
p.end();
}
void GapCompChart::resetZoom()
{
ChartWidget::resetZoom();
first = 1; last = 99;
}
void GapCompChart::calculateTransformFactors()
{
int firstLap, lastLap;
findFirstAndLastLap(firstLap, lastLap);
int sz = lastLap-firstLap+1;
double xFactor = ((double)paintRect.width()) / ((double)sz);
double yFactor = (((double)paintRect.height()) / (double)(tMax - tMin));
first = firstLap + ceil((scaleRect.left() - paintRect.left()) / xFactor);
if (first < 1)
first = 1;
// if (first >= driverData.lapData.size())
// first = driverData.lapData.size() - 1;
last = first + ceil((scaleRect.right() - scaleRect.left()) / xFactor);
if (first >= last)
first = last - 1;
// if (last >= driverData.lapData.size())
// last = driverData.lapData.size() - 1;
tMin = tMin + ceil((paintRect.bottom() - scaleRect.bottom()) / yFactor)-1;
if (tMin < min)
tMin = min;
tMax = tMin + ceil((scaleRect.bottom() - scaleRect.top()) / yFactor);
}
//=========================================================
void PosCompChart::drawAxes(QPainter *p, int firstLap, int lastLap)
{
p->setPen(QColor(ColorsManager::getInstance().getDefaultColor(LTPackets::WHITE)));
//x axe
p->drawLine(paintRect.left(), paintRect.bottom(), paintRect.right(), paintRect.bottom());
//y axe
p->drawLine(paintRect.left(), paintRect.bottom(), paintRect.left(), paintRect.top());
p->setFont(QFont("Arial", 10));
p->setPen(QColor(ColorsManager::getInstance().getDefaultColor(LTPackets::WHITE)));
double yFactor = (double)(paintRect.height()/6.0);
double yFactor2 = (double)((tMax-tMin)/6.0);
double j = tMin;
for (int i = paintRect.bottom(); i >= paintRect.top(); i-= yFactor, j += yFactor2)
{
p->setPen(QColor(ColorsManager::getInstance().getDefaultColor(LTPackets::WHITE)));
p->drawText(5, i+5, QString("%1").arg(round(j)));
if (i != paintRect.bottom())
{
QPen pen(QColor(ColorsManager::getInstance().getDefaultColor(LTPackets::DEFAULT)));
pen.setStyle(Qt::DashLine);
p->setPen(pen);
p->drawLine(paintRect.left(), i, paintRect.right(), i);
}
}
if (lastLap - firstLap > 0)
{
double xFactor = ((double)paintRect.width()) / /*((lapData.size() < 5) ?*/ (double)(lastLap - firstLap) /*: 5)*/;
double j = firstLap;
double i = paintRect.left();
int prevJ = firstLap;
double jFactor = (lastLap - firstLap) < 6 ? 1.0 : (double)((lastLap - firstLap)/6.0);
for (; i < width()-15.0 && round(j) < lastLap; /*i += xFactor,*/ j += jFactor)
{
i += (double)(round(j) - prevJ) * xFactor;
prevJ = round(j);
p->setPen(QColor(ColorsManager::getInstance().getDefaultColor(LTPackets::WHITE)));
p->drawText(round(i)-5, height()-10, QString("L%1").arg(round(j)));
if (i > paintRect.left())
{
QPen pen(QColor(ColorsManager::getInstance().getDefaultColor(LTPackets::DEFAULT)));
pen.setStyle(Qt::DashLine);
p->setPen(pen);
p->drawLine(round(i), paintRect.bottom(), round(i), paintRect.top());
}
}
}
// if (lastLap - firstLap > 0)
// {
// double xFactor = (width()-42) / ((lastLap - firstLap < 5) ? lastLap - firstLap : 5);
// double j = firstLap;
// double jFactor = lastLap - firstLap < 5 ? 1.0 : (double)((lastLap - firstLap)/5.0);
// for (int i = 37; i < width()-15 && round(j) < lastLap; i += xFactor, j += jFactor)
// {
// p->setPen(QColor(ColorsManager::getInstance().getDefaultColor(LTPackets::WHITE]));
// p->drawText(i-5, height()-10, QString("L%1").arg(round(j)));
// if (i > 37)
// {
// QPen pen(QColor(ColorsManager::getInstance().getDefaultColor(LTPackets::DEFAULT]));
// pen.setStyle(Qt::DashLine);
// p->setPen(pen);
// p->drawLine(i, height()-25, i, 10);
// }
// }
// }
}
void PosCompChart::findFirstAndLastLap(int &firstLap, int &lastLap)
{
firstLap = 99, lastLap = 0;
for (int i = 0; i < 2; ++i)
{
if (driverData[i] != 0 && !driverData[i]->getLapData().isEmpty())
{
for (int j = 0; j < driverData[i]->getLapData().size(); ++j)
{
if (driverData[i]->getLapData()[j].getLapNumber() < firstLap && driverData[i]->getLapData()[j].getLapNumber() >= first)
firstLap = driverData[i]->getLapData()[j].getLapNumber();
if (driverData[i]->getLapData()[j].getLapNumber() > lastLap && driverData[i]->getLapData()[j].getLapNumber() <= last)
lastLap = driverData[i]->getLapData()[j].getLapNumber();
}
// msecs = -QTime::fromString(driverData[i].getLapData()[0].getTime(), "m:ss.zzz").msecsTo(QTime::fromString("0:00.000", "m:ss.zzz"));
// secs = (double)(msecs / 1000.0);
//
// if (secs > max) secs = max;
// if (secs < min) secs = min;
}
}
}
void PosCompChart::drawChart(QPainter *p)
{
int firstLap = 99, lastLap = 0;
double x[2] = {(double)paintRect.left(), (double)paintRect.left()};
double y1[2];
double y2[2];
double yFactor = ((double)paintRect.height() / (double)(tMax-tMin));
findFirstAndLastLap(firstLap, lastLap);
drawAxes(p, firstLap, lastLap);
if (lastLap - firstLap == 0)
return;
double xFactor = ((double)paintRect.width()) / (double)(lastLap - firstLap);
p->setRenderHint(QPainter::Antialiasing);
int index[2] = {0,0};
double j[2] = {(x[0]), (x[0])};
int lastPaintedSC = 0;
for (int i = firstLap; i <= lastLap; ++i)
{
for (int k = 0; k < 2; ++k)
{
if (driverData[k] == 0)
continue;
LapData ld = driverData[k]->getLapData(i);
// if (!driverData[k]->lapData.empty() && index[k] < driverData[k]->lapData.size() && driverData[k]->getLapData()[index[k]].getLapNumber() == i)
if (ld.getCarID() == driverData[k]->getCarID() && ld.getLapNumber() == i && !ld.getTime().toString().contains("LAP"))
{
if (ld.getRaceLapExtraData().isSCLap() && ld.getLapNumber() > lastPaintedSC)
{
drawSCLap(p, ld, xFactor);
lastPaintedSC = ld.getLapNumber();
}
QPen pen;
pen.setWidth(2);
pen.setColor(ColorsManager::getInstance().getCarColor(driverData[k]->getNumber()));
p->setPen(pen);
int pos = ld.getPosition();//driverData[k]->getLapData()[index[k]].pos;
y2[k] = (double)(paintRect.bottom() - (double)(pos-tMin) * yFactor);
if (index[k] == 0)
y1[k] = y2[k];
double dx1 = x[k], dx2 = j[k], dy1 = y1[k], dy2 = y2[k];
checkX1(dx1, dy1, dx2, dy2);
checkX2(dx1, dy1, dx2, dy2);
if (EventData::getInstance().getEventType() == LTPackets::RACE_EVENT)
p->drawLine(dx1, dy1, dx2, dy2);
if (y2[k] <= paintRect.bottom())
{
QPainterPath path;
p->setBrush(QBrush(ColorsManager::getInstance().getCarColor(driverData[k]->getNumber())));
if (ld.getTime().toString() == "IN PIT")
path.addEllipse(QPoint(j[k], y2[k]), 6, 6);
else if (EventData::getInstance().getEventType() != LTPackets::RACE_EVENT)
path.addEllipse(QPoint(j[k], y2[k]), 3, 3);
p->drawPath(path);
drawRetire(p, dx2, dy2, 6, ld);
}
y1[k] = y2[k];
x[k] = j[k];
j[k] += xFactor;
++index[k];
}
else
{
x[k] += xFactor;
j[k] = x[k];
}
}
}
}
void PosCompChart::paintEvent(QPaintEvent *)
{
resetPaintRect();
if (scaleRect.width() == 0 && scaleRect.height() == 0)
{
resetZoom();
}
QPainter p;
p.begin(this);
drawChart(&p);
if (scaling)
drawScaleRect(&p);
p.end();
}
void PosCompChart::drawLegend(QPainter *p)
{
p->setRenderHint(QPainter::Antialiasing, false);
p->setBrush(QColor(20, 20, 20));
p->setPen(ColorsManager::getInstance().getDefaultColor(LTPackets::DEFAULT));
p->drawRect(40, 5, 115, 45);
double yy = 0.0;
for (int i = 0; i < 2; ++i)
{
if (driverData[i] != 0 && driverData[i]->getCarID() > 0)
{
p->setPen(ColorsManager::getInstance().getCarColor(driverData[i]->getNumber()));
p->drawText(45, yy+20, driverData[i]->getDriverName());
yy += 20;
}
}
}
void PosCompChart::drawIntoImage(QImage &img)
{
QPainter p;
p.begin(&img);
p.setBrush(QColor(20,20,20));
p.setPen(QColor(20,20,20));
p.drawRect(0, 0, width(), height());
drawChart(&p);
drawLegend(&p);
p.end();
}
void PosCompChart::resetZoom()
{
ChartWidget::resetZoom();
first = 1; last = 99;
}
void PosCompChart::calculateTransformFactors()
{
int firstLap, lastLap;
findFirstAndLastLap(firstLap, lastLap);
int sz = lastLap-firstLap+1;
double xFactor = ((double)paintRect.width()) / ((double)sz);
double yFactor = (((double)paintRect.height()) / (double)(tMax - tMin));
first = firstLap + ceil((scaleRect.left() - paintRect.left()) / xFactor);
if (first < 1)
first = 1;
last = first + ceil((scaleRect.right() - scaleRect.left()) / xFactor);
if (first >= last)
first = last - 1;
tMin = tMin + ceil((paintRect.bottom() - scaleRect.bottom()) / yFactor)-1;
if (tMin < min)
tMin = min;
tMax = tMin + ceil((scaleRect.bottom() - scaleRect.top()) / yFactor);
}
| zywhlc-f1lt | src/charts/lapcompchart.cpp | C++ | gpl3 | 40,286 |
/*******************************************************************************
* *
* F1LT - unofficial Formula 1 live timing application *
* Copyright (C) 2012-2013 Mariusz Pilarek (pieczaro@gmail.com) *
* *
* 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 *
* the Free Software Foundation, either version 3 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
* *
*******************************************************************************/
#include "sessionlaptimeschart.h"
#include <QDebug>
#include <QPainter>
#include "../core/colorsmanager.h"
bool lessThan(LapData ld1, LapData ld2)
{
if (ld1.getCarID() > 0 && ld2.getCarID() > 0)
{
DriverData dd1 = EventData::getInstance().getDriversData()[ld1.getCarID()-1];
DriverData dd2 = EventData::getInstance().getDriversData()[ld2.getCarID()-1];
if (dd1.getPosition() > dd2.getPosition())
return true;
if (dd1.getPosition() < dd2.getPosition())
return false;
if (dd1.getPosition() == dd2.getPosition())
{
if (dd1.getCarID() != dd2.getCarID())
return dd1.getCarID() < dd2.getCarID();
if (ld1.getLapNumber() < ld2.getLapNumber())
return true;
}
}
return false;
}
void SessionLapTimesChart::findFirstAndLastLap(int &firstLap, int &lastLap, int &size)
{
firstLap = 99, lastLap = 0, size = 0;
double lMin = 99999999.0, lMax = 0.0;
for (int j = 0; j < lapDataArray.size(); ++j)
{
if (lapDataArray[j].getLapNumber() < firstLap && lapDataArray[j].getLapNumber() >= first)
firstLap = lapDataArray[j].getLapNumber();
if (lapDataArray[j].getLapNumber() > lastLap && lapDataArray[j].getLapNumber() <= last)
lastLap = lapDataArray[j].getLapNumber();
if (lapDataArray[j].getLapNumber() >= first && lapDataArray[j].getLapNumber() <= last && lapDataArray[j].getTime().toDouble() < lMin && lapDataArray[j].getTime().isValid())
lMin = lapDataArray[j].getTime().toDouble();
if (lapDataArray[j].getLapNumber() >= first && lapDataArray[j].getLapNumber() <= last && lapDataArray[j].getTime().toDouble() > lMax && lapDataArray[j].getTime().isValid())
lMax = lapDataArray[j].getTime().toDouble();
if (lapDataArray[j].getLapNumber() >= first && lapDataArray[j].getLapNumber() <= last)
++size;
}
if (lMax != 0)
{
max = (double)(lMax + lMax * 0.01);
min = (double)(lMin - lMin * 0.01);
if (max > 180)
max = 180;
if (min < 0)
min = 0;
}
}
void SessionLapTimesChart::drawAxes(QPainter *p, int firstLap, int lastLap)
{
p->setPen(QColor(ColorsManager::getInstance().getDefaultColor(LTPackets::WHITE)));
//x axe
p->drawLine(paintRect.left(), paintRect.bottom(), paintRect.right(), paintRect.bottom());
//y axe
p->drawLine(paintRect.left(), paintRect.bottom(), paintRect.left(), paintRect.top());
p->setFont(QFont("Arial", 10, QFont::Bold, false));
p->setPen(QColor(ColorsManager::getInstance().getDefaultColor(LTPackets::WHITE)));
double yFactor = (double)((paintRect.height())/10.0);
double yFactor2 = (double)((tMax-tMin)/10.0);
double j = tMin;
for (double i = paintRect.bottom(); i >= 10; i-= yFactor, j += yFactor2)
{
p->setPen(QColor(ColorsManager::getInstance().getDefaultColor(LTPackets::WHITE)));
int msecs = j * 1000;
LapTime lt(msecs);
QString str = lt.toString();
int idx = str.indexOf(".");
if (idx != -1)
str = str.left(idx+2);
p->drawText(5, i+5, str);//QString("%1").arg(j, 0, 'f', 1));
if (i != paintRect.bottom())
{
QPen pen(QColor(ColorsManager::getInstance().getDefaultColor(LTPackets::DEFAULT)));
pen.setStyle(Qt::DashLine);
p->setPen(pen);
p->drawLine(paintRect.left(), i, paintRect.right(), i);
}
}
if (lastLap - firstLap > 0)
{
double xFactor = ((double)paintRect.width()) / /*((lapData.size() < 5) ?*/ (double)(lastLap - firstLap) /*: 5)*/;
double j = firstLap;
double i = paintRect.left();
int prevJ = firstLap;
double jFactor = (lastLap - firstLap) < 6 ? 1.0 : (double)((lastLap - firstLap) / 10.0);
for (; i < width()-15.0 && round(j) < lastLap; /*i += xFactor,*/ j += jFactor)
{
i += (double)(round(j) - prevJ) * xFactor;
prevJ = round(j);
p->setPen(QColor(ColorsManager::getInstance().getDefaultColor(LTPackets::WHITE)));
p->drawText(round(i)-5, height()-10, QString("L%1").arg(round(j)));
if (i > paintRect.left())
{
QPen pen(QColor(ColorsManager::getInstance().getDefaultColor(LTPackets::DEFAULT)));
pen.setStyle(Qt::DashLine);
p->setPen(pen);
p->drawLine(round(i), paintRect.bottom(), round(i), paintRect.top());
}
}
}
}
void SessionLapTimesChart::drawChart(QPainter *p)
{
int firstLap = first, lastLap = last;
double x = paintRect.left();
double y;
double yFactor = (((double)paintRect.height()) / (double)(tMax-tMin));
double secs;
int size;
findFirstAndLastLap(firstLap, lastLap, size);
firstLap = first; lastLap = last;
if (/*lastLap - firstLap == 0 ||*/ lapDataArray.isEmpty())
return;
drawAxes(p, firstLap, lastLap);
double xFactor = ((double)paintRect.width()) / (double)(lastLap - firstLap);
p->setRenderHint(QPainter::Antialiasing);
int lastPaintedSC = -1;
// lapDataXYArray.clear();
int lapsInWindow = 0;
for (int i = 0; i < lapDataArray.size(); ++i)
{
if (lapDataArray[i].getLapNumber() >= firstLap && lapDataArray[i].getLapNumber() <= lastLap)// && lapDataArray[i].getTime().isValid())
{
secs = lapDataArray[i].getTime().toDouble();
if (!lapDataArray[i].getTime().isValid() && lapDataArray[i].getLapNumber()-1 >= firstLap && i > 0)// && i < lapDataArray.size()-1)
{
secs = lapDataArray[i-1].getTime().toDouble();
if (!lapDataArray[i-1].getTime().isValid() && lapDataArray[i].getLapNumber()+1 <= lastLap && i < lapDataArray.size()-1)
{
QString pl = EventData::getInstance().getDriversData()[lapDataArray[i].getCarID()-1].getPitTime(lapDataArray[i].getLapNumber());
secs = LapTime(lapDataArray[i+1].getTime() + LapTime(pl) + LapTime(5000)).toDouble();
}
}
if (lapDataArray[i].getRaceLapExtraData().isSCLap() && !lapDataArray[i].getGap().contains("L") && lapDataArray[i].getLapNumber() > lastPaintedSC)
{
drawSCLap(p, lapDataArray[i], xFactor);
lastPaintedSC = lapDataArray[i].getLapNumber();
}
// if (lapDataArray[i].getRaceLapExtraData().isSCLap() && lapDataArray[i].getLapNumber() > lastPaintedSC)
// {
// double sc_x1 = (double)(lapDataArray[i].getLapNumber() - firstLap) * xFactor + (double)paintRect.left();
// double sc_x2 = (double)(lapDataArray[i].getLapNumber()+1 - firstLap) * xFactor + (double)paintRect.left();
// if (sc_x1 < paintRect.left())
// sc_x1 = paintRect.left();
// if (lastPaintedSCPixel == -1)
// lastPaintedSCPixel = round(sc_x2);
// else if (abs(round(sc_x1) - lastPaintedSCPixel) <= 5)
// {
// sc_x1 = (double)lastPaintedSCPixel;
// lastPaintedSCPixel = round(sc_x2);
// }
// p->setPen(QColor(255, 255, 0, 0));
// p->setBrush(QBrush(QColor(255, 255, 0, 35)));
// p->drawRect(round(sc_x1), paintRect.top(), round(sc_x2-sc_x1), paintRect.height());
// lastPaintedSC = lapDataArray[i].getLapNumber();
// }
if (secs > tMax && tMax == max)
secs = tMax;
// if (secs < tMin)
// secs = tMin;
y = (double)(paintRect.bottom() - (double)(secs-tMin) * yFactor);
x = (double)(lapDataArray[i].getLapNumber() - firstLap) * xFactor + (double)paintRect.left();
//int no = EventData::getInstance()lapDataArray[i].getCarID()
QColor color = getCarColor(lapDataArray[i]);
QPen pen;
pen.setWidth(3);
pen.setColor(color);
p->setPen(pen);
QPainterPath path;
if (!scaling)
{
if (lapsInWindow >= lapDataCoordinates.size())
lapDataCoordinates.append(LapDataCoordinates(i, (int)x, (int)y));
else
lapDataCoordinates[lapsInWindow] = LapDataCoordinates(i, (int)x, (int)y);
}
// p->setBrush(QBrush(ColorsManager::getInstance().getDefaultColor(LTPackets::BACKGROUND]));
p->setBrush(QBrush(color));
if (y < paintRect.bottom())
{
if (lapDataArray[i].getTime().toString() == "IN PIT")
{
// p->setBrush(QBrush(QColor()));
path.addEllipse(QPoint(x, y), 7, 7);
}
else
{
path.addEllipse(QPoint(x, y), 2, 2);
}
p->drawPath(path);
}
if (lapDataArray[i].getLapNumber()-1 >= firstLap && i > 0)
{
double x1 = (double)(lapDataArray[i].getLapNumber() - 1 - firstLap) * xFactor + (double)paintRect.left();
secs = lapDataArray[i-1].getTime().toDouble();
if (!lapDataArray[i-1].getTime().isValid() && i-2 >= firstLap)
{
secs = lapDataArray[i-2].getTime().toDouble();
if (!lapDataArray[i-2].getTime().isValid())// && i < lapDataArray.size()-1)
{
QString pl = EventData::getInstance().getDriversData()[lapDataArray[i-1].getCarID()-1].getPitTime(lapDataArray[i-1].getLapNumber());
secs = LapTime(lapDataArray[i].getTime() + LapTime(pl) + LapTime(5000)).toDouble();
}
}
if (secs > tMax && tMax == max)
secs = tMax;
// if (secs < tMin)
// secs = tMin;
double y1 = (double)(paintRect.bottom() - (double)(secs-tMin) * yFactor);
if ((y > paintRect.bottom() && y1 > paintRect.bottom()) || (y < paintRect.top() && y1 < paintRect.top()))
continue;
ChartWidget::checkX1(x1, y1, x, y);
ChartWidget::checkX2(x1, y1, x, y);
p->drawLine(x1, y1, x, y);
drawRetire(p, x, y, 7, lapDataArray[i]);
}
++lapsInWindow;
}
}
if (!scaling)
clearLapDataCoordinates(lapsInWindow);
}
//void SessionLapTimesChart::drawRetire(QPainter *p, int x, int y, const LapData &ld, QColor color)
//{
// if (ld.getCarID() > 0)
// {
// LapData ld2 = EventData::getInstance().getDriverDataById(ld.getCarID()).getLapData(ld.getLapNumber()+1);
// LapData ld3 = EventData::getInstance().getDriverDataById(ld.getCarID()).getLapData(ld.getLapNumber()+2);
// if (ld2.getCarID() == -1 && ld3.getCarID() == -1)
// {
// QPen pen;
// pen.setWidth(3);
// pen.setColor(QColor(255, 0, 0));
// p->setPen(pen);
// p->drawLine(x-5, y-5, x+5, y+5);
// p->drawLine(x-5, y+5, x+5, y-5);
// pen.setColor(QColor(255, 255, 255));
// p->setPen(pen);
// p->setBrush(QColor(255, 0, 0));
// QPainterPath path;
// path.addEllipse(QPoint(x, y), 7, 7);
// p->drawPath(path);
// }
// }
//}
int SessionLapTimesChart::checkLapDataCoordinates(int x, int y)
{
if (popupBox != 0)
{
popupBox->values.clear();
for (int i = 0; i < lapDataCoordinates.size(); ++i)
{
if (std::abs((float)(lapDataCoordinates[i].x - x)) <= 3 && std::abs((float)(lapDataCoordinates[i].y - y)) <= 3 &&
lapDataCoordinates[i].idx < lapDataArray.size())
{
LapData ld = lapDataArray[lapDataCoordinates[i].idx];
popupBox->values.append(ld);
popupBox->title = "LAP: " + QString::number(ld.getLapNumber());
}
}
popupBox->sortValues();
return popupBox->values.size();
}
return 0;
}
QColor SessionLapTimesChart::getCarColor(const LapData &ld)
{
if (ld.getCarID() > 0)
{
DriverData dd = EventData::getInstance().getDriverDataById(ld.getCarID());
return getCarColor(dd);
}
return ColorsManager::getInstance().getDefaultColor(LTPackets::BACKGROUND);
}
QColor SessionLapTimesChart::getCarColor(const DriverData &dd)
{
// QColor color = ColorsManager::getInstance().getDefaultColor(LTPackets::BACKGROUND);
// if (dd.getCarID() > 0)
// {
// int no = dd.getNumber();
// if (no > 0 && no < colors.size()+2)
// color = colors[no <= 12 ? no-1 : no -2];
// }
// return color;
return ColorsManager::getInstance().getCarColor(dd.getNumber());
}
void SessionLapTimesChart::drawIntoImage(QImage &img)
{
QPainter p;
p.begin(&img);
p.setBrush(QColor(20,20,20));
p.setPen(QColor(20,20,20));
p.drawRect(0, 0, width(), height());
drawChart(&p);
p.end();
}
void SessionLapTimesChart::drawImage(QPainter *p)
{
p->drawImage(0, 0, chartImg);
}
void SessionLapTimesChart::paintEvent(QPaintEvent *)
{
resetPaintRect();
if (scaleRect.width() == 0 && scaleRect.height() == 0)
{
resetZoom();
}
if (!scaling && !repaintPopup)
{
chartImg = QImage(width(), height(), QImage::Format_ARGB32);
drawIntoImage(chartImg);
}
QPainter p;
p.begin(this);
// p.setBrush(QColor(20,20,20));
// p.setPen(QColor(20,20,20));
// p.drawRect(0, 0, width(), height());
// drawChart(&p);
if (!scaling && !repaintPopup)
{
drawImage(&p);
checkLapDataCoordinates(mousePosX, mousePosY);
popupBox->paint(&p, mousePosX, mousePosY, paintRect);
}
if (scaling)
{
drawImage(&p);
drawScaleRect(&p);
}
if (repaintPopup)
{
drawImage(&p);
popupBox->paint(&p, mousePosX, mousePosY, paintRect);
}
p.end();
if (lapDataArray.isEmpty())
clearLapDataCoordinates(0);
}
void SessionLapTimesChart::resetZoom()
{
first = 1; last = 99;
int firstLap, lastLap, size;
findFirstAndLastLap(firstLap, lastLap, size);
first = 1; last = EventData::getInstance().getEventInfo().laps;
tMin = min;
tMax = max;
}
void SessionLapTimesChart::calculateTransformFactors()
{
int firstLap, lastLap, size;
findFirstAndLastLap(firstLap, lastLap, size);
int sz = last-first+1;
double xFactor = ((double)paintRect.width()) / ((double)sz);
double yFactor = (((double)paintRect.height()) / (double)(tMax - tMin));
first = firstLap + ceil((scaleRect.left() - paintRect.left()) / xFactor);
if (first < 1)
first = 1;
// if (first >= driverData.lapData.size())
// first = driverData.lapData.size() - 1;
last = first + ceil((scaleRect.right() - scaleRect.left()) / xFactor);
if (last > EventData::getInstance().getEventInfo().laps)
last = EventData::getInstance().getEventInfo().laps;
tMin = tMin + ceil((paintRect.bottom() - scaleRect.bottom()) / yFactor)-1;
if (tMin < min)
tMin = min;
tMax = tMin + ceil((scaleRect.bottom() - scaleRect.top()) / yFactor);
emit zoomChanged(first, last, tMin, tMax);
}
void SessionLapTimesChart::onZoomOut()
{
ChartWidget::onZoomOut();
if (scaleRectsStack.size() > 1)
emit zoomChanged(first, last, tMin, tMax);
else
emit zoomChanged(first, last, -1, -1);
}
void SessionLapTimesChart::mouseDoubleClickEvent(QMouseEvent *ev)
{
ChartWidget::mouseDoubleClickEvent(ev);
if (!scaling)
emit zoomChanged(first, last, -1, -1);
}
void SessionLapTimesChart::mouseMoveEvent(QMouseEvent *ev)
{
if (scaling)
ChartWidget::mouseMoveEvent(ev);
else
{
mousePosX = ev->pos().x();
mousePosY = ev->pos().y();
if (popupBox != 0)
{
int items = popupBox->values.size();
if (checkLapDataCoordinates(mousePosX, mousePosY))
{
repaintPopup = true;
repaint();
repaintPopup = false;
}
else if (items != 0) //if the cursor has moved and a popup was displayed previously, it has to be cleared
update();
}
}
}
//=========================================================================
void SessionPositionsChart::findFirstAndLastLap(int &firstLap, int &lastLap, int &size)
{
firstLap = 99, lastLap = 0, size = 0;
for (int j = 0; j < lapDataArray.size(); ++j)
{
if (lapDataArray[j].getLapNumber() < firstLap && lapDataArray[j].getLapNumber() >= first)
firstLap = lapDataArray[j].getLapNumber();
if (lapDataArray[j].getLapNumber() > lastLap && lapDataArray[j].getLapNumber() <= last)
lastLap = lapDataArray[j].getLapNumber();
if (lapDataArray[j].getLapNumber() >= first && lapDataArray[j].getLapNumber() <= last)
++size;
}
}
QList<SessionPositionsChart::DriverPosAtom> SessionPositionsChart::getDriverStartingPositions()
{
QList<SessionPositionsChart::DriverPosAtom> positionList;
for (int i = 0; i < EventData::getInstance().getDriversData().size(); ++i)
{
DriverData &dd = EventData::getInstance().getDriversData()[i];
positionList.append(SessionPositionsChart::DriverPosAtom(dd.getStartingPos(), dd.getCarID()));
}
qSort(positionList);
return positionList;
}
int SessionPositionsChart::getDriverStartingPosition(const LapData &ld)
{
DriverData dd = EventData::getInstance().getDriverDataById(ld.getCarID());
if (dd.getCarID() > 0)
return dd.getStartingPos();
return 0;
}
void SessionPositionsChart::drawAxes(QPainter *p, int firstLap, int lastLap)
{
p->setPen(QColor(ColorsManager::getInstance().getDefaultColor(LTPackets::WHITE)));
//x axe
p->drawLine(paintRect.left(), paintRect.top(), paintRect.right(), paintRect.top());
//y axe
p->drawLine(paintRect.left(), paintRect.bottom()-10, paintRect.left(), paintRect.top());
p->setFont(QFont("Arial", 10, QFont::Bold, false));
p->setPen(QColor(ColorsManager::getInstance().getDefaultColor(LTPackets::WHITE)));
QList<SessionPositionsChart::DriverPosAtom> positionList = getDriverStartingPositions();
int chartMin = (tMin == 1 ? 0 : tMin), k = 0;
double yFactor = (double)((paintRect.height())/(tMax-chartMin));
double yFactor2 = 1.0;//(double)((tMax-chartMin)/12.0);
double j = tMin;
for (double i = paintRect.top(); i <= paintRect.bottom(); i+= yFactor, j += yFactor2, ++k)
{
if (firstLap == 0)
{
DriverData dd;
int k = round(j)-1;
if (k >= 0 && k < positionList.size() && positionList[k].id-1 >= 0 && positionList[k].id-1 < EventData::getInstance().getDriversData().size())
dd = EventData::getInstance().getDriversData()[positionList[round(j)-1].id-1];
QColor color = getCarColor(dd.getLastLap());
p->setBrush(color);
p->setPen(color);
p->drawRect(5, i-6, 4, 11);
QString driver = SeasonData::getInstance().getDriverShortName(dd.getDriverName());
p->setPen(QColor(ColorsManager::getInstance().getDefaultColor(LTPackets::WHITE)));
p->drawText(13, i+5, QString("%1 %2").arg(round(j)).arg(driver));
}
if (i != paintRect.top())
{
QPen pen(QColor(ColorsManager::getInstance().getDefaultColor(LTPackets::DEFAULT)));
pen.setStyle(Qt::DashLine);
p->setPen(pen);
p->drawLine(paintRect.left(), i, paintRect.right(), i);
}
}
if (lastLap - firstLap > 0)
{
double xFactor = ((double)paintRect.width()) / /*((lapData.size() < 5) ?*/ (double)(lastLap - firstLap) /*: 5)*/;
double j = firstLap;
double i = paintRect.left();
int prevJ = firstLap;
bool lap1Line = false;
double jFactor = (lastLap - firstLap) < 6 ? 1.0 : (double)((lastLap - firstLap) / 10.0);
for (; i < width()-15.0 && round(j) < lastLap; /*i += xFactor,*/ j += jFactor)
{
i += (double)(round(j) - prevJ) * xFactor;
prevJ = round(j);
p->setPen(QColor(ColorsManager::getInstance().getDefaultColor(LTPackets::WHITE)));
QString lap = QString("L%1").arg(round(j));
if (lap == "L0")
lap = "S";
p->drawText(round(i)-5, 15, lap);
if (i > paintRect.left())
{
QPen pen(QColor(ColorsManager::getInstance().getDefaultColor(LTPackets::DEFAULT)));
pen.setStyle(Qt::DashLine);
p->setPen(pen);
p->drawLine(round(i), paintRect.bottom()-10, round(i), paintRect.top());
}
if (firstLap == 0 && !lap1Line)
{
p->drawText(round(i)-5+xFactor, 15, "L1");
QPen pen(QColor(ColorsManager::getInstance().getDefaultColor(LTPackets::DEFAULT)));
pen.setStyle(Qt::DashLine);
p->setPen(pen);
p->drawLine(round(i) + xFactor, paintRect.bottom()-10, round(i) + xFactor, paintRect.top());
lap1Line = true;
}
}
}
}
void SessionPositionsChart::drawChart(QPainter *p)
{
int firstLap = 99, lastLap = 0;
int chartMin = tMin == 1 ? 0 : tMin;
double left = paintRect.left();
double x = left;
double y;
double yFactor = (((double)paintRect.height()) / (double)(tMax-chartMin));
int size;
findFirstAndLastLap(firstLap, lastLap, size);
firstLap = first; lastLap = last;
double xFactor = ((double)paintRect.width()) / (double)(lastLap - firstLap);
if (firstLap == 1)
{
firstLap = 0;
xFactor = ((double)paintRect.width()) / (double)(lastLap);
}
if (/*lastLap - firstLap == 0 ||*/ lapDataArray.isEmpty())
return;
drawAxes(p, firstLap, lastLap);
p->setRenderHint(QPainter::Antialiasing);
int lastPaintedSC = -1;
for (int i = 0; i < lapDataArray.size(); ++i)
{
if (lapDataArray[i].getLapNumber() >= firstLap && lapDataArray[i].getLapNumber() <= lastLap)// && lapDataArray[i].getTime().isValid())
{
// if (lapDataArray[i].getRaceLapExtraData().isSCLap() && lapDataArray[i].getLapNumber() > lastPaintedSC)
// {
// double sc_x1 = (double)(lapDataArray[i].getLapNumber() - firstLap) * xFactor + left;
// double sc_x2 = (double)(lapDataArray[i].getLapNumber()+1 - firstLap) * xFactor + left;
// if (sc_x1 < paintRect.left())
// sc_x1 = paintRect.left();
// if (lastPaintedSCPixel == -1)
// lastPaintedSCPixel = round(sc_x2);
// else if (abs(round(sc_x1) - lastPaintedSCPixel) <= 5)
// {
// sc_x1 = (double)lastPaintedSCPixel;
// lastPaintedSCPixel = round(sc_x2);
// }
// p->setPen(QColor(255, 255, 0, 0));
// p->setBrush(QBrush(QColor(255, 255, 0, 35)));
// p->drawRect(round(sc_x1), paintRect.top(), round(sc_x2-sc_x1), paintRect.height()-10);
// lastPaintedSC = lapDataArray[i].getLapNumber();
//// lastSCLap = lapDataArray[i].getLapNumber();
// }
if (lapDataArray[i].getRaceLapExtraData().isSCLap() && !lapDataArray[i].getGap().contains("L") && lapDataArray[i].getLapNumber() > lastPaintedSC)
{
int tmp = first;
if (firstLap == 0)
first -= 1;
drawSCLap(p, lapDataArray[i], xFactor);
lastPaintedSC = lapDataArray[i].getLapNumber();
first = tmp;
}
y = (double)(paintRect.top() + (double)(lapDataArray[i].getPosition()-tMin) * yFactor);
x = (double)(lapDataArray[i].getLapNumber() - firstLap) * xFactor + left;
//int no = EventData::getInstance()lapDataArray[i].getCarID()
QColor color = getCarColor(lapDataArray[i]);
QPen pen;
pen.setWidth(3);
pen.setColor(color);
p->setPen(pen);
if (y <= paintRect.bottom())
{
if (lapDataArray[i].getTime().toString() == "IN PIT")
{
QPainterPath path;
p->setBrush(QBrush(color));
path.addEllipse(QPoint(x, y), 7, 7);
p->drawPath(path);
}
}
if (lapDataArray[i].getLapNumber()-1 >= firstLap)//&& i > 0)
{
double x1 = x;
double y1 = y;
if (firstLap == 0 && lapDataArray[i].getLapNumber() == 1)
{
x1 = (double)(lapDataArray[i].getLapNumber() - 1) * xFactor + left;
y1 = (double)(paintRect.top() + (double)(getDriverStartingPosition(lapDataArray[i])-tMin) * yFactor);
}
else if (i > 0)
{
x1 = (double)(lapDataArray[i].getLapNumber() - 1 - firstLap) * xFactor + left;
y1 = (double)(paintRect.top() + (double)(lapDataArray[i-1].getPosition()-tMin) * yFactor);
}
if ((y > paintRect.bottom() && y1 > paintRect.bottom()) || (y < paintRect.top() && y1 < paintRect.top()))
continue;
ChartWidget::checkX1(x1, y1, x, y);
ChartWidget::checkX2(x1, y1, x, y);
p->drawLine(x1, y1, x, y);
drawRetire(p, x, y, 7, lapDataArray[i]);
if (i > 0 && x1 == left && firstLap != 0)
drawDriversLegend(p, lapDataArray[i-1], y1);
}
// drawRetire(p, x, y, lapDataArray[i], color);
}
}
}
void SessionPositionsChart::drawDriversLegend(QPainter *p, const LapData &ld, double y)
{
DriverData dd = EventData::getInstance().getDriverDataById(ld.getCarID());
if (dd.getCarID() > 0)
{
QColor color = getCarColor(dd.getLastLap());
p->setBrush(color);
p->setPen(color);
p->drawRect(5, y-6, 4, 11);
QString driver = SeasonData::getInstance().getDriverShortName(dd.getDriverName());
p->setPen(QColor(ColorsManager::getInstance().getDefaultColor(LTPackets::WHITE)));
p->drawText(13, y+5, QString("%1 %2").arg(ld.getPosition()).arg(driver));
}
}
void SessionPositionsChart::paintEvent(QPaintEvent *)
{
resetPaintRect();
if (scaleRect.width() == 0 && scaleRect.height() == 0)
{
resetZoom();
}
QPainter p;
p.begin(this);
p.setBrush(QColor(20,20,20));
p.setPen(QColor(20,20,20));
p.drawRect(0, 0, width(), height());
drawChart(&p);
if (scaling)
drawScaleRect(&p);
// drawLegend(&p, 35, 5);
p.end();
if (lapDataArray.isEmpty())
clearLapDataCoordinates(0);
}
void SessionPositionsChart::calculateTransformFactors()
{
double tmpMin = tMin;
double yFactor = (((double)paintRect.height()) / (double)(tMax - tmpMin));
SessionLapTimesChart::calculateTransformFactors();
tMin = tmpMin + ceil((paintRect.top() + scaleRect.top()) / yFactor)-2;
tMax = tMin + ceil((scaleRect.bottom() - scaleRect.top()) / yFactor)+1;
if (tMax > max)
tMax = max;
// emit zoomChanged(first, last, tMin, tMax);
}
//=========================================================================
//void SessionGapsChart::resetZoom()
//{
// first = 1; last = 99;
// int firstLap, lastLap, size;
// findFirstAndLastLap(firstLap, lastLap, size);
// tMin = min;
// tMax = max;
//}
//void SessionGapsChart::transform()
//{
// if (scaling || scaleRect == paintRect || (abs(scaleRect.width()) < 20 || abs(scaleRect.height()) < 20))
// return;
// if (scaleRect == QRect())
// {
// first = 1;
// last = 99;
// tMin = min;
// tMax = max;
// return;
// }
// if (scaleRect.left() > scaleRect.right())
// scaleRect = QRect(scaleRect.right(), scaleRect.top(), -scaleRect.width(), scaleRect.height());
// if (scaleRect.top() > scaleRect.bottom())
// scaleRect = QRect(scaleRect.left(), scaleRect.bottom(), scaleRect.width(), -scaleRect.height());
// int firstLap, lastLap, size;
// findFirstAndLastLap(firstLap, lastLap, size);
// int sz = lastLap-firstLap+1;
// double xFactor = ((double)paintRect.width()) / ((double)sz);
// double yFactor = (((double)paintRect.height()) / (double)(tMax - tMin));
// first = firstLap + ceil((scaleRect.left() - paintRect.left()) / xFactor);
// if (first < 1)
// first = 1;
//// if (first >= driverData.lapData.size())
//// first = driverData.lapData.size() - 1;
// last = first + ceil((scaleRect.right() - scaleRect.left()) / xFactor);
//// if (last >= driverData.lapData.size())
//// last = driverData.lapData.size() - 1;
// tMin = tMin + ceil((paintRect.bottom() - scaleRect.bottom()) / yFactor)-1;
// if (tMin < min)
// tMin = min;
// tMax = tMin + ceil((scaleRect.bottom() - scaleRect.top()) / yFactor);
//}
void SessionGapsChart::findFirstAndLastLap(int &firstLap, int &lastLap, int &size)
{
firstLap = 99, lastLap = 0, size = 0;
for (int j = 0; j < lapDataArray.size(); ++j)
{
if (lapDataArray[j].getLapNumber() < firstLap && lapDataArray[j].getLapNumber() >= first)
firstLap = lapDataArray[j].getLapNumber();
if (lapDataArray[j].getLapNumber() > lastLap && lapDataArray[j].getLapNumber() <= last)
lastLap = lapDataArray[j].getLapNumber();
if (lapDataArray[j].getLapNumber() >= first && lapDataArray[j].getLapNumber() <= last)
++size;
}
}
void SessionGapsChart::drawAxes(QPainter *p, int firstLap, int lastLap)
{
p->setPen(QColor(ColorsManager::getInstance().getDefaultColor(LTPackets::WHITE)));
//x axe
p->drawLine(paintRect.left(), paintRect.bottom(), paintRect.right(), paintRect.bottom());
//y axe
p->drawLine(paintRect.left(), paintRect.bottom(), paintRect.left(), paintRect.top());
p->setFont(QFont("Arial", 10, QFont::Bold, false));
p->setPen(QColor(ColorsManager::getInstance().getDefaultColor(LTPackets::WHITE)));
double yFactor = (double)((paintRect.height()-40)/9.0);
double yFactor2 = (double)((tMax-tMin)/9.0);
double j = tMin;
for (double i = paintRect.bottom(); i >= 40; i-= yFactor, j += yFactor2)
{
p->setPen(QColor(ColorsManager::getInstance().getDefaultColor(LTPackets::WHITE)));
p->drawText(5, i+5, QString::number(j, 'f', 0));
if (i != paintRect.bottom())
{
QPen pen(QColor(ColorsManager::getInstance().getDefaultColor(LTPackets::DEFAULT)));
pen.setStyle(Qt::DashLine);
p->setPen(pen);
p->drawLine(paintRect.left(), i, paintRect.right(), i);
}
}
if (tMax >= max)
{
p->setPen(QColor(ColorsManager::getInstance().getDefaultColor(LTPackets::WHITE)));
p->drawText(5, 15, ">1L");
QPen pen(QColor(ColorsManager::getInstance().getDefaultColor(LTPackets::DEFAULT)));
pen.setStyle(Qt::DashLine);
p->setPen(pen);
p->drawLine(paintRect.left(), paintRect.top(), paintRect.right(), paintRect.top());
p->setPen(QColor(ColorsManager::getInstance().getDefaultColor(LTPackets::WHITE)));
p->drawText(5, 35, QString(">%1").arg(max));
pen.setColor(QColor(ColorsManager::getInstance().getDefaultColor(LTPackets::DEFAULT)));
pen.setStyle(Qt::DashLine);
p->setPen(pen);
p->drawLine(paintRect.left(), 30, paintRect.right(), 30);
}
if (lastLap - firstLap > 0)
{
double xFactor = ((double)paintRect.width()) / /*((lapData.size() < 5) ?*/ (double)(lastLap - firstLap) /*: 5)*/;
double j = firstLap;
double i = paintRect.left();
int prevJ = firstLap;
double jFactor = (lastLap - firstLap) < 6 ? 1.0 : (double)((lastLap - firstLap) / 10.0);
for (; i < width()-15.0 && round(j) < lastLap; /*i += xFactor,*/ j += jFactor)
{
i += (double)(round(j) - prevJ) * xFactor;
prevJ = round(j);
p->setPen(QColor(ColorsManager::getInstance().getDefaultColor(LTPackets::WHITE)));
p->drawText(round(i)-5, height()-10, QString("L%1").arg(round(j)));
if (i > paintRect.left())
{
QPen pen(QColor(ColorsManager::getInstance().getDefaultColor(LTPackets::DEFAULT)));
pen.setStyle(Qt::DashLine);
p->setPen(pen);
p->drawLine(round(i), paintRect.bottom(), round(i), paintRect.top());
}
}
}
}
void SessionGapsChart::drawChart(QPainter *p)
{
int firstLap = first, lastLap = last;
double x = paintRect.left();
double y;
double yFactor = (((double)paintRect.height()-40) / (double)(tMax-tMin));
int size;
findFirstAndLastLap(firstLap, lastLap, size);
firstLap = first; lastLap = last;
if (/*lastLap - firstLap == 0 ||*/ lapDataArray.isEmpty())
return;
drawAxes(p, firstLap, lastLap);
double xFactor = ((double)paintRect.width()) / (double)(lastLap - firstLap);
p->setRenderHint(QPainter::Antialiasing);
int lastPaintedSC = -1;
int lapsInWindow = 0;
for (int i = 0; i < lapDataArray.size(); ++i)
{
if (lapDataArray[i].getLapNumber() >= firstLap && lapDataArray[i].getLapNumber() <= lastLap)// && lapDataArray[i].getTime().isValid())
{
// if (lapDataArray[i].getRaceLapExtraData().isSCLap() && lapDataArray[i].getLapNumber() > lastPaintedSC)
// {
// double sc_x1 = (double)(lapDataArray[i].getLapNumber()-1 - firstLap) * xFactor + (double)paintRect.left();
// double sc_x2 = (double)(lapDataArray[i].getLapNumber() - firstLap) * xFactor + (double)paintRect.left();
// if (sc_x1 < paintRect.left())
// sc_x1 = paintRect.left();
// if (lastPaintedSCPixel == -1)
// lastPaintedSCPixel = round(sc_x2);
// else if (abs(round(sc_x1) - lastPaintedSCPixel) <= 5)
// {
// sc_x1 = (double)lastPaintedSCPixel;
// lastPaintedSCPixel = round(sc_x2);
// }
// p->setPen(QColor(255, 255, 0, 0));
// p->setBrush(QBrush(QColor(255, 255, 0, 35)));
// p->drawRect(round(sc_x1), paintRect.top(), round(sc_x2-sc_x1), paintRect.height());
// lastPaintedSC = lapDataArray[i].getLapNumber();
//// lastSCLap = lapDataArray[i].getLapNumber();
// }
if (lapDataArray[i].getRaceLapExtraData().isSCLap() && !lapDataArray[i].getGap().contains("L") && lapDataArray[i].getLapNumber() > lastPaintedSC)
{
drawSCLap(p, lapDataArray[i], xFactor);
lastPaintedSC = lapDataArray[i].getLapNumber();
}
double gap = lapDataArray[i].getGap().toDouble();
if (lapDataArray[i].getGap().size() > 0 && lapDataArray[i].getGap()[lapDataArray[i].getGap().size()-1] == 'L')
{
if (tMax >= max)
gap = -1.0;
else
gap = max;
}
if (lapDataArray[i].getPosition() == 1)
gap = 0.0;
if (tMax >= max && lapDataArray[i].getGap() == "")
gap = -1.0;
y = (double)(paintRect.bottom() - (double)(gap-tMin) * yFactor);
if (gap == -1.0 && tMax >= max)
y = 10;
else if (gap > tMax && tMax >= max)
y = 30;
x = (double)(lapDataArray[i].getLapNumber() - firstLap) * xFactor + (double)paintRect.left();
//int no = EventData::getInstance()lapDataArray[i].getCarID()
QColor color = getCarColor(lapDataArray[i]);
QPen pen;
pen.setWidth(3);
pen.setColor(color);
p->setPen(pen);
if (y <= paintRect.bottom())
{
QPainterPath path;
p->setBrush(QBrush(color));
if (lapDataArray[i].getTime().toString() == "IN PIT")
{
path.addEllipse(QPoint(x, y), 7, 7);
}
else
{
path.addEllipse(QPoint(x, y), 2, 2);
}
p->drawPath(path);
if (!scaling)
{
if (lapsInWindow >= lapDataCoordinates.size())
lapDataCoordinates.append(LapDataCoordinates(i, (int)x, (int)y));
else
lapDataCoordinates[lapsInWindow] = LapDataCoordinates(i, (int)x, (int)y);
}
++lapsInWindow;
}
if (lapDataArray[i].getLapNumber()-1 >= firstLap && i > 0)
{
if (lapDataArray[i].getCarID() == lapDataArray[i-1].getCarID())
{
gap = lapDataArray[i-1].getGap().toDouble();
if (lapDataArray[i-1].getGap().size() > 0 && lapDataArray[i-1].getGap()[lapDataArray[i-1].getGap().size()-1] == 'L')
{
if (tMax >= max)
gap = -1.0;
else
gap = max;
}
if (lapDataArray[i-1].getPosition() == 1)
gap = 0.0;
if (tMax >= max && lapDataArray[i-1].getGap() == "")
gap = -1.0;
double y1 = (double)(paintRect.bottom() - (double)(gap-tMin) * yFactor);
if (gap == -1.0 && tMax >= max)
y1 = 10;
else if (gap > tMax && tMax >= max)
y1 = 30;
double x1 = (double)(lapDataArray[i].getLapNumber() - 1 - firstLap) * xFactor + (double)paintRect.left();
if ((y > paintRect.bottom() && y1 > paintRect.bottom()) || (y < paintRect.top() && y1 < paintRect.top()))
continue;
ChartWidget::checkX1(x1, y1, x, y);
ChartWidget::checkX2(x1, y1, x, y);
if (y1 >= paintRect.top() || y >= paintRect.top())
p->drawLine(x1, y1, x, y);
drawRetire(p, x, y, 7, lapDataArray[i]);
}
}
}
}
if (!scaling)
clearLapDataCoordinates(lapsInWindow);
}
void SessionGapsChart::paintEvent(QPaintEvent *)
{
resetPaintRect();
if (scaleRect.width() == 0 && scaleRect.height() == 0)
{
resetZoom();
}
if (!scaling && !repaintPopup)
{
chartImg = QImage(width(), height(), QImage::Format_ARGB32);
drawIntoImage(chartImg);
}
QPainter p;
p.begin(this);
if (!scaling && !repaintPopup)
{
drawImage(&p);
checkLapDataCoordinates(mousePosX, mousePosY);
popupBox->paint(&p, mousePosX, mousePosY, paintRect);
}
if (scaling)
{
drawImage(&p);
drawScaleRect(&p);
}
if (repaintPopup)
{
drawImage(&p);
popupBox->paint(&p, mousePosX, mousePosY, paintRect);
}
// p.setBrush(QColor(20,20,20));
// p.setPen(QColor(20,20,20));
// p.drawRect(0, 0, width(), height());
// drawChart(&p);
// if (scaling)
// drawScaleRect(&p);
// else
// {
// if (!repaintPopup)
// findLapDataXY(mousePosX, mousePosY);
// drawLapDataXY(&p);
// }
// drawLegend(&p, 35, 5);
p.end();
if (lapDataArray.isEmpty())
clearLapDataCoordinates(0);
}
| zywhlc-f1lt | src/charts/sessionlaptimeschart.cpp | C++ | gpl3 | 42,159 |
/*******************************************************************************
* *
* F1LT - unofficial Formula 1 live timing application *
* Copyright (C) 2012-2013 Mariusz Pilarek (pieczaro@gmail.com) *
* *
* 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 *
* the Free Software Foundation, either version 3 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
* *
*******************************************************************************/
#ifndef WEATHERCHART_H
#define WEATHERCHART_H
#include "chartwidget.h"
#include "../core/eventdata.h"
class WeatherChart : public ChartWidget
{
Q_OBJECT
public:
WeatherChart(QColor col, int id, int id2, QWidget *parent = 0) : ChartWidget(0, 180, col, parent)
{
weatherId = id;
wetDryId = id2;
// menu->removeAction(zoomOutAction);
allowedMin = 0;
}
virtual void drawAxes(QPainter *p);
virtual void drawChart(QPainter *p);
virtual void drawLegend(QPainter *) { }
void drawLine(QPainter *p, int x1, int y1, int x2, int y2);
virtual void setMinMax();
virtual void setAllowedMin(int am) { allowedMin = am; }
void resetZoom();
virtual void calculateTransformFactors();
QString getSessionTime(const WeatherData &wd)
{
QString text = QString("L%1").arg(wd.getLap());
if (EventData::getInstance().getEventType() == LTPackets::PRACTICE_EVENT)
{
QTime t = SeasonData::getInstance().getSessionDefaults().correctFPTime(wd.getSessionTime());
text = QString::number(SeasonData::getInstance().getSessionDefaults().timeToMins(t)) + "'";
}
if (EventData::getInstance().getEventType() == LTPackets::QUALI_EVENT)
{
QTime t = SeasonData::getInstance().getSessionDefaults().correctQualiTime(wd.getSessionTime(), wd.getQualiPeriod());
text = QString("Q%1 %2'").arg(wd.getQualiPeriod()).arg(SeasonData::getInstance().getSessionDefaults().timeToMins(t));
}
return text;
}
protected:
void paintEvent(QPaintEvent *);
virtual void resetPaintRect()
{
paintRect = QRect(40, 10, width()-45, height()-35);
}
int weatherId;
int wetDryId;
int allowedMin; //min could not be below this
};
class TempChart : public WeatherChart
{
Q_OBJECT
public:
TempChart(QColor col, QColor col2, int id, int tempId, int id2, QWidget *parent = 0) : WeatherChart(col, id, id2, parent)
{
trackTempId = tempId;
trackTempCol = col2;
}
void drawAxes(QPainter *p);
void drawChart(QPainter *p);
void drawLegend(QPainter *p);
void setMinMax();
protected:
void paintEvent(QPaintEvent *);
virtual void resetPaintRect()
{
paintRect = QRect(40, 10, width()-45, height()-35);
}
private:
int trackTempId;
QColor trackTempCol;
};
class WetDryChart : public WeatherChart
{
Q_OBJECT
public:
WetDryChart(QColor col, int id, int id2, QWidget *parent = 0) : WeatherChart(col, id, id2, parent)
{
min = 0.0;
max = 1.0;
menu->removeAction(zoomOutAction);
}
protected:
void paintEvent(QPaintEvent *);
virtual void mouseMoveEvent(QMouseEvent *) {}
virtual void mouseReleaseEvent(QMouseEvent *) {}
virtual void mouseDoubleClickEvent (QMouseEvent *) {}
void drawAxes(QPainter *p);
void drawChart(QPainter *p);
void setMinMax() {}
};
#endif // WEATHERCHART_H
| zywhlc-f1lt | src/charts/weatherchart.h | C++ | gpl3 | 4,546 |
/*******************************************************************************
* *
* F1LT - unofficial Formula 1 live timing application *
* Copyright (C) 2012-2013 Mariusz Pilarek (pieczaro@gmail.com) *
* *
* 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 *
* the Free Software Foundation, either version 3 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
* *
*******************************************************************************/
#include "fplaptimeschart.h"
#include "../core/colorsmanager.h"
#include "../core/seasondata.h"
#include <QPainter>
void FPLapTimesChart::findFirstAndLastLap(int &firstMin, int &lastMin, int &size)
{
firstMin = getSessionLength(), lastMin = 0, size = 0;
double lMin = 99999999.0, lMax = 0.0;
for (int j = 0; j < lapDataArray.size(); ++j)
{
int minute = SeasonData::getInstance().getSessionDefaults().getFPLength() - SeasonData::getInstance().getSessionDefaults().timeToMins(lapDataArray[j].getPracticeLapExtraData().getSessionTime());
if (minute < firstMin && minute >= first)
firstMin = minute;
if (minute > lastMin && minute <= last)
lastMin = minute;
if (minute >= first && minute <= last && lapDataArray[j].getTime().toDouble() < lMin && lapDataArray[j].getTime().isValid())
lMin = lapDataArray[j].getTime().toDouble();
if (minute >= first && minute <= last && lapDataArray[j].getTime().toDouble() > lMax && lapDataArray[j].getTime().isValid())
lMax = lapDataArray[j].getTime().toDouble();
if (minute >= first && minute <= last)
++size;
}
if (lMax != 0)
{
max = (double)(lMax + lMax * 0.01);
min = (double)(lMin - lMin * 0.01);
if (max > 180)
max = 180;
if (min < 0)
min = 0;
}
}
int FPLapTimesChart::checkLapDataCoordinates(int x, int y)
{
if (popupBox != 0)
{
popupBox->values.clear();
for (int i = 0; i < lapDataCoordinates.size(); ++i)
{
if (std::abs((float)(lapDataCoordinates[i].x - x)) <= 3 && std::abs((float)(lapDataCoordinates[i].y - y)) <= 3 &&
lapDataCoordinates[i].idx < lapDataArray.size())
{
LapData ld = lapDataArray[lapDataCoordinates[i].idx];
popupBox->values.append(ld);
int min = SeasonData::getInstance().getSessionDefaults().timeToMins(SeasonData::getInstance().getSessionDefaults().correctFPTime(ld.getPracticeLapExtraData().getSessionTime()));
popupBox->title = QString("%1. minute").arg(min);
}
}
popupBox->sortValues();
return popupBox->values.size();
}
return 0;
}
void FPLapTimesChart::drawAxes(QPainter *p, int, int)
{
p->setPen(QColor(ColorsManager::getInstance().getDefaultColor(LTPackets::WHITE)));
//x axe
p->drawLine(paintRect.left(), paintRect.bottom(), paintRect.right(), paintRect.bottom());
//y axe
p->drawLine(paintRect.left(), paintRect.bottom(), paintRect.left(), paintRect.top());
p->setFont(QFont("Arial", 10, QFont::Bold, false));
p->setPen(QColor(ColorsManager::getInstance().getDefaultColor(LTPackets::WHITE)));
double yFactor = (double)((paintRect.height())/10.0);
double yFactor2 = (double)((tMax-tMin)/10.0);
double j = tMin;
for (double i = paintRect.bottom(); i >= 10; i-= yFactor, j += yFactor2)
{
p->setPen(QColor(ColorsManager::getInstance().getDefaultColor(LTPackets::WHITE)));
int msecs = j * 1000;
LapTime lt(msecs);
QString str = lt.toString();
int idx = str.indexOf(".");
if (idx != -1)
str = str.left(idx+2);
p->drawText(5, i+5, str);//QString("%1").arg(j, 0, 'f', 1));
if (i != paintRect.bottom())
{
QPen pen(QColor(ColorsManager::getInstance().getDefaultColor(LTPackets::DEFAULT)));
pen.setStyle(Qt::DashLine);
p->setPen(pen);
p->drawLine(paintRect.left(), i, paintRect.right(), i);
}
}
if (last - first > 0)
{
double xFactor = ((double)paintRect.width()) / /*((lapData.size() < 5) ?*/ (double)(last - first) /*: 5)*/;
double j = first;
double i = paintRect.left();
int prevJ = first;
double jFactor = (last - first) < 6 ? 1.0 : (double)((last - first) / 10.0);
for (; i < width()-15.0 && round(j) < last; /*i += xFactor,*/ j += jFactor)
{
i += (double)(round(j) - prevJ) * xFactor;
prevJ = round(j);
p->setPen(QColor(ColorsManager::getInstance().getDefaultColor(LTPackets::WHITE)));
p->drawText(round(i)-5, height()-10, QString("%1'").arg(round(j)));
if (i > paintRect.left())
{
QPen pen(QColor(ColorsManager::getInstance().getDefaultColor(LTPackets::DEFAULT)));
pen.setStyle(Qt::DashLine);
p->setPen(pen);
p->drawLine(round(i), paintRect.bottom(), round(i), paintRect.top());
}
}
}
}
void FPLapTimesChart::drawChart(QPainter *p)
{
int firstMin = getSessionLength(), lastMin = 0;
double x = paintRect.left();
double y;
double yFactor = (((double)paintRect.height()) / (double)(tMax-tMin));
double secs;
int size;
findFirstAndLastLap(firstMin, lastMin, size);
if (/*lastMin - firstMin == 0 ||*/ lapDataArray.isEmpty())
return;
drawAxes(p, firstMin, lastMin);
double xFactor = ((double)paintRect.width()) / (double)((last - first)*60);
p->setRenderHint(QPainter::Antialiasing);
int lapsInWindow = 0;
for (int i = 0; i < lapDataArray.size(); ++i)
{
int minute = SeasonData::getInstance().getSessionDefaults().getFPLength() - SeasonData::getInstance().getSessionDefaults().timeToMins(lapDataArray[i].getPracticeLapExtraData().getSessionTime());
int second = SeasonData::getInstance().getSessionDefaults().getFPLength()*60 - SeasonData::getInstance().getSessionDefaults().timeToSecs(lapDataArray[i].getPracticeLapExtraData().getSessionTime());
if (lapDataArray[i].getPracticeLapExtraData().getSessionTime().toString("h:mm:ss") == "")
{
minute = 0;
second = 0;
}
if (minute >= first && minute <= last)// && lapDataArray[i].getTime().isValid())
{
secs = lapDataArray[i].getTime().toDouble();
if (secs > tMax && tMax == max)
secs = tMax;
y = (double)(paintRect.bottom() - (double)(secs-tMin) * yFactor);
x = (double)(second - first*60) * xFactor + (double)paintRect.left();
if (x < paintRect.left())
x = paintRect.left();
//int no = EventData::getInstance()lapDataArray[i].carID
QColor color = getCarColor(lapDataArray[i]);
QPen pen;
pen.setWidth(3);
pen.setColor(color);
p->setPen(pen);
if (lapsInWindow >= lapDataCoordinates.size())
lapDataCoordinates.append(LapDataCoordinates(i, (int)x, (int)y));
else
lapDataCoordinates[lapsInWindow] = LapDataCoordinates(i, (int)x, (int)y);
QPainterPath path;
p->setBrush(QBrush(color));
if (y < paintRect.bottom())
{
{
path.addEllipse(QPoint(x, y), 3, 3);
}
p->drawPath(path);
}
++lapsInWindow;
}
}
clearLapDataCoordinates(lapsInWindow);
}
void FPLapTimesChart::paintEvent(QPaintEvent *)
{
resetPaintRect();
if (scaleRect.width() == 0 && scaleRect.height() == 0)
{
resetZoom();
}
if (!scaling && !repaintPopup)
{
chartImg = QImage(width(), height(), QImage::Format_ARGB32);
drawIntoImage(chartImg);
}
QPainter p;
p.begin(this);
// p.setBrush(QColor(20,20,20));
// p.setPen(QColor(20,20,20));
// p.drawRect(0, 0, width(), height());
// drawChart(&p);
if (!scaling && !repaintPopup)
{
drawImage(&p);
checkLapDataCoordinates(mousePosX, mousePosY);
popupBox->paint(&p, mousePosX, mousePosY, paintRect);
}
if (scaling)
{
drawImage(&p);
drawScaleRect(&p);
}
if (repaintPopup)
{
drawImage(&p);
popupBox->paint(&p, mousePosX, mousePosY, paintRect);
}
// QPainter p;
// p.begin(this);
// p.setBrush(QColor(20,20,20));
// p.setPen(QColor(20,20,20));
// p.drawRect(0, 0, width(), height());
// drawChart(&p);
// if (scaling)
// drawScaleRect(&p);
// else
// {
// if (!repaintPopup)
// findLapDataXY(mousePosX, mousePosY);
// drawLapDataXY(&p);
// }
// drawLegend(&p, 35, 5);
p.end();
if (lapDataArray.isEmpty())
clearLapDataCoordinates(0);
}
void FPLapTimesChart::resetZoom()
{
first = 0; last = getSessionLength();
int firstLap, lastLap, size;
findFirstAndLastLap(firstLap, lastLap, size);
tMin = min;
tMax = max;
}
void FPLapTimesChart::calculateTransformFactors()
{
int firstLap, lastLap, size;
findFirstAndLastLap(firstLap, lastLap, size);
// int sz = lastLap-firstLap+1;
int sz = last - first + 1;
double xFactor = ((double)paintRect.width()) / ((double)sz);
double yFactor = (((double)paintRect.height()) / (double)(tMax - tMin));
first = first + ceil((scaleRect.left() - paintRect.left()) / xFactor);
if (first < 0)
first = 0;
if (first >= getSessionLength())
first = getSessionLength()-1;
// if (first >= driverData.lapData.size())
// first = driverData.lapData.size() - 1;
last = first + ceil((scaleRect.right() - scaleRect.left()) / xFactor);
if (last > getSessionLength())
last = getSessionLength();
// if (last >= driverData.lapData.size())
// last = driverData.lapData.size() - 1;
tMin = tMin + ceil((paintRect.bottom() - scaleRect.bottom()) / yFactor)-1;
if (tMin < min)
tMin = min;
tMax = tMin + ceil((scaleRect.bottom() - scaleRect.top()) / yFactor);
emit zoomChanged(first, last, tMin, tMax);
}
//=========================================
void QualiLapTimesChart::findFirstAndLastLap(int &firstMin, int &lastMin, int &size)
{
firstMin = getSessionLength(), lastMin = 0, size = 0;
double lMin = 99999999.0, lMax = 0.0;
for (int j = 0; j < lapDataArray.size(); ++j)
{
int minute = getSessionLength() - SeasonData::getInstance().getSessionDefaults().timeToMins(lapDataArray[j].getQualiLapExtraData().getSessionTime());
if (minute < firstMin && minute >= first)
firstMin = minute;
if (minute > lastMin && minute <= last)
lastMin = minute;
if (minute >= first && minute <= last && lapDataArray[j].getTime().toDouble() < lMin && lapDataArray[j].getTime().isValid() && lapDataArray[j].getQualiLapExtraData().getQualiPeriod() == qualiPeriod)
lMin = lapDataArray[j].getTime().toDouble();
if (minute >= first && minute <= last && lapDataArray[j].getTime().toDouble() > lMax && lapDataArray[j].getTime().isValid() && lapDataArray[j].getQualiLapExtraData().getQualiPeriod() == qualiPeriod)
lMax = lapDataArray[j].getTime().toDouble();
if (minute >= first && minute <= last)
++size;
}
if (lMax != 0)
{
max = (double)(lMax + lMax * 0.01);
min = (double)(lMin - lMin * 0.01);
if (max > 180)
max = 180;
if (min < 0)
min = 0;
}
}
int QualiLapTimesChart::checkLapDataCoordinates(int x, int y)
{
if (popupBox != 0)
{
popupBox->values.clear();
for (int i = 0; i < lapDataCoordinates.size(); ++i)
{
if (std::abs((float)(lapDataCoordinates[i].x - x)) <= 3 && std::abs((float)(lapDataCoordinates[i].y - y)) <= 3 &&
lapDataCoordinates[i].idx < lapDataArray.size())
{
LapData ld = lapDataArray[lapDataCoordinates[i].idx];
popupBox->values.append(ld);
int min = SeasonData::getInstance().getSessionDefaults().timeToMins(SeasonData::getInstance().getSessionDefaults().correctQualiTime(ld.getQualiLapExtraData().getSessionTime(), ld.getQualiLapExtraData().getQualiPeriod()));
popupBox->title = QString("%1. minute").arg(min);
}
}
popupBox->sortValues();
return popupBox->values.size();
}
return 0;
}
void QualiLapTimesChart::drawChart(QPainter *p)
{
int firstMin = getSessionLength(), lastMin = 0;
double x = paintRect.left();
double y;
double yFactor = (((double)paintRect.height()) / (double)(tMax-tMin));
double secs;
int size;
findFirstAndLastLap(firstMin, lastMin, size);
if (/*lastMin - firstMin == 0 ||*/ lapDataArray.isEmpty())
return;
drawAxes(p, firstMin, lastMin);
double xFactor = ((double)paintRect.width()) / (double)((last - first)*60);
p->setRenderHint(QPainter::Antialiasing);
int lapsInWindow = 0;
for (int i = 0; i < lapDataArray.size(); ++i)
{
int minute = getSessionLength() - SeasonData::getInstance().getSessionDefaults().timeToMins(lapDataArray[i].getQualiLapExtraData().getSessionTime());
int second = getSessionLength()*60 - SeasonData::getInstance().getSessionDefaults().timeToSecs(lapDataArray[i].getQualiLapExtraData().getSessionTime());
if (lapDataArray[i].getQualiLapExtraData().getSessionTime().toString("h:mm:ss") == "")
{
minute = 0;
second = 0;
}
if (minute >= first && minute <= last && lapDataArray[i].getQualiLapExtraData().getQualiPeriod() == qualiPeriod)// && lapDataArray[i].getTime().isValid())
{
secs = lapDataArray[i].getTime().toDouble();
if (secs > tMax && tMax == max)
secs = tMax;
y = (double)(paintRect.bottom() - (double)(secs-tMin) * yFactor);
x = (double)(second - first*60) * xFactor + (double)paintRect.left();
if (x < paintRect.left())
x = paintRect.left();
//int no = EventData::getInstance()lapDataArray[i].carID
QColor color = getCarColor(lapDataArray[i]);
QPen pen;
pen.setWidth(3);
pen.setColor(color);
p->setPen(pen);
if (lapsInWindow >= lapDataCoordinates.size())
lapDataCoordinates.append(LapDataCoordinates(i, (int)x, (int)y));
else
lapDataCoordinates[lapsInWindow] = LapDataCoordinates(i, (int)x, (int)y);
QPainterPath path;
// p->setBrush(QBrush(SeasonData::getInstance().getColor(LTPackets::BACKGROUND]));
p->setBrush(QBrush(color));
if (y < paintRect.bottom())
{
{
path.addEllipse(QPoint(x, y), 3, 3);
}
p->drawPath(path);
}
++lapsInWindow;
}
}
clearLapDataCoordinates(lapsInWindow);
}
//=======================================
void AllQualiLapTimesChart::findFirstAndLastLap(int &firstMin, int &lastMin, int &size)
{
firstMin = getSessionLength(), lastMin = 0, size = 0;
double lMin = 99999999.0, lMax = 0.0;
for (int j = 0; j < lapDataArray.size(); ++j)
{
int sessTime = SeasonData::getInstance().getSessionDefaults().timeToMins(lapDataArray[j].getQualiLapExtraData().getSessionTime());
for (int i = 0; i < lapDataArray[j].getQualiLapExtraData().getQualiPeriod()-1; ++i)
sessTime += SeasonData::getInstance().getSessionDefaults().getQualiLength(i+1);
int minute = getSessionLength() - sessTime;
if (minute < firstMin && minute >= first)
firstMin = minute;
if (minute > lastMin && minute <= last)
lastMin = minute;
if (minute >= first && minute <= last && lapDataArray[j].getTime().toDouble() < lMin && lapDataArray[j].getTime().isValid())
lMin = lapDataArray[j].getTime().toDouble();
if (minute >= first && minute <= last && lapDataArray[j].getTime().toDouble() > lMax && lapDataArray[j].getTime().isValid())
lMax = lapDataArray[j].getTime().toDouble();
if (minute >= first && minute <= last)
++size;
}
if (lMax != 0)
{
max = (double)(lMax + lMax * 0.01);
min = (double)(lMin - lMin * 0.01);
if (max > 180)
max = 180;
if (min < 0)
min = 0;
}
}
int AllQualiLapTimesChart::checkLapDataCoordinates(int x, int y)
{
if (popupBox != 0)
{
popupBox->values.clear();
for (int i = 0; i < lapDataCoordinates.size(); ++i)
{
if (std::abs((float)(lapDataCoordinates[i].x - x)) <= 3 && std::abs((float)(lapDataCoordinates[i].y - y)) <= 3 &&
lapDataCoordinates[i].idx < lapDataArray.size())
{
LapData ld = lapDataArray[lapDataCoordinates[i].idx];
popupBox->values.append(ld);
int q = ld.getQualiLapExtraData().getQualiPeriod();
int min = SeasonData::getInstance().getSessionDefaults().timeToMins(SeasonData::getInstance().getSessionDefaults().correctQualiTime(ld.getQualiLapExtraData().getSessionTime(), q));
popupBox->title = QString("Q%1 %2. minute").arg(q).arg(min);
}
}
popupBox->sortValues();
return popupBox->values.size();
}
return 0;
}
void AllQualiLapTimesChart::drawAxes(QPainter *p, int, int)
{
p->setPen(QColor(ColorsManager::getInstance().getDefaultColor(LTPackets::WHITE)));
//x axe
p->drawLine(paintRect.left(), paintRect.bottom(), paintRect.right(), paintRect.bottom());
//y axe
p->drawLine(paintRect.left(), paintRect.bottom(), paintRect.left(), paintRect.top());
p->setFont(QFont("Arial", 10, QFont::Bold, false));
p->setPen(QColor(ColorsManager::getInstance().getDefaultColor(LTPackets::WHITE)));
double yFactor = (double)((paintRect.height())/10.0);
double yFactor2 = (double)((tMax-tMin)/10.0);
double j = tMin;
for (double i = paintRect.bottom(); i >= 10; i-= yFactor, j += yFactor2)
{
p->setPen(QColor(ColorsManager::getInstance().getDefaultColor(LTPackets::WHITE)));
int msecs = j * 1000;
LapTime lt(msecs);
QString str = lt.toString();
int idx = str.indexOf(".");
if (idx != -1)
str = str.left(idx+2);
p->drawText(5, i+5, str);//QString("%1").arg(j, 0, 'f', 1));
if (i != paintRect.bottom())
{
QPen pen(QColor(ColorsManager::getInstance().getDefaultColor(LTPackets::DEFAULT)));
pen.setStyle(Qt::DashLine);
p->setPen(pen);
p->drawLine(paintRect.left(), i, paintRect.right(), i);
}
}
if (last - first > 0)
{
double xFactor = ((double)paintRect.width()) / /*((lapData.size() < 5) ?*/ (double)(last - first) /*: 5)*/;
double j = first;
double i = paintRect.left();
int prevJ = first;
double jFactor = (last - first) < 6 ? 1.0 : (double)((last - first) / 9.0);
double q1Line = (SeasonData::getInstance().getSessionDefaults().getQualiLength(1) - first) * xFactor + paintRect.left();
double q2Line = (SeasonData::getInstance().getSessionDefaults().getQualiLength(1)+SeasonData::getInstance().getSessionDefaults().getQualiLength(2) - first) * xFactor + paintRect.left();
QPen pen(QColor(ColorsManager::getInstance().getDefaultColor(LTPackets::DEFAULT)));
pen.setWidth(1);
for (; i < width()-15.0 && round(j) < last; /*i += xFactor,*/ j += jFactor)
{
i += (double)(round(j) - prevJ) * xFactor;
int qTime = round(j);
if (qTime > (SeasonData::getInstance().getSessionDefaults().getQualiLength(1) + SeasonData::getInstance().getSessionDefaults().getQualiLength(2)))
qTime -= (SeasonData::getInstance().getSessionDefaults().getQualiLength(1) + SeasonData::getInstance().getSessionDefaults().getQualiLength(2));
else if (qTime > SeasonData::getInstance().getSessionDefaults().getQualiLength(1))
qTime -= SeasonData::getInstance().getSessionDefaults().getQualiLength(1);
prevJ = round(j);
p->setFont(QFont("Arial", 10, QFont::Bold, false));
p->setPen(QColor(ColorsManager::getInstance().getDefaultColor(LTPackets::WHITE)));
p->drawText(round(i)-5, height()-10, QString("%1'").arg(qTime));
if (i > paintRect.left())
{
pen.setStyle(Qt::DashLine);
p->setPen(pen);
p->setRenderHint(QPainter::Antialiasing);
p->drawLine(round(i), paintRect.bottom(), round(i), paintRect.top());
}
}
int qpos[6] = {-1, -1, -1, -1, -1, -1};
if (i >= q1Line && q1Line > paintRect.left())
{
pen.setColor(QColor(ColorsManager::getInstance().getDefaultColor(LTPackets::WHITE)));
pen.setWidth(4);
pen.setStyle(Qt::SolidLine);
p->setPen(pen);
p->drawLine(round(q1Line), paintRect.bottom(), round(q1Line), paintRect.top());
qpos[0] = paintRect.left();
qpos[1] = q1Line;
qpos[2] = q1Line;
qpos[3] = paintRect.right();
}
else if (last <= SeasonData::getInstance().getSessionDefaults().getQualiLength(1))
{
qpos[0] = paintRect.left();
qpos[1] = paintRect.right();
}
if (i >= q2Line && q2Line > paintRect.left())
{
pen.setWidth(4);
pen.setColor(QColor(ColorsManager::getInstance().getDefaultColor(LTPackets::WHITE)));
pen.setStyle(Qt::SolidLine);
p->setPen(pen);
p->drawLine(round(q2Line), paintRect.bottom(), round(q2Line), paintRect.top());
qpos[2] = first < SeasonData::getInstance().getSessionDefaults().getQualiLength(1) ? q1Line : paintRect.left();
qpos[3] = q2Line;
qpos[4] = q2Line;
qpos[5] = paintRect.right();
}
else if (first >= SeasonData::getInstance().getSessionDefaults().getQualiLength(1) && last <= (SeasonData::getInstance().getSessionDefaults().getQualiLength(1) + SeasonData::getInstance().getSessionDefaults().getQualiLength(2)))
{
qpos[2] = paintRect.left();
qpos[3] = paintRect.right();
}
else if (first >= (SeasonData::getInstance().getSessionDefaults().getQualiLength(1) + SeasonData::getInstance().getSessionDefaults().getQualiLength(2)))
{
qpos[4] = paintRect.left();
qpos[5] = paintRect.right();
}
p->setPen(QColor(150, 150, 150, 150));
p->setFont(QFont("Arial", 50, QFont::Bold, false));
p->setRenderHint(QPainter::Antialiasing);
if (qpos[0] != -1 && qpos[1] != -1)
{
QString text = "Q1";
int textWidth = p->fontMetrics().width(text);
p->drawText(qpos[1] - (qpos[1] - qpos[0] + textWidth)/2, paintRect.top() + 100, text);
}
if (qpos[2] != -1 && qpos[3] != -1)
{
QString text = "Q2";
int textWidth = p->fontMetrics().width(text);
p->drawText(qpos[3] - (qpos[3] - qpos[2] + textWidth)/2, paintRect.top() + 100, text);
}
if (qpos[4] != -1 && qpos[5] != -1)
{
QString text = "Q3";
int textWidth = p->fontMetrics().width(text);
p->drawText(qpos[5] - (qpos[5] - qpos[4] + textWidth)/2, paintRect.top() + 100, text);
}
}
}
void AllQualiLapTimesChart::drawChart(QPainter *p)
{
int firstMin = getSessionLength(), lastMin = 0;
double x = paintRect.left();
double y;
double yFactor = (((double)paintRect.height()) / (double)(tMax-tMin));
double secs;
int size;
findFirstAndLastLap(firstMin, lastMin, size);
if (/*lastMin - firstMin == 0 ||*/ lapDataArray.isEmpty())
return;
drawAxes(p, firstMin, lastMin);
double xFactor = ((double)paintRect.width()) / (double)((last - first)*60);
p->setRenderHint(QPainter::Antialiasing);
int lapsInWindow = 0;
for (int i = 0; i < lapDataArray.size(); ++i)
{
int sessTime = SeasonData::getInstance().getSessionDefaults().getQualiLength(lapDataArray[i].getQualiLapExtraData().getQualiPeriod()) -
SeasonData::getInstance().getSessionDefaults().timeToMins(lapDataArray[i].getQualiLapExtraData().getSessionTime());
int sessTimeSecs = SeasonData::getInstance().getSessionDefaults().getQualiLength(lapDataArray[i].getQualiLapExtraData().getQualiPeriod()) * 60 -
SeasonData::getInstance().getSessionDefaults().timeToSecs(lapDataArray[i].getQualiLapExtraData().getSessionTime());
if (lapDataArray[i].getQualiLapExtraData().getSessionTime().toString("h:mm:ss") == "")
{
sessTime = 0;
sessTimeSecs = 0;
}
for (int k = 0; k < lapDataArray[i].getQualiLapExtraData().getQualiPeriod()-1; ++k)
{
sessTime += SeasonData::getInstance().getSessionDefaults().getQualiLength(k+1);
sessTimeSecs += SeasonData::getInstance().getSessionDefaults().getQualiLength(k+1)*60;
}
// int minute = LTPackets::currentEventFPLength() - LTPackets::timeToMins(lapDataArray[i].sessionTime);
// int second = LTPackets::currentEventFPLength()*60 - LTPackets::timeToSecs(lapDataArray[i].sessionTime);
if (sessTime >= first && sessTime <= last)// && lapDataArray[i].getTime().isValid())
{
secs = lapDataArray[i].getTime().toDouble();
if (secs > tMax && tMax == max)
secs = tMax;
y = (double)(paintRect.bottom() - (double)(secs-tMin) * yFactor);
x = (double)(sessTimeSecs - first*60) * xFactor + (double)paintRect.left();
if (x < paintRect.left())
x = paintRect.left();
//int no = EventData::getInstance()lapDataArray[i].carID
QColor color = getCarColor(lapDataArray[i]);
QPen pen;
pen.setWidth(3);
pen.setColor(color);
p->setPen(pen);
if (lapsInWindow >= lapDataCoordinates.size())
lapDataCoordinates.append(LapDataCoordinates(i, (int)x, (int)y));
else
lapDataCoordinates[lapsInWindow] = LapDataCoordinates(i, (int)x, (int)y);
QPainterPath path;
p->setBrush(QBrush(color));
if (y < paintRect.bottom())
{
{
path.addEllipse(QPoint(x, y), 3, 3);
}
p->drawPath(path);
}
++lapsInWindow;
}
}
clearLapDataCoordinates(lapsInWindow);
}
| zywhlc-f1lt | src/charts/fplaptimeschart.cpp | C++ | gpl3 | 28,324 |
/*******************************************************************************
* *
* F1LT - unofficial Formula 1 live timing application *
* Copyright (C) 2012-2013 Mariusz Pilarek (pieczaro@gmail.com) *
* *
* 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 *
* the Free Software Foundation, either version 3 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
* *
*******************************************************************************/
#include "driverdatachart.h"
#include "../core/colorsmanager.h"
#include <QPainter>
void PopupInfoBox::paint(QPainter *p, int x, int y, const QRect &paintRect)
{
if (values.isEmpty())
return;
// p.setPen(QColor(232, 227, 185, 200));
// p.setBrush(QColor(232, 227, 185, 200));
p->setPen(QColor(50, 50, 50));
p->setBrush(QColor(50, 50, 50));
int titleRows = title.isNull() ? 0 : 1;
int height = 20 * (getSize() + titleRows);
int bottom = y + height;
int right = x + width;
if (bottom > paintRect.bottom())
y = paintRect.bottom() - height;
if (right > paintRect.right())
x = paintRect.right() - width;
p->drawRect(x+20, y, width, 20 * (getSize() + titleRows));
p->setPen(ColorsManager::getInstance().getDefaultColor(LTPackets::WHITE));
if (!title.isNull())
{
p->setFont(QFont("Arial", 10, QFont::Normal, true));
p->drawText(x+25, y+15, title);
}
p->setFont(QFont("Arial", 10, QFont::Bold, false));
for (int i = 0; i < getSize(); ++i)
{
p->drawText(x+25, y+(i + titleRows)*20+15, getInfo(i));
}
}
DriverDataChart::DriverDataChart(double n, double x, QColor col, QWidget *parent) :
ChartWidget(n, x, col, parent), driverData(0), popupBox(0)
{
if (driverData != 0)
{
first = driverData->getPositionHistory().size() > driverData->getLapData().size() ? 2 : 1;
last = driverData->getPositionHistory().size();
tMin = min;
tMax = max;
}
}
void DriverDataChart::mouseMoveEvent(QMouseEvent *ev)
{
ChartWidget::mouseMoveEvent(ev);
if (!scaling)
{
mousePosX = ev->pos().x();
mousePosY = ev->pos().y();
if (popupBox != 0)
{
int items = popupBox->values.size();
if (checkLapDataCoordinates(mousePosX, mousePosY))
{
repaintPopup = true;
update();
repaintPopup = false;
}
else if (items != 0) //if the cursor has moved and a popup was displayed previously, it has to be cleared
update();
}
}
}
void DriverDataChart::drawAxes(QPainter *p)
{
p->setPen(QColor(ColorsManager::getInstance().getDefaultColor(LTPackets::WHITE)));
//x axe
p->drawLine(paintRect.left(), paintRect.bottom(), paintRect.right(), paintRect.bottom());
//y axe
p->drawLine(paintRect.left(), paintRect.bottom(), paintRect.left(), paintRect.top());
// first = driverData->posHistory.size() > driverData->lapData.size() ? 2 : 1;
// last = driverData->posHistory.size();
p->setFont(QFont("Arial", 10));
p->setPen(QColor(ColorsManager::getInstance().getDefaultColor(LTPackets::WHITE)));
double yFactor = (((double)paintRect.height())/4.0);
double yFactor2 = ((double)(tMax-tMin)/4.0);
double j = tMin;
for (int i = paintRect.bottom(); i >= 10; i-= yFactor, j += yFactor2)
{
p->setPen(QColor(ColorsManager::getInstance().getDefaultColor(LTPackets::WHITE)));
p->drawText(5, i+5, QString("%1").arg(round(j)));
if (i != paintRect.bottom())
{
QPen pen(QColor(ColorsManager::getInstance().getDefaultColor(LTPackets::DEFAULT)));
pen.setStyle(Qt::DashLine);
p->setPen(pen);
p->drawLine(paintRect.left(), i, paintRect.right(), i);
}
}
if (driverData != 0 && driverData->getPositionHistory().size()>1)
{
int sz = last-first+1;//(driverData->posHistory.size() > driverData->lapData.size() ? driverData->posHistory.size()-1 : driverData->posHistory.size());
double xFactor = ((double)paintRect.width()) / /*((lapData.size() < 5) ?*/ (double)(sz) /*: 5)*/;
double j = 1.0;
double i = paintRect.left();
int prevJ = 1;
double jFactor = last-first+1/*driverData->posHistory.size()*/ < 5 ? 1.0 : (double)((last-first+1/*driverData->posHistory.size()-1*/)/6.0);
j = first-1;
prevJ = first - 1;
for (; i < width()-15.0 && round(j) < last && round(j) < driverData->getLapData().size(); /*i += xFactor,*/ j += jFactor)
{
i += (double)(round(j) - prevJ) * xFactor;
prevJ = round(j);
p->setPen(QColor(ColorsManager::getInstance().getDefaultColor(LTPackets::WHITE)));
if (driverData->getPositionHistory().size() > driverData->getLapData().size())
p->drawText(round(i)-5, height()-10, QString("L%1").arg(round(j)));
else
p->drawText(round(i)-5, height()-10, QString("L%1").arg(driverData->getLapData()[round(j)].getLapNumber()));
if (i > paintRect.left())
{
QPen pen(QColor(ColorsManager::getInstance().getDefaultColor(LTPackets::DEFAULT)));
pen.setStyle(Qt::DashLine);
p->setPen(pen);
p->drawLine(round(i), paintRect.bottom(), round(i), paintRect.top());
}
}
}
}
void DriverDataChart::drawChart(QPainter *p)
{
if (driverData != 0 && driverData->getPositionHistory().size()>1 && first < driverData->getPositionHistory().size())
{
p->setBrush(QBrush(color));
QPen pen(color);
pen.setWidth(2);
p->setPen(pen);
p->setRenderHint(QPainter::Antialiasing);
int sz = last-first+1;//(driverData->posHistory.size() > driverData->lapData.size() ? driverData->posHistory.size()-1 : driverData->posHistory.size());
double xFactor = ((double)paintRect.width()) / ((double)sz);
double yFactor = (((double)paintRect.height()) / (double)(tMax-tMin));
double x = paintRect.left(), j = x + xFactor;
double y = (double)paintRect.bottom() - (double)(driverData->getPositionHistory()[first-1]-tMin) * yFactor;
int i = first; //(driverData->posHistory.size() > driverData->lapData.size() ? 2 : 1);
int lastPaintedSC = 0;
for (; i < last + 1 && i < driverData->getPositionHistory().size(); ++i, j += xFactor)
{
double y2 = (double)paintRect.bottom() - (double)(driverData->getPositionHistory()[i]-tMin) * yFactor;
double x2 = j;
if (driverData->getPositionHistory()[i] <= 0)
{
y2 = y;
}
LapData ld = driverData->getLapData(i-1);
if (ld.getCarID() == driverData->getCarID() && ld.getRaceLapExtraData().isSCLap() && ld.getLapNumber() > lastPaintedSC)
{
int tmp = first;
first -= 1;
drawSCLap(p, ld, xFactor);
lastPaintedSC = ld.getLapNumber();
first = tmp;
}
if (y2 > paintRect.bottom() && y > paintRect.bottom())
{
x = j;
y = y2;
continue;
}
double tmpY2 = y2;
checkX1(x, y, x2, tmpY2);
checkX2(x, y, x2, tmpY2);
pen.setWidth(2);
p->setPen(pen);
p->drawLine(x, y, x2, tmpY2);
drawRetire(p, x2, tmpY2, 6, driverData->getLapData(i));
x = j;
y = y2;
if (i >= 0 && i < last && i < driverData->getLapData().size() && driverData->getLapData()[i-1].getTime().toString() == "IN PIT" && tmpY2 <= paintRect.bottom())
{
QPainterPath path;
path.addEllipse(QPoint(j, tmpY2), 6, 6);
p->setBrush(QBrush(color));
p->setPen(color);
p->drawPath(path);
}
}
}
}
void DriverDataChart::drawLegend(QPainter *p)
{
p->setPen(ColorsManager::getInstance().getDefaultColor(LTPackets::WHITE));
p->drawText(40, 20, driverData->getDriverName());
}
int DriverDataChart::checkLapDataCoordinates(int x, int y)
{
if (popupBox != 0 && driverData != 0)
{
popupBox->values.clear();
for (int i = 0; i < lapDataCoordinates.size(); ++i)
{
if (std::abs((float)(lapDataCoordinates[i].x - x)) <= 3 && std::abs((float)(lapDataCoordinates[i].y - y)) <= 3 &&
lapDataCoordinates[i].idx < driverData->getLapData().size())
{
LapData ld = driverData->getLapData()[lapDataCoordinates[i].idx];
popupBox->values.append(ld);
}
}
popupBox->sortValues();
return popupBox->values.size();
}
return 0;
}
//void DriverDataChart::drawLapDataXY(QPainter *p)
//{
// if (itemsInXY.isEmpty())
// return;
//// p.setPen(QColor(232, 227, 185, 200));
//// p.setBrush(QColor(232, 227, 185, 200));
// p->setPen(QColor(50, 50, 50));
// p->setBrush(QColor(50, 50, 50));
// int x = mousePosX;
// int y = mousePosY;
// int height = 20 * (itemsInXY.size());
// int bottom = y + height;
// int width = getPopupWidth()+20;
// int right = x + width;
// if (bottom > paintRect.bottom())
// y = paintRect.bottom() - height;
// if (right > paintRect.right())
// x = paintRect.right() - width;
// p->drawRect(x+20, y, getPopupWidth(), 20 * (itemsInXY.size()));
// p->setFont(QFont("Arial", 10, QFont::Bold, false));
// p->setPen(QColor(ColorsManager::getInstance().getColor(LTPackets::WHITE)));
// for (int i = 0; i < itemsInXY.size(); ++i)
// {
// if (itemsInXY[i] < driverData->getLapData().size())
// p->drawText(x+25, y+i*20+15, getDriverInfoXY(driverData->getLapData()[itemsInXY[i]]));
// }
//}
void DriverDataChart::drawSCLap(QPainter *p, const LapData &lapData, double xFactor)
{
double sc_x1 = (double)(lapData.getLapNumber() - first) * xFactor + (double)paintRect.left();
double sc_x2 = (double)(lapData.getLapNumber()+1 - first) * xFactor + (double)paintRect.left();
if (sc_x1 < paintRect.left())
sc_x1 = paintRect.left();
// if (lastPaintedSCPixel == -1)
// lastPaintedSCPixel = round(sc_x2);
// else if (std::abs(round(sc_x1) - lastPaintedSCPixel) <= 5)
// {
// sc_x1 = (double)lastPaintedSCPixel;
// lastPaintedSCPixel = round(sc_x2);
// }
p->setPen(QColor(255, 255, 0, 0));
p->setBrush(QBrush(QColor(255, 255, 0, 35)));
p->drawRect(round(sc_x1), paintRect.top(), round(sc_x2-sc_x1), paintRect.height());
}
void DriverDataChart::drawRetire(QPainter *p, int x, int y, int r, const LapData &ld)
{
if (ld.getCarID() > 0)
{
DriverData *dd = EventData::getInstance().getDriverDataByIdPtr(ld.getCarID());
if (dd == 0)
return;
LapData ld2 = dd->getLapData(ld.getLapNumber()+1);
LapData ld3 = dd->getLapData(ld.getLapNumber()+2);
if (ld2.getCarID() == -1 && ld3.getCarID() == -1 && dd->isRetired())
{
QPen pen;
pen.setWidth(3);
pen.setColor(QColor(255, 255, 255));
p->setPen(pen);
p->setBrush(QColor(255, 255, 255));
QPainterPath path;
path.addEllipse(QPoint(x, y), r, r);
p->drawPath(path);
pen.setColor(QColor(255, 0, 0));
p->setPen(pen);
p->drawLine(x-r/2, y-r/2, x+r/2, y+r/2);
p->drawLine(x-r/2, y+r/2, x+r/2, y-r/2);
}
}
}
void DriverDataChart::paintEvent(QPaintEvent *)
{
resetPaintRect();
if (scaleRect.width() == 0 && scaleRect.height() == 0)
{
resetZoom();
}
QPainter p;
p.begin(this);
p.setBrush(QColor(20,20,20));
p.setPen(QColor(20,20,20));
p.drawRect(0, 0, width(), height());
drawAxes(&p);
drawChart(&p);
if (scaling)
drawScaleRect(&p);
p.end();
}
void DriverDataChart::resetZoom()
{
if (driverData != 0)
{
first = driverData->getPositionHistory().size() > driverData->getLapData().size() ? 2 : 1;
last = driverData->getPositionHistory().size();
}
tMin = min;
tMax = max;
}
void DriverDataChart::calculateTransformFactors()
{
int sz = last-first+1;
double xFactor = ((double)paintRect.width()) / ((double)sz);
double yFactor = (((double)paintRect.height()) / (double)(tMax - tMin));
first = first + ceil((scaleRect.left() - paintRect.left()) / xFactor);
if (first < 1)
first = 1;
if (driverData != 0)
{
if (first >= driverData->getPositionHistory().size())
first = driverData->getPositionHistory().size() - 1;
last = first + ceil((scaleRect.right() - scaleRect.left()) / xFactor);
if (last >= driverData->getPositionHistory().size())
last = driverData->getPositionHistory().size() - 1;
}
tMin = tMin + ceil((paintRect.bottom() - scaleRect.bottom()) / yFactor)-1;
if (tMin < min)
tMin = min;
tMax = tMin + ceil((scaleRect.bottom() - scaleRect.top()) / yFactor);
}
void DriverDataChart::drawIntoImage(QImage &img)
{
QPainter p;
p.begin(&img);
p.setBrush(QColor(20,20,20));
p.setPen(QColor(20,20,20));
p.drawRect(0, 0, width(), height());
drawAxes(&p);
drawChart(&p);
drawLegend(&p);
p.end();
}
//====================================================
void LapTimeChart::setData(DriverData *dd)
{
driverData = dd;
if (dd == 0)
return;
max = 0.0;
for (int i = 0; i < dd->getLapData().size(); ++i)
{
double secs = (double)(dd->getLapData()[i].getTime().toMsecs() / 1000.0);
if (secs > max)
max = secs;
}
if (max == 0.0 || max > 180.0)
max = 180.0;
else
max = max + 0.1*max;
}
void LapTimeChart::drawAxes(QPainter *p)
{
p->setPen(QColor(ColorsManager::getInstance().getDefaultColor(LTPackets::WHITE)));
//x axe
p->drawLine(paintRect.left(), paintRect.bottom(), paintRect.right(), paintRect.bottom());
//y axe
p->drawLine(paintRect.left(), paintRect.bottom(), paintRect.left(), paintRect.top());
p->setFont(QFont("Arial", 10));
for (int i = paintRect.bottom(), j = tMin; i >= 50; i-= (height()-55)/6, j += (tMax-tMin)/6)
{
p->setPen(QColor(ColorsManager::getInstance().getDefaultColor(LTPackets::WHITE)));
p->drawText(5, i+5, QString("%1").arg(j));
if (i != paintRect.bottom())
{
QPen pen(QColor(ColorsManager::getInstance().getDefaultColor(LTPackets::DEFAULT)));
pen.setStyle(Qt::DashLine);
p->setPen(pen);
p->drawLine(paintRect.left(), i, paintRect.right(), i);
}
}
if (driverData != 0 && !driverData->getLapData().isEmpty() && first < driverData->getLapData().size())
{
int sz = last - first + 1;
double xFactor = ((double)width()-33.0) / /*((lapData.size() < 5) ?*/ (double)sz /*: 5)*/;
double j = first-1;
double i = paintRect.left();
int prevJ = first-1;
double jFactor = sz < 5 ? 1.0 : (double)(sz/6.0);
for (; i < width()-15.0 && round(j) < last && round(j) < driverData->getLapData().size(); /*i += xFactor,*/ j += jFactor)
{
i += (double)(round(j) - prevJ) * xFactor;
prevJ = round(j);
p->setPen(QColor(ColorsManager::getInstance().getDefaultColor(LTPackets::WHITE)));
p->drawText(round(i)-5, height()-10, QString("L%1").arg(driverData->getLapData()[round(j)].getLapNumber()));
if (i > paintRect.left())
{
QPen pen(QColor(ColorsManager::getInstance().getDefaultColor(LTPackets::DEFAULT)));
pen.setStyle(Qt::DashLine);
p->setPen(pen);
p->drawLine(round(i), paintRect.bottom(), round(i), paintRect.top());
}
}
}
}
void LapTimeChart::drawChart(QPainter *p)
{
if (driverData != 0 && !driverData->getLapData().empty() && first < driverData->getLapData().size())
{
QPen pen(colors[0]);
pen.setWidth(2);
p->setRenderHint(QPainter::Antialiasing);
int sz = last - first + 1;
double xFactor = ((double)width()-33.0) / (double)sz;
double yFactor = (((double)height()-60.0) / (double)(tMax-tMin));
double x, x2, j;
double sec1y, sec2y, sec3y, lapy, sec1y2, sec2y2, sec3y2, lapy2;
x = paintRect.left();
j = x + xFactor;
LapTime sector1 = driverData->getLapData()[first-1].getSectorTime(1);
LapTime sector2 = driverData->getLapData()[first-1].getSectorTime(2);
LapTime sector3 = driverData->getLapData()[first-1].getSectorTime(3);
LapTime lapTime = driverData->getLapData()[first-1].getTime();
if (sz > 1)
{
if (lapTime.toString() == "IN PIT")
{
lapTime = driverData->getLapData()[first].getTime();
LapTime pl = LapTime(driverData->getPitTime(driverData->getLapData()[first-1].getLapNumber()));
lapTime = lapTime - pl + LapTime(5000);
}
if (sector1.toString() == "")
{
sector1 = driverData->getLapData()[first].getSectorTime(1);
LapTime pl = LapTime(driverData->getPitTime(driverData->getLapData()[first-1].getLapNumber()));
sector1 = sector1 - pl + LapTime(5000);
}
if (sector2.toString() == "")
sector2 = driverData->getLapData()[first].getSectorTime(2);
if (sector3.toString() == "")
sector3 = driverData->getLapData()[first].getSectorTime(3);
}
double secs = sector1.toDouble();
sec1y = (double)(paintRect.bottom() - (secs - tMin) * yFactor);
secs = sector2.toDouble();
sec2y = (double)(paintRect.bottom() - (secs - tMin) * yFactor);
secs = sector3.toDouble();
sec3y = (double)(paintRect.bottom() - (secs - tMin) * yFactor);
secs = lapTime.toDouble();//-QTime::fromString(lapTime, "m:ss.zzz").msecsTo(QTime::fromString("0:00.000", "m:ss.zzz"));
//secs = (double)(msecs/1000.0);
lapy = (double)(paintRect.bottom() - (secs - tMin) * yFactor);
if (driverData->getLapData()[first-1].getTime().toString() == "IN PIT")
{
QPainterPath path;
path.addEllipse(QPoint(round(x), lapy), 6, 6);
p->setBrush(QBrush(colors[3]));
p->setPen(colors[3]);
if (driverData->getLapData()[0].getRaceLapExtraData().isSCLap())
{
pen.setColor(colors[4]);
p->setBrush(QBrush(colors[4]));
}
p->drawPath(path);
}
int lapsInWindow = 0;
int lastPaintedSC = -1;
for (int i = first; i < last+1 && i < driverData->getLapData().size(); ++i, j += xFactor)
{
x2 = j;
sector1 = driverData->getLapData()[i].getSectorTime(1);
sector2 = driverData->getLapData()[i].getSectorTime(2);
sector3 = driverData->getLapData()[i].getSectorTime(3);
lapTime = driverData->getLapData()[i].getTime();
if (driverData->getLapData()[i-1].getRaceLapExtraData().isSCLap() && driverData->getLapData()[i-1].getLapNumber() > lastPaintedSC)
{
drawSCLap(p, driverData->getLapData()[i-1], xFactor);
lastPaintedSC = driverData->getLapData()[i-1].getLapNumber();
}
if (lapTime.toString() == "IN PIT" || lapTime.toString() == "RETIRED")
{
lapTime = driverData->getLapData()[i-1].getTime();
if (lapTime.toString() == "IN PIT" || lapTime.toString() == "RETIRED")
{
// if (i - 1 > 0)
// lapTime = lapData[i-2].lapTime;
if (i < last-1)
{
lapTime = driverData->getLapData()[i+1].getTime();
LapTime pl = driverData->getPitTime(driverData->getLapData()[i].getLapNumber());
lapTime = lapTime - pl + LapTime(5000);
}
}
}
if (lapTime.toString().contains("LAP"))
continue;
if (sector1.toString() == "")
{
sector1 = driverData->getLapData()[i-1].getSectorTime(1);
if (sector1.toString() == "" && i < last-1)
sector1 = driverData->getLapData()[i+1].getSectorTime(1);
}
if (sector2.toString() == "")
{
sector2 = driverData->getLapData()[i-1].getSectorTime(2);
if (sector2.toString() == "" && i < last-1)
sector2 = driverData->getLapData()[i+1].getSectorTime(2);
}
if (sector3.toString() == "")
{
sector3 = driverData->getLapData()[i-1].getSectorTime(3);
if (sector3.toString() == "")
{
// if (i - 1 > 0)
// sector3 = lapData[i-2].sector3;
if (i < driverData->getLapData().size()-1)
sector3 = driverData->getLapData()[i+1].getSectorTime(3);
}
}
secs = sector1.toDouble();
if (secs > max) secs = max;
sec1y2 = (double)(paintRect.bottom() - (secs - tMin)* yFactor);
secs = sector2.toDouble();
if (secs > max) secs = max;
sec2y2 = (double)(paintRect.bottom() - (secs - tMin) * yFactor);
secs = sector3.toDouble();
if (secs > max) secs = max;
sec3y2 = (double)(paintRect.bottom() - (secs - tMin) * yFactor);
secs = lapTime.toDouble();
if (secs > max) secs = max;
lapy2 = (double)(paintRect.bottom() - (secs - tMin) * yFactor);
double dx1 = x, dx2 = x2, dy1 = sec1y, dy2 = sec1y2;
if (sec1y <= paintRect.bottom() || sec1y2 <= paintRect.bottom())
{
pen.setColor(colors[0]);
p->setPen(pen);
checkX1(dx1, dy1, dx2, dy2);
checkX2(dx1, dy1, dx2, dy2);
p->drawLine(dx1, dy1, dx2, dy2);
}
if (sec2y <= paintRect.bottom() || sec2y2 <= paintRect.bottom())
{
dx1 = x, dx2 = x2; dy1 = sec2y; dy2 = sec2y2;
pen.setColor(colors[1]);
p->setPen(pen);
checkX1(dx1, dy1, dx2, dy2);
checkX2(dx1, dy1, dx2, dy2);
p->drawLine(dx1, dy1, dx2, dy2);
}
if (sec3y <= paintRect.bottom() || sec3y2 <= paintRect.bottom())
{
dx1 = x, dx2 = x2; dy1 = sec3y; dy2 = sec3y2;
pen.setColor(colors[2]);
p->setPen(pen);
checkX1(dx1, dy1, dx2, dy2);
checkX2(dx1, dy1, dx2, dy2);
p->drawLine(dx1, dy1, dx2, dy2);
}
if (lapy <= paintRect.bottom() || lapy2 <= paintRect.bottom())
{
dx1 = x, dx2 = x2; dy1 = lapy; dy2 = lapy2;
pen.setColor(colors[3]);
p->setPen(pen);
checkX1(dx1, dy1, dx2, dy2);
checkX2(dx1, dy1, dx2, dy2);
p->drawLine(dx1, dy1, dx2, dy2);
if (!scaling)
{
if (lapsInWindow >= lapDataCoordinates.size())
lapDataCoordinates.append(LapDataCoordinates(i, (int)dx2, (int)dy2));
else
lapDataCoordinates[lapsInWindow] = LapDataCoordinates(i, (int)dx2, (int)dy2);
}
++lapsInWindow;
p->setBrush(QBrush(colors[3]));
if (driverData->getLapData()[i].getTime().toString() == "IN PIT")
{
QPainterPath path;
path.addEllipse(QPoint(round(x2), lapy2), 6, 6);
// p->setPen(colors[3]);
p->drawPath(path);
// pen.setWidth(4);
// p.setPen(pen);
// p.drawPoint(x2, lapy2);
// pen.setWidth(2);
}
else
{
QPainterPath path;
path.addEllipse(QPoint(round(x2), lapy2), 2, 2);
// p->setPen(colors[3]);
p->drawPath(path);
}
drawRetire(p, dx2, dy2, 6, driverData->getLapData()[i]);
}
x = x2;
sec1y = sec1y2;
sec2y = sec2y2;
sec3y = sec3y2;
lapy = lapy2;
}
clearLapDataCoordinates(lapsInWindow);
}
}
void LapTimeChart::drawLegend(QPainter *p)
{
int x = 35, y = 25;
p->setRenderHint(QPainter::Antialiasing, false);
p->setBrush(QColor(20, 20, 20));
p->setPen(ColorsManager::getInstance().getDefaultColor(LTPackets::DEFAULT));
p->drawRect(x, y, 200, 20);
p->setPen(colors[0]);
p->drawText(x+5, y+15, "S1");
p->setPen(colors[1]);
p->drawText(x+35, y+15, "S2");
p->setPen(colors[2]);
p->drawText(x+65, y+15, "S3");
p->setPen(colors[3]);
p->drawText(x+95, y+15, "Lap");
p->drawText(x+145, y+15, "Pit");
p->setPen(colors[4]);
p->drawText(x+175, y+15, "SC");
p->setRenderHint(QPainter::Antialiasing);
QPainterPath path;
p->setPen(colors[3]);
path.addEllipse(QPoint(x+138, y+10), 4, 4);
p->setBrush(colors[3]);
p->drawPath(path);
p->setBrush(QBrush());
}
void LapTimeChart::paintEvent(QPaintEvent *pe)
{
DriverDataChart::paintEvent(pe);
QPainter p;
p.begin(this);
if (!scaling)
{
if (!repaintPopup)
checkLapDataCoordinates(mousePosX, mousePosY);
popupBox->paint(&p, mousePosX, mousePosY, paintRect);
}
drawLegend(&p);
p.end();
}
void LapTimeChart::resetZoom()
{
ChartWidget::resetZoom();
first = 1;
if (driverData != 0)
last = driverData->getLapData().size();
}
//========================================================================
void GapChart::drawAxes(QPainter *p)
{
p->setPen(QColor(ColorsManager::getInstance().getDefaultColor(LTPackets::WHITE)));
//x axe
p->drawLine(paintRect.left(), paintRect.bottom(), paintRect.right(), paintRect.bottom());
//y axe
p->drawLine(paintRect.left(), paintRect.bottom(), paintRect.left(), paintRect.top());
p->setFont(QFont("Arial", 10));
p->setPen(QColor(ColorsManager::getInstance().getDefaultColor(LTPackets::WHITE)));
//double factor =
// min = 0;
// max = 0;
// for (int i = 0; i < lapData.size(); ++i)
// {
// if (lapData[i].gap[lapData[i].gap.size()-1] != 'L' && lapData[i].gap != "")
// {
// double gap = lapData[i].gap.toDouble();
// if (gap > max)
// max = gap;
// }
// }
for (int i = paintRect.bottom(), j = tMin; i >= 50; i-= (height()-75)/4, j += (tMax-tMin)/4)
{
p->setPen(QColor(ColorsManager::getInstance().getDefaultColor(LTPackets::WHITE)));
p->drawText(5, i+5, QString("%1").arg(j));
if (i != paintRect.height() && i < paintRect.bottom())
{
QPen pen(QColor(ColorsManager::getInstance().getDefaultColor(LTPackets::DEFAULT)));
pen.setStyle(Qt::DashLine);
p->setPen(pen);
p->drawLine(paintRect.left(), i, paintRect.right(), i);
}
}
if (tMax >= max)
{
p->setPen(QColor(ColorsManager::getInstance().getDefaultColor(LTPackets::WHITE)));
p->drawText(5, 15, ">1L");
QPen pen(QColor(ColorsManager::getInstance().getDefaultColor(LTPackets::DEFAULT)));
pen.setStyle(Qt::DashLine);
p->setPen(pen);
p->drawLine(paintRect.left(), paintRect.top(), paintRect.right(), paintRect.top());
p->setPen(QColor(ColorsManager::getInstance().getDefaultColor(LTPackets::WHITE)));
p->drawText(5, 35, QString(">%1").arg(max));
pen.setColor(QColor(ColorsManager::getInstance().getDefaultColor(LTPackets::DEFAULT)));
pen.setStyle(Qt::DashLine);
p->setPen(pen);
p->drawLine(paintRect.left(), 30, paintRect.right(), 30);
}
if (driverData != 0 && !driverData->getLapData().isEmpty())
{
int sz = last - first + 1;
double xFactor = ((double)paintRect.width()) / /*((lapData.size() < 5) ?*/ (double)sz /*: 5)*/;
double j = first-1;
double i = paintRect.left();
int prevJ = first-1;
double jFactor = sz < 5 ? 1.0 : (double)(sz/6.0);
for (; i < width()-15.0 && round(j) < last && round(j) < driverData->getLapData().size(); /*i += xFactor,*/ j += jFactor)
{
i += (double)(round(j) - prevJ) * xFactor;
prevJ = round(j);
p->setPen(QColor(ColorsManager::getInstance().getDefaultColor(LTPackets::WHITE)));
p->drawText(round(i)-5, height()-10, QString("L%1").arg(driverData->getLapData()[round(j)].getLapNumber()));
if (i > paintRect.left())
{
QPen pen(QColor(ColorsManager::getInstance().getDefaultColor(LTPackets::DEFAULT)));
pen.setStyle(Qt::DashLine);
p->setPen(pen);
p->drawLine(round(i), paintRect.bottom(), round(i), paintRect.top());
}
}
}
}
void GapChart::drawChart(QPainter *p)
{
if (driverData != 0 && !driverData->getLapData().empty() && first < driverData->getLapData().size() && last <= driverData->getLapData().size())
{
p->setBrush(QBrush(color));
QPen pen(color);
pen.setWidth(2);
p->setPen(pen);
p->setRenderHint(QPainter::Antialiasing);
int sz = last - first + 1;
double xFactor = ((double)width()-30.0) / (double)sz;
double yFactor = (((double)height()-75.0) / (double)(tMax-tMin));
double gap = driverData->getLapData()[first-1].getGap().toDouble();
if (driverData->getLapData()[first-1].getGap().size() > 0 && driverData->getLapData()[first-1].getGap()[driverData->getLapData()[first-1].getGap().size()-1] == 'L')
gap = -1.0;
double x = paintRect.left(), y = paintRect.bottom() - (gap - tMin) * yFactor, y2;
if (gap == -1.0 && tMax >= max)
y = 10;
else if (gap > tMax && tMax >= max)
y = 30;
double j = x + xFactor;
int lapsInWindow = 0;
int lastPaintedSC = 0;
for (int i = first; i < last+1 && i < driverData->getLapData().size(); ++i, j += xFactor)
{
bool ok;
gap = driverData->getLapData()[i].getGap().toDouble(&ok);
y2 = paintRect.bottom() - (gap - tMin) * yFactor;
double x2 = j;
if (gap > tMax && tMax >= max)
y2 = 30;
if (EventData::getInstance().getEventType() == LTPackets::RACE_EVENT)
{
if (driverData->getLapData()[i].getPosition() == 1 && driverData->getLapData()[i].getGap() == "LAP")
{
gap = 0;
y2 = paintRect.bottom() - gap * yFactor;
}
else if (driverData->getLapData()[i].getGap().size() > 0 && driverData->getLapData()[i].getGap()[driverData->getLapData()[i].getGap().size()-1] == 'L')
{
if (tMax >= max)
{
y2 = 10;
gap = -1.0;
}
else
{
gap = max;
y2 = paintRect.top()-10;
}
}
else if ((gap <= 0 || !ok || gap > tMax) && tMax >= max)
y2 = 30;
// else
// y2 = height()-25 - gap * yFactor;
}
if (driverData->getLapData()[i].getTime().toString().contains("LAP"))
continue;
if (driverData->getLapData()[i-1].getRaceLapExtraData().isSCLap() && driverData->getLapData()[i-1].getLapNumber() > lastPaintedSC)
{
drawSCLap(p, driverData->getLapData()[i-1], xFactor);
lastPaintedSC = driverData->getLapData()[i-1].getLapNumber();
}
if ((y2 > paintRect.bottom() && y > paintRect.bottom()) ||
(y2 < paintRect.top() && y < paintRect.top()))
{
x = j;
y = y2;
continue;
}
pen.setWidth(2);
p->setPen(pen);
QPainterPath path;
p->setBrush(QBrush(color));
if (y2 <= paintRect.bottom())
{
if (driverData->getLapData()[i].getTime().toString() == "IN PIT")
{
path.addEllipse(QPoint(x2, y2), 6, 6);
}
else
{
path.addEllipse(QPoint(x2, y2), 2, 2);
}
p->drawPath(path);
if (!scaling)
{
if (lapsInWindow >= lapDataCoordinates.size())
lapDataCoordinates.append(LapDataCoordinates(i, (int)x2, (int)y2));
else
lapDataCoordinates[lapsInWindow] = LapDataCoordinates(i, (int)x2, (int)y2);
}
++lapsInWindow;
}
double tmpY2 = y2;
checkX1(x, y, x2, tmpY2);
checkX2(x, y, x2, tmpY2);
p->drawLine(x, y, x2, tmpY2);
drawRetire(p, x2, tmpY2, 6, driverData->getLapData()[i]);
x = j;
y = y2;
}
clearLapDataCoordinates(lapsInWindow);
}
}
void GapChart::paintEvent(QPaintEvent *pe)
{
DriverDataChart::paintEvent(pe);
if (!scaling)
{
if (!repaintPopup)
checkLapDataCoordinates(mousePosX, mousePosY);
QPainter p;
p.begin(this);
popupBox->paint(&p, mousePosX, mousePosY, paintRect);
p.end();
}
}
void GapChart::resetZoom()
{
ChartWidget::resetZoom();
first = 1;
if (driverData != 0)
last = driverData->getLapData().size();
}
| zywhlc-f1lt | src/charts/driverdatachart.cpp | C++ | gpl3 | 35,927 |
/*******************************************************************************
* *
* F1LT - unofficial Formula 1 live timing application *
* Copyright (C) 2012-2013 Mariusz Pilarek (pieczaro@gmail.com) *
* *
* 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 *
* the Free Software Foundation, either version 3 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
* *
*******************************************************************************/
#include "chartwidget.h"
#include "ui_chartwidget.h"
#include <QClipboard>
#include <QFileDialog>
#include <QImage>
#include <QPainter>
#include <cmath>
#include <QDebug>
#include "../core/eventdata.h"
#include "../core/seasondata.h"
ChartWidget::ChartWidget(double n, double x, QColor col, QWidget *parent) :
QWidget(parent), min(n), max(x), color(col)
{
menu = new QMenu(this);
copyAction = menu->addAction("Copy chart");
saveAction = menu->addAction("Save as image");
zoomOutAction = menu->addAction("Zoom out");
connect(copyAction, SIGNAL(triggered()), this, SLOT(onCopy()));
connect(saveAction, SIGNAL(triggered()), this, SLOT(onSave()));
connect(zoomOutAction, SIGNAL(triggered()), this, SLOT(onZoomOut()));
scaling = false;
first = 0;
last = 0;
tMin = min;
tMax = max;
setMouseTracking(true);
}
ChartWidget::~ChartWidget()
{
}
void ChartWidget::checkX1(double &x1, double &y1, double x2, double y2)
{
if (y1 > paintRect.bottom())
{
double h = y1 - y2;
double w = x2 - x1;
x1 = x1 + ((y1 - paintRect.bottom()) * w)/h;
y1 = paintRect.bottom();
}
}
void ChartWidget::checkX2(double x1, double y1, double &x2, double &y2)
{
if (y2 > paintRect.bottom())
{
double h = y2 - y1;
double w = x2 - x1;
x2 = x2 - ((y2 - paintRect.bottom()) * w)/h;
y2 = paintRect.bottom();
}
}
void ChartWidget::mousePressEvent(QMouseEvent *ev)
{
if (ev->button() == Qt::RightButton)
{
menu->exec(QWidget::mapToGlobal(ev->pos()));
}
if (ev->button() == Qt::LeftButton)
{
if (ev->pos().x() >= paintRect.left() && ev->pos().y() <= paintRect.bottom() &&
ev->pos().x() <= paintRect.right()&& ev->pos().y() >= paintRect.top())
{
scaling = true;
scaleRect = QRect();
scaleRect.setX(ev->pos().x());
scaleRect.setY(ev->pos().y());
scaleRect.setWidth(1);
scaleRect.setHeight(1);
}
}
}
void ChartWidget::mouseMoveEvent(QMouseEvent *ev)
{
if (/*ev->button() == Qt::LeftButton &&*/ scaling)
{
if (ev->pos().x() >= paintRect.left() && ev->pos().y() <= paintRect.bottom() &&
ev->pos().x() <= paintRect.right()&& ev->pos().y() >= paintRect.top())
{
scaleRect.setWidth(ev->pos().x() - scaleRect.x());
scaleRect.setHeight(ev->pos().y() - scaleRect.y());
}
update();
}
}
void ChartWidget::mouseReleaseEvent(QMouseEvent *)
{
if (scaling)
{
scaling = false;
if (abs(scaleRect.width()) > 20 && abs(scaleRect.height()) > 20)
{
pushScaleRect();
transform();
}
repaint();
}
}
void ChartWidget::mouseDoubleClickEvent(QMouseEvent *)
{
if (!scaling)
{
scaleRect = QRect();
resetZoom();
transform();
scaleRectsStack.clear();
repaint();
}
}
void ChartWidget::drawScaleRect(QPainter *p)
{
p->setPen(QColor(255, 255, 255, 150));
p->setBrush(QColor(240, 240, 240, 50));
p->drawRect(scaleRect);
}
void ChartWidget::paintEvent(QPaintEvent *)
{
resetPaintRect();
if (scaleRect.width() == 0 && scaleRect.height() == 0)
{
resetZoom();
}
QPainter p;
p.begin(this);
p.setBrush(QColor(20,20,20));
p.setPen(QColor(20,20,20));
p.drawRect(0, 0, width(), height());
drawAxes(&p);
drawChart(&p);
if (scaling)
drawScaleRect(&p);
p.end();
}
void ChartWidget::resetZoom()
{
tMin = min;
tMax = max;
}
void ChartWidget::transform()
{
if (scaling || scaleRect == paintRect || (abs(scaleRect.width()) < 20 || abs(scaleRect.height()) < 20))
return;
if (scaleRect == QRect())
{
resetZoom();
return;
}
if (scaleRect.left() > scaleRect.right())
scaleRect = QRect(scaleRect.right(), scaleRect.top(), -scaleRect.width(), scaleRect.height());
if (scaleRect.top() > scaleRect.bottom())
scaleRect = QRect(scaleRect.left(), scaleRect.bottom(), scaleRect.width(), -scaleRect.height());
calculateTransformFactors();
}
void ChartWidget::pushScaleRect()
{
ChartWidget::ScaleAtom sa;
sa.first = first; sa.last = last;
sa.min = tMin; sa.max = tMax;
scaleRectsStack.push(sa);
}
void ChartWidget::drawIntoImage(QImage &img)
{
QPainter p;
p.begin(&img);
p.setBrush(QColor(20,20,20));
p.setPen(QColor(20,20,20));
p.drawRect(0, 0, width(), height());
drawAxes(&p);
drawChart(&p);
drawLegend(&p);
p.end();
}
void ChartWidget::onCopy()
{
QImage img = QImage(width(), height(), QImage::Format_ARGB32);
drawIntoImage(img);
qApp->clipboard()->setImage(img);
}
void ChartWidget::onSave()
{
QString fName = QFileDialog::getSaveFileName(this, "Select file", "", "*.png");
if (!fName.isNull())
{
QImage img = QImage(width(), height(), QImage::Format_ARGB32);
drawIntoImage(img);
img.save(fName, "PNG");
}
}
void ChartWidget::onZoomOut()
{
if (scaleRectsStack.size() > 1)
{
ChartWidget::ScaleAtom sa = scaleRectsStack.pop();
resetZoom();
first = sa.first; last = sa.last;
tMin = sa.min; tMax = sa.max;
repaint();
}
else
{
scaleRectsStack.clear();
scaleRect = QRect();
resetZoom();
repaint();
}
}
| zywhlc-f1lt | src/charts/chartwidget.cpp | C++ | gpl3 | 6,707 |
/*******************************************************************************
* *
* F1LT - unofficial Formula 1 live timing application *
* Copyright (C) 2012-2013 Mariusz Pilarek (pieczaro@gmail.com) *
* *
* 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 *
* the Free Software Foundation, either version 3 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
* *
*******************************************************************************/
#ifndef CHARTWIDGET_H
#define CHARTWIDGET_H
#include <QAction>
#include <QDebug>
#include <QList>
#include <QMenu>
#include <QMouseEvent>
#include <QStack>
#include <QWidget>
class ChartWidget : public QWidget
{
Q_OBJECT
public:
explicit ChartWidget(double, double, QColor, QWidget *parent = 0);
~ChartWidget();
void setMinMax(double min, double max) { this->min = min, this->max = max; }
virtual void drawAxes(QPainter *p) = 0;
virtual void drawChart(QPainter *p) = 0;
virtual void drawLegend(QPainter *p) = 0;
virtual void drawScaleRect(QPainter *p);
virtual void drawIntoImage(QImage &img);
virtual void transform();
virtual void calculateTransformFactors() = 0;
virtual void resetZoom();
void pushScaleRect();
void checkX1(double &x1, double &y1, double x2, double y2);
void checkX2(double x1, double y1, double &x2, double &y2);
int getMin() { return min; }
int getMax() { return max; }
int getFirst() { return first; }
int getLast() { return last; }
public slots:
virtual void onCopy();
virtual void onSave();
virtual void onZoomOut();
protected:
virtual void paintEvent(QPaintEvent *);
virtual void mousePressEvent(QMouseEvent *);
virtual void mouseMoveEvent(QMouseEvent *);
virtual void mouseReleaseEvent(QMouseEvent *);
virtual void mouseDoubleClickEvent (QMouseEvent *);
virtual void resetPaintRect()
{
paintRect = QRect(27, 10, width()-32, height()-35);
}
double min, max;
double tMin, tMax;
int first, last;
QColor color;
QMenu *menu;
QAction *copyAction;
QAction *saveAction;
QAction *zoomOutAction;
struct ScaleAtom
{
double min, max;
int first, last;
};
QRect scaleRect;
QStack<ScaleAtom> scaleRectsStack;
QRect paintRect;
bool scaling;
};
#endif // CHARTWIDGET_H
| zywhlc-f1lt | src/charts/chartwidget.h | C++ | gpl3 | 3,454 |
/*******************************************************************************
* *
* F1LT - unofficial Formula 1 live timing application *
* Copyright (C) 2012-2013 Mariusz Pilarek (pieczaro@gmail.com) *
* *
* 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 *
* the Free Software Foundation, either version 3 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
* *
*******************************************************************************/
#include "eventrecorder.h"
#include "ltfilesloader.h"
#include <QDataStream>
#include <QFile>
EventRecorder::EventRecorder(SessionTimer *st, QObject *parent) :
QObject(parent), eventData(EventData::getInstance()), recordStartTime(0), elapsedSeconds(0), autoSaveRecord(-1), autoSaveCounter(-1), sessionRecorded(false), sessionTimer(st)
{
}
void EventRecorder::startRecording(int delay)
{
sessionRecorded = false;
recordStartTime = QDateTime::currentMSecsSinceEpoch() - delay * 1000;
//prepare everyting for record, clear old records and store the LTTeam and LTEvent data
ltTeamList = SeasonData::getInstance().getTeams();
ltEvent = eventData.getEventInfo();
packets.clear();
elapsedSeconds = 0;
lastSavedTime.first = 0;
lastSavedTime.second = eventData.getRemainingTime();
elapsedTimeToStop = -1;
autoSaveCounter = autoSaveRecord * 60;
gatherInitialData();
}
/*Before start of the recording, we have to gather all initial data, that will be needed to correctly startup replaying the event. This includes:
- event type
- track status
- remaining time
- car position update and history, driver numbers and names
- weather data
- speed records
- fastest lap data
- commentary
*/
void EventRecorder::gatherInitialData()
{
Packet packet;
gatherSysData();
gatherDriverData();
//commentary
packet.carID = 0;
packet.type = LTPackets::SYS_COMMENTARY;
packet.data = 0;
packet.longData.append(" "); //append 2 empty bytes
packet.longData.append(eventData.getCommentary());
packet.length = packet.longData.size();
packets.append(QPair<int, Packet>(elapsedSeconds, packet));
++elapsedSeconds;
}
void EventRecorder::gatherSysData()
{
Packet packet;
//event type
packet.carID = 0;
packet.type = LTPackets::SYS_EVENT_ID;
packet.data = eventData.getEventType();
packet.length = 0; //we don't need a number for the decryption key
packets.append(QPair<int, Packet>(elapsedSeconds, packet));
packet.longData.clear();
//track status
packet.carID = 0;
packet.type = LTPackets::SYS_TRACK_STATUS;
packet.data = 1;
packet.longData.append((char)(eventData.getFlagStatus()) + '0');
packet.length = 1;
packets.append(QPair<int, Packet>(elapsedSeconds, packet));
packet.longData.clear();
//remaining time
packet.carID = 0;
packet.type = LTPackets::SYS_WEATHER;
packet.data = LTPackets::WEATHER_SESSION_CLOCK;
packet.longData.append(eventData.getRemainingTime().toString("h:mm:ss"));
packet.length = packet.longData.size();
packets.append(QPair<int, Packet>(elapsedSeconds, packet));
packet.longData.clear();
//weather data
//track temp
packet.carID = 0;
packet.type = LTPackets::SYS_WEATHER;
packet.data = LTPackets::WEATHER_TRACK_TEMP;
packet.longData.append(QString::number(eventData.getWeather().getTrackTemp().getValue()));
packet.length = packet.longData.size();
packets.append(QPair<int, Packet>(elapsedSeconds, packet));
packet.longData.clear();
//air temp
packet.carID = 0;
packet.type = LTPackets::SYS_WEATHER;
packet.data = LTPackets::WEATHER_AIR_TEMP;
packet.longData.append(QString::number(eventData.getWeather().getAirTemp().getValue()));
packet.length = packet.longData.size();
packets.append(QPair<int, Packet>(elapsedSeconds, packet));
packet.longData.clear();
//wind speed
packet.carID = 0;
packet.type = LTPackets::SYS_WEATHER;
packet.data = LTPackets::WEATHER_WIND_SPEED;
packet.longData.append(QString::number(eventData.getWeather().getWindSpeed().getValue()));
packet.length = packet.longData.size();
packets.append(QPair<int, Packet>(elapsedSeconds, packet));
packet.longData.clear();
//humidity
packet.carID = 0;
packet.type = LTPackets::SYS_WEATHER;
packet.data = LTPackets::WEATHER_HUMIDITY;
packet.longData.append(QString::number(eventData.getWeather().getHumidity().getValue()));
packet.length = packet.longData.size();
packets.append(QPair<int, Packet>(elapsedSeconds, packet));
packet.longData.clear();
//pressure
packet.carID = 0;
packet.type = LTPackets::SYS_WEATHER;
packet.data = LTPackets::WEATHER_PRESSURE;
packet.longData.append(QString::number(eventData.getWeather().getPressure().getValue()));
packet.length = packet.longData.size();
packets.append(QPair<int, Packet>(elapsedSeconds, packet));
packet.longData.clear();
//wind dir.
packet.carID = 0;
packet.type = LTPackets::SYS_WEATHER;
packet.data = LTPackets::WEATHER_WIND_DIRECTION;
packet.longData.append(QString::number(eventData.getWeather().getWindDirection().getValue()));
packet.length = packet.longData.size();
packets.append(QPair<int, Packet>(elapsedSeconds, packet));
packet.longData.clear();
//wet track
packet.carID = 0;
packet.type = LTPackets::SYS_WEATHER;
packet.data = LTPackets::WEATHER_WET_TRACK;
packet.longData.append(QString::number(eventData.getWeather().getWetDry().getValue()));
packet.length = packet.longData.size();
packets.append(QPair<int, Packet>(elapsedSeconds, packet));
packet.longData.clear();
//speed records
//sector 1
packet.carID = 0;
packet.type = LTPackets::SYS_SPEED;
packet.data = 0;
packet.longData.append(QString::number(LTPackets::SPEED_SECTOR1));
for (int i = 0; i < 6; ++i)
{
QString name = SeasonData::getInstance().getDriverShortName(eventData.getSessionRecords().getSectorSpeed(1, i).getDriverName());
QString speed = QString::number(eventData.getSessionRecords().getSectorSpeed(1, i).getSpeed());
packet.longData.append(name + speed);
}
packet.length = packet.longData.size();
packets.append(QPair<int, Packet>(elapsedSeconds, packet));
packet.longData.clear();
//sector 2
packet.carID = 0;
packet.type = LTPackets::SYS_SPEED;
packet.data = 0;
packet.longData.append(QString::number(LTPackets::SPEED_SECTOR2));
for (int i = 0; i < 6; ++i)
{
QString name = SeasonData::getInstance().getDriverShortName(eventData.getSessionRecords().getSectorSpeed(2, i).getDriverName());
QString speed = QString::number(eventData.getSessionRecords().getSectorSpeed(2, i).getSpeed());
packet.longData.append(name + speed);
}
packet.length = packet.longData.size();
packets.append(QPair<int, Packet>(elapsedSeconds, packet));
packet.longData.clear();
//sector 3
packet.carID = 0;
packet.type = LTPackets::SYS_SPEED;
packet.data = 0;
packet.longData.append(QString::number(LTPackets::SPEED_SECTOR3));
for (int i = 0; i < 6; ++i)
{
QString name = SeasonData::getInstance().getDriverShortName(eventData.getSessionRecords().getSectorSpeed(3, i).getDriverName());
QString speed = QString::number(eventData.getSessionRecords().getSectorSpeed(3, i).getSpeed());
packet.longData.append(name + speed);
}
packet.length = packet.longData.size();
packets.append(QPair<int, Packet>(elapsedSeconds, packet));
packet.longData.clear();
//speed trap
packet.carID = 0;
packet.type = LTPackets::SYS_SPEED;
packet.data = 0;
packet.longData.append(QString::number(LTPackets::SPEED_TRAP));
for (int i = 0; i < 6; ++i)
{
QString name = SeasonData::getInstance().getDriverShortName(eventData.getSessionRecords().getSpeedTrap(i).getDriverName());
QString speed = QString::number(eventData.getSessionRecords().getSpeedTrap(i).getSpeed());
packet.longData.append(name + speed);
}
packet.length = packet.longData.size();
packets.append(QPair<int, Packet>(elapsedSeconds, packet));
packet.longData.clear();
//fastest lap data
//FL_CAR
packet.carID = 0;
packet.type = LTPackets::SYS_SPEED;
packet.data = 0;
packet.longData.append(QString::number(LTPackets::FL_CAR));
packet.longData.append(QString::number(eventData.getSessionRecords().getFastestLap().getNumber()));
packets.append(QPair<int, Packet>(elapsedSeconds, packet));
packet.longData.clear();
//FL_DRIVER
packet.carID = 0;
packet.type = LTPackets::SYS_SPEED;
packet.data = 0;
packet.longData.append(QString::number(LTPackets::FL_DRIVER));
packet.longData.append(eventData.getSessionRecords().getFastestLap().getDriverName().toUpper());
packets.append(QPair<int, Packet>(elapsedSeconds, packet));
packet.longData.clear();
//FL_LAP
packet.carID = 0;
packet.type = LTPackets::SYS_SPEED;
packet.data = 0;
packet.longData.append(QString::number(LTPackets::FL_LAP));
packet.longData.append(QString::number(eventData.getSessionRecords().getFastestLap().getLapNumber()));
packets.append(QPair<int, Packet>(elapsedSeconds, packet));
packet.longData.clear();
//FL_TIME
packet.carID = 0;
packet.type = LTPackets::SYS_SPEED;
packet.data = 0;
packet.longData.append(QString::number(LTPackets::FL_LAP));
packet.longData.append(eventData.getSessionRecords().getFastestLap().getTime());
packets.append(QPair<int, Packet>(elapsedSeconds, packet));
packet.longData.clear();
}
void EventRecorder::gatherDriverData()
{
Packet packet;
//car position update
for (int i = 0; i < eventData.getDriversData().size(); ++i)
{
packet.type = LTPackets::CAR_POSITION_UPDATE;
packet.carID = eventData.getDriversData()[i].getCarID();
packet.length = 0;
packet.data = eventData.getDriversData()[i].getPosition();
packets.append(QPair<int, Packet>(elapsedSeconds, packet));
packet.longData.clear();
}
//car position history
for (int i = 0; i < eventData.getDriversData().size(); ++i)
{
packet.type = LTPackets::CAR_POSITION_HISTORY;
packet.carID = eventData.getDriversData()[i].getCarID();
packet.data = 0;
packet.length = eventData.getDriversData()[i].getPositionHistory().size();
for (int j = 0; j < packet.length; ++j)
packet.longData.append((char)(eventData.getDriversData()[i].getPositionHistory()[j]));
packets.append(QPair<int, Packet>(elapsedSeconds, packet));
packet.longData.clear();
}
//other car data
for (int i = 0; i < eventData.getDriversData().size(); ++i)
{
//position
packet.type = LTPackets::RACE_POSITION;
packet.carID = eventData.getDriversData()[i].getCarID();
packet.data = eventData.getDriversData()[i].getColorData().positionColor();
packet.longData.append(QString::number(eventData.getDriversData()[i].getPosition()));
packets.append(QPair<int, Packet>(elapsedSeconds, packet));
packet.longData.clear();
//number
packet.type = LTPackets::RACE_NUMBER;
packet.carID = eventData.getDriversData()[i].getCarID();
packet.data = eventData.getDriversData()[i].getColorData().numberColor();
packet.longData.append(QString::number(eventData.getDriversData()[i].getNumber()));
packets.append(QPair<int, Packet>(elapsedSeconds, packet));
packet.longData.clear();
//car driver
packet.type = LTPackets::RACE_DRIVER;
packet.carID = eventData.getDriversData()[i].getCarID();
packet.data = eventData.getDriversData()[i].getColorData().driverColor();
packet.longData.append(eventData.getDriversData()[i].getDriverName().toUpper());
packets.append(QPair<int, Packet>(elapsedSeconds, packet));
packet.longData.clear();
if (eventData.getEventType() == LTPackets::RACE_EVENT)
{
//race gap
packet.type = LTPackets::RACE_GAP;
packet.carID = eventData.getDriversData()[i].getCarID();
packet.data = eventData.getDriversData()[i].getColorData().gapColor();
packet.longData.append(eventData.getDriversData()[i].getLastLap().getGap());
packets.append(QPair<int, Packet>(elapsedSeconds, packet));
packet.longData.clear();
//race gap
packet.type = LTPackets::RACE_INTERVAL;
packet.carID = eventData.getDriversData()[i].getCarID();
packet.data = eventData.getDriversData()[i].getColorData().intervalColor();
packet.longData.append(eventData.getDriversData()[i].getLastLap().getInterval());
packets.append(QPair<int, Packet>(elapsedSeconds, packet));
packet.longData.clear();
//race lap time
packet.type = LTPackets::RACE_LAP_TIME;
packet.carID = eventData.getDriversData()[i].getCarID();
packet.data = eventData.getDriversData()[i].getColorData().lapTimeColor();
packet.longData.append(eventData.getDriversData()[i].getLastLap().getTime().toString());
packets.append(QPair<int, Packet>(elapsedSeconds, packet));
packet.longData.clear();
//race sector 1
packet.type = LTPackets::RACE_SECTOR_1;
packet.carID = eventData.getDriversData()[i].getCarID();
packet.data = eventData.getDriversData()[i].getColorData().sectorColor(1);
packet.longData.append(eventData.getDriversData()[i].getLastLap().getSectorTime(1));
packets.append(QPair<int, Packet>(elapsedSeconds, packet));
packet.longData.clear();
//race sector 2
packet.type = LTPackets::RACE_SECTOR_2;
packet.carID = eventData.getDriversData()[i].getCarID();
packet.data = eventData.getDriversData()[i].getColorData().sectorColor(2);
packet.longData.append(eventData.getDriversData()[i].getLastLap().getSectorTime(2));
packets.append(QPair<int, Packet>(elapsedSeconds, packet));
packet.longData.clear();
//race sector 3
packet.type = LTPackets::RACE_SECTOR_3;
packet.carID = eventData.getDriversData()[i].getCarID();
packet.data = eventData.getDriversData()[i].getColorData().sectorColor(3);
packet.longData.append(eventData.getDriversData()[i].getLastLap().getSectorTime(3));
packets.append(QPair<int, Packet>(elapsedSeconds, packet));
packet.longData.clear();
//race num pits
packet.type = LTPackets::RACE_NUM_PITS;
packet.carID = eventData.getDriversData()[i].getCarID();
packet.data = eventData.getDriversData()[i].getColorData().numPitsColor();
packet.longData.append(QString::number(eventData.getDriversData()[i].getNumPits()));
packets.append(QPair<int, Packet>(elapsedSeconds, packet));
packet.longData.clear();
}
else if (eventData.getEventType() == LTPackets::QUALI_EVENT)
{
//quali 1
packet.type = LTPackets::QUALI_PERIOD_1;
packet.carID = eventData.getDriversData()[i].getCarID();
packet.data = eventData.getDriversData()[i].getColorData().qualiTimeColor(1);
packet.longData.append(eventData.getDriversData()[i].getQualiTime(1).toString());
packets.append(QPair<int, Packet>(elapsedSeconds, packet));
packet.longData.clear();
//quali 2
packet.type = LTPackets::QUALI_PERIOD_2;
packet.carID = eventData.getDriversData()[i].getCarID();
packet.data = eventData.getDriversData()[i].getColorData().qualiTimeColor(2);
packet.longData.append(eventData.getDriversData()[i].getQualiTime(2).toString());
packets.append(QPair<int, Packet>(elapsedSeconds, packet));
packet.longData.clear();
//quali 3
packet.type = LTPackets::QUALI_PERIOD_3;
packet.carID = eventData.getDriversData()[i].getCarID();
packet.data = eventData.getDriversData()[i].getColorData().qualiTimeColor(3);
packet.longData.append(eventData.getDriversData()[i].getQualiTime(3).toString());
packets.append(QPair<int, Packet>(elapsedSeconds, packet));
packet.longData.clear();
//quali sector 1
packet.type = LTPackets::QUALI_SECTOR_1;
packet.carID = eventData.getDriversData()[i].getCarID();
packet.data = eventData.getDriversData()[i].getColorData().sectorColor(1);
packet.longData.append(eventData.getDriversData()[i].getLastLap().getSectorTime(1));
packets.append(QPair<int, Packet>(elapsedSeconds, packet));
packet.longData.clear();
//quali sector 2
packet.type = LTPackets::QUALI_SECTOR_2;
packet.carID = eventData.getDriversData()[i].getCarID();
packet.data = eventData.getDriversData()[i].getColorData().sectorColor(2);
packet.longData.append(eventData.getDriversData()[i].getLastLap().getSectorTime(2));
packets.append(QPair<int, Packet>(elapsedSeconds, packet));
packet.longData.clear();
//quali sector 3
packet.type = LTPackets::QUALI_SECTOR_3;
packet.carID = eventData.getDriversData()[i].getCarID();
packet.data = eventData.getDriversData()[i].getColorData().sectorColor(3);
packet.longData.append(eventData.getDriversData()[i].getLastLap().getSectorTime(3));
packets.append(QPair<int, Packet>(elapsedSeconds, packet));
packet.longData.clear();
//quali lap
packet.type = LTPackets::QUALI_LAP;
packet.carID = eventData.getDriversData()[i].getCarID();
packet.data = eventData.getDriversData()[i].getColorData().numLapsColor();
packet.longData.append(QString::number(eventData.getDriversData()[i].getLastLap().getLapNumber()));
packets.append(QPair<int, Packet>(elapsedSeconds, packet));
packet.longData.clear();
}
else if (eventData.getEventType() == LTPackets::PRACTICE_EVENT)
{
//practice best
packet.type = LTPackets::PRACTICE_BEST;
packet.carID = eventData.getDriversData()[i].getCarID();
packet.data = eventData.getDriversData()[i].getColorData().lapTimeColor();
packet.longData.append(eventData.getDriversData()[i].getLastLap().getTime().toString());
packets.append(QPair<int, Packet>(elapsedSeconds, packet));
packet.longData.clear();
//practice gap
packet.type = LTPackets::PRACTICE_GAP;
packet.carID = eventData.getDriversData()[i].getCarID();
packet.data = eventData.getDriversData()[i].getColorData().gapColor();
packet.longData.append(eventData.getDriversData()[i].getLastLap().getGap());
packets.append(QPair<int, Packet>(elapsedSeconds, packet));
packet.longData.clear();
//practice sector 1
packet.type = LTPackets::PRACTICE_SECTOR_1;
packet.carID = eventData.getDriversData()[i].getCarID();
packet.data = eventData.getDriversData()[i].getColorData().sectorColor(1);
packet.longData.append(eventData.getDriversData()[i].getLastLap().getSectorTime(1));
packets.append(QPair<int, Packet>(elapsedSeconds, packet));
packet.longData.clear();
//practice sector 2
packet.type = LTPackets::PRACTICE_SECTOR_2;
packet.carID = eventData.getDriversData()[i].getCarID();
packet.data = eventData.getDriversData()[i].getColorData().sectorColor(2);
packet.longData.append(eventData.getDriversData()[i].getLastLap().getSectorTime(2));
packets.append(QPair<int, Packet>(elapsedSeconds, packet));
packet.longData.clear();
//practice sector 3
packet.type = LTPackets::PRACTICE_SECTOR_3;
packet.carID = eventData.getDriversData()[i].getCarID();
packet.data = eventData.getDriversData()[i].getColorData().sectorColor(3);
packet.longData.append(eventData.getDriversData()[i].getLastLap().getSectorTime(3));
packets.append(QPair<int, Packet>(elapsedSeconds, packet));
packet.longData.clear();
//practice lap
packet.type = LTPackets::PRACTICE_LAP;
packet.carID = eventData.getDriversData()[i].getCarID();
packet.data = eventData.getDriversData()[i].getColorData().numLapsColor();
packet.longData.append(QString::number(eventData.getDriversData()[i].getLastLap().getLapNumber()));
packets.append(QPair<int, Packet>(elapsedSeconds, packet));
packet.longData.clear();
}
}
}
void EventRecorder::stopRecording()
{
sessionRecorded = true;
saveToFile("");
}
void EventRecorder::appendPacket(const Packet &p)
{
packets.append(QPair<int, Packet>(elapsedSeconds, p));
}
void EventRecorder::appendPacket(const QPair<Packet, qint64> &packet)
{
elapsedSeconds = round((double(packet.second) - double(recordStartTime)) / 1000.0);
if (elapsedSeconds < 0)
{
recordStartTime += elapsedSeconds * 1000;
elapsedSeconds = 0;
}
appendSessionTimer();
packets.append(QPair<int, Packet>(elapsedSeconds, packet.first));
if (packet.first.type == LTPackets::SYS_WEATHER && packet.first.data == LTPackets::WEATHER_SESSION_CLOCK)
{
lastSavedTime.first = elapsedSeconds;
lastSavedTime.second = eventData.getRemainingTime();
}
}
void EventRecorder::appendSessionTimer()
{
if (eventData.getRemainingTime().isNull())
return;
int secs = lastSavedTime.second.second();
int mins = lastSavedTime.second.minute();
int hours = lastSavedTime.second.hour();
for (int i = lastSavedTime.first + 1; i <= elapsedSeconds; ++i)
{
--secs;
if (secs < 0)
{
--mins;
secs = 60 + secs;
if (mins < 0)
{
--hours;
mins = 60 + mins;
if (hours < 0)
hours = mins = secs = 0;
}
}
Packet packet;
packet.carID = 0;
packet.type = LTPackets::SYS_WEATHER;
packet.data = LTPackets::WEATHER_SESSION_CLOCK;
lastSavedTime.second = QTime(hours, mins, secs);
packet.longData.append(lastSavedTime.second.toString("h:mm:ss"));
packet.length = packet.longData.size();
packets.append(QPair<int, Packet>(i, packet));
lastSavedTime.first = i;
}
}
void EventRecorder::timeout()
{
if (sessionTimer->isSynchronizing())
return;
if (autoStopRecord >= 0)
{
if((eventData.getRemainingTime().toString("h:mm:ss") == "0:00:00" && eventData.getEventType() == LTPackets::PRACTICE_EVENT) ||
(eventData.getRemainingTime().toString("h:mm:ss") == "0:00:00" && eventData.getEventType() == LTPackets::QUALI_EVENT && eventData.getQualiPeriod() == 3) ||
((eventData.getRemainingTime().toString("h:mm:ss") == "0:00:00" || eventData.getCompletedLaps() == eventData.getEventInfo().laps) && eventData.getEventType() == LTPackets::RACE_EVENT))
++elapsedTimeToStop;
if (elapsedTimeToStop >= (autoStopRecord * 60))
{
emit recordingStopped();
stopRecording();
}
}
if (autoSaveRecord > -1)
{
--autoSaveCounter;
if (autoSaveCounter <= 0)
{
saveToFile("");
autoSaveCounter = autoSaveRecord * 60;
}
}
}
void EventRecorder::saveToFile(QString)
{
if (packets.size() > 0)
{
int year = eventData.getEventInfo().raceDate.year();
int no = eventData.getEventInfo().eventNo;
QString shortName = eventData.getEventInfo().eventShortName.toLower();
QString session;
switch (eventData.getEventType())
{
case LTPackets::RACE_EVENT:
session = "race"; break;
case LTPackets::QUALI_EVENT:
session = "quali"; break;
case LTPackets::PRACTICE_EVENT:
session = "fp" + QString::number(EventData::getInstance().getFPNumber()); break;
default: break;
}
QString sNo = QString::number(no);
if (no < 10)
sNo = "0" + QString::number(no);
QString fName = QString("%1-%2-%3-%4.lt").arg(year).arg(sNo).arg(shortName).arg(session);
//since we have 3 practice session we have to choose the correct session number
if (session == "fp1" && QFile::exists(fName))
{
fName = QString("%1-%2-%3-%4.lt").arg(year).arg(sNo).arg(shortName).arg("fp2");
if (QFile::exists(fName))
fName = QString("%1-%2-%3-%4.lt").arg(year).arg(sNo).arg(shortName).arg("fp3");
}
QDir dir(F1LTCore::ltDataHomeDir());
if (!dir.exists())
dir.mkpath(F1LTCore::ltDataHomeDir());
LTFilesLoader loader;
loader.saveFile(F1LTCore::ltDataHomeDir()+fName, packets.toVector());
}
}
| zywhlc-f1lt | src/player/eventrecorder.cpp | C++ | gpl3 | 26,713 |
/*******************************************************************************
* *
* F1LT - unofficial Formula 1 live timing application *
* Copyright (C) 2012-2013 Mariusz Pilarek (pieczaro@gmail.com) *
* *
* 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 *
* the Free Software Foundation, either version 3 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
* *
*******************************************************************************/
#ifndef EVENTPLAYER_H
#define EVENTPLAYER_H
#include <QList>
#include <QPair>
#include <QTime>
#include <QWidget>
#include "../net/datastreamreader.h"
namespace Ui {
class EventPlayer;
}
class EventPlayer : public QWidget
{
Q_OBJECT
public:
explicit EventPlayer(QWidget *parent = 0);
~EventPlayer();
bool loadFromFile(QString fName);
bool isPlaying() { return playing; }
bool isPaused() { return paused; }
void setTimeLabel();
QString playedFile() { return fileName; }
public slots:
void timeout();
void startPlaying();
void stopPlaying();
void pausePlaying();
signals:
void rewindToStartClicked();
void playClicked(int);
void pauseClicked();
void forwardToEndClicked();
void rewindClicked();
void stopClicked();
void nextPackets(const QVector<Packet> &);
private slots:
void on_playButton_clicked();
void on_speedBox_currentIndexChanged(const QString &arg1);
void on_rewindToStartButton_clicked();
void on_forwardToEndButton_clicked();
void on_forwardButton_clicked();
void on_rewindButton_clicked();
void on_stopButton_clicked();
void on_seekSlider_valueChanged(int value);
void on_seekSlider_sliderMoved(int position);
private:
Ui::EventPlayer *ui;
QVector< QPair<int, Packet> > packets;
int currentPos;
bool playing;
bool paused;
int elapsedSeconds;
int timerInterval;
int initialPacketsNum;
EventData &eventData;
QString fileName;
};
#endif // EVENTPLAYER_H
| zywhlc-f1lt | src/player/eventplayer.h | C++ | gpl3 | 3,090 |
#ifndef LTFILESLOADER_H
#define LTFILESLOADER_H
#include <QList>
#include <QPair>
#include <string>
#include "../net/datastreamreader.h"
/*!
* \brief The LTFilesLoader class is used to manage (load and save) .lt files. It can load both V1 and V2 .lt files version, but saves only in new format (V2) as the old one is no longer supported.
*/
class LTFilesLoader
{
public:
LTFilesLoader();
bool loadFile(QString fName, QVector< QPair<int, Packet> > &packets);
bool loadV1File(QDataStream &stream, QVector< QPair<int, Packet> > &packets);
bool loadV2File(QDataStream &stream, QVector< QPair<int, Packet> > &packets);
void saveFile(QString fName, const QVector< QPair<int, Packet> > &packets);
void saveMainData(QDataStream &stream);
void savePackets(QDataStream &stream, const QVector< QPair<int, Packet> > &packets);
private:
QString encrypt(QString text)
{
return text;
// int sz = text.size();
// QString ret;
// for (int i = 0; i < sz; ++i)
// {
// char c = text[i].toAscii();
// c ^= (1 << (i%7));
// ret += c;
// }
// return ret;
}
};
#endif // LTFILESLOADER_H
| zywhlc-f1lt | src/player/ltfilesloader.h | C++ | gpl3 | 1,197 |
/*******************************************************************************
* *
* F1LT - unofficial Formula 1 live timing application *
* Copyright (C) 2012-2013 Mariusz Pilarek (pieczaro@gmail.com) *
* *
* 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 *
* the Free Software Foundation, either version 3 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
* *
*******************************************************************************/
#include "eventplayer.h"
#include "ltfilesloader.h"
#include "ui_eventplayer.h"
#include <QDataStream>
#include <QDebug>
#include <QFile>
EventPlayer::EventPlayer(QWidget *parent) :
QWidget(parent), ui(new Ui::EventPlayer), currentPos(0), playing(false), paused(false), eventData(EventData::getInstance())
{
ui->setupUi(this);
}
EventPlayer::~EventPlayer()
{
delete ui;
}
bool EventPlayer::loadFromFile(QString fName)
{
fileName = fName;
LTFilesLoader loader;
return loader.loadFile(fName, packets);
// QFile file(fName);
//// if (file.open(QIODevice::ReadOnly))
//// {
//// QDataStream stream(&file);
//// ltTeamList.clear();
//// packets.clear();
//// char *tab;
//// stream >> tab;
//// QString sbuf(tab);
//// delete [] tab;
//// if (sbuf != "F1LT")
//// return false;
//// int ibuf;
//// QPixmap pixBuf;
//// stream >> ibuf;
//// ltEvent.eventNo = ibuf;
//// stream >> sbuf;
//// ltEvent.eventName = sbuf;
//// stream >> sbuf;
//// ltEvent.eventShortName = sbuf;
//// stream >> sbuf;
//// ltEvent.eventPlace = sbuf;
//// stream >> sbuf;
//// ltEvent.fpDate = QDate::fromString(sbuf, "dd-MM-yyyy");
//// stream >> sbuf;
//// ltEvent.raceDate = QDate::fromString(sbuf, "dd-MM-yyyy");
//// stream >> ibuf;
//// ltEvent.laps = ibuf;
//// stream >> pixBuf;
//// ltEvent.trackImg = pixBuf;
//// eventData.setEventInfo(ltEvent);
//// int size;
//// stream >> size;
//// ltTeamList.resize(size);
//// for (int i = 0; i < size; ++i)
//// {
//// ltTeamList[i].drivers.resize(2);
//// stream >> sbuf; ltTeamList[i].teamName = sbuf;
//// stream >> sbuf; ltTeamList[i].drivers[0].name = sbuf;
//// stream >> sbuf; ltTeamList[i].drivers[0].shortName = sbuf;
//// stream >> ibuf; ltTeamList[i].drivers[0].no = ibuf;
//// stream >> sbuf; ltTeamList[i].drivers[1].name = sbuf;
//// stream >> sbuf; ltTeamList[i].drivers[1].shortName = sbuf;
//// stream >> ibuf; ltTeamList[i].drivers[1].no = ibuf;
//// stream >> ltTeamList[i].carImg;
//// }
//// SeasonData::getInstance().loadSeasonData(ltEvent.fpDate.year());
//// SeasonData::getInstance().updateTeamList(ltTeamList); stream >> size;
//// packets.resize(size);
//// for (int i = 0; i < size; ++i)
//// {
//// stream >> packets[i].first;
//// stream >> packets[i].second.type;
//// stream >> packets[i].second.carID;
//// stream >> packets[i].second.data;
//// stream >> packets[i].second.length;
//// stream >> packets[i].second.longData;
//// }
//// return true;
//// }
//// return false;
}
void EventPlayer::startPlaying()
{
elapsedSeconds = 0;
currentPos = 0;
playing = false;
paused = false;
ui->playButton->setIcon(QIcon(":/ui_icons/play.png"));
//emit initial packets
timeout();
initialPacketsNum = currentPos;
ui->seekSlider->setMaximum(packets.last().first);//packets.size() - 1 - initialPacketsNum);
ui->seekSlider->setValue(0);
setTimeLabel();
}
void EventPlayer::pausePlaying()
{
paused = true;
ui->playButton->setIcon(QIcon(":/ui_icons/play.png"));
emit pauseClicked();
}
void EventPlayer::on_playButton_clicked()
{
if (currentPos >= packets.size())
return;
timerInterval = 1000.0 / ui->speedBox->currentText().right(ui->speedBox->currentText().size()-2).toDouble();
if (!paused && !playing)
{
playing = true;
ui->playButton->setIcon(QIcon(":/ui_icons/pause.png"));
emit playClicked(timerInterval);
}
else if (playing && !paused)
{
pausePlaying();
}
else if (playing && paused)
{
paused = false;
ui->playButton->setIcon(QIcon(":/ui_icons/pause.png"));
emit playClicked(timerInterval);
}
}
void EventPlayer::timeout()
{
if (currentPos >= packets.size())
{
stopPlaying();
return;
}
QVector<Packet> LTpackets;
while (currentPos < packets.size() && elapsedSeconds == packets[currentPos].first)
{
LTpackets.append(packets[currentPos].second);
++currentPos;
}
emit nextPackets(LTpackets);
ui->seekSlider->setValue(elapsedSeconds);//currentPos - initialPacketsNum);
setTimeLabel();
++elapsedSeconds;
}
void EventPlayer::on_speedBox_currentIndexChanged(const QString &arg1)
{
timerInterval = 1000.0 / arg1.right(arg1.size()-2).toDouble();
if (playing && !paused)
emit playClicked(timerInterval);
}
void EventPlayer::on_rewindToStartButton_clicked()
{
currentPos = 0;
elapsedSeconds = 0;
ui->seekSlider->setValue(0);//initialPacketsNum);
setTimeLabel();
stopPlaying();
emit rewindToStartClicked();
}
void EventPlayer::on_forwardToEndButton_clicked()
{
QVector<Packet> LTpackets;
while (currentPos < packets.size())
{
LTpackets.append(packets[currentPos].second);
elapsedSeconds = packets[currentPos].first;
++currentPos;
}
ui->seekSlider->setValue(elapsedSeconds);//currentPos - initialPacketsNum);
setTimeLabel();
emit nextPackets(LTpackets);
emit forwardToEndClicked();
stopPlaying();
}
void EventPlayer::on_forwardButton_clicked()
{
if (elapsedSeconds <= packets.last().first)
{
elapsedSeconds += 10;
if (elapsedSeconds > packets.last().first)
elapsedSeconds = packets.last().first;
QVector<Packet> LTpackets;
while (currentPos < packets.size() && packets[currentPos].first <= elapsedSeconds)
{
LTpackets.append(packets[currentPos].second);
++currentPos;
}
ui->seekSlider->setValue(elapsedSeconds);//currentPos - initialPacketsNum);
setTimeLabel();
emit nextPackets(LTpackets);
}
}
void EventPlayer::on_rewindButton_clicked()
{
if (elapsedSeconds > 0)
{
emit rewindClicked();
elapsedSeconds -= 10;
if (elapsedSeconds < 0)
elapsedSeconds = 0;
//we have to back to the begining and re-emit all packets
currentPos = 0;
QVector<Packet> LTpackets;
while (currentPos < packets.size() && packets[currentPos].first <= elapsedSeconds)
{
LTpackets.append(packets[currentPos].second);
++currentPos;
}
ui->seekSlider->setValue(elapsedSeconds);//currentPos - initialPacketsNum);
setTimeLabel();
emit nextPackets(LTpackets);
}
}
void EventPlayer::stopPlaying()
{
playing = paused = false;
ui->playButton->setIcon(QIcon(":/ui_icons/play.png"));
emit pauseClicked();
}
void EventPlayer::on_stopButton_clicked()
{
stopPlaying();
emit stopClicked();
}
void EventPlayer::on_seekSlider_valueChanged(int)
{
}
void EventPlayer::on_seekSlider_sliderMoved(int position)
{
// int value = position + initialPacketsNum;
// if (value == 0 || value == packets.size()-1)
// {
// currentPos = value;
// stopPlaying();
// return;
// }
// if (value > currentPos)
// {
// QList<Packet> LTpackets;
// while (currentPos <= value)
// {
// LTpackets.append(packets[currentPos].second);
// ++currentPos;
// elapsedSeconds = packets[currentPos].first-1;
// }
// emit nextPackets(LTpackets);
// }
// else
// {
// emit rewindClicked();
// //we have to back to the begining and re-emit all packets
// currentPos = 0;
// QList<Packet> LTpackets;
// while (currentPos <= value)
// {
// LTpackets.append(packets[currentPos].second);
// ++currentPos;
// elapsedSeconds = packets[currentPos].first-1;
// }
// emit nextPackets(LTpackets);
// }
// setTimeLabel();
int value = position;// + initialPacketsNum;
if (value > elapsedSeconds)//packets[currentPos].first)
{
QVector<Packet> LTpackets;
while (elapsedSeconds <= value && currentPos < packets.size()-1)
{
LTpackets.append(packets[currentPos].second);
++currentPos;
elapsedSeconds = packets[currentPos].first-1;
}
emit nextPackets(LTpackets);
}
else
{
emit rewindClicked();
//we have to back to the begining and re-emit all packets
currentPos = 0;
elapsedSeconds = 0;
QVector<Packet> LTpackets;
while (elapsedSeconds <= value)
{
LTpackets.append(packets[currentPos].second);
++currentPos;
if (currentPos < packets.size())
elapsedSeconds = packets[currentPos].first-1;
else
break;
}
emit nextPackets(LTpackets);
}
setTimeLabel();
if (value == 0)
on_rewindToStartButton_clicked();
if (value == packets.last().first)
on_forwardToEndButton_clicked();
{/*
currentPos = (value == 0) ? 0 : packets.size()-1;
elapsedSeconds = value;
setTimeLabel();*/
// stopPlaying();
}
}
void EventPlayer::setTimeLabel()
{
int elSeconds = packets[currentPos == 0 ? 0 : currentPos-1].first;
int hours = elSeconds / 3600;
int mins = (elSeconds - hours * 3600)/60;
int secs = elSeconds - hours * 3600 - mins * 60;
QString sMins = QString::number(mins);
QString sSecs = QString::number(secs);
if (mins < 10)
sMins = "0" + sMins;
if (secs < 10)
sSecs = "0" + sSecs;
QString currTime = QString("%1:%2:%3").arg(hours).arg(sMins).arg(sSecs);
int totalSeconds = packets.last().first;
hours = totalSeconds / 3600, mins = totalSeconds / 60, secs = totalSeconds;
mins = (totalSeconds - hours * 3600)/60;
secs = totalSeconds - hours * 3600 - mins * 60;
sMins = QString::number(mins);
sSecs = QString::number(secs);
if (mins < 10)
sMins = "0" + sMins;
if (secs < 10)
sSecs = "0" + sSecs;
QString totalTime = QString("/%1:%2:%3").arg(hours).arg(sMins).arg(sSecs);
ui->timeLabel->setText(currTime + totalTime);
}
| zywhlc-f1lt | src/player/eventplayer.cpp | C++ | gpl3 | 12,030 |
/*******************************************************************************
* *
* F1LT - unofficial Formula 1 live timing application *
* Copyright (C) 2012-2013 Mariusz Pilarek (pieczaro@gmail.com) *
* *
* 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 *
* the Free Software Foundation, either version 3 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
* *
*******************************************************************************/
#ifndef EVENTRECORDER_H
#define EVENTRECORDER_H
#include <QObject>
#include "../net/datastreamreader.h"
#include "../core/sessiontimer.h"
class EventRecorder : public QObject
{
Q_OBJECT
public:
explicit EventRecorder(SessionTimer *st, QObject *parent = 0);
void saveToFile(QString);
void gatherInitialData();
void gatherSysData();
void gatherDriverData();
bool isEmpty() { return packets.isEmpty(); }
bool isSessionRecorded() { return sessionRecorded; }
void setSessionRecorded(bool rec) { sessionRecorded = rec; }
void setAutoStopRecord(int x)
{
autoStopRecord = x;
}
void setAutoSaveRecord(int x)
{
autoSaveRecord = x;
}
void appendSessionTimer();
signals:
void recordingStopped();
public slots:
void startRecording(int delay);
void stopRecording();
void timeout();
void appendPacket(const Packet&);
void appendPacket(const QPair<Packet, qint64> &packet);
// void updateEventData(const EventData &);
// void updateDriverData(const DriverData &);
private:
// EventData eventData;
// QList<EventData> eventDataList;
// //drivers lap data will be stored here, in a 2-dimensional array
// QList< QList<LapData> > lapDataList;
QList< QPair<int, Packet> > packets;
QVector<LTTeam> ltTeamList;
LTEvent ltEvent;
EventData &eventData;
qint64 recordStartTime;
int elapsedSeconds;
int autoStopRecord;
int autoSaveRecord;
int autoSaveCounter;
int elapsedTimeToStop;
bool sessionRecorded;
QPair<int, QTime> lastSavedTime;
SessionTimer *sessionTimer;
};
#endif // EVENTRECORDER_H
| zywhlc-f1lt | src/player/eventrecorder.h | C++ | gpl3 | 3,208 |
#include "ltfilesloader.h"
#include "../core/eventdata.h"
#include <QDebug>
LTFilesLoader::LTFilesLoader()
{
}
bool LTFilesLoader::loadFile(QString fName, QVector<QPair<int, Packet> > &packets)
{
QFile file(fName);
if (file.open(QIODevice::ReadOnly))
{
QDataStream stream(&file);
char *tab;
stream >> tab;
QString sbuf(tab);
delete [] tab;
if (sbuf == "F1LT")
{
//old files didn't contain any info about FP number, try to guess it from the file name
QFileInfo fInfo(fName);
QRegExp reg("fp(\\d)");
if (reg.indexIn(fInfo.fileName()) != -1)
EventData::getInstance().setFPNumber(reg.cap(1).toInt());
return loadV1File(stream, packets);
}
if (sbuf == "F1LT2_LT")
{
return loadV2File(stream, packets);
}
}
return false;
}
bool LTFilesLoader::loadV1File(QDataStream &stream, QVector<QPair<int, Packet> > &packets)
{
LTEvent ltEvent;
QVector<LTTeam> ltTeamList;
int ibuf;
int size;
QPixmap pixBuf;
QString sbuf;
//load event data
stream >> ibuf;
ltEvent.eventNo = ibuf;
stream >> sbuf;
ltEvent.eventName = sbuf;
stream >> sbuf;
ltEvent.eventShortName = sbuf;
stream >> sbuf;
ltEvent.eventPlace = sbuf;
stream >> sbuf;
ltEvent.fpDate = QDate::fromString(sbuf, "dd-MM-yyyy");
stream >> sbuf;
ltEvent.raceDate = QDate::fromString(sbuf, "dd-MM-yyyy");
stream >> ibuf;
ltEvent.laps = ibuf;
stream >> pixBuf;
ltEvent.trackImg = pixBuf;
//load drivers data
stream >> size;
ltTeamList.resize(size);
for (int i = 0; i < size; ++i)
{
ltTeamList[i].drivers.resize(2);
stream >> sbuf; ltTeamList[i].teamName = sbuf;
stream >> sbuf; ltTeamList[i].drivers[0].name = sbuf;
stream >> sbuf; ltTeamList[i].drivers[0].shortName = sbuf;
stream >> ibuf; ltTeamList[i].drivers[0].no = ibuf;
stream >> sbuf; ltTeamList[i].drivers[1].name = sbuf;
stream >> sbuf; ltTeamList[i].drivers[1].shortName = sbuf;
stream >> ibuf; ltTeamList[i].drivers[1].no = ibuf;
stream >> ltTeamList[i].carImg;
}
SeasonData::getInstance().loadSeasonData(ltEvent.fpDate.year());
SeasonData::getInstance().updateTeamList(ltTeamList);
EventData::getInstance().clear();
EventData::getInstance().setEventInfo(ltEvent);
stream >> size;
packets.resize(size);
for (int i = 0; i < size; ++i)
{
stream >> packets[i].first;
stream >> packets[i].second.type;
stream >> packets[i].second.carID;
stream >> packets[i].second.data;
stream >> packets[i].second.length;
stream >> packets[i].second.longData;
}
return true;
}
bool LTFilesLoader::loadV2File(QDataStream &stream, QVector<QPair<int, Packet> > &packets)
{
LTEvent ltEvent;
QVector<LTTeam> ltTeamList;
int ibuf;
int size;
char *cbuf;
//load event data
stream >> ibuf;
ltEvent.eventNo = ibuf;
stream >> cbuf;
ltEvent.eventName = encrypt(QString(cbuf));
delete [] cbuf;
stream >> cbuf;
ltEvent.eventShortName = encrypt(QString(cbuf));
delete [] cbuf;
stream >> cbuf;
ltEvent.eventPlace = encrypt(QString(cbuf));
delete [] cbuf;
stream >> cbuf;
ltEvent.fpDate = QDate::fromString(encrypt(QString(cbuf)), "dd-MM-yyyy");
delete [] cbuf;
stream >> cbuf;
ltEvent.raceDate = QDate::fromString(encrypt(QString(cbuf)), "dd-MM-yyyy");
delete [] cbuf;
stream >> ibuf;
ltEvent.laps = ibuf;
SeasonData::getInstance().loadSeasonData(ltEvent.fpDate.year());
EventData::getInstance().clear();
stream >> ibuf;
EventData::getInstance().setEventType((LTPackets::EventType)ibuf);
stream >> ibuf;
if (EventData::getInstance().getEventType() == LTPackets::PRACTICE_EVENT)
EventData::getInstance().setFPNumber(ibuf);
EventData::getInstance().setEventInfo(ltEvent);
//load drivers data
stream >> size;
ltTeamList.resize(size);
for (int i = 0; i < size; ++i)
{
stream >> cbuf; ltTeamList[i].teamName = encrypt(QString(cbuf));
delete [] cbuf;
int dsize;
stream >> dsize;
ltTeamList[i].drivers.resize(dsize);
for (int j = 0; j < dsize; ++j)
{
stream >> cbuf; ltTeamList[i].drivers[j].name = encrypt(QString(cbuf));
delete [] cbuf;
stream >> cbuf; ltTeamList[i].drivers[j].shortName = encrypt(QString(cbuf));
delete [] cbuf;
stream >> ibuf; ltTeamList[i].drivers[j].no = ibuf;
}
}
SeasonData::getInstance().updateTeamList(ltTeamList);
stream >> size;
packets.resize(size);
for (int i = 0; i < size; ++i)
{
stream >> packets[i].first;
stream >> packets[i].second.type;
stream >> packets[i].second.carID;
stream >> packets[i].second.data;
stream >> packets[i].second.length;
stream >> cbuf;
packets[i].second.longData.clear();
// packets[i].second.longData.append(encrypt(std::string(cbuf)).c_str());
// packets[i].second.longData.append(encrypt(sbuf));
packets[i].second.longData.append(encrypt(QString(cbuf)));
delete [] cbuf;
}
return true;
}
void LTFilesLoader::saveFile(QString fName, const QVector<QPair<int, Packet> > &packets)
{
QFile file(fName);
if (file.open(QIODevice::WriteOnly))
{
QDataStream stream(&file);
const char tab[9] = "F1LT2_LT";
stream << tab;
//save the teams and events info
saveMainData(stream);
savePackets(stream, packets);
}
}
void LTFilesLoader::saveMainData(QDataStream &stream)
{
LTEvent event = EventData::getInstance().getEventInfo();
stream << event.eventNo;
stream << encrypt(event.eventName).toStdString().c_str();
stream << encrypt(event.eventShortName).toStdString().c_str();
stream << encrypt(event.eventPlace).toStdString().c_str();
stream << encrypt(event.fpDate.toString("dd-MM-yyyy")).toStdString().c_str();
stream << encrypt(event.raceDate.toString("dd-MM-yyyy")).toStdString().c_str();
stream << event.laps;
stream << EventData::getInstance().getEventType();
stream << EventData::getInstance().getFPNumber();
QVector<LTTeam> teams = SeasonData::getInstance().getTeamsFromCurrentSession();
stream << teams.size();
for (int i = 0; i < teams.size(); ++i)
{
stream << encrypt(teams[i].teamName).toStdString().c_str();
stream << teams[i].drivers.size();
for (int j = 0; j < teams[i].drivers.size(); ++j)
{
stream << encrypt(teams[i].drivers[j].name).toStdString().c_str();
stream << encrypt(teams[i].drivers[j].shortName).toStdString().c_str();
stream << teams[i].drivers[j].no;
}
}
}
void LTFilesLoader::savePackets(QDataStream &stream, const QVector<QPair<int, Packet> > &packets)
{
stream << packets.size();
for (int i = 0; i < packets.size(); ++i)
{
stream << packets[i].first;
stream << packets[i].second.type;
stream << packets[i].second.carID;
stream << packets[i].second.data;
stream << packets[i].second.length;
// stream << encrypt(QString(packets[i].second.longData).toStdString()).c_str();
stream << encrypt(QString(packets[i].second.longData)).toStdString().c_str();
// stream << QString(packets[i].second.longData).toStdString().c_str();
}
}
| zywhlc-f1lt | src/player/ltfilesloader.cpp | C++ | gpl3 | 7,732 |
/*******************************************************************************
* *
* F1LT - unofficial Formula 1 live timing application *
* Copyright (C) 2012-2013 Mariusz Pilarek (pieczaro@gmail.com) *
* *
* 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 *
* the Free Software Foundation, either version 3 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
* *
*******************************************************************************/
#include <QtGui/QApplication>
#include <QMessageBox>
#include "main_gui/ltwindow.h"
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
bool ok = SeasonData::getInstance().loadSeasonFile();
if (!ok)
{
QMessageBox::critical(0, "Error!", "Could not load input data files. Check your installation. \n Application will exit now.");
exit(-1);
}
LTWindow w;
w.show();
return a.exec();
}
| zywhlc-f1lt | src/main.cpp | C++ | gpl3 | 1,990 |
body
{
background-color: #141414;
font-family: verdana, arial;
color: #dcdcdc;
padding-top: 20px;
text-align: justify
}
a:link
{
color: #777777;
text-decoration: none;
}
a:hover
{
text-decoration: underline;
}
.image
{
padding-top: 20px;
padding-bottom: 20px;
text-align: center;
font-size: 10pt;
}
code
{
font-size: 12pt;
}
img.icon
{
float: left;
padding-right: 10px;
}
| zywhlc-f1lt | doc/stylesheet.css | CSS | gpl3 | 391 |
# -------------------------------------------------
# Project created by QtCreator 2012-03-18T12:26:59
# -------------------------------------------------
QT += core \
gui \
network
TARGET = F1LT
#--------------------------------------------------------------
# installation prefixes
PREFIX = /opt/$$TARGET
#by default application data will be stored in /opt/F1LT/share
SHARE=$$PREFIX/share
#--------------------------------------------------------------
DEFINES += INSTALL_PREFIX=$$PREFIX
DEFINES += SHARE_PREFIX=$$SHARE
target.path = $$PREFIX/bin/
TEMPLATE = app
OBJECTS_DIR = obj/
MOC_DIR = moc/
UI_DIR = ui/
INSTALLS += target \
DATA_FILES
DATA_FILES.files = season.dat trackdata.dat trackrecords.dat
DATA_FILES.path = $$SHARE
RC_FILE = f1lt.rc
DEFINES += QT_NO_DEBUG_OUTPUT
SOURCES += src/tools/sessionanalysiswidget.cpp \
src/main_gui/weatherchartswidget.cpp \
src/main_gui/nosessionboardwidget.cpp \
src/main.cpp \
src/main_gui/ltwindow.cpp \
src/net/datastreamreader.cpp \
src/net/httpdatareader.cpp \
src/net/socketdatareader.cpp \
src/main_gui/driverdatawidget.cpp \
src/charts/chartwidget.cpp \
src/main_gui/sessiondatawidget.cpp \
src/tools/headtoheaddialog.cpp \
src/core/driverdata.cpp \
src/core/eventdata.cpp \
src/player/eventrecorder.cpp \
src/main_gui/preferencesdialog.cpp \
src/main_gui/logindialog.cpp \
src/player/eventplayer.cpp \
src/tools/laptimecomparisondialog.cpp \
src/core/f1ltcore.cpp \
src/main_gui/eventstatuswidget.cpp \
src/charts/sessionlaptimeschart.cpp \
src/charts/fplaptimeschart.cpp \
src/charts/lapcompchart.cpp \
src/charts/weatherchart.cpp \
src/core/lapdata.cpp \
src/net/packetparser.cpp \
src/main_gui/ltwidget.cpp \
src/main_gui/models/ltmodel.cpp \
src/main_gui/models/practicemodel.cpp \
src/main_gui/lttableview.cpp \
src/main_gui/models/qualimodel.cpp \
src/main_gui/models/racemodel.cpp \
src/main_gui/models/driverlaphistorymodel.cpp \
src/main_gui/ltitemdelegate.cpp \
src/main_gui/models/speedrecordsmodel.cpp \
src/main_gui/models/fastestlapsmodel.cpp \
src/main_gui/models/pitstopsmodel.cpp \
src/core/seasondata.cpp \
src/core/sessiontimer.cpp \
src/net/ltfilesmanager.cpp \
src/tools/ltfilesmanagerdialog.cpp \
src/main_gui/aboutdialog.cpp \
src/charts/driverdatachart.cpp \
src/tools/followadriverdialog.cpp \
src/tools/sessiontimeswidget.cpp \
src/tools/driverradarpositioner.cpp \
src/tools/driverradar.cpp \
src/tools/drivertrackerpositioner.cpp \
src/tools/drivertracker.cpp \
src/tools/drivertrackerwidget.cpp \
src/tools/drivertrackerinfo.cpp \
src/net/packetbuffer.cpp \
src/main_gui/delaywidget.cpp \
src/core/trackrecords.cpp \
src/tools/trackrecordsdialog.cpp \
src/tools/driverrecordsdialog.cpp \
src/core/imagesfactory.cpp \
src/main_gui/driverinfolabel.cpp \
src/net/networksettings.cpp \
src/main_gui/drivercolorsdialog.cpp \
src/core/colorsmanager.cpp \
src/core/sessiondefaults.cpp \
src/core/trackmapscoordinates.cpp \
src/player/ltfilesloader.cpp \
src/main_gui/commentarywidget.cpp \
src/main_gui/updatescheckerdialog.cpp
HEADERS += src/tools/sessionanalysiswidget.h \
src/main_gui/weatherchartswidget.h \
src/main_gui/nosessionboardwidget.h \
src/main_gui/ltwindow.h \
src/net/datastreamreader.h \
src/net/httpdatareader.h \
src/net/socketdatareader.h \
src/main_gui/driverdatawidget.h \
src/charts/chartwidget.h \
src/main_gui/sessiondatawidget.h \
src/tools/headtoheaddialog.h \
src/core/driverdata.h \
src/core/eventdata.h \
src/player/eventrecorder.h \
src/main_gui/preferencesdialog.h \
src/main_gui/logindialog.h \
src/player/eventplayer.h \
src/tools/laptimecomparisondialog.h \
src/core/f1ltcore.h \
src/main_gui/eventstatuswidget.h \
src/charts/sessionlaptimeschart.h \
src/charts/fplaptimeschart.h \
src/charts/lapcompchart.h \
src/charts/weatherchart.h \
src/core/lapdata.h \
src/net/packetparser.h \
src/main_gui/ltwidget.h \
src/main_gui/models/ltmodel.h \
src/main_gui/models/practicemodel.h \
src/main_gui/lttableview.h \
src/main_gui/models/qualimodel.h \
src/main_gui/models/racemodel.h \
src/main_gui/models/driverlaphistorymodel.h \
src/main_gui/ltitemdelegate.h \
src/main_gui/models/speedrecordsmodel.h \
src/main_gui/models/fastestlapsmodel.h \
src/main_gui/models/pitstopsmodel.h \
src/core/seasondata.h \
src/core/ltpackets.h \
src/core/sessiontimer.h \
src/net/ltfilesmanager.h \
src/tools/ltfilesmanagerdialog.h \
src/main_gui/aboutdialog.h \
src/charts/driverdatachart.h \
src/tools/followadriverdialog.h \
src/tools/sessiontimeswidget.h \
src/tools/driverradarpositioner.h \
src/tools/driverradar.h \
src/tools/drivertrackerpositioner.h \
src/tools/drivertracker.h \
src/tools/drivertrackerwidget.h \
src/tools/drivertrackerinfo.h \
src/net/packetbuffer.h \
src/main_gui/delaywidget.h \
src/core/trackrecords.h \
src/tools/trackrecordsdialog.h \
src/tools/driverrecordsdialog.h \
src/core/imagesfactory.h \
src/main_gui/driverinfolabel.h \
src/net/networksettings.h \
src/main_gui/drivercolorsdialog.h \
src/core/colorsmanager.h \
src/core/sessiondefaults.h \
src/core/trackmapscoordinates.h \
src/player/ltfilesloader.h \
src/main_gui/commentarywidget.h \
src/main_gui/updatescheckerdialog.h
FORMS += ui/sessionanalysiswidget.ui \
ui/weatherchartswidget.ui \
ui/nosessionboardwidget.ui \
ui/ltwindow.ui \
ui/driverdatawidget.ui \
ui/chartwidget.ui \
ui/sessiondatawidget.ui \
ui/headtoheaddialog.ui \
ui/preferencesdialog.ui \
ui/logindialog.ui \
ui/eventplayer.ui \
ui/laptimecomparisondialog.ui \
ui/eventstatuswidget.ui \
ui/ltwidget.ui \
ui/ltfilesmanagerdialog.ui \
ui/aboutdialog.ui \
ui/followadriverdialog.ui \
ui/sessiontimeswidget.ui \
ui/drivertrackerwidget.ui \
ui/delaywidget.ui \
ui/trackrecordsdialog.ui \
ui/driverrecordsdialog.ui \
ui/drivercolorsdialog.ui \
ui/commentarywidget.ui \
ui/updatescheckerdialog.ui
INCLUDEPATH += src/
RESOURCES += icons/icons.qrc \
other_files.qrc
OTHER_FILES += \
CHANGELOG \
INSTALL
| zywhlc-f1lt | F1LT.pro | QMake | gpl3 | 6,502 |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>F1LT - Formula 1 live timing application</title>
<meta http-equiv="content-type" content="text/html;charset=utf-8" />
<link type="text/css" rel="stylesheet" href="doc/stylesheet.css"/>
</head>
<body>
<img class="icon" src="doc/icon.png"> <b>F1LT</b> is a Formula 1 live timing application written using Qt library for Windows and Linux systems. It is an alternative application to the java applet available on formula1.com site. To use the application you only need an account on formula1.com site, which is used to login into the live timing server and obtain the data.
<br/><br/>
Main features of the application:
<ul>
<li>gathering all live timing data - you can see lap time history of every driver,</li>
<li>session statistics - fastest laps, fastest pit stops, speed records, charts,</li>
<li>lap time comparison tool - allows you to compare lap times of up to 4 drivers at once,</li>
<li>head to head tool - a driver tracking tool - select two drivers and program will be calculating the gap between them, showing the differences between lap and sector times and drawing charts on every lap,</li>
<li>recording and replaying live timing - every session can be recorded and played later, very usefull tool when watching a replay of the race.</li>
</ul>
<h3>The application window</h3>
Main window of the application is presented on Fig. 1. We can see three panels there - the live timing data is presented on the left panel, while the right panel contains many additional informations, which include:
<ul>
<li>driver info tab: lap history with charts</li>
<li>basic informations about current event</li>
<li>session statistics:</li>
<ul>
<li>fastest laps</li>
<li>speed records</li>
<li>fastest pit stops</li>
</ul>
<li>session commentary</li>
</ul>
<div class="image">
<img src="doc/screen1.png"/><br/>
Fig. 1. Main window of the F1LT application.
</div>
The top panel contains session and weather data. <br/><br/>
Icons on the toolbar:
<ul>
<li>open archived LT session,</li>
<li>connect to the LT server,</li>
<li>head to head tool,</li>
<li>lap time comparison tool,</li>
<li>program preferences,</li>
<li>exit,</li>
<li>start recording the session,</li>
<li>stop recording.</li>
</ul>
<h3>The live timing panel</h3>
This is the main panel where the current live timing data is shown. This is basically the same what you can see using the formula1.com applet, so there isn't much to explain. Meaning of the colors:
<ul>
<li>white - most of the data, no particular meaning,</li>
<li>green - personal record of the driver</li>
<li>violet - fastest lap (or sector) of the session</li>
<li>red - driver is in the pits</li>
<li>yellow - data from the previous lap/sector</li>
</ul>
In addition, during the race, information about the fastest lap is printed at the bottom of the table. During free practice and quali sessions, the 107% time of the session is printed there.
<br><br>
When you select a driver and double-click on his name, his statistics will be shown in the right panel. You can use standard cursor keys, page up-page down, home and end keys to move around the table. Hitting enter will do the same as mouse double-click.
<h3>Top panel</h3>
Panel contains weather data and session timer. During the race there is also information about completed and total laps. Top left icon correspond to the current flag status (green, yellow, red, safety car, etc.).
<h3>Driver data tab</h3>
This tab contains data and statistics of a selected driver. It is splitted into 3 sub-tabs:
<ul>
<li>basic driver information and statistics (Fig. 2.)</li>
<li>lap time chart (Fig. 3.)</li>
<li>position and gap charts (Fig. 3.)</li>
</ul>
<div class="image">
<img src="doc/screen2.png"/><br/>
Fig. 2. Driver lap history tab.
</div>
In the driver lap history tab (Fig. 2.) we have all informations about the selected driver - his current position, grid position (completed laps in free practice and quali sessions), gap to leader, best and last lap times, pit stops information and the lap history. Laps are printed in ascending or descending order (this can be set in the preferences). Lap times are coloured:
<ul>
<li>white - usuall laps</li>
<li>yellow - laps behind a safety car</li>
<li>red - pit stops</li>
<li>green - driver best lap</li>
<li>violet - fastest lap of the race</li>
<li>cyan (free practice and quali only) - if the current lap time is worse than the drivers best, the LT server doesn't send us this time - it is approximated by the program using sector times (lap time is rounded to 0.1 of the second) </li>
</ul>
During free practice and quali the "Gap" column is replaced by the session time when the lap time was set. Moreover, during quali, lap number contains information about the quali period in which lap time was set.<br/>
Lap history data can be selected and copied to the clipboard - just select what you need and press Ctrl-C.
<div class="image">
<img src="doc/screen3.png"/><br/>
Fig. 3. Lap time, position and gap charts.
</div>
Three charts are printed in the driver data tab (Fig. 3.):
<ul>
<li>lap time chart - contains sector and lap times, laps behind SC are printed in yellow, dots correspond to the pit stops,</li>
<li>position chart - prints the drivers positions during the session. If you connect to the LT server during the race, server sends the position history, hence this chart always prints driver positions from the start of the race in opposition to other charts which are printed only for gathered data (e.g. when you connect on lap 14, program will start gathering data from that lap onwards). As previously, dots correspond to pit stops,</li>
<li>gap to the leader chart - so far this works only during the race and free practice. The meaning of dots is as previously.</li>
</ul>
Charts can be copied to clipboard or saved to disk in png format - right click on the chart will popup the menu with the appropriate options.
<h3>Session data tab</h3>
Contains information about the current session:
<ul>
<li>event information (Fig. 4.)</li>
<li>fastest laps (Fig. 5.) - during quali additional information about the quali period in which the time was set is printed</li>
<li>speed records (Fig. 5.)</li>
<li>fastest pit stops (Fig. 5.)</li>
</ul>
<div class="image">
<img src="doc/screen4.png"/><br/>
Fig. 4. Event information tab.
</div>
<div class="image">
<img src="doc/screen5.png"/><br/>
Fig. 5. Fastest laps, speed records and fastest pit stops tabs.
</div>
Data printed in fastest laps, speed records and fastest pit stops tabs can be selected and copied to the clipboard by hitting Ctrl-C keys.
<h3>Commentary</h3>
This tab contains the usuall commentary that appears on the formula1.com site next to the java applet.
<h3>Lap time comparison tool</h3>
This tool allows you to select up to 4 drivers and compare their lap times. It is very usefull during the race as you can see your favourite drivers progression in comparison to others. The fastest time on a current lap is printed in green, the second best - in white, then the yellow and red. For example, take a look on Fig. 6. - on lap 25 Vettel was the fastest, Hamilton was second best, Raikkonen was third fastest and the slowest one was Rosberg. As in driver lap history tab, laps can be printed in ascending or descending order - this can be set in program preferences. Data can be selected and copied to clipboard using Ctrl-C key sequence.
<br/><br/>
Lap time charts are rather self-explanatory.
<br/><br/>
The dialog window with lap time comparison is non-modal, therefore you can open it and still have access to the main application window. You can open up to 30 windows with the tool, that gives you a wide range of possible driver comparison combinations.
<div class="image">
<img src="doc/screen6.png"/><br/>
Fig. 6. Lap time comparison tool - main window.
</div>
<div class="image">
<img src="doc/screen7.png"/><br/>
Fig. 7. Lap time charts in lap time comparison tool.
</div>
<h3>Head to head tool</h3>
This is more advanced version of the lap time comparison tool. It allows you to track two drivers - on every lap program calculates the gap between them and shows the differences between lap and sector times. The better times are printed in green. If SC is on track lap and sector times are printed in yellow. The gap is always calculated as a gap of Driver 1 (in Fig. 8. it is Vettel) to Driver 2 (Raikkonen). Since Vettel was always in front the gap is negative. As in lap time comparison tool, data can be selected and copied to clipboard (Ctrl-C).
<div class="image">
<img src="doc/screen8.png"/><br/>
Fig. 8. Head to head tool - main window.
</div>
<div class="image">
<img src="doc/screen9.png"/><br/>
Fig. 9. Charts in head to head tool.
</div>
There are three charts in this tool (Fig. 9.) - lap time and position charts are rather self-explanatory. In the gap chart, the driver that is in front is always printed in 0. If Raikkonen would pass Vettel, his chart would be printed in 0 then, while the Vettels one - according to the gap he would have to Raikkonen.
Similar to lap time comparison tool, this dialog window is also non-modal and allows you to open max. 30 windows.
<h3>Live timing recording and playing</h3>
F1LT allows you to record current session, save to file and play it later. This can be very usefull when you miss a session and want to watch its replay. Saved files are very small - race files takes from 1 to 2 MB of disk space (free practice and quali sessions even less) and therefore can be easy shared on internet. To start recording the session you only need to choose the right option from the menu, or click the red button on toolbar. You can also set an auto-record option in the preferences - in this case recording will start automatically when the session starts. To stop recording you need to press the "Stop" button on toolbar. This automatically saves the recorded file onto the disk, in the <i>ltdata</i> folder. File names are determined using the following template: <br/>
<code>year-GPno-name-session.lt</code>, e.g: <br/>
<code>2012-04-bah-race.lt</code><br/>
Session can be <code>race</code>, <code>quali</code> or <code>fpX</code>, where <code>X</code> is the free practice number. Actually program doesn't know what is the current free practice number, it saves the subsequent practice sessions as fp1, fp2 and fp3. If you miss free practice 2 for example, free practice 3 will be saved as fp2, etc.
<br/><br/>
Saved live timing sessions can be opened and played - just click the "open" button on toolbar (first from left), select the appropriate file and application will change its state into the "player state". In this state the application is not connected to the LT server, it doesn't even need the internet connection. When you open a .lt file, you will notice the apperance of player controls on the toolbar (Fig. 10.). These controls replace the "Record" and "Stop" buttons, as recording is not active during session playing.
<div class="image">
<img src="doc/screen10.png"/><br/>
Fig. 10. Live timing player controls on the toolbar.
</div>
Live timing player can be controlled using these buttons:
<ul>
<li>playing speed - from x0.5 to x8</li>
<li>skip to begin</li>
<li>rewind by 10 seconds</li>
<li>play/pause</li>
<li>stop</li>
<li>fast forward by 10 seconds</li>
<li>skip to end</li>
</ul>
There is also additional slider to skip to any time in the session (use it carefully as it can consume a lot of processing power). The usage of player is very intuitive - it doesn't differ much from standard media player. All program tools (like head 2 head) are available during playback. <br/><br/>
To stop playing and go back to the standard program mode click "Stop" button or "Connect" - both of these will stop playback and reconnect to the LT server.<br/><br/>
All races from 2012 season are included in the application archive file. I have also many races from 2010 and 2011 - they are avaialble <a href="http://f1lt.googlecode.com/files/lt_10-11.zip">here</a>.<br/><br/>
You can also set .lt files to be always opened using F1LT - double click on any of the .lt files and choose the right path to the application. After this, every time you double click on a .lt file F1LT application will be launched.
<h3>Customizing F1LT</h3>
Clicking "Preferences" button will open preferences dialog. Here you can choose font which the data is displayed in and a font for the commentary tab. There are also settings for reversing the laps order in lap history, lap time comparison and head to head tools, session auto-recording and alternating row colors in the LT window.
<h3>Known issues and errors</h3>
This program is still under development and therefore contains many errors. The known issues are:
<ul>
<li>sometimes application won't connect to the LT server - restart it,</li>
<li>when application is launched more than 5 minutes before start of the session, it prints no data and can have problems with connecting to the server,</li>
<li>data sent by the LT server is encrypted and sometimes the decryption algorithm fails,</li>
<li>LT server often sends junk data, this could lead to append wrong data in the lap history.</li>
</ul>
<h3>Credits</h3>
This program was written by Mariusz Pilarek. Many thanks to Scott James Remnant and his great live-f1 application - his data protocol description and source code helped me a lot in implementing F1LT. Also thanks to Maiesky from the f1wm.pl forum for the live timing data from 2010, 2011 and 2012 races.<br/><br/>
If you have any questions or requests, please <a href="mailto:pieczaro@gmail.com">contact with me</a>.
</body>
</html>
| zywhlc-f1lt | README.html | HTML | gpl3 | 14,088 |
// stdafx.cpp : source file that includes just the standard includes
// RussiaRect.pch will be the pre-compiled header
// stdafx.obj will contain the pre-compiled type information
#include "stdafx.h"
| zzy-russia-rect | StdAfx.cpp | C++ | gpl2 | 212 |
// RussiaRect.h : main header file for the RUSSIARECT application
//
#if !defined(AFX_RUSSIARECT_H__5A9590E9_45AE_4E79_AF2B_43F4E54A102E__INCLUDED_)
#define AFX_RUSSIARECT_H__5A9590E9_45AE_4E79_AF2B_43F4E54A102E__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#ifndef __AFXWIN_H__
#error include 'stdafx.h' before including this file for PCH
#endif
#include "resource.h" // main symbols
/////////////////////////////////////////////////////////////////////////////
// CRussiaRectApp:
// See RussiaRect.cpp for the implementation of this class
//
class CRussiaRectApp : public CWinApp
{
public:
CRussiaRectApp();
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CRussiaRectApp)
public:
virtual BOOL InitInstance();
//}}AFX_VIRTUAL
// Implementation
//{{AFX_MSG(CRussiaRectApp)
afx_msg void OnAppAbout();
// NOTE - the ClassWizard will add and remove member functions here.
// DO NOT EDIT what you see in these blocks of generated code !
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
/////////////////////////////////////////////////////////////////////////////
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_RUSSIARECT_H__5A9590E9_45AE_4E79_AF2B_43F4E54A102E__INCLUDED_)
| zzy-russia-rect | RussiaRect.h | C++ | gpl2 | 1,400 |
# Microsoft Developer Studio Generated NMAKE File, Based on RussiaRect.dsp
!IF "$(CFG)" == ""
CFG=RussiaRect - Win32 Debug
!MESSAGE No configuration specified. Defaulting to RussiaRect - Win32 Debug.
!ENDIF
!IF "$(CFG)" != "RussiaRect - Win32 Release" && "$(CFG)" != "RussiaRect - Win32 Debug"
!MESSAGE Invalid configuration "$(CFG)" specified.
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "RussiaRect.mak" CFG="RussiaRect - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "RussiaRect - Win32 Release" (based on "Win32 (x86) Application")
!MESSAGE "RussiaRect - Win32 Debug" (based on "Win32 (x86) Application")
!MESSAGE
!ERROR An invalid configuration is specified.
!ENDIF
!IF "$(OS)" == "Windows_NT"
NULL=
!ELSE
NULL=nul
!ENDIF
!IF "$(CFG)" == "RussiaRect - Win32 Release"
OUTDIR=.\Release
INTDIR=.\Release
# Begin Custom Macros
OutDir=.\Release
# End Custom Macros
ALL : "$(OUTDIR)\RussiaRect.exe"
CLEAN :
-@erase "$(INTDIR)\ConnectDlg.obj"
-@erase "$(INTDIR)\GameExitDlg.obj"
-@erase "$(INTDIR)\MainFrm.obj"
-@erase "$(INTDIR)\RussiaRect.obj"
-@erase "$(INTDIR)\RussiaRect.pch"
-@erase "$(INTDIR)\RussiaRect.res"
-@erase "$(INTDIR)\RussiaRectDoc.obj"
-@erase "$(INTDIR)\RussiaRectView.obj"
-@erase "$(INTDIR)\StdAfx.obj"
-@erase "$(INTDIR)\UserHelp.obj"
-@erase "$(INTDIR)\vc60.idb"
-@erase "$(OUTDIR)\RussiaRect.exe"
"$(OUTDIR)" :
if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
CPP=cl.exe
CPP_PROJ=/nologo /MD /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_AFXDLL" /D "_MBCS" /Fp"$(INTDIR)\RussiaRect.pch" /Yu"stdafx.h" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c
.c{$(INTDIR)}.obj::
$(CPP) @<<
$(CPP_PROJ) $<
<<
.cpp{$(INTDIR)}.obj::
$(CPP) @<<
$(CPP_PROJ) $<
<<
.cxx{$(INTDIR)}.obj::
$(CPP) @<<
$(CPP_PROJ) $<
<<
.c{$(INTDIR)}.sbr::
$(CPP) @<<
$(CPP_PROJ) $<
<<
.cpp{$(INTDIR)}.sbr::
$(CPP) @<<
$(CPP_PROJ) $<
<<
.cxx{$(INTDIR)}.sbr::
$(CPP) @<<
$(CPP_PROJ) $<
<<
MTL=midl.exe
MTL_PROJ=/nologo /D "NDEBUG" /mktyplib203 /win32
RSC=rc.exe
RSC_PROJ=/l 0x804 /fo"$(INTDIR)\RussiaRect.res" /d "NDEBUG" /d "_AFXDLL"
BSC32=bscmake.exe
BSC32_FLAGS=/nologo /o"$(OUTDIR)\RussiaRect.bsc"
BSC32_SBRS= \
LINK32=link.exe
LINK32_FLAGS=/nologo /subsystem:windows /incremental:no /pdb:"$(OUTDIR)\RussiaRect.pdb" /machine:I386 /out:"$(OUTDIR)\RussiaRect.exe"
LINK32_OBJS= \
"$(INTDIR)\ConnectDlg.obj" \
"$(INTDIR)\GameExitDlg.obj" \
"$(INTDIR)\MainFrm.obj" \
"$(INTDIR)\RussiaRect.obj" \
"$(INTDIR)\RussiaRectDoc.obj" \
"$(INTDIR)\RussiaRectView.obj" \
"$(INTDIR)\StdAfx.obj" \
"$(INTDIR)\UserHelp.obj" \
"$(INTDIR)\RussiaRect.res"
"$(OUTDIR)\RussiaRect.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
$(LINK32) @<<
$(LINK32_FLAGS) $(LINK32_OBJS)
<<
!ELSEIF "$(CFG)" == "RussiaRect - Win32 Debug"
OUTDIR=.\Debug
INTDIR=.\Debug
# Begin Custom Macros
OutDir=.\Debug
# End Custom Macros
ALL : "$(OUTDIR)\RussiaRect.exe"
CLEAN :
-@erase "$(INTDIR)\ConnectDlg.obj"
-@erase "$(INTDIR)\GameExitDlg.obj"
-@erase "$(INTDIR)\MainFrm.obj"
-@erase "$(INTDIR)\RussiaRect.obj"
-@erase "$(INTDIR)\RussiaRect.pch"
-@erase "$(INTDIR)\RussiaRect.res"
-@erase "$(INTDIR)\RussiaRectDoc.obj"
-@erase "$(INTDIR)\RussiaRectView.obj"
-@erase "$(INTDIR)\StdAfx.obj"
-@erase "$(INTDIR)\UserHelp.obj"
-@erase "$(INTDIR)\vc60.idb"
-@erase "$(INTDIR)\vc60.pdb"
-@erase "$(OUTDIR)\RussiaRect.exe"
-@erase "$(OUTDIR)\RussiaRect.ilk"
-@erase "$(OUTDIR)\RussiaRect.pdb"
"$(OUTDIR)" :
if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
CPP=cl.exe
CPP_PROJ=/nologo /MDd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_AFXDLL" /D "_MBCS" /Fp"$(INTDIR)\RussiaRect.pch" /Yu"stdafx.h" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /GZ /c
.c{$(INTDIR)}.obj::
$(CPP) @<<
$(CPP_PROJ) $<
<<
.cpp{$(INTDIR)}.obj::
$(CPP) @<<
$(CPP_PROJ) $<
<<
.cxx{$(INTDIR)}.obj::
$(CPP) @<<
$(CPP_PROJ) $<
<<
.c{$(INTDIR)}.sbr::
$(CPP) @<<
$(CPP_PROJ) $<
<<
.cpp{$(INTDIR)}.sbr::
$(CPP) @<<
$(CPP_PROJ) $<
<<
.cxx{$(INTDIR)}.sbr::
$(CPP) @<<
$(CPP_PROJ) $<
<<
MTL=midl.exe
MTL_PROJ=/nologo /D "_DEBUG" /mktyplib203 /win32
RSC=rc.exe
RSC_PROJ=/l 0x804 /fo"$(INTDIR)\RussiaRect.res" /d "_DEBUG" /d "_AFXDLL"
BSC32=bscmake.exe
BSC32_FLAGS=/nologo /o"$(OUTDIR)\RussiaRect.bsc"
BSC32_SBRS= \
LINK32=link.exe
LINK32_FLAGS=/nologo /subsystem:windows /incremental:yes /pdb:"$(OUTDIR)\RussiaRect.pdb" /debug /machine:I386 /out:"$(OUTDIR)\RussiaRect.exe" /pdbtype:sept
LINK32_OBJS= \
"$(INTDIR)\ConnectDlg.obj" \
"$(INTDIR)\GameExitDlg.obj" \
"$(INTDIR)\MainFrm.obj" \
"$(INTDIR)\RussiaRect.obj" \
"$(INTDIR)\RussiaRectDoc.obj" \
"$(INTDIR)\RussiaRectView.obj" \
"$(INTDIR)\StdAfx.obj" \
"$(INTDIR)\UserHelp.obj" \
"$(INTDIR)\RussiaRect.res"
"$(OUTDIR)\RussiaRect.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
$(LINK32) @<<
$(LINK32_FLAGS) $(LINK32_OBJS)
<<
!ENDIF
!IF "$(NO_EXTERNAL_DEPS)" != "1"
!IF EXISTS("RussiaRect.dep")
!INCLUDE "RussiaRect.dep"
!ELSE
!MESSAGE Warning: cannot find "RussiaRect.dep"
!ENDIF
!ENDIF
!IF "$(CFG)" == "RussiaRect - Win32 Release" || "$(CFG)" == "RussiaRect - Win32 Debug"
SOURCE=.\ConnectDlg.cpp
"$(INTDIR)\ConnectDlg.obj" : $(SOURCE) "$(INTDIR)" "$(INTDIR)\RussiaRect.pch"
SOURCE=.\GameExitDlg.cpp
"$(INTDIR)\GameExitDlg.obj" : $(SOURCE) "$(INTDIR)" "$(INTDIR)\RussiaRect.pch"
SOURCE=.\MainFrm.cpp
"$(INTDIR)\MainFrm.obj" : $(SOURCE) "$(INTDIR)" "$(INTDIR)\RussiaRect.pch"
SOURCE=.\RussiaRect.cpp
"$(INTDIR)\RussiaRect.obj" : $(SOURCE) "$(INTDIR)" "$(INTDIR)\RussiaRect.pch"
SOURCE=.\RussiaRect.rc
"$(INTDIR)\RussiaRect.res" : $(SOURCE) "$(INTDIR)"
$(RSC) $(RSC_PROJ) $(SOURCE)
SOURCE=.\RussiaRectDoc.cpp
"$(INTDIR)\RussiaRectDoc.obj" : $(SOURCE) "$(INTDIR)" "$(INTDIR)\RussiaRect.pch"
SOURCE=.\RussiaRectView.cpp
"$(INTDIR)\RussiaRectView.obj" : $(SOURCE) "$(INTDIR)" "$(INTDIR)\RussiaRect.pch"
SOURCE=.\StdAfx.cpp
!IF "$(CFG)" == "RussiaRect - Win32 Release"
CPP_SWITCHES=/nologo /MD /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_AFXDLL" /D "_MBCS" /Fp"$(INTDIR)\RussiaRect.pch" /Yc"stdafx.h" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c
"$(INTDIR)\StdAfx.obj" "$(INTDIR)\RussiaRect.pch" : $(SOURCE) "$(INTDIR)"
$(CPP) @<<
$(CPP_SWITCHES) $(SOURCE)
<<
!ELSEIF "$(CFG)" == "RussiaRect - Win32 Debug"
CPP_SWITCHES=/nologo /MDd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_AFXDLL" /D "_MBCS" /Fp"$(INTDIR)\RussiaRect.pch" /Yc"stdafx.h" /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /GZ /c
"$(INTDIR)\StdAfx.obj" "$(INTDIR)\RussiaRect.pch" : $(SOURCE) "$(INTDIR)"
$(CPP) @<<
$(CPP_SWITCHES) $(SOURCE)
<<
!ENDIF
SOURCE=.\UserHelp.cpp
"$(INTDIR)\UserHelp.obj" : $(SOURCE) "$(INTDIR)" "$(INTDIR)\RussiaRect.pch"
!ENDIF
| zzy-russia-rect | RussiaRect.mak | Makefile | gpl2 | 7,195 |
//{{NO_DEPENDENCIES}}
// Microsoft Developer Studio generated include file.
// Used by RussiaRect.rc
//
#define IDD_ABOUTBOX 100
#define IDP_SOCKETS_INIT_FAILED 104
#define IDR_MAINFRAME 128
#define IDR_RUSSIATYPE 129
#define IDD_DIALOG1 131
#define IDD_DIALOG2 138
#define IDD_DIALOG3 139
#define IDC_RADIO1 1006
#define IDC_RADIO2 1007
#define IDC_IP_HOST 1008
#define IDM_OnePlayer 32771
#define IDM_TwoPlayers 32772
#define IDM_Connect 32773
#define IDM_Request 32774
#define IDM_ShowIP 32775
#define IDM_GameStart 32776
#define IDM_GamePause 32777
#define IDM_GameEnd 32778
#define IDM_UserHelp 32779
#define IDM_GameExit 32782
#define IDM_LEVEL_1 32783
#define IDM_LEVEL_2 32784
#define IDM_LEVEL_3 32785
#define IDM_LEVEL_4 32786
#define IDM_LEVEL_5 32787
#define IDM_MUSIC_OFF 32789
#define IDM_GRID 32790
#define IDM_NOGRID 32791
#define IDM_ONMUSIC1 32792
#define IDM_ONMUSIC2 32793
#define IDM_ONMUSIC3 32794
#define IDM_ONMUSIC4 32795
#define IDM_ONMUSIC5 32796
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_3D_CONTROLS 1
#define _APS_NEXT_RESOURCE_VALUE 142
#define _APS_NEXT_COMMAND_VALUE 32797
#define _APS_NEXT_CONTROL_VALUE 1010
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif
| zzy-russia-rect | resource.h | C | gpl2 | 1,996 |
// RussiaRectDoc.h : interface of the CRussiaRectDoc class
//
/////////////////////////////////////////////////////////////////////////////
#if !defined(AFX_RUSSIARECTDOC_H__EBA9B8C7_CFDC_430F_A4D0_52F96CA6C18B__INCLUDED_)
#define AFX_RUSSIARECTDOC_H__EBA9B8C7_CFDC_430F_A4D0_52F96CA6C18B__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
class CRussiaRectDoc : public CDocument
{
protected: // create from serialization only
CRussiaRectDoc();
DECLARE_DYNCREATE(CRussiaRectDoc)
// Attributes
public:
// Operations
public:
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CRussiaRectDoc)
public:
virtual BOOL OnNewDocument();
virtual void Serialize(CArchive& ar);
//}}AFX_VIRTUAL
// Implementation
public:
virtual ~CRussiaRectDoc();
#ifdef _DEBUG
virtual void AssertValid() const;
virtual void Dump(CDumpContext& dc) const;
#endif
protected:
// Generated message map functions
protected:
//{{AFX_MSG(CRussiaRectDoc)
// NOTE - the ClassWizard will add and remove member functions here.
// DO NOT EDIT what you see in these blocks of generated code !
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
/////////////////////////////////////////////////////////////////////////////
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_RUSSIARECTDOC_H__EBA9B8C7_CFDC_430F_A4D0_52F96CA6C18B__INCLUDED_)
| zzy-russia-rect | RussiaRectDoc.h | C++ | gpl2 | 1,519 |
// GameExitDlg.cpp : implementation file
//
#include "stdafx.h"
#include "RussiaRect.h"
#include "GameExitDlg.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CGameExitDlg dialog
CGameExitDlg::CGameExitDlg(CWnd* pParent /*=NULL*/)
: CDialog(CGameExitDlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CGameExitDlg)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
}
void CGameExitDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CGameExitDlg)
// NOTE: the ClassWizard will add DDX and DDV calls here
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CGameExitDlg, CDialog)
//{{AFX_MSG_MAP(CGameExitDlg)
// NOTE: the ClassWizard will add message map macros here
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CGameExitDlg message handlers
| zzy-russia-rect | GameExitDlg.cpp | C++ | gpl2 | 1,049 |
// RussiaRect.cpp : Defines the class behaviors for the application.
//
#include "stdafx.h"
#include "RussiaRect.h"
#include "MainFrm.h"
#include "RussiaRectDoc.h"
#include "RussiaRectView.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CRussiaRectApp
BEGIN_MESSAGE_MAP(CRussiaRectApp, CWinApp)
//{{AFX_MSG_MAP(CRussiaRectApp)
ON_COMMAND(ID_APP_ABOUT, OnAppAbout)
// NOTE - the ClassWizard will add and remove mapping macros here.
// DO NOT EDIT what you see in these blocks of generated code!
//}}AFX_MSG_MAP
// Standard file based document commands
ON_COMMAND(ID_FILE_NEW, CWinApp::OnFileNew)
ON_COMMAND(ID_FILE_OPEN, CWinApp::OnFileOpen)
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CRussiaRectApp construction
CRussiaRectApp::CRussiaRectApp()
{
// TODO: add construction code here,
// Place all significant initialization in InitInstance
}
/////////////////////////////////////////////////////////////////////////////
// The one and only CRussiaRectApp object
CRussiaRectApp theApp;
/////////////////////////////////////////////////////////////////////////////
// CRussiaRectApp initialization
BOOL CRussiaRectApp::InitInstance()
{
if (!AfxSocketInit())
{
AfxMessageBox(IDP_SOCKETS_INIT_FAILED);
return FALSE;
}
AfxEnableControlContainer();
// Standard initialization
// If you are not using these features and wish to reduce the size
// of your final executable, you should remove from the following
// the specific initialization routines you do not need.
#ifdef _AFXDLL
Enable3dControls(); // Call this when using MFC in a shared DLL
#else
Enable3dControlsStatic(); // Call this when linking to MFC statically
#endif
// Change the registry key under which our settings are stored.
// TODO: You should modify this string to be something appropriate
// such as the name of your company or organization.
SetRegistryKey(_T("Local AppWizard-Generated Applications"));
LoadStdProfileSettings(); // Load standard INI file options (including MRU)
// Register the application's document templates. Document templates
// serve as the connection between documents, frame windows and views.
CSingleDocTemplate* pDocTemplate;
pDocTemplate = new CSingleDocTemplate(
IDR_MAINFRAME,
RUNTIME_CLASS(CRussiaRectDoc),
RUNTIME_CLASS(CMainFrame), // main SDI frame window
RUNTIME_CLASS(CRussiaRectView));
AddDocTemplate(pDocTemplate);
// Parse command line for standard shell commands, DDE, file open
CCommandLineInfo cmdInfo;
ParseCommandLine(cmdInfo);
// Dispatch commands specified on the command line
if (!ProcessShellCommand(cmdInfo))
return FALSE;
// The one and only window has been initialized, so show and update it.
m_pMainWnd->ShowWindow(SW_SHOW);
m_pMainWnd->UpdateWindow();
return TRUE;
}
/////////////////////////////////////////////////////////////////////////////
// CAboutDlg dialog used for App About
class CAboutDlg : public CDialog
{
public:
CAboutDlg();
// Dialog Data
//{{AFX_DATA(CAboutDlg)
enum { IDD = IDD_ABOUTBOX };
//}}AFX_DATA
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CAboutDlg)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
// Implementation
protected:
//{{AFX_MSG(CAboutDlg)
// No message handlers
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD)
{
//{{AFX_DATA_INIT(CAboutDlg)
//}}AFX_DATA_INIT
}
void CAboutDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CAboutDlg)
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)
//{{AFX_MSG_MAP(CAboutDlg)
// No message handlers
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
// App command to run the dialog
void CRussiaRectApp::OnAppAbout()
{
CAboutDlg aboutDlg;
aboutDlg.DoModal();
}
/////////////////////////////////////////////////////////////////////////////
// CRussiaRectApp message handlers
| zzy-russia-rect | RussiaRect.cpp | C++ | gpl2 | 4,280 |
// MainFrm.h : interface of the CMainFrame class
//
/////////////////////////////////////////////////////////////////////////////
#if !defined(AFX_MAINFRM_H__2AFA8EDD_8ED7_4846_A43C_8CC12CACEEB2__INCLUDED_)
#define AFX_MAINFRM_H__2AFA8EDD_8ED7_4846_A43C_8CC12CACEEB2__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
class CMainFrame : public CFrameWnd
{
protected: // create from serialization only
CMainFrame();
DECLARE_DYNCREATE(CMainFrame)
// Attributes
public:
// Operations
public:
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CMainFrame)
virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
//}}AFX_VIRTUAL
// Implementation
public:
virtual ~CMainFrame();
#ifdef _DEBUG
virtual void AssertValid() const;
virtual void Dump(CDumpContext& dc) const;
#endif
protected: // control bar embedded members
CStatusBar m_wndStatusBar;
CToolBar m_wndToolBar;
// Generated message map functions
protected:
//{{AFX_MSG(CMainFrame)
afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
afx_msg void OnUpdateConnect(CCmdUI* pCmdUI);
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
/////////////////////////////////////////////////////////////////////////////
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_MAINFRM_H__2AFA8EDD_8ED7_4846_A43C_8CC12CACEEB2__INCLUDED_)
| zzy-russia-rect | MainFrm.h | C++ | gpl2 | 1,488 |
; CLW file contains information for the MFC ClassWizard
[General Info]
Version=1
LastClass=CMainFrame
LastTemplate=CDialog
NewFileInclude1=#include "stdafx.h"
NewFileInclude2=#include "RussiaRect.h"
LastPage=0
ClassCount=8
Class1=CRussiaRectApp
Class2=CRussiaRectDoc
Class3=CRussiaRectView
Class4=CMainFrame
ResourceCount=5
Resource1=IDD_DIALOG2
Class5=CAboutDlg
Resource2=IDR_MAINFRAME
Class6=CConnectDlg
Resource3=IDD_ABOUTBOX
Class7=CUserHelp
Resource4=IDD_DIALOG1
Class8=CGameExitDlg
Resource5=IDD_DIALOG3
[CLS:CRussiaRectApp]
Type=0
HeaderFile=RussiaRect.h
ImplementationFile=RussiaRect.cpp
Filter=N
[CLS:CRussiaRectDoc]
Type=0
HeaderFile=RussiaRectDoc.h
ImplementationFile=RussiaRectDoc.cpp
Filter=N
[CLS:CRussiaRectView]
Type=0
HeaderFile=RussiaRectView.h
ImplementationFile=RussiaRectView.cpp
Filter=C
BaseClass=CView
VirtualFilter=VWC
LastObject=CRussiaRectView
[CLS:CMainFrame]
Type=0
HeaderFile=MainFrm.h
ImplementationFile=MainFrm.cpp
Filter=T
LastObject=IDM_Connect
BaseClass=CFrameWnd
VirtualFilter=fWC
[CLS:CAboutDlg]
Type=0
HeaderFile=RussiaRect.cpp
ImplementationFile=RussiaRect.cpp
Filter=D
[DLG:IDD_ABOUTBOX]
Type=1
Class=CAboutDlg
ControlCount=5
Control1=IDC_STATIC,static,1342177283
Control2=IDC_STATIC,static,1342308480
Control3=IDC_STATIC,static,1342308352
Control4=IDOK,button,1342373889
Control5=IDC_STATIC,static,1342308352
[MNU:IDR_MAINFRAME]
Type=1
Class=CMainFrame
Command1=IDM_OnePlayer
Command2=IDM_TwoPlayers
Command3=IDM_GameExit
Command4=IDM_Connect
Command5=IDM_Request
Command6=IDM_ShowIP
Command7=IDM_GameStart
Command8=IDM_GamePause
Command9=IDM_GameEnd
Command10=IDM_GRID
Command11=IDM_NOGRID
Command12=IDM_ONMUSIC1
Command13=IDM_ONMUSIC2
Command14=IDM_ONMUSIC3
Command15=IDM_ONMUSIC4
Command16=IDM_ONMUSIC5
Command17=IDM_MUSIC_OFF
Command18=IDM_LEVEL_1
Command19=IDM_LEVEL_2
Command20=IDM_LEVEL_3
Command21=IDM_LEVEL_4
Command22=IDM_LEVEL_5
Command23=ID_APP_ABOUT
Command24=IDM_UserHelp
CommandCount=24
[ACL:IDR_MAINFRAME]
Type=1
Class=CMainFrame
Command1=ID_FILE_NEW
Command2=ID_FILE_OPEN
Command3=ID_FILE_SAVE
Command4=ID_EDIT_UNDO
Command5=ID_EDIT_CUT
Command6=ID_EDIT_COPY
Command7=ID_EDIT_PASTE
Command8=ID_EDIT_UNDO
Command9=ID_EDIT_CUT
Command10=ID_EDIT_COPY
Command11=ID_EDIT_PASTE
Command12=ID_NEXT_PANE
Command13=ID_PREV_PANE
CommandCount=13
[TB:IDR_MAINFRAME]
Type=1
Class=?
Command1=IDM_GameStart
Command2=IDM_GamePause
Command3=IDM_GameEnd
Command4=IDM_Connect
Command5=IDM_Request
Command6=IDM_ShowIP
Command7=IDM_UserHelp
Command8=IDM_GameExit
CommandCount=8
[DLG:IDD_DIALOG1]
Type=1
Class=CConnectDlg
ControlCount=8
Control1=IDOK,button,1342242817
Control2=IDCANCEL,button,1342242816
Control3=IDC_STATIC,button,1342178055
Control4=IDC_RADIO1,button,1342308361
Control5=IDC_RADIO2,button,1342177289
Control6=IDC_STATIC,static,1342308352
Control7=IDC_IP_HOST,SysIPAddress32,1342242816
Control8=IDM_ShowIP,button,1342242816
[CLS:CConnectDlg]
Type=0
HeaderFile=ConnectDlg.h
ImplementationFile=ConnectDlg.cpp
BaseClass=CDialog
Filter=D
LastObject=IDOK
VirtualFilter=dWC
[DLG:IDD_DIALOG2]
Type=1
Class=CUserHelp
ControlCount=14
Control1=IDOK,button,1342242817
Control2=IDC_STATIC,button,1342178055
Control3=IDC_STATIC,button,1342177287
Control4=IDC_STATIC,button,1342177287
Control5=IDC_STATIC,static,1342308352
Control6=IDC_STATIC,static,1342308352
Control7=IDC_STATIC,static,1342308352
Control8=IDC_STATIC,static,1342308352
Control9=IDC_STATIC,static,1342308352
Control10=IDC_STATIC,static,1342308352
Control11=IDC_STATIC,static,1342308352
Control12=IDC_STATIC,static,1342308352
Control13=IDC_STATIC,static,1342308352
Control14=IDC_STATIC,static,1342308352
[CLS:CUserHelp]
Type=0
HeaderFile=UserHelp.h
ImplementationFile=UserHelp.cpp
BaseClass=CDialog
Filter=D
LastObject=CUserHelp
[DLG:IDD_DIALOG3]
Type=1
Class=CGameExitDlg
ControlCount=3
Control1=ID_APP_EXIT,button,1342242817
Control2=IDCANCEL,button,1342242816
Control3=IDC_STATIC,button,1342194439
[CLS:CGameExitDlg]
Type=0
HeaderFile=GameExitDlg.h
ImplementationFile=GameExitDlg.cpp
BaseClass=CDialog
Filter=D
LastObject=CGameExitDlg
| zzy-russia-rect | RussiaRect.clw | Clarion | gpl2 | 4,268 |
// ConnectDlg.cpp : implementation file
//
#include "stdafx.h"
#include "RussiaRect.h"
#include "ConnectDlg.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CConnectDlg dialog
CConnectDlg::CConnectDlg(CWnd* pParent /*=NULL*/)
: CDialog(CConnectDlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CConnectDlg)
m_iConnectStatus = 0;
//m_HostIP = "127.0.0.1" ;
//}}AFX_DATA_INIT
}
void CConnectDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CConnectDlg)
DDX_Control(pDX, IDC_IP_HOST, m_HostIP);
DDX_Radio(pDX, IDC_RADIO1, m_iConnectStatus);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CConnectDlg, CDialog)
//{{AFX_MSG_MAP(CConnectDlg)
ON_BN_CLICKED(IDC_RADIO1, OnRadio1)
ON_BN_CLICKED(IDC_RADIO2, OnRadio2)
ON_NOTIFY(IPN_FIELDCHANGED, IDC_IP_HOST, OnFieldchangedIpHost)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CConnectDlg message handlers
//DEL void CConnectDlg::OnOK()
//DEL {
//DEL // TODO: Add extra validation here
//DEL
//DEL CDialog::OnOK();
//DEL }
void CConnectDlg::OnRadio1()
{
// TODO: Add your control notification handler code here
}
void CConnectDlg::OnRadio2()
{
// TODO: Add your control notification handler code here
}
void CConnectDlg::OnFieldchangedIpHost(NMHDR* pNMHDR, LRESULT* pResult)
{
// TODO: Add your control notification handler code here
*pResult = 0;
}
| zzy-russia-rect | ConnectDlg.cpp | C++ | gpl2 | 1,629 |
// RussiaRectDoc.cpp : implementation of the CRussiaRectDoc class
//
#include "stdafx.h"
#include "RussiaRect.h"
#include "RussiaRectDoc.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CRussiaRectDoc
IMPLEMENT_DYNCREATE(CRussiaRectDoc, CDocument)
BEGIN_MESSAGE_MAP(CRussiaRectDoc, CDocument)
//{{AFX_MSG_MAP(CRussiaRectDoc)
// NOTE - the ClassWizard will add and remove mapping macros here.
// DO NOT EDIT what you see in these blocks of generated code!
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CRussiaRectDoc construction/destruction
CRussiaRectDoc::CRussiaRectDoc()
{
// TODO: add one-time construction code here
}
CRussiaRectDoc::~CRussiaRectDoc()
{
}
BOOL CRussiaRectDoc::OnNewDocument()
{
if (!CDocument::OnNewDocument())
return FALSE;
// TODO: add reinitialization code here
// (SDI documents will reuse this document)
return TRUE;
}
/////////////////////////////////////////////////////////////////////////////
// CRussiaRectDoc serialization
void CRussiaRectDoc::Serialize(CArchive& ar)
{
if (ar.IsStoring())
{
// TODO: add storing code here
}
else
{
// TODO: add loading code here
}
}
/////////////////////////////////////////////////////////////////////////////
// CRussiaRectDoc diagnostics
#ifdef _DEBUG
void CRussiaRectDoc::AssertValid() const
{
CDocument::AssertValid();
}
void CRussiaRectDoc::Dump(CDumpContext& dc) const
{
CDocument::Dump(dc);
}
#endif //_DEBUG
/////////////////////////////////////////////////////////////////////////////
// CRussiaRectDoc commands
| zzy-russia-rect | RussiaRectDoc.cpp | C++ | gpl2 | 1,822 |
// UserHelp.cpp : implementation file
//
#include "stdafx.h"
#include "RussiaRect.h"
#include "UserHelp.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CUserHelp dialog
CUserHelp::CUserHelp(CWnd* pParent /*=NULL*/)
: CDialog(CUserHelp::IDD, pParent)
{
//{{AFX_DATA_INIT(CUserHelp)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
}
void CUserHelp::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CUserHelp)
// NOTE: the ClassWizard will add DDX and DDV calls here
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CUserHelp, CDialog)
//{{AFX_MSG_MAP(CUserHelp)
// NOTE: the ClassWizard will add message map macros here
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CUserHelp message handlers
| zzy-russia-rect | UserHelp.cpp | C++ | gpl2 | 1,013 |
#if !defined(AFX_USERHELP_H__475978A6_F08E_4301_9170_C1CB252A92EC__INCLUDED_)
#define AFX_USERHELP_H__475978A6_F08E_4301_9170_C1CB252A92EC__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
// UserHelp.h : header file
//
/////////////////////////////////////////////////////////////////////////////
// CUserHelp dialog
class CUserHelp : public CDialog
{
// Construction
public:
CUserHelp(CWnd* pParent = NULL); // standard constructor
// Dialog Data
//{{AFX_DATA(CUserHelp)
enum { IDD = IDD_DIALOG2 };
// NOTE: the ClassWizard will add data members here
//}}AFX_DATA
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CUserHelp)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
// Implementation
protected:
// Generated message map functions
//{{AFX_MSG(CUserHelp)
// NOTE: the ClassWizard will add member functions here
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_USERHELP_H__475978A6_F08E_4301_9170_C1CB252A92EC__INCLUDED_)
| zzy-russia-rect | UserHelp.h | C++ | gpl2 | 1,239 |
#if !defined(AFX_CONNECTDLG_H__63228BB2_7149_454B_856E_1FC05C4BB621__INCLUDED_)
#define AFX_CONNECTDLG_H__63228BB2_7149_454B_856E_1FC05C4BB621__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
// ConnectDlg.h : header file
//
/////////////////////////////////////////////////////////////////////////////
// CConnectDlg dialog
class CConnectDlg : public CDialog
{
// Construction
public:
CConnectDlg(CWnd* pParent = NULL); // standard constructor
// Dialog Data
//{{AFX_DATA(CConnectDlg)
enum { IDD = IDD_DIALOG1 };
CIPAddressCtrl m_HostIP;
int m_iConnectStatus;
//}}AFX_DATA
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CConnectDlg)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
// Implementation
protected:
// Generated message map functions
//{{AFX_MSG(CConnectDlg)
afx_msg void OnRadio1();
afx_msg void OnRadio2();
afx_msg void OnFieldchangedIpHost(NMHDR* pNMHDR, LRESULT* pResult);
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_CONNECTDLG_H__63228BB2_7149_454B_856E_1FC05C4BB621__INCLUDED_)
| zzy-russia-rect | ConnectDlg.h | C++ | gpl2 | 1,321 |
// stdafx.h : include file for standard system include files,
// or project specific include files that are used frequently, but
// are changed infrequently
//
#if !defined(AFX_STDAFX_H__EEBBCF93_A642_49BD_968E_67849685C835__INCLUDED_)
#define AFX_STDAFX_H__EEBBCF93_A642_49BD_968E_67849685C835__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers
#include <afxwin.h> // MFC core and standard components
#include <afxext.h> // MFC extensions
#include <afxdisp.h> // MFC Automation classes
#include <afxdtctl.h> // MFC support for Internet Explorer 4 Common Controls
#ifndef _AFX_NO_AFXCMN_SUPPORT
#include <afxcmn.h> // MFC support for Windows Common Controls
#endif // _AFX_NO_AFXCMN_SUPPORT
#include <afxsock.h> // MFC socket extensions
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_STDAFX_H__EEBBCF93_A642_49BD_968E_67849685C835__INCLUDED_)
| zzy-russia-rect | StdAfx.h | C | gpl2 | 1,102 |
#if !defined(AFX_GAMEEXITDLG_H__1D762E50_894E_4FD6_8836_DE97C25D2A22__INCLUDED_)
#define AFX_GAMEEXITDLG_H__1D762E50_894E_4FD6_8836_DE97C25D2A22__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
// GameExitDlg.h : header file
//
/////////////////////////////////////////////////////////////////////////////
// CGameExitDlg dialog
class CGameExitDlg : public CDialog
{
// Construction
public:
CGameExitDlg(CWnd* pParent = NULL); // standard constructor
// Dialog Data
//{{AFX_DATA(CGameExitDlg)
enum { IDD = IDD_DIALOG3 };
// NOTE: the ClassWizard will add data members here
//}}AFX_DATA
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CGameExitDlg)
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
//}}AFX_VIRTUAL
// Implementation
protected:
// Generated message map functions
//{{AFX_MSG(CGameExitDlg)
// NOTE: the ClassWizard will add member functions here
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
#endif // !defined(AFX_GAMEEXITDLG_H__1D762E50_894E_4FD6_8836_DE97C25D2A22__INCLUDED_)
| zzy-russia-rect | GameExitDlg.h | C++ | gpl2 | 1,269 |
MsgBox(0,"PlatformServer","") | zzz-autoitpro | trunk/CloseWindowByTitle/复件 test.au3 | AutoIt | bsd | 29 |
@echo off
net stop wuauserv
TASKKILL /F /IM sqlservr.exe
exit | zzz-autoitpro | trunk/上网模式开发模式/Other关闭.bat | Batchfile | bsd | 67 |
@echo off
TASKKILL /F /IM jqs.exe
TASKKILL /F /IM YNotes.exe
TASKKILL /F /IM mDNSRsponder.exe
TASKKILL /F /IM sqlwriter.exe
TASKKILL /F /IM cloud.exe
TASKKILL /F /IM VisualSVNServer.exe
net stop CloudServer
exit | zzz-autoitpro | trunk/上网模式开发模式/复件 关闭Cloud.bat | Batchfile | bsd | 222 |
@net stop OracleOraHome92TNSListener
@net stop OracleServiceORAX61
@net stop OracleOraHome92Agent
@net stop OracleMTSRecoveryService
| zzz-autoitpro | trunk/上网模式开发模式/oracleX611关闭.bat | Batchfile | bsd | 137 |
@net start "World Wide Web Publishing"
@net start "Simple Mail Transfer Protocol (SMTP)"
@net start "IIS Admin"
| zzz-autoitpro | trunk/上网模式开发模式/IIS打开.bat | Batchfile | bsd | 115 |
@echo off
net stop mssqlserver
net stop MSSQLServerOLAPService
net stop MsDtsServer100
net stop ReportServer
net stop SQLWriter
net stop MySQL
net stop Serv-U
net stop VisualSVNServer
TASKKILL /F /IM sqlservr.exe
exit | zzz-autoitpro | trunk/上网模式开发模式/sqlserver_SVN关闭.bat | Batchfile | bsd | 228 |
@net stop "World Wide Web Publishing"
@net stop "Simple Mail Transfer Protocol (SMTP)"
@net stop "IIS Admin"
| zzz-autoitpro | trunk/上网模式开发模式/IIS关闭.bat | Batchfile | bsd | 116 |
@net stop "ICBC Daemon Service"
| zzz-autoitpro | trunk/上网模式开发模式/工行打开.bat | Batchfile | bsd | 33 |
@echo off
TASKKILL /F /IM jqs.exe
TASKKILL /F /IM YNotes.exe
TASKKILL /F /IM mDNSRsponder.exe
TASKKILL /F /IM sqlwriter.exe
TASKKILL /F /IM cloud.exe
TASKKILL /F /IM VisualSVNServer.exe
TASKKILL /F /IM CloudServer.exe
net stop CloudServer
exit | zzz-autoitpro | trunk/上网模式开发模式/Cloud关闭.bat | Batchfile | bsd | 255 |
@net stop "SQL Server (SQLEXPRESS)"
@net stop "SQL Server VSS Writer"
@net stop "SQL Server (MSSQLSERVER)"
| zzz-autoitpro | trunk/上网模式开发模式/Sqlserver_X61关闭.bat | Batchfile | bsd | 110 |
@net stop "CloudServer"
@pause
@exit | zzz-autoitpro | trunk/上网模式开发模式/CloudServer打开.bat | Batchfile | bsd | 38 |
@echo off
net stop mssqlserver
net stop MSSQLServerOLAPService
net stop MsDtsServer100
net stop ReportServer
net stop SQLWriter
net stop MySQL
net stop Serv-U
TASKKILL /F /IM sqlservr.exe
exit | zzz-autoitpro | trunk/上网模式开发模式/sqlserve关闭.bat | Batchfile | bsd | 202 |
@echo off
net start mssqlserver
net start MSSQLServerOLAPService
net start MsDtsServer100
net start ReportServer
net start SQLWriter
net start VisualSVNServer
net start SQLWriter
net start MySQL
net start Serv-U
net start VisualSVNServer
exit | zzz-autoitpro | trunk/上网模式开发模式/sqlserver_SVN打开.bat | Batchfile | bsd | 254 |
@net start OracleOraHome92TNSListener
@net start OracleServiceORAX61
@net start OracleOraHome92Agent
@net start OracleMTSRecoveryService
| zzz-autoitpro | trunk/上网模式开发模式/oracleX611打开.bat | Batchfile | bsd | 145 |
@net stop "ICBC Daemon Service"
| zzz-autoitpro | trunk/上网模式开发模式/工行关闭.bat | Batchfile | bsd | 33 |
@echo off
net stop OracleDBConsoleorc129
net stop OracleOraDb10g_home1iSQL*Plus
net stop OracleOraDb10g_home1TNSListener
net stop OracleServiceORC129
TASKKILL /F /IM sqlservr.exe
exit | zzz-autoitpro | trunk/上网模式开发模式/oracle关闭.bat | Batchfile | bsd | 190 |
@echo off
net start CloudServer
D:\Cloud\cloud.exe
exit | zzz-autoitpro | trunk/上网模式开发模式/Cloud打开.bat | Batchfile | bsd | 59 |
@net start "SQL Server (SQLEXPRESS)"
@net start "SQL Server VSS Writer"
@net start "SQL Server (MSSQLSERVER)"
| zzz-autoitpro | trunk/上网模式开发模式/Sqlserver_X61打开.bat | Batchfile | bsd | 117 |
<%@ page language="java" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title>欢迎登陆</title>
<%@ include file="/common/meta.jsp"%>
<%@ include file="/common/variable.jsp"%>
<base href="${ctx}" />
<link rel="shortcut icon" type="image/x-icon" href="${ctx}/images/extend/iconkey.ico" media="screen" />
<script type="text/javascript" src="${ctx}/js/xheditor/jquery-1.8.0.min.js"></script>
<script type="text/javascript" src="${ctx}/js/jquery.cookie.js"></script>
<link rel="stylesheet" type="text/css" href="${ctx}/css/zice.style.css">
<link rel="stylesheet" type="text/css" href="${ctx}/css/tipsy.css">
<link rel="stylesheet" type="text/css" href="${ctx}/css/icon.css">
<link rel="stylesheet" type="text/css" href="${ctx}/css/buttons.css">
<script type="text/javascript" src="${ctx}/js/iphone.check.js"></script>
<script type="text/javascript" src="${ctx}/js/jquery-jrumble.js"></script>
<script type="text/javascript" src="${ctx}/js/jquery.tipsy.js"></script>
<script type="text/javascript" src="${ctx}/js/login.js"></script>
<script type="text/javascript">
if(top!=self){
if(top.location != self.location)
top.location=self.location;
}
</script>
<style type="text/css">
html {
background-image: none;
}
label.iPhoneCheckLabelOn span {
padding-left: 0px
}
#versionBar {
background-color: #212121;
position: fixed;
width: 100%;
height: 35px;
bottom: 0;
left: 0;
text-align: center;
line-height: 35px;
z-index: 11;
-webkit-box-shadow: black 0px 10px 10px -10px inset;
-moz-box-shadow: black 0px 10px 10px -10px inset;
box-shadow: black 0px 10px 10px -10px inset;
}
.copyright {
text-align: center;
font-size: 10px;
color: #CCC;
}
.copyright a {
color: #A31F1A;
text-decoration: none
}
/*update-begin--Author:tanghong Date:20130419 for:【是否】按钮错位*/
.on_off_checkbox{
width:0px;
}
/*update-end--Author:tanghong Date:20130419 for:【是否】按钮错位*/
#login .logo {
width: 500px;
height: 51px;
}
#cap{
margin-left: 88px;
}
</style>
</head>
<body>
<div id="alertMessage"></div>
<div id="successLogin"></div>
<div class="text_success">
<img src="${ctx}/images/extend/loader_green.gif" alt="Please wait" /> <span>登陆成功!请稍后....</span>
</div>
<div id="login">
<div class="ribbon" style="background-image:url(${ctx}/images/extend/typelogin.png);"></div>
<div class="inner">
<div class="logo">
<img src="${ctx}/images/extend/toplogo-jeecg.png" />
</div>
<div class="formLogin">
<form name="formLogin" action="${ctx }/login.html" id="formLogin" method="post">
<input name="userKey" type="hidden" id="userKey" value="D1B5CC2FE46C4CC983C073BCA897935608D926CD32992B5900" />
<div class="tip">
<input class="userName" name="userName" type="text" id="userName" title="用户名" iscookie="true" value="zhouxushun" nullmsg="请输入用户名!" />
</div>
<div class="tip">
<input class="userPwd" name="userPwd" type="password" id="userPwd" title="密码" value="123456" nullmsg="请输入密码!" />
</div>
<div id="cap" class="tip">
<input class="captcha" name="captcha" type="text" id="captcha" nullmsg="请输入验证码!" />
<img style="width:85px;height:35px;margin-top: -10px;" align="absmiddle" id="Kaptcha" src="${ctx}/kaptcha.jpg"/>
</div>
<div class="loginButton">
<div style="float: left; margin-left: -9px;">
<input type="checkbox" id="on_off" name="remember" checked="ture" class="on_off_checkbox" value="0" /> <span class="f_help">是否记住用户名?</span>
</div>
<div style="float: right; padding: 3px 0; margin-right: -12px;">
<div>
<ul class="uibutton-group">
<li><a class="uibutton normal" href="javascript:void(0);" id="but_login">登陆</a>
</li>
<li><a class="uibutton normal" href="javascript:void(0);" id="forgetpass">重置</a>
</li>
</ul>
</div>
<div style="float: left; margin-left: 30px;">
<a href="javascript:void(0);"><span class="f_help">是否初始化admin的密码</span></a>
</div>
</div>
<div class="clear"></div>
</div>
</form>
</div>
</div>
<div class="shadow"></div>
</div>
<!--Login div-->
<div class="clear"></div>
<div id="versionBar">
<div class="copyright">© 版权所有 <span class="tip"><a href="javascript:void(0);" title="zzms">zzms</a>
(推荐使用IE9+,谷歌浏览器可以获得更快,更安全的页面响应速度)技术支持:<a href="javascript:void(0);" title="zzms">zzms</a> </span>
</div>
</div>
</body>
</html>
| zz-ms | trunk/zz-ms-v2.0/src/main/webapp/login.jsp | Java Server Pages | asf20 | 4,871 |
(function(){
/**************************************************************
*
* Firebug Lite 1.3.0
*
* Copyright (c) 2007, Parakey Inc.
* Released under BSD license.
* More information: http://getfirebug.com/firebuglite
*
**************************************************************/
/*
* CSS selectors powered by:
*
* Sizzle CSS Selector Engine - v1.0
* Copyright 2009, The Dojo Foundation
* Released under the MIT, BSD, and GPL Licenses.
* More information: http://sizzlejs.com/
*/
var FBL={};
(function(){var productionDir="http://getfirebug.com/releases/lite/";
var bookmarletVersion=3;
var reNotWhitespace=/[^\s]/;
var reSplitFile=/:\/{1,3}(.*?)\/([^\/]*?)\/?($|\?.*)/;
var userAgent=navigator.userAgent.toLowerCase();
this.isFirefox=/firefox/.test(userAgent);
this.isOpera=/opera/.test(userAgent);
this.isSafari=/webkit/.test(userAgent);
this.isIE=/msie/.test(userAgent)&&!/opera/.test(userAgent);
this.isIE6=/msie 6/i.test(navigator.appVersion);
this.browserVersion=(userAgent.match(/.+(?:rv|it|ra|ie)[\/: ]([\d.]+)/)||[0,"0"])[1];
this.isIElt8=this.isIE&&(this.browserVersion-0<8);
this.NS=null;
this.pixelsPerInch=null;
var namespaces=[];
this.ns=function(fn){var ns={};
namespaces.push(fn,ns);
return ns
};
var FBTrace=null;
this.initialize=function(){if(FBL.FBTrace){FBTrace=FBL.FBTrace
}else{FBTrace=FBL.FBTrace={}
}FBL.Ajax.initialize();
var isChromeContext=window.Firebug&&typeof window.Firebug.SharedEnv=="object";
if(isChromeContext){sharedEnv=window.Firebug.SharedEnv;
delete window.Firebug.SharedEnv;
FBL.Env=sharedEnv;
FBL.Env.isChromeContext=true;
FBTrace.messageQueue=FBL.Env.traceMessageQueue
}else{FBL.NS=document.documentElement.namespaceURI;
FBL.Env.browser=window;
FBL.Env.destroy=destroyEnvironment;
if(document.documentElement.getAttribute("debug")=="true"){FBL.Env.Options.startOpened=true
}findLocation();
var prefs=eval("("+FBL.readCookie("FirebugLite")+")");
if(prefs){FBL.Env.Options.startOpened=prefs.startOpened;
FBL.Env.Options.enableTrace=prefs.enableTrace;
FBL.Env.Options.enablePersistent=prefs.enablePersistent
}if(FBL.isFirefox&&typeof FBL.Env.browser.console=="object"&&FBL.Env.browser.console.firebug&&FBL.Env.Options.disableWhenFirebugActive){return
}}if(FBL.Env.isDebugMode){FBL.Env.browser.FBL=FBL
}this.isQuiksMode=FBL.Env.browser.document.compatMode=="BackCompat";
this.isIEQuiksMode=this.isIE&&this.isQuiksMode;
this.isIEStantandMode=this.isIE&&!this.isQuiksMode;
this.noFixedPosition=this.isIE6||this.isIEQuiksMode;
if(FBL.Env.Options.enableTrace){FBTrace.initialize()
}if(FBTrace.DBG_INITIALIZE&&isChromeContext){FBTrace.sysout("FBL.initialize - persistent application","initialize chrome context")
}if(FBTrace.DBG_INITIALIZE){FBTrace.sysout("FBL.initialize",namespaces.length/2+" namespaces BEGIN")
}for(var i=0;
i<namespaces.length;
i+=2){var fn=namespaces[i];
var ns=namespaces[i+1];
fn.apply(ns)
}if(FBTrace.DBG_INITIALIZE){FBTrace.sysout("FBL.initialize",namespaces.length/2+" namespaces END");
FBTrace.sysout("FBL waitForDocument","waiting document load")
}FBL.Firebug.loadPrefs(prefs);
if(FBL.Env.Options.enablePersistent){if(isChromeContext){FBL.FirebugChrome.clone(FBL.Env.FirebugChrome)
}else{FBL.Env.FirebugChrome=FBL.FirebugChrome;
FBL.Env.traceMessageQueue=FBTrace.messageQueue
}}if(FBL.Env.isChromeExtension){var doc=FBL.Env.browser.document;
if(!doc.getElementById("FirebugChannel")){var channel=doc.createElement("div");
channel.id="FirebugChannel";
channel.firebugIgnore=true;
channel.style.display="none";
doc.documentElement.insertBefore(channel,doc.documentElement.firstChild)
}var channelEvent=document.createEvent("Event");
channelEvent.initEvent("FirebugChannelEvent",true,true);
this.chromeExtensionDispatch=function(data){channel.innerText=data;
channel.dispatchEvent(channelEvent)
}
}waitForDocument()
};
var waitForDocument=function waitForDocument(){var doc=FBL.Env.browser.document;
var body=doc.getElementsByTagName("body")[0];
if(body){calculatePixelsPerInch(doc,body);
onDocumentLoad()
}else{setTimeout(waitForDocument,50)
}};
var onDocumentLoad=function onDocumentLoad(){if(FBTrace.DBG_INITIALIZE){FBTrace.sysout("FBL onDocumentLoad","document loaded")
}if(FBL.isIE6){fixIE6BackgroundImageCache()
}if(FBL.Env.Options.enablePersistent&&FBL.Env.isChromeContext){FBL.Firebug.initialize();
if(!FBL.Env.isDevelopmentMode){sharedEnv.destroy();
sharedEnv=null
}}else{FBL.FirebugChrome.create()
}};
var sharedEnv;
this.Env={Options:{saveCookies:false,saveWindowPosition:false,saveCommandLineHistory:false,startOpened:false,startInNewWindow:false,showIconWhenHidden:true,overrideConsole:true,ignoreFirebugElements:true,disableWhenFirebugActive:true,enableTrace:false,enablePersistent:false},Location:{sourceDir:null,baseDir:null,skinDir:null,skin:null,app:null},skin:"xp",useLocalSkin:false,isDevelopmentMode:false,isDebugMode:false,isChromeContext:false,browser:null,chrome:null};
var destroyEnvironment=function destroyEnvironment(){setTimeout(function(){FBL=null
},100)
};
var findLocation=function findLocation(){var reFirebugFile=/(firebug-lite(?:-\w+)?(?:\.js|\.jgz))(?:#(.+))?$/;
var rePath=/^(.*\/)/;
var reProtocol=/^\w+:\/\//;
var path=null;
var doc=document;
var script=doc.getElementById("FirebugLite");
if(script){file=reFirebugFile.exec(script.src);
var version=script.getAttribute("FirebugLite");
var number=version?parseInt(version):0;
if(!version||!number||number<bookmarletVersion){}}else{for(var i=0,s=doc.getElementsByTagName("script"),si;
si=s[i];
i++){var file=null;
if(si.nodeName.toLowerCase()=="script"&&(file=reFirebugFile.exec(si.src))){script=si;
break
}}}if(script){script.firebugIgnore=true
}if(file){var fileName=file[1];
var fileOptions=file[2];
if(reProtocol.test(script.src)){path=rePath.exec(script.src)[1]
}else{var r=rePath.exec(script.src);
var src=r?r[1]:script.src;
var backDir=/^((?:\.\.\/)+)(.*)/.exec(src);
var reLastDir=/^(.*\/)[^\/]+\/$/;
path=rePath.exec(location.href)[1];
if(backDir){var j=backDir[1].length/3;
var p;
while(j-->0){path=reLastDir.exec(path)[1]
}path+=backDir[2]
}else{if(src.indexOf("/")!=-1){if(/^\.\/./.test(src)){path+=src.substring(2)
}else{if(/^\/./.test(src)){var domain=/^(\w+:\/\/[^\/]+)/.exec(path);
path=domain[1]+src
}else{path+=src
}}}}}}FBL.Env.isChromeExtension=script&&script.getAttribute("extension")=="Chrome";
if(FBL.Env.isChromeExtension){path=productionDir;
script={innerHTML:"{showIconWhenHidden:false}"}
}var m=path&&path.match(/([^\/]+)\/$/)||null;
if(path&&m){var Env=FBL.Env;
if(fileName=="firebug-lite-dev.js"){Env.isDevelopmentMode=true;
Env.useLocalSkin=true;
Env.isDebugMode=true
}else{if(fileName=="firebug-lite-debug.js"){Env.isDebugMode=true
}}if(Env.browser.document.documentElement.getAttribute("debug")=="true"){Env.Options.startOpened=true
}if(fileOptions){var options=fileOptions.split(",");
for(var i=0,length=options.length;
i<length;
i++){var option=options[i];
var name,value;
if(option.indexOf("=")!=-1){var parts=option.split("=");
name=parts[0];
value=eval(unescape(parts[1]))
}else{name=option;
value=true
}if(name=="debug"){Env.isDebugMode=!!value
}else{if(name in Env.Options){Env.Options[name]=value
}else{Env[name]=value
}}}}var innerOptions=FBL.trim(script.innerHTML);
if(innerOptions){var innerOptionsObject=eval("("+innerOptions+")");
for(var name in innerOptionsObject){var value=innerOptionsObject[name];
if(name=="debug"){Env.isDebugMode=!!value
}else{if(name in Env.Options){Env.Options[name]=value
}else{Env[name]=value
}}}}if(Env.isDebugMode){Env.Options.startOpened=true;
Env.Options.enableTrace=true;
Env.Options.disableWhenFirebugActive=false
}var loc=Env.Location;
var isProductionRelease=path.indexOf(productionDir)!=-1;
loc.sourceDir=path;
loc.baseDir=path.substr(0,path.length-m[1].length-1);
loc.skinDir=(isProductionRelease?path:loc.baseDir)+"skin/"+Env.skin+"/";
loc.skin=loc.skinDir+"firebug.html";
loc.app=path+fileName
}else{throw new Error("Firebug Error: Library path not found")
}};
this.bind=function(){var args=cloneArray(arguments),fn=args.shift(),object=args.shift();
return function(){return fn.apply(object,arrayInsert(cloneArray(args),0,arguments))
}
};
this.bindFixed=function(){var args=cloneArray(arguments),fn=args.shift(),object=args.shift();
return function(){return fn.apply(object,args)
}
};
this.extend=function(l,r){var newOb={};
for(var n in l){newOb[n]=l[n]
}for(var n in r){newOb[n]=r[n]
}return newOb
};
this.append=function(l,r){for(var n in r){l[n]=r[n]
}return l
};
this.keys=function(map){var keys=[];
try{for(var name in map){keys.push(name)
}}catch(exc){}return keys
};
this.values=function(map){var values=[];
try{for(var name in map){try{values.push(map[name])
}catch(exc){if(FBTrace.DBG_ERRORS){FBTrace.sysout("lib.values FAILED ",exc)
}}}}catch(exc){if(FBTrace.DBG_ERRORS){FBTrace.sysout("lib.values FAILED ",exc)
}}return values
};
this.remove=function(list,item){for(var i=0;
i<list.length;
++i){if(list[i]==item){list.splice(i,1);
break
}}};
this.sliceArray=function(array,index){var slice=[];
for(var i=index;
i<array.length;
++i){slice.push(array[i])
}return slice
};
function cloneArray(array,fn){var newArray=[];
if(fn){for(var i=0;
i<array.length;
++i){newArray.push(fn(array[i]))
}}else{for(var i=0;
i<array.length;
++i){newArray.push(array[i])
}}return newArray
}function extendArray(array,array2){var newArray=[];
newArray.push.apply(newArray,array);
newArray.push.apply(newArray,array2);
return newArray
}this.extendArray=extendArray;
this.cloneArray=cloneArray;
function arrayInsert(array,index,other){for(var i=0;
i<other.length;
++i){array.splice(i+index,0,other[i])
}return array
}this.createStyleSheet=function(doc,url){var style=doc.createElementNS("http://www.w3.org/1999/xhtml","link");
style.setAttribute("charset","utf-8");
style.firebugIgnore=true;
style.setAttribute("rel","stylesheet");
style.setAttribute("type","text/css");
style.setAttribute("href",url);
return style
};
this.addStyleSheet=function(doc,style){var heads=doc.getElementsByTagName("head");
if(heads.length){heads[0].appendChild(style)
}else{doc.documentElement.appendChild(style)
}};
this.getStyle=this.isIE?function(el,name){return el.currentStyle[name]||el.style[name]||undefined
}:function(el,name){return el.ownerDocument.defaultView.getComputedStyle(el,null)[name]||el.style[name]||undefined
};
var entityConversionLists=this.entityConversionLists={normal:{whitespace:{"\t":"\u200c\u2192","\n":"\u200c\u00b6","\r":"\u200c\u00ac"," ":"\u200c\u00b7"}},reverse:{whitespace:{"	":"\t","
":"\n","\u200c\u2192":"\t","\u200c\u00b6":"\n","\u200c\u00ac":"\r","\u200c\u00b7":" "}}};
var normal=entityConversionLists.normal,reverse=entityConversionLists.reverse;
function addEntityMapToList(ccode,entity){var lists=Array.prototype.slice.call(arguments,2),len=lists.length,ch=String.fromCharCode(ccode);
for(var i=0;
i<len;
i++){var list=lists[i];
normal[list]=normal[list]||{};
normal[list][ch]="&"+entity+";";
reverse[list]=reverse[list]||{};
reverse[list]["&"+entity+";"]=ch
}}var e=addEntityMapToList,white="whitespace",text="text",attr="attributes",css="css",editor="editor";
e(34,"quot",attr,css);
e(38,"amp",attr,text,css);
e(39,"apos",css);
e(60,"lt",attr,text,css);
e(62,"gt",attr,text,css);
e(169,"copy",text,editor);
e(174,"reg",text,editor);
e(8482,"trade",text,editor);
e(8210,"#8210",attr,text,editor);
e(8211,"ndash",attr,text,editor);
e(8212,"mdash",attr,text,editor);
e(8213,"#8213",attr,text,editor);
e(160,"nbsp",attr,text,white,editor);
e(8194,"ensp",attr,text,white,editor);
e(8195,"emsp",attr,text,white,editor);
e(8201,"thinsp",attr,text,white,editor);
e(8204,"zwnj",attr,text,white,editor);
e(8205,"zwj",attr,text,white,editor);
e(8206,"lrm",attr,text,white,editor);
e(8207,"rlm",attr,text,white,editor);
e(8203,"#8203",attr,text,white,editor);
var entityConversionRegexes={normal:{},reverse:{}};
var escapeEntitiesRegEx={normal:function(list){var chars=[];
for(var ch in list){chars.push(ch)
}return new RegExp("(["+chars.join("")+"])","gm")
},reverse:function(list){var chars=[];
for(var ch in list){chars.push(ch)
}return new RegExp("("+chars.join("|")+")","gm")
}};
function getEscapeRegexp(direction,lists){var name="",re;
var groups=[].concat(lists);
for(i=0;
i<groups.length;
i++){name+=groups[i].group
}re=entityConversionRegexes[direction][name];
if(!re){var list={};
if(groups.length>1){for(var i=0;
i<groups.length;
i++){var aList=entityConversionLists[direction][groups[i].group];
for(var item in aList){list[item]=aList[item]
}}}else{if(groups.length==1){list=entityConversionLists[direction][groups[0].group]
}else{list={}
}}re=entityConversionRegexes[direction][name]=escapeEntitiesRegEx[direction](list)
}return re
}function createSimpleEscape(name,direction){return function(value){var list=entityConversionLists[direction][name];
return String(value).replace(getEscapeRegexp(direction,{group:name,list:list}),function(ch){return list[ch]
})
}
}function escapeGroupsForEntities(str,lists){lists=[].concat(lists);
var re=getEscapeRegexp("normal",lists),split=String(str).split(re),len=split.length,results=[],cur,r,i,ri=0,l,list,last="";
if(!len){return[{str:String(str),group:"",name:""}]
}for(i=0;
i<len;
i++){cur=split[i];
if(cur==""){continue
}for(l=0;
l<lists.length;
l++){list=lists[l];
r=entityConversionLists.normal[list.group][cur];
if(r){results[ri]={str:r,"class":list["class"],extra:list.extra[cur]?list["class"]+list.extra[cur]:""};
break
}}if(!r){results[ri]={str:cur,"class":"",extra:""}
}ri++
}return results
}this.escapeGroupsForEntities=escapeGroupsForEntities;
function unescapeEntities(str,lists){var re=getEscapeRegexp("reverse",lists),split=String(str).split(re),len=split.length,results=[],cur,r,i,ri=0,l,list;
if(!len){return str
}lists=[].concat(lists);
for(i=0;
i<len;
i++){cur=split[i];
if(cur==""){continue
}for(l=0;
l<lists.length;
l++){list=lists[l];
r=entityConversionLists.reverse[list.group][cur];
if(r){results[ri]=r;
break
}}if(!r){results[ri]=cur
}ri++
}return results.join("")||""
}var escapeForTextNode=this.escapeForTextNode=createSimpleEscape("text","normal");
var escapeForHtmlEditor=this.escapeForHtmlEditor=createSimpleEscape("editor","normal");
var escapeForElementAttribute=this.escapeForElementAttribute=createSimpleEscape("attributes","normal");
var escapeForCss=this.escapeForCss=createSimpleEscape("css","normal");
var escapeForSourceLine=this.escapeForSourceLine=createSimpleEscape("text","normal");
var unescapeWhitespace=createSimpleEscape("whitespace","reverse");
this.unescapeForTextNode=function(str){if(Firebug.showTextNodesWithWhitespace){str=unescapeWhitespace(str)
}if(!Firebug.showTextNodesWithEntities){str=escapeForElementAttribute(str)
}return str
};
this.escapeNewLines=function(value){return value.replace(/\r/g,"\\r").replace(/\n/g,"\\n")
};
this.stripNewLines=function(value){return typeof(value)=="string"?value.replace(/[\r\n]/g," "):value
};
this.escapeJS=function(value){return value.replace(/\r/g,"\\r").replace(/\n/g,"\\n").replace('"','\\"',"g")
};
function escapeHTMLAttribute(value){function replaceChars(ch){switch(ch){case"&":return"&";
case"'":return apos;
case'"':return quot
}return"?"
}var apos="'",quot=""",around='"';
if(value.indexOf('"')==-1){quot='"';
apos="'"
}else{if(value.indexOf("'")==-1){quot='"';
around="'"
}}return around+(String(value).replace(/[&'"]/g,replaceChars))+around
}function escapeHTML(value){function replaceChars(ch){switch(ch){case"<":return"<";
case">":return">";
case"&":return"&";
case"'":return"'";
case'"':return"""
}return"?"
}return String(value).replace(/[<>&"']/g,replaceChars)
}this.escapeHTML=escapeHTML;
this.cropString=function(text,limit){text=text+"";
if(!limit){var halfLimit=50
}else{var halfLimit=limit/2
}if(text.length>limit){return this.escapeNewLines(text.substr(0,halfLimit)+"..."+text.substr(text.length-halfLimit))
}else{return this.escapeNewLines(text)
}};
this.isWhitespace=function(text){return !reNotWhitespace.exec(text)
};
this.safeToString=function(ob){if(this.isIE){return ob+""
}try{if(ob&&"toString" in ob&&typeof ob.toString=="function"){return ob.toString()
}}catch(exc){return"[an object with no toString() function]"
}};
var reTrim=/^\s+|\s+$/g;
this.trim=function(s){return s.replace(reTrim,"")
};
this.emptyFn=function(){};
this.isVisible=function(elt){return this.getStyle(elt,"visibility")!="hidden"&&(elt.offsetWidth>0||elt.offsetHeight>0||elt.tagName in invisibleTags||elt.namespaceURI=="http://www.w3.org/2000/svg"||elt.namespaceURI=="http://www.w3.org/1998/Math/MathML")
};
this.collapse=function(elt,collapsed){if(this.isIElt8){if(collapsed){this.setClass(elt,"collapsed")
}else{this.removeClass(elt,"collapsed")
}}else{elt.setAttribute("collapsed",collapsed?"true":"false")
}};
this.obscure=function(elt,obscured){if(obscured){this.setClass(elt,"obscured")
}else{this.removeClass(elt,"obscured")
}};
this.hide=function(elt,hidden){elt.style.visibility=hidden?"hidden":"visible"
};
this.clearNode=function(node){var nodeName=" "+node.nodeName.toLowerCase()+" ";
var ignoreTags=" table tbody thead tfoot th tr td ";
if(this.isIE&&ignoreTags.indexOf(nodeName)!=-1){this.eraseNode(node)
}else{node.innerHTML=""
}};
this.eraseNode=function(node){while(node.lastChild){node.removeChild(node.lastChild)
}};
this.iterateWindows=function(win,handler){if(!win||!win.document){return
}handler(win);
if(win==top||!win.frames){return
}for(var i=0;
i<win.frames.length;
++i){var subWin=win.frames[i];
if(subWin!=win){this.iterateWindows(subWin,handler)
}}};
this.getRootWindow=function(win){for(;
win;
win=win.parent){if(!win.parent||win==win.parent||!this.instanceOf(win.parent,"Window")){return win
}}return null
};
this.getClientOffset=function(elt){var addOffset=function addOffset(elt,coords,view){var p=elt.offsetParent;
var style=isIE?elt.currentStyle:view.getComputedStyle(elt,"");
if(elt.offsetLeft){coords.x+=elt.offsetLeft+parseInt(style.borderLeftWidth)
}if(elt.offsetTop){coords.y+=elt.offsetTop+parseInt(style.borderTopWidth)
}if(p){if(p.nodeType==1){addOffset(p,coords,view)
}}else{var otherView=isIE?elt.ownerDocument.parentWindow:elt.ownerDocument.defaultView;
if(otherView.frameElement){addOffset(otherView.frameElement,coords,otherView)
}}};
var isIE=this.isIE;
var coords={x:0,y:0};
if(elt){var view=isIE?elt.ownerDocument.parentWindow:elt.ownerDocument.defaultView;
addOffset(elt,coords,view)
}return coords
};
this.getViewOffset=function(elt,singleFrame){function addOffset(elt,coords,view){var p=elt.offsetParent;
coords.x+=elt.offsetLeft-(p?p.scrollLeft:0);
coords.y+=elt.offsetTop-(p?p.scrollTop:0);
if(p){if(p.nodeType==1){var parentStyle=view.getComputedStyle(p,"");
if(parentStyle.position!="static"){coords.x+=parseInt(parentStyle.borderLeftWidth);
coords.y+=parseInt(parentStyle.borderTopWidth);
if(p.localName=="TABLE"){coords.x+=parseInt(parentStyle.paddingLeft);
coords.y+=parseInt(parentStyle.paddingTop)
}else{if(p.localName=="BODY"){var style=view.getComputedStyle(elt,"");
coords.x+=parseInt(style.marginLeft);
coords.y+=parseInt(style.marginTop)
}}}else{if(p.localName=="BODY"){coords.x+=parseInt(parentStyle.borderLeftWidth);
coords.y+=parseInt(parentStyle.borderTopWidth)
}}var parent=elt.parentNode;
while(p!=parent){coords.x-=parent.scrollLeft;
coords.y-=parent.scrollTop;
parent=parent.parentNode
}addOffset(p,coords,view)
}}else{if(elt.localName=="BODY"){var style=view.getComputedStyle(elt,"");
coords.x+=parseInt(style.borderLeftWidth);
coords.y+=parseInt(style.borderTopWidth);
var htmlStyle=view.getComputedStyle(elt.parentNode,"");
coords.x-=parseInt(htmlStyle.paddingLeft);
coords.y-=parseInt(htmlStyle.paddingTop)
}if(elt.scrollLeft){coords.x+=elt.scrollLeft
}if(elt.scrollTop){coords.y+=elt.scrollTop
}var win=elt.ownerDocument.defaultView;
if(win&&(!singleFrame&&win.frameElement)){addOffset(win.frameElement,coords,win)
}}}var coords={x:0,y:0};
if(elt){addOffset(elt,coords,elt.ownerDocument.defaultView)
}return coords
};
this.getLTRBWH=function(elt){var bcrect,dims={left:0,top:0,right:0,bottom:0,width:0,height:0};
if(elt){bcrect=elt.getBoundingClientRect();
dims.left=bcrect.left;
dims.top=bcrect.top;
dims.right=bcrect.right;
dims.bottom=bcrect.bottom;
if(bcrect.width){dims.width=bcrect.width;
dims.height=bcrect.height
}else{dims.width=dims.right-dims.left;
dims.height=dims.bottom-dims.top
}}return dims
};
this.applyBodyOffsets=function(elt,clientRect){var od=elt.ownerDocument;
if(!od.body){return clientRect
}var style=od.defaultView.getComputedStyle(od.body,null);
var pos=style.getPropertyValue("position");
if(pos==="absolute"||pos==="relative"){var borderLeft=parseInt(style.getPropertyValue("border-left-width").replace("px",""),10)||0;
var borderTop=parseInt(style.getPropertyValue("border-top-width").replace("px",""),10)||0;
var paddingLeft=parseInt(style.getPropertyValue("padding-left").replace("px",""),10)||0;
var paddingTop=parseInt(style.getPropertyValue("padding-top").replace("px",""),10)||0;
var marginLeft=parseInt(style.getPropertyValue("margin-left").replace("px",""),10)||0;
var marginTop=parseInt(style.getPropertyValue("margin-top").replace("px",""),10)||0;
var offsetX=borderLeft+paddingLeft+marginLeft;
var offsetY=borderTop+paddingTop+marginTop;
clientRect.left-=offsetX;
clientRect.top-=offsetY;
clientRect.right-=offsetX;
clientRect.bottom-=offsetY
}return clientRect
};
this.getOffsetSize=function(elt){return{width:elt.offsetWidth,height:elt.offsetHeight}
};
this.getOverflowParent=function(element){for(var scrollParent=element.parentNode;
scrollParent;
scrollParent=scrollParent.offsetParent){if(scrollParent.scrollHeight>scrollParent.offsetHeight){return scrollParent
}}};
this.isScrolledToBottom=function(element){var onBottom=(element.scrollTop+element.offsetHeight)==element.scrollHeight;
if(FBTrace.DBG_CONSOLE){FBTrace.sysout("isScrolledToBottom offsetHeight: "+element.offsetHeight+" onBottom:"+onBottom)
}return onBottom
};
this.scrollToBottom=function(element){element.scrollTop=element.scrollHeight;
if(FBTrace.DBG_CONSOLE){FBTrace.sysout("scrollToBottom reset scrollTop "+element.scrollTop+" = "+element.scrollHeight);
if(element.scrollHeight==element.offsetHeight){FBTrace.sysout("scrollToBottom attempt to scroll non-scrollable element "+element,element)
}}return(element.scrollTop==element.scrollHeight)
};
this.move=function(element,x,y){element.style.left=x+"px";
element.style.top=y+"px"
};
this.resize=function(element,w,h){element.style.width=w+"px";
element.style.height=h+"px"
};
this.linesIntoCenterView=function(element,scrollBox){if(!scrollBox){scrollBox=this.getOverflowParent(element)
}if(!scrollBox){return
}var offset=this.getClientOffset(element);
var topSpace=offset.y-scrollBox.scrollTop;
var bottomSpace=(scrollBox.scrollTop+scrollBox.clientHeight)-(offset.y+element.offsetHeight);
if(topSpace<0||bottomSpace<0){var split=(scrollBox.clientHeight/2);
var centerY=offset.y-split;
scrollBox.scrollTop=centerY;
topSpace=split;
bottomSpace=split-element.offsetHeight
}return{before:Math.round((topSpace/element.offsetHeight)+0.5),after:Math.round((bottomSpace/element.offsetHeight)+0.5)}
};
this.scrollIntoCenterView=function(element,scrollBox,notX,notY){if(!element){return
}if(!scrollBox){scrollBox=this.getOverflowParent(element)
}if(!scrollBox){return
}var offset=this.getClientOffset(element);
if(!notY){var topSpace=offset.y-scrollBox.scrollTop;
var bottomSpace=(scrollBox.scrollTop+scrollBox.clientHeight)-(offset.y+element.offsetHeight);
if(topSpace<0||bottomSpace<0){var centerY=offset.y-(scrollBox.clientHeight/2);
scrollBox.scrollTop=centerY
}}if(!notX){var leftSpace=offset.x-scrollBox.scrollLeft;
var rightSpace=(scrollBox.scrollLeft+scrollBox.clientWidth)-(offset.x+element.clientWidth);
if(leftSpace<0||rightSpace<0){var centerX=offset.x-(scrollBox.clientWidth/2);
scrollBox.scrollLeft=centerX
}}if(FBTrace.DBG_SOURCEFILES){FBTrace.sysout("lib.scrollIntoCenterView ","Element:"+element.innerHTML)
}};
var cssKeywordMap=null;
var cssPropNames=null;
var cssColorNames=null;
var imageRules=null;
this.getCSSKeywordsByProperty=function(propName){if(!cssKeywordMap){cssKeywordMap={};
for(var name in this.cssInfo){var list=[];
var types=this.cssInfo[name];
for(var i=0;
i<types.length;
++i){var keywords=this.cssKeywords[types[i]];
if(keywords){list.push.apply(list,keywords)
}}cssKeywordMap[name]=list
}}return propName in cssKeywordMap?cssKeywordMap[propName]:[]
};
this.getCSSPropertyNames=function(){if(!cssPropNames){cssPropNames=[];
for(var name in this.cssInfo){cssPropNames.push(name)
}}return cssPropNames
};
this.isColorKeyword=function(keyword){if(keyword=="transparent"){return false
}if(!cssColorNames){cssColorNames=[];
var colors=this.cssKeywords.color;
for(var i=0;
i<colors.length;
++i){cssColorNames.push(colors[i].toLowerCase())
}var systemColors=this.cssKeywords.systemColor;
for(var i=0;
i<systemColors.length;
++i){cssColorNames.push(systemColors[i].toLowerCase())
}}return cssColorNames.indexOf(keyword.toLowerCase())!=-1
};
this.isImageRule=function(rule){if(!imageRules){imageRules=[];
for(var i in this.cssInfo){var r=i.toLowerCase();
var suffix="image";
if(r.match(suffix+"$")==suffix||r=="background"){imageRules.push(r)
}}}return imageRules.indexOf(rule.toLowerCase())!=-1
};
this.copyTextStyles=function(fromNode,toNode,style){var view=this.isIE?fromNode.ownerDocument.parentWindow:fromNode.ownerDocument.defaultView;
if(view){if(!style){style=this.isIE?fromNode.currentStyle:view.getComputedStyle(fromNode,"")
}toNode.style.fontFamily=style.fontFamily;
toNode.style.fontSize=style.fontSize;
toNode.style.fontWeight=style.fontWeight;
toNode.style.fontStyle=style.fontStyle;
return style
}};
this.copyBoxStyles=function(fromNode,toNode,style){var view=this.isIE?fromNode.ownerDocument.parentWindow:fromNode.ownerDocument.defaultView;
if(view){if(!style){style=this.isIE?fromNode.currentStyle:view.getComputedStyle(fromNode,"")
}toNode.style.marginTop=style.marginTop;
toNode.style.marginRight=style.marginRight;
toNode.style.marginBottom=style.marginBottom;
toNode.style.marginLeft=style.marginLeft;
toNode.style.borderTopWidth=style.borderTopWidth;
toNode.style.borderRightWidth=style.borderRightWidth;
toNode.style.borderBottomWidth=style.borderBottomWidth;
toNode.style.borderLeftWidth=style.borderLeftWidth;
return style
}};
this.readBoxStyles=function(style){var styleNames={"margin-top":"marginTop","margin-right":"marginRight","margin-left":"marginLeft","margin-bottom":"marginBottom","border-top-width":"borderTop","border-right-width":"borderRight","border-left-width":"borderLeft","border-bottom-width":"borderBottom","padding-top":"paddingTop","padding-right":"paddingRight","padding-left":"paddingLeft","padding-bottom":"paddingBottom","z-index":"zIndex"};
var styles={};
for(var styleName in styleNames){styles[styleNames[styleName]]=parseInt(style.getPropertyCSSValue(styleName).cssText)||0
}if(FBTrace.DBG_INSPECT){FBTrace.sysout("readBoxStyles ",styles)
}return styles
};
this.getBoxFromStyles=function(style,element){var args=this.readBoxStyles(style);
args.width=element.offsetWidth-(args.paddingLeft+args.paddingRight+args.borderLeft+args.borderRight);
args.height=element.offsetHeight-(args.paddingTop+args.paddingBottom+args.borderTop+args.borderBottom);
return args
};
this.getElementCSSSelector=function(element){var label=element.localName.toLowerCase();
if(element.id){label+="#"+element.id
}if(element.hasAttribute("class")){label+="."+element.getAttribute("class").split(" ")[0]
}return label
};
this.getURLForStyleSheet=function(styleSheet){return(styleSheet.href?styleSheet.href:styleSheet.ownerNode.ownerDocument.URL)
};
this.getDocumentForStyleSheet=function(styleSheet){while(styleSheet.parentStyleSheet&&!styleSheet.ownerNode){styleSheet=styleSheet.parentStyleSheet
}if(styleSheet.ownerNode){return styleSheet.ownerNode.ownerDocument
}};
this.getInstanceForStyleSheet=function(styleSheet,ownerDocument){if(FBL.isSystemStyleSheet(styleSheet)){return 0
}if(FBTrace.DBG_CSS){FBTrace.sysout("getInstanceForStyleSheet: "+styleSheet.href+" "+styleSheet.media.mediaText+" "+(styleSheet.ownerNode&&FBL.getElementXPath(styleSheet.ownerNode)),ownerDocument)
}ownerDocument=ownerDocument||FBL.getDocumentForStyleSheet(styleSheet);
var ret=0,styleSheets=ownerDocument.styleSheets,href=styleSheet.href;
for(var i=0;
i<styleSheets.length;
i++){var curSheet=styleSheets[i];
if(FBTrace.DBG_CSS){FBTrace.sysout("getInstanceForStyleSheet: compare href "+i+" "+curSheet.href+" "+curSheet.media.mediaText+" "+(curSheet.ownerNode&&FBL.getElementXPath(curSheet.ownerNode)))
}if(curSheet==styleSheet){break
}if(curSheet.href==href){ret++
}}return ret
};
this.hasClass=function(node,name){if(!node||node.nodeType!=1){return false
}else{for(var i=1;
i<arguments.length;
++i){var name=arguments[i];
var re=new RegExp("(^|\\s)"+name+"($|\\s)");
if(!re.exec(node.className)){return false
}}return true
}};
this.setClass=function(node,name){if(node&&!this.hasClass(node,name)){node.className+=" "+name
}};
this.getClassValue=function(node,name){var re=new RegExp(name+"-([^ ]+)");
var m=re.exec(node.className);
return m?m[1]:""
};
this.removeClass=function(node,name){if(node&&node.className){var index=node.className.indexOf(name);
if(index>=0){var size=name.length;
node.className=node.className.substr(0,index-1)+node.className.substr(index+size)
}}};
this.toggleClass=function(elt,name){if(this.hasClass(elt,name)){this.removeClass(elt,name)
}else{this.setClass(elt,name)
}};
this.setClassTimed=function(elt,name,context,timeout){if(!timeout){timeout=1300
}if(elt.__setClassTimeout){context.clearTimeout(elt.__setClassTimeout)
}else{this.setClass(elt,name)
}elt.__setClassTimeout=context.setTimeout(function(){delete elt.__setClassTimeout;
FBL.removeClass(elt,name)
},timeout)
};
this.cancelClassTimed=function(elt,name,context){if(elt.__setClassTimeout){FBL.removeClass(elt,name);
context.clearTimeout(elt.__setClassTimeout);
delete elt.__setClassTimeout
}};
this.$=function(id,doc){if(doc){return doc.getElementById(id)
}else{return FBL.Firebug.chrome.document.getElementById(id)
}};
this.$$=function(selector,doc){if(doc||!FBL.Firebug.chrome){return FBL.Firebug.Selector(selector,doc)
}else{return FBL.Firebug.Selector(selector,FBL.Firebug.chrome.document)
}};
this.getChildByClass=function(node){for(var i=1;
i<arguments.length;
++i){var className=arguments[i];
var child=node.firstChild;
node=null;
for(;
child;
child=child.nextSibling){if(this.hasClass(child,className)){node=child;
break
}}}return node
};
this.getAncestorByClass=function(node,className){for(var parent=node;
parent;
parent=parent.parentNode){if(this.hasClass(parent,className)){return parent
}}return null
};
this.getElementsByClass=function(node,className){var result=[];
for(var child=node.firstChild;
child;
child=child.nextSibling){if(this.hasClass(child,className)){result.push(child)
}}return result
};
this.getElementByClass=function(node,className){var args=cloneArray(arguments);
args.splice(0,1);
for(var child=node.firstChild;
child;
child=child.nextSibling){var args1=cloneArray(args);
args1.unshift(child);
if(FBL.hasClass.apply(null,args1)){return child
}else{var found=FBL.getElementByClass.apply(null,args1);
if(found){return found
}}}return null
};
this.isAncestor=function(node,potentialAncestor){for(var parent=node;
parent;
parent=parent.parentNode){if(parent==potentialAncestor){return true
}}return false
};
this.getNextElement=function(node){while(node&&node.nodeType!=1){node=node.nextSibling
}return node
};
this.getPreviousElement=function(node){while(node&&node.nodeType!=1){node=node.previousSibling
}return node
};
this.getBody=function(doc){if(doc.body){return doc.body
}var body=doc.getElementsByTagName("body")[0];
if(body){return body
}return doc.firstChild
};
this.findNextDown=function(node,criteria){if(!node){return null
}for(var child=node.firstChild;
child;
child=child.nextSibling){if(criteria(child)){return child
}var next=this.findNextDown(child,criteria);
if(next){return next
}}};
this.findPreviousUp=function(node,criteria){if(!node){return null
}for(var child=node.lastChild;
child;
child=child.previousSibling){var next=this.findPreviousUp(child,criteria);
if(next){return next
}if(criteria(child)){return child
}}};
this.findNext=function(node,criteria,upOnly,maxRoot){if(!node){return null
}if(!upOnly){var next=this.findNextDown(node,criteria);
if(next){return next
}}for(var sib=node.nextSibling;
sib;
sib=sib.nextSibling){if(criteria(sib)){return sib
}var next=this.findNextDown(sib,criteria);
if(next){return next
}}if(node.parentNode&&node.parentNode!=maxRoot){return this.findNext(node.parentNode,criteria,true)
}};
this.findPrevious=function(node,criteria,downOnly,maxRoot){if(!node){return null
}for(var sib=node.previousSibling;
sib;
sib=sib.previousSibling){var prev=this.findPreviousUp(sib,criteria);
if(prev){return prev
}if(criteria(sib)){return sib
}}if(!downOnly){var next=this.findPreviousUp(node,criteria);
if(next){return next
}}if(node.parentNode&&node.parentNode!=maxRoot){if(criteria(node.parentNode)){return node.parentNode
}return this.findPrevious(node.parentNode,criteria,true)
}};
this.getNextByClass=function(root,state){var iter=function iter(node){return node.nodeType==1&&FBL.hasClass(node,state)
};
return this.findNext(root,iter)
};
this.getPreviousByClass=function(root,state){var iter=function iter(node){return node.nodeType==1&&FBL.hasClass(node,state)
};
return this.findPrevious(root,iter)
};
this.isElement=function(o){try{return o&&this.instanceOf(o,"Element")
}catch(ex){return false
}};
this.createElement=function(tagName,properties){properties=properties||{};
var doc=properties.document||FBL.Firebug.chrome.document;
var element=doc.createElement(tagName);
for(var name in properties){if(name!="document"){element[name]=properties[name]
}}return element
};
this.createGlobalElement=function(tagName,properties){properties=properties||{};
var doc=FBL.Env.browser.document;
var element=this.NS&&doc.createElementNS?doc.createElementNS(FBL.NS,tagName):doc.createElement(tagName);
for(var name in properties){var propname=name;
if(FBL.isIE&&name=="class"){propname="className"
}if(name!="document"){element.setAttribute(propname,properties[name])
}}return element
};
this.isLeftClick=function(event){return(this.isIE&&event.type!="click"?event.button==1:event.button==0)&&this.noKeyModifiers(event)
};
this.isMiddleClick=function(event){return(this.isIE&&event.type!="click"?event.button==4:event.button==1)&&this.noKeyModifiers(event)
};
this.isRightClick=function(event){return(this.isIE&&event.type!="click"?event.button==2:event.button==2)&&this.noKeyModifiers(event)
};
this.noKeyModifiers=function(event){return !event.ctrlKey&&!event.shiftKey&&!event.altKey&&!event.metaKey
};
this.isControlClick=function(event){return(this.isIE&&event.type!="click"?event.button==1:event.button==0)&&this.isControl(event)
};
this.isShiftClick=function(event){return(this.isIE&&event.type!="click"?event.button==1:event.button==0)&&this.isShift(event)
};
this.isControl=function(event){return(event.metaKey||event.ctrlKey)&&!event.shiftKey&&!event.altKey
};
this.isAlt=function(event){return event.altKey&&!event.ctrlKey&&!event.shiftKey&&!event.metaKey
};
this.isAltClick=function(event){return(this.isIE&&event.type!="click"?event.button==1:event.button==0)&&this.isAlt(event)
};
this.isControlShift=function(event){return(event.metaKey||event.ctrlKey)&&event.shiftKey&&!event.altKey
};
this.isShift=function(event){return event.shiftKey&&!event.metaKey&&!event.ctrlKey&&!event.altKey
};
this.addEvent=function(object,name,handler){if(object.addEventListener){object.addEventListener(name,handler,false)
}else{object.attachEvent("on"+name,handler)
}};
this.removeEvent=function(object,name,handler){try{if(object.removeEventListener){object.removeEventListener(name,handler,false)
}else{object.detachEvent("on"+name,handler)
}}catch(e){if(FBTrace.DBG_ERRORS){FBTrace.sysout("FBL.removeEvent error: ",object,name)
}}};
this.cancelEvent=function(e,preventDefault){if(!e){return
}if(preventDefault){if(e.preventDefault){e.preventDefault()
}else{e.returnValue=false
}}if(e.stopPropagation){e.stopPropagation()
}else{e.cancelBubble=true
}};
this.addGlobalEvent=function(name,handler){var doc=this.Firebug.browser.document;
var frames=this.Firebug.browser.window.frames;
this.addEvent(doc,name,handler);
if(this.Firebug.chrome.type=="popup"){this.addEvent(this.Firebug.chrome.document,name,handler)
}for(var i=0,frame;
frame=frames[i];
i++){try{this.addEvent(frame.document,name,handler)
}catch(E){}}};
this.removeGlobalEvent=function(name,handler){var doc=this.Firebug.browser.document;
var frames=this.Firebug.browser.window.frames;
this.removeEvent(doc,name,handler);
if(this.Firebug.chrome.type=="popup"){this.removeEvent(this.Firebug.chrome.document,name,handler)
}for(var i=0,frame;
frame=frames[i];
i++){try{this.removeEvent(frame.document,name,handler)
}catch(E){}}};
this.dispatch=function(listeners,name,args){try{if(typeof listeners.length!="undefined"){if(FBTrace.DBG_DISPATCH){FBTrace.sysout("FBL.dispatch",name+" to "+listeners.length+" listeners")
}for(var i=0;
i<listeners.length;
++i){var listener=listeners[i];
if(listener.hasOwnProperty(name)){listener[name].apply(listener,args)
}}}else{if(FBTrace.DBG_DISPATCH){FBTrace.sysout("FBL.dispatch",name+" to listeners of an object")
}for(var prop in listeners){var listener=listeners[prop];
if(listeners.hasOwnProperty(prop)&&listener[name]){listener[name].apply(listener,args)
}}}}catch(exc){if(FBTrace.DBG_ERRORS){FBTrace.sysout(" Exception in lib.dispatch "+name,exc)
}}};
var disableTextSelectionHandler=function(event){FBL.cancelEvent(event,true);
return false
};
this.disableTextSelection=function(e){if(typeof e.onselectstart!="undefined"){this.addEvent(e,"selectstart",disableTextSelectionHandler)
}else{e.style.cssText="user-select: none; -khtml-user-select: none; -moz-user-select: none;";
if(!this.isFirefox){this.addEvent(e,"mousedown",disableTextSelectionHandler)
}}e.style.cursor="default"
};
this.restoreTextSelection=function(e){if(typeof e.onselectstart!="undefined"){this.removeEvent(e,"selectstart",disableTextSelectionHandler)
}else{e.style.cssText="cursor: default;";
if(!this.isFirefox){this.removeEvent(e,"mousedown",disableTextSelectionHandler)
}}};
var eventTypes={composition:["composition","compositionstart","compositionend"],contextmenu:["contextmenu"],drag:["dragenter","dragover","dragexit","dragdrop","draggesture"],focus:["focus","blur"],form:["submit","reset","change","select","input"],key:["keydown","keyup","keypress"],load:["load","beforeunload","unload","abort","error"],mouse:["mousedown","mouseup","click","dblclick","mouseover","mouseout","mousemove"],mutation:["DOMSubtreeModified","DOMNodeInserted","DOMNodeRemoved","DOMNodeRemovedFromDocument","DOMNodeInsertedIntoDocument","DOMAttrModified","DOMCharacterDataModified"],paint:["paint","resize","scroll"],scroll:["overflow","underflow","overflowchanged"],text:["text"],ui:["DOMActivate","DOMFocusIn","DOMFocusOut"],xul:["popupshowing","popupshown","popuphiding","popuphidden","close","command","broadcast","commandupdate"]};
this.getEventFamily=function(eventType){if(!this.families){this.families={};
for(var family in eventTypes){var types=eventTypes[family];
for(var i=0;
i<types.length;
++i){this.families[types[i]]=family
}}}return this.families[eventType]
};
this.getFileName=function(url){var split=this.splitURLBase(url);
return split.name
};
this.splitURLBase=function(url){if(this.isDataURL(url)){return this.splitDataURL(url)
}return this.splitURLTrue(url)
};
this.splitDataURL=function(url){var mark=url.indexOf(":",3);
if(mark!=4){return false
}var point=url.indexOf(",",mark+1);
if(point<mark){return false
}var props={encodedContent:url.substr(point+1)};
var metadataBuffer=url.substr(mark+1,point);
var metadata=metadataBuffer.split(";");
for(var i=0;
i<metadata.length;
i++){var nv=metadata[i].split("=");
if(nv.length==2){props[nv[0]]=nv[1]
}}if(props.hasOwnProperty("fileName")){var caller_URL=decodeURIComponent(props.fileName);
var caller_split=this.splitURLTrue(caller_URL);
if(props.hasOwnProperty("baseLineNumber")){props.path=caller_split.path;
props.line=props.baseLineNumber;
var hint=decodeURIComponent(props.encodedContent.substr(0,200)).replace(/\s*$/,"");
props.name="eval->"+hint
}else{props.name=caller_split.name;
props.path=caller_split.path
}}else{if(!props.hasOwnProperty("path")){props.path="data:"
}if(!props.hasOwnProperty("name")){props.name=decodeURIComponent(props.encodedContent.substr(0,200)).replace(/\s*$/,"")
}}return props
};
this.splitURLTrue=function(url){var m=reSplitFile.exec(url);
if(!m){return{name:url,path:url}
}else{if(!m[2]){return{path:m[1],name:m[1]}
}else{return{path:m[1],name:m[2]+m[3]}
}}};
this.getFileExtension=function(url){var lastDot=url.lastIndexOf(".");
return url.substr(lastDot+1)
};
this.isSystemURL=function(url){if(!url){return true
}if(url.length==0){return true
}if(url[0]=="h"){return false
}if(url.substr(0,9)=="resource:"){return true
}else{if(url.substr(0,16)=="chrome://firebug"){return true
}else{if(url=="XPCSafeJSObjectWrapper.cpp"){return true
}else{if(url.substr(0,6)=="about:"){return true
}else{if(url.indexOf("firebug-service.js")!=-1){return true
}else{return false
}}}}}};
this.isSystemPage=function(win){try{var doc=win.document;
if(!doc){return false
}if((doc.styleSheets.length&&doc.styleSheets[0].href=="chrome://global/content/xml/XMLPrettyPrint.css")||(doc.styleSheets.length>1&&doc.styleSheets[1].href=="chrome://browser/skin/feeds/subscribe.css")){return true
}return FBL.isSystemURL(win.location.href)
}catch(exc){ERROR("tabWatcher.isSystemPage document not ready:"+exc);
return false
}};
this.isSystemStyleSheet=function(sheet){var href=sheet&&sheet.href;
return href&&FBL.isSystemURL(href)
};
this.getURIHost=function(uri){try{if(uri){return uri.host
}else{return""
}}catch(exc){return""
}};
this.isLocalURL=function(url){if(url.substr(0,5)=="file:"){return true
}else{if(url.substr(0,8)=="wyciwyg:"){return true
}else{return false
}}};
this.isDataURL=function(url){return(url&&url.substr(0,5)=="data:")
};
this.getLocalPath=function(url){if(this.isLocalURL(url)){var fileHandler=ioService.getProtocolHandler("file").QueryInterface(Ci.nsIFileProtocolHandler);
var file=fileHandler.getFileFromURLSpec(url);
return file.path
}};
this.getURLFromLocalFile=function(file){var fileHandler=ioService.getProtocolHandler("file").QueryInterface(Ci.nsIFileProtocolHandler);
var URL=fileHandler.getURLSpecFromFile(file);
return URL
};
this.getDataURLForContent=function(content,url){var uri="data:text/html;";
uri+="fileName="+encodeURIComponent(url)+",";
uri+=encodeURIComponent(content);
return uri
},this.getDomain=function(url){var m=/[^:]+:\/{1,3}([^\/]+)/.exec(url);
return m?m[1]:""
};
this.getURLPath=function(url){var m=/[^:]+:\/{1,3}[^\/]+(\/.*?)$/.exec(url);
return m?m[1]:""
};
this.getPrettyDomain=function(url){var m=/[^:]+:\/{1,3}(www\.)?([^\/]+)/.exec(url);
return m?m[2]:""
};
this.absoluteURL=function(url,baseURL){return this.absoluteURLWithDots(url,baseURL).replace("/./","/","g")
};
this.absoluteURLWithDots=function(url,baseURL){if(url[0]=="?"){return baseURL+url
}var reURL=/(([^:]+:)\/{1,2}[^\/]*)(.*?)$/;
var m=reURL.exec(url);
if(m){return url
}var m=reURL.exec(baseURL);
if(!m){return""
}var head=m[1];
var tail=m[3];
if(url.substr(0,2)=="//"){return m[2]+url
}else{if(url[0]=="/"){return head+url
}else{if(tail[tail.length-1]=="/"){return baseURL+url
}else{var parts=tail.split("/");
return head+parts.slice(0,parts.length-1).join("/")+"/"+url
}}}};
this.normalizeURL=function(url){if(!url){return""
}if(url.length<255){url=url.replace(/[^/]+\/\.\.\//,"","g");
url=url.replace(/#.*/,"");
url=url.replace(/file:\/([^/])/g,"file:///$1");
if(url.indexOf("chrome:")==0){var m=reChromeCase.exec(url);
if(m){url="chrome://"+m[1].toLowerCase()+"/"+m[2]
}}}return url
};
this.denormalizeURL=function(url){return url.replace(/file:\/\/\//g,"file:/")
};
this.parseURLParams=function(url){var q=url?url.indexOf("?"):-1;
if(q==-1){return[]
}var search=url.substr(q+1);
var h=search.lastIndexOf("#");
if(h!=-1){search=search.substr(0,h)
}if(!search){return[]
}return this.parseURLEncodedText(search)
};
this.parseURLEncodedText=function(text){var maxValueLength=25000;
var params=[];
text=text.replace(/\+/g," ");
var args=text.split("&");
for(var i=0;
i<args.length;
++i){try{var parts=args[i].split("=");
if(parts.length==2){if(parts[1].length>maxValueLength){parts[1]=this.$STR("LargeData")
}params.push({name:decodeURIComponent(parts[0]),value:decodeURIComponent(parts[1])})
}else{params.push({name:decodeURIComponent(parts[0]),value:""})
}}catch(e){if(FBTrace.DBG_ERRORS){FBTrace.sysout("parseURLEncodedText EXCEPTION ",e);
FBTrace.sysout("parseURLEncodedText EXCEPTION URI",args[i])
}}}params.sort(function(a,b){return a.name<=b.name?-1:1
});
return params
};
this.parseURLParamsArray=function(url){var q=url?url.indexOf("?"):-1;
if(q==-1){return[]
}var search=url.substr(q+1);
var h=search.lastIndexOf("#");
if(h!=-1){search=search.substr(0,h)
}if(!search){return[]
}return this.parseURLEncodedTextArray(search)
};
this.parseURLEncodedTextArray=function(text){var maxValueLength=25000;
var params=[];
text=text.replace(/\+/g," ");
var args=text.split("&");
for(var i=0;
i<args.length;
++i){try{var parts=args[i].split("=");
if(parts.length==2){if(parts[1].length>maxValueLength){parts[1]=this.$STR("LargeData")
}params.push({name:decodeURIComponent(parts[0]),value:[decodeURIComponent(parts[1])]})
}else{params.push({name:decodeURIComponent(parts[0]),value:[""]})
}}catch(e){if(FBTrace.DBG_ERRORS){FBTrace.sysout("parseURLEncodedText EXCEPTION ",e);
FBTrace.sysout("parseURLEncodedText EXCEPTION URI",args[i])
}}}params.sort(function(a,b){return a.name<=b.name?-1:1
});
return params
};
this.reEncodeURL=function(file,text){var lines=text.split("\n");
var params=this.parseURLEncodedText(lines[lines.length-1]);
var args=[];
for(var i=0;
i<params.length;
++i){args.push(encodeURIComponent(params[i].name)+"="+encodeURIComponent(params[i].value))
}var url=file.href;
url+=(url.indexOf("?")==-1?"?":"&")+args.join("&");
return url
};
this.getResource=function(aURL){try{var channel=ioService.newChannel(aURL,null,null);
var input=channel.open();
return FBL.readFromStream(input)
}catch(e){if(FBTrace.DBG_ERRORS){FBTrace.sysout("lib.getResource FAILS for "+aURL,e)
}}};
this.parseJSONString=function(jsonString,originURL){var regex=new RegExp(/^\/\*-secure-([\s\S]*)\*\/\s*$/);
var matches=regex.exec(jsonString);
if(matches){jsonString=matches[1];
if(jsonString[0]=="\\"&&jsonString[1]=="n"){jsonString=jsonString.substr(2)
}if(jsonString[jsonString.length-2]=="\\"&&jsonString[jsonString.length-1]=="n"){jsonString=jsonString.substr(0,jsonString.length-2)
}}if(jsonString.indexOf("&&&START&&&")){regex=new RegExp(/&&&START&&& (.+) &&&END&&&/);
matches=regex.exec(jsonString);
if(matches){jsonString=matches[1]
}}jsonString="("+jsonString+")";
var s=Components.utils.Sandbox(originURL);
var jsonObject=null;
try{jsonObject=Components.utils.evalInSandbox(jsonString,s)
}catch(e){if(e.message.indexOf("is not defined")){var parts=e.message.split(" ");
s[parts[0]]=function(str){return str
};
try{jsonObject=Components.utils.evalInSandbox(jsonString,s)
}catch(ex){if(FBTrace.DBG_ERRORS||FBTrace.DBG_JSONVIEWER){FBTrace.sysout("jsonviewer.parseJSON EXCEPTION",e)
}return null
}}else{if(FBTrace.DBG_ERRORS||FBTrace.DBG_JSONVIEWER){FBTrace.sysout("jsonviewer.parseJSON EXCEPTION",e)
}return null
}}return jsonObject
};
this.objectToString=function(object){try{return object+""
}catch(exc){return null
}};
this.setSelectionRange=function(input,start,length){if(input.createTextRange){var range=input.createTextRange();
range.moveStart("character",start);
range.moveEnd("character",length-input.value.length);
range.select()
}else{if(input.setSelectionRange){input.setSelectionRange(start,length);
input.focus()
}}};
this.getInputCaretPosition=function(input){var position=0;
if(document.selection){input.focus();
var range=document.selection.createRange();
range.moveStart("character",-input.value.length);
position=range.text.length
}else{if(input.selectionStart||input.selectionStart=="0"){position=input.selectionStart
}}return(position)
};
function onOperaTabBlur(e){if(this.lastKey==9){this.focus()
}}function onOperaTabKeyDown(e){this.lastKey=e.keyCode
}function onOperaTabFocus(e){this.lastKey=null
}this.fixOperaTabKey=function(el){el.onfocus=onOperaTabFocus;
el.onblur=onOperaTabBlur;
el.onkeydown=onOperaTabKeyDown
};
this.Property=function(object,name){this.object=object;
this.name=name;
this.getObject=function(){return object[name]
}
};
this.ErrorCopy=function(message){this.message=message
};
function EventCopy(event){for(var name in event){try{this[name]=event[name]
}catch(exc){}}}this.EventCopy=EventCopy;
var toString=Object.prototype.toString;
var reFunction=/^\s*function(\s+[\w_$][\w\d_$]*)?\s*\(/;
this.isArray=function(object){return toString.call(object)==="[object Array]"
};
this.isFunction=function(object){if(!object){return false
}return toString.call(object)==="[object Function]"||this.isIE&&typeof object!="string"&&reFunction.test(""+object)
};
this.instanceOf=function(object,className){if(!object||typeof object!="object"){return false
}if(object.ownerDocument){var win=object.ownerDocument.defaultView||object.ownerDocument.parentWindow;
if(className in win){return object instanceof win[className]
}}else{var win=Firebug.browser.window;
if(className in win){return object instanceof win[className]
}}var cache=instanceCheckMap[className];
if(!cache){return false
}for(var n in cache){var obj=cache[n];
var type=typeof obj;
obj=type=="object"?obj:[obj];
for(var name in obj){var value=obj[name];
if(n=="property"&&!(value in object)||n=="method"&&!this.isFunction(object[value])||n=="value"&&(""+object[name]).toLowerCase()!=(""+value).toLowerCase()){return false
}}}return true
};
var instanceCheckMap={Window:{property:["window","document"],method:"setTimeout"},Document:{property:["body","cookie"],method:"getElementById"},Node:{property:"ownerDocument",method:"appendChild"},Element:{property:"tagName",value:{nodeType:1}},Location:{property:["hostname","protocol"],method:"assign"},HTMLImageElement:{property:"useMap",value:{nodeType:1,tagName:"img"}},HTMLAnchorElement:{property:"hreflang",value:{nodeType:1,tagName:"a"}},HTMLInputElement:{property:"form",value:{nodeType:1,tagName:"input"}},HTMLButtonElement:{},HTMLFormElement:{method:"submit",value:{nodeType:1,tagName:"form"}},HTMLBodyElement:{},HTMLHtmlElement:{},CSSStyleRule:{property:["selectorText","style"]}};
this.getDOMMembers=function(object){if(!domMemberCache){domMemberCache={};
for(var name in domMemberMap){var builtins=domMemberMap[name];
var cache=domMemberCache[name]={};
for(var i=0;
i<builtins.length;
++i){cache[builtins[i]]=i
}}}try{if(this.instanceOf(object,"Window")){return domMemberCache.Window
}else{if(object instanceof Document||object instanceof XMLDocument){return domMemberCache.Document
}else{if(object instanceof Location){return domMemberCache.Location
}else{if(object instanceof HTMLImageElement){return domMemberCache.HTMLImageElement
}else{if(object instanceof HTMLAnchorElement){return domMemberCache.HTMLAnchorElement
}else{if(object instanceof HTMLInputElement){return domMemberCache.HTMLInputElement
}else{if(object instanceof HTMLButtonElement){return domMemberCache.HTMLButtonElement
}else{if(object instanceof HTMLFormElement){return domMemberCache.HTMLFormElement
}else{if(object instanceof HTMLBodyElement){return domMemberCache.HTMLBodyElement
}else{if(object instanceof HTMLHtmlElement){return domMemberCache.HTMLHtmlElement
}else{if(object instanceof HTMLScriptElement){return domMemberCache.HTMLScriptElement
}else{if(object instanceof HTMLTableElement){return domMemberCache.HTMLTableElement
}else{if(object instanceof HTMLTableRowElement){return domMemberCache.HTMLTableRowElement
}else{if(object instanceof HTMLTableCellElement){return domMemberCache.HTMLTableCellElement
}else{if(object instanceof HTMLIFrameElement){return domMemberCache.HTMLIFrameElement
}else{if(object instanceof SVGSVGElement){return domMemberCache.SVGSVGElement
}else{if(object instanceof SVGElement){return domMemberCache.SVGElement
}else{if(object instanceof Element){return domMemberCache.Element
}else{if(object instanceof Text||object instanceof CDATASection){return domMemberCache.Text
}else{if(object instanceof Attr){return domMemberCache.Attr
}else{if(object instanceof Node){return domMemberCache.Node
}else{if(object instanceof Event||object instanceof EventCopy){return domMemberCache.Event
}else{return{}
}}}}}}}}}}}}}}}}}}}}}}}catch(E){return{}
}};
this.isDOMMember=function(object,propName){var members=this.getDOMMembers(object);
return members&&propName in members
};
var domMemberCache=null;
var domMemberMap={};
domMemberMap.Window=["document","frameElement","innerWidth","innerHeight","outerWidth","outerHeight","screenX","screenY","pageXOffset","pageYOffset","scrollX","scrollY","scrollMaxX","scrollMaxY","status","defaultStatus","parent","opener","top","window","content","self","location","history","frames","navigator","screen","menubar","toolbar","locationbar","personalbar","statusbar","directories","scrollbars","fullScreen","netscape","java","console","Components","controllers","closed","crypto","pkcs11","name","property","length","sessionStorage","globalStorage","setTimeout","setInterval","clearTimeout","clearInterval","addEventListener","removeEventListener","dispatchEvent","getComputedStyle","captureEvents","releaseEvents","routeEvent","enableExternalCapture","disableExternalCapture","moveTo","moveBy","resizeTo","resizeBy","scroll","scrollTo","scrollBy","scrollByLines","scrollByPages","sizeToContent","setResizable","getSelection","open","openDialog","close","alert","confirm","prompt","dump","focus","blur","find","back","forward","home","stop","print","atob","btoa","updateCommands","XPCNativeWrapper","GeckoActiveXObject","applicationCache"];
domMemberMap.Location=["href","protocol","host","hostname","port","pathname","search","hash","assign","reload","replace"];
domMemberMap.Node=["id","className","nodeType","tagName","nodeName","localName","prefix","namespaceURI","nodeValue","ownerDocument","parentNode","offsetParent","nextSibling","previousSibling","firstChild","lastChild","childNodes","attributes","dir","baseURI","textContent","innerHTML","addEventListener","removeEventListener","dispatchEvent","cloneNode","appendChild","insertBefore","replaceChild","removeChild","compareDocumentPosition","hasAttributes","hasChildNodes","lookupNamespaceURI","lookupPrefix","normalize","isDefaultNamespace","isEqualNode","isSameNode","isSupported","getFeature","getUserData","setUserData"];
domMemberMap.Document=extendArray(domMemberMap.Node,["documentElement","body","title","location","referrer","cookie","contentType","lastModified","characterSet","inputEncoding","xmlEncoding","xmlStandalone","xmlVersion","strictErrorChecking","documentURI","URL","defaultView","doctype","implementation","styleSheets","images","links","forms","anchors","embeds","plugins","applets","width","height","designMode","compatMode","async","preferredStylesheetSet","alinkColor","linkColor","vlinkColor","bgColor","fgColor","domain","addEventListener","removeEventListener","dispatchEvent","captureEvents","releaseEvents","routeEvent","clear","open","close","execCommand","execCommandShowHelp","getElementsByName","getSelection","queryCommandEnabled","queryCommandIndeterm","queryCommandState","queryCommandSupported","queryCommandText","queryCommandValue","write","writeln","adoptNode","appendChild","removeChild","renameNode","cloneNode","compareDocumentPosition","createAttribute","createAttributeNS","createCDATASection","createComment","createDocumentFragment","createElement","createElementNS","createEntityReference","createEvent","createExpression","createNSResolver","createNodeIterator","createProcessingInstruction","createRange","createTextNode","createTreeWalker","domConfig","evaluate","evaluateFIXptr","evaluateXPointer","getAnonymousElementByAttribute","getAnonymousNodes","addBinding","removeBinding","getBindingParent","getBoxObjectFor","setBoxObjectFor","getElementById","getElementsByTagName","getElementsByTagNameNS","hasAttributes","hasChildNodes","importNode","insertBefore","isDefaultNamespace","isEqualNode","isSameNode","isSupported","load","loadBindingDocument","lookupNamespaceURI","lookupPrefix","normalize","normalizeDocument","getFeature","getUserData","setUserData"]);
domMemberMap.Element=extendArray(domMemberMap.Node,["clientWidth","clientHeight","offsetLeft","offsetTop","offsetWidth","offsetHeight","scrollLeft","scrollTop","scrollWidth","scrollHeight","style","tabIndex","title","lang","align","spellcheck","addEventListener","removeEventListener","dispatchEvent","focus","blur","cloneNode","appendChild","insertBefore","replaceChild","removeChild","compareDocumentPosition","getElementsByTagName","getElementsByTagNameNS","getAttribute","getAttributeNS","getAttributeNode","getAttributeNodeNS","setAttribute","setAttributeNS","setAttributeNode","setAttributeNodeNS","removeAttribute","removeAttributeNS","removeAttributeNode","hasAttribute","hasAttributeNS","hasAttributes","hasChildNodes","lookupNamespaceURI","lookupPrefix","normalize","isDefaultNamespace","isEqualNode","isSameNode","isSupported","getFeature","getUserData","setUserData"]);
domMemberMap.SVGElement=extendArray(domMemberMap.Element,["x","y","width","height","rx","ry","transform","href","ownerSVGElement","viewportElement","farthestViewportElement","nearestViewportElement","getBBox","getCTM","getScreenCTM","getTransformToElement","getPresentationAttribute","preserveAspectRatio"]);
domMemberMap.SVGSVGElement=extendArray(domMemberMap.Element,["x","y","width","height","rx","ry","transform","viewBox","viewport","currentView","useCurrentView","pixelUnitToMillimeterX","pixelUnitToMillimeterY","screenPixelToMillimeterX","screenPixelToMillimeterY","currentScale","currentTranslate","zoomAndPan","ownerSVGElement","viewportElement","farthestViewportElement","nearestViewportElement","contentScriptType","contentStyleType","getBBox","getCTM","getScreenCTM","getTransformToElement","getEnclosureList","getIntersectionList","getViewboxToViewportTransform","getPresentationAttribute","getElementById","checkEnclosure","checkIntersection","createSVGAngle","createSVGLength","createSVGMatrix","createSVGNumber","createSVGPoint","createSVGRect","createSVGString","createSVGTransform","createSVGTransformFromMatrix","deSelectAll","preserveAspectRatio","forceRedraw","suspendRedraw","unsuspendRedraw","unsuspendRedrawAll","getCurrentTime","setCurrentTime","animationsPaused","pauseAnimations","unpauseAnimations"]);
domMemberMap.HTMLImageElement=extendArray(domMemberMap.Element,["src","naturalWidth","naturalHeight","width","height","x","y","name","alt","longDesc","lowsrc","border","complete","hspace","vspace","isMap","useMap",]);
domMemberMap.HTMLAnchorElement=extendArray(domMemberMap.Element,["name","target","accessKey","href","protocol","host","hostname","port","pathname","search","hash","hreflang","coords","shape","text","type","rel","rev","charset"]);
domMemberMap.HTMLIFrameElement=extendArray(domMemberMap.Element,["contentDocument","contentWindow","frameBorder","height","longDesc","marginHeight","marginWidth","name","scrolling","src","width"]);
domMemberMap.HTMLTableElement=extendArray(domMemberMap.Element,["bgColor","border","caption","cellPadding","cellSpacing","frame","rows","rules","summary","tBodies","tFoot","tHead","width","createCaption","createTFoot","createTHead","deleteCaption","deleteRow","deleteTFoot","deleteTHead","insertRow"]);
domMemberMap.HTMLTableRowElement=extendArray(domMemberMap.Element,["bgColor","cells","ch","chOff","rowIndex","sectionRowIndex","vAlign","deleteCell","insertCell"]);
domMemberMap.HTMLTableCellElement=extendArray(domMemberMap.Element,["abbr","axis","bgColor","cellIndex","ch","chOff","colSpan","headers","height","noWrap","rowSpan","scope","vAlign","width"]);
domMemberMap.HTMLScriptElement=extendArray(domMemberMap.Element,["src"]);
domMemberMap.HTMLButtonElement=extendArray(domMemberMap.Element,["accessKey","disabled","form","name","type","value","click"]);
domMemberMap.HTMLInputElement=extendArray(domMemberMap.Element,["type","value","checked","accept","accessKey","alt","controllers","defaultChecked","defaultValue","disabled","form","maxLength","name","readOnly","selectionEnd","selectionStart","size","src","textLength","useMap","click","select","setSelectionRange"]);
domMemberMap.HTMLFormElement=extendArray(domMemberMap.Element,["acceptCharset","action","author","elements","encoding","enctype","entry_id","length","method","name","post","target","text","url","reset","submit"]);
domMemberMap.HTMLBodyElement=extendArray(domMemberMap.Element,["aLink","background","bgColor","link","text","vLink"]);
domMemberMap.HTMLHtmlElement=extendArray(domMemberMap.Element,["version"]);
domMemberMap.Text=extendArray(domMemberMap.Node,["data","length","appendData","deleteData","insertData","replaceData","splitText","substringData"]);
domMemberMap.Attr=extendArray(domMemberMap.Node,["name","value","specified","ownerElement"]);
domMemberMap.Event=["type","target","currentTarget","originalTarget","explicitOriginalTarget","relatedTarget","rangeParent","rangeOffset","view","keyCode","charCode","screenX","screenY","clientX","clientY","layerX","layerY","pageX","pageY","detail","button","which","ctrlKey","shiftKey","altKey","metaKey","eventPhase","timeStamp","bubbles","cancelable","cancelBubble","isTrusted","isChar","getPreventDefault","initEvent","initMouseEvent","initKeyEvent","initUIEvent","preventBubble","preventCapture","preventDefault","stopPropagation"];
this.domConstantMap={ELEMENT_NODE:1,ATTRIBUTE_NODE:1,TEXT_NODE:1,CDATA_SECTION_NODE:1,ENTITY_REFERENCE_NODE:1,ENTITY_NODE:1,PROCESSING_INSTRUCTION_NODE:1,COMMENT_NODE:1,DOCUMENT_NODE:1,DOCUMENT_TYPE_NODE:1,DOCUMENT_FRAGMENT_NODE:1,NOTATION_NODE:1,DOCUMENT_POSITION_DISCONNECTED:1,DOCUMENT_POSITION_PRECEDING:1,DOCUMENT_POSITION_FOLLOWING:1,DOCUMENT_POSITION_CONTAINS:1,DOCUMENT_POSITION_CONTAINED_BY:1,DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC:1,UNKNOWN_RULE:1,STYLE_RULE:1,CHARSET_RULE:1,IMPORT_RULE:1,MEDIA_RULE:1,FONT_FACE_RULE:1,PAGE_RULE:1,CAPTURING_PHASE:1,AT_TARGET:1,BUBBLING_PHASE:1,SCROLL_PAGE_UP:1,SCROLL_PAGE_DOWN:1,MOUSEUP:1,MOUSEDOWN:1,MOUSEOVER:1,MOUSEOUT:1,MOUSEMOVE:1,MOUSEDRAG:1,CLICK:1,DBLCLICK:1,KEYDOWN:1,KEYUP:1,KEYPRESS:1,DRAGDROP:1,FOCUS:1,BLUR:1,SELECT:1,CHANGE:1,RESET:1,SUBMIT:1,SCROLL:1,LOAD:1,UNLOAD:1,XFER_DONE:1,ABORT:1,ERROR:1,LOCATE:1,MOVE:1,RESIZE:1,FORWARD:1,HELP:1,BACK:1,TEXT:1,ALT_MASK:1,CONTROL_MASK:1,SHIFT_MASK:1,META_MASK:1,DOM_VK_TAB:1,DOM_VK_PAGE_UP:1,DOM_VK_PAGE_DOWN:1,DOM_VK_UP:1,DOM_VK_DOWN:1,DOM_VK_LEFT:1,DOM_VK_RIGHT:1,DOM_VK_CANCEL:1,DOM_VK_HELP:1,DOM_VK_BACK_SPACE:1,DOM_VK_CLEAR:1,DOM_VK_RETURN:1,DOM_VK_ENTER:1,DOM_VK_SHIFT:1,DOM_VK_CONTROL:1,DOM_VK_ALT:1,DOM_VK_PAUSE:1,DOM_VK_CAPS_LOCK:1,DOM_VK_ESCAPE:1,DOM_VK_SPACE:1,DOM_VK_END:1,DOM_VK_HOME:1,DOM_VK_PRINTSCREEN:1,DOM_VK_INSERT:1,DOM_VK_DELETE:1,DOM_VK_0:1,DOM_VK_1:1,DOM_VK_2:1,DOM_VK_3:1,DOM_VK_4:1,DOM_VK_5:1,DOM_VK_6:1,DOM_VK_7:1,DOM_VK_8:1,DOM_VK_9:1,DOM_VK_SEMICOLON:1,DOM_VK_EQUALS:1,DOM_VK_A:1,DOM_VK_B:1,DOM_VK_C:1,DOM_VK_D:1,DOM_VK_E:1,DOM_VK_F:1,DOM_VK_G:1,DOM_VK_H:1,DOM_VK_I:1,DOM_VK_J:1,DOM_VK_K:1,DOM_VK_L:1,DOM_VK_M:1,DOM_VK_N:1,DOM_VK_O:1,DOM_VK_P:1,DOM_VK_Q:1,DOM_VK_R:1,DOM_VK_S:1,DOM_VK_T:1,DOM_VK_U:1,DOM_VK_V:1,DOM_VK_W:1,DOM_VK_X:1,DOM_VK_Y:1,DOM_VK_Z:1,DOM_VK_CONTEXT_MENU:1,DOM_VK_NUMPAD0:1,DOM_VK_NUMPAD1:1,DOM_VK_NUMPAD2:1,DOM_VK_NUMPAD3:1,DOM_VK_NUMPAD4:1,DOM_VK_NUMPAD5:1,DOM_VK_NUMPAD6:1,DOM_VK_NUMPAD7:1,DOM_VK_NUMPAD8:1,DOM_VK_NUMPAD9:1,DOM_VK_MULTIPLY:1,DOM_VK_ADD:1,DOM_VK_SEPARATOR:1,DOM_VK_SUBTRACT:1,DOM_VK_DECIMAL:1,DOM_VK_DIVIDE:1,DOM_VK_F1:1,DOM_VK_F2:1,DOM_VK_F3:1,DOM_VK_F4:1,DOM_VK_F5:1,DOM_VK_F6:1,DOM_VK_F7:1,DOM_VK_F8:1,DOM_VK_F9:1,DOM_VK_F10:1,DOM_VK_F11:1,DOM_VK_F12:1,DOM_VK_F13:1,DOM_VK_F14:1,DOM_VK_F15:1,DOM_VK_F16:1,DOM_VK_F17:1,DOM_VK_F18:1,DOM_VK_F19:1,DOM_VK_F20:1,DOM_VK_F21:1,DOM_VK_F22:1,DOM_VK_F23:1,DOM_VK_F24:1,DOM_VK_NUM_LOCK:1,DOM_VK_SCROLL_LOCK:1,DOM_VK_COMMA:1,DOM_VK_PERIOD:1,DOM_VK_SLASH:1,DOM_VK_BACK_QUOTE:1,DOM_VK_OPEN_BRACKET:1,DOM_VK_BACK_SLASH:1,DOM_VK_CLOSE_BRACKET:1,DOM_VK_QUOTE:1,DOM_VK_META:1,SVG_ZOOMANDPAN_DISABLE:1,SVG_ZOOMANDPAN_MAGNIFY:1,SVG_ZOOMANDPAN_UNKNOWN:1};
this.cssInfo={background:["bgRepeat","bgAttachment","bgPosition","color","systemColor","none"],"background-attachment":["bgAttachment"],"background-color":["color","systemColor"],"background-image":["none"],"background-position":["bgPosition"],"background-repeat":["bgRepeat"],border:["borderStyle","thickness","color","systemColor","none"],"border-top":["borderStyle","borderCollapse","color","systemColor","none"],"border-right":["borderStyle","borderCollapse","color","systemColor","none"],"border-bottom":["borderStyle","borderCollapse","color","systemColor","none"],"border-left":["borderStyle","borderCollapse","color","systemColor","none"],"border-collapse":["borderCollapse"],"border-color":["color","systemColor"],"border-top-color":["color","systemColor"],"border-right-color":["color","systemColor"],"border-bottom-color":["color","systemColor"],"border-left-color":["color","systemColor"],"border-spacing":[],"border-style":["borderStyle"],"border-top-style":["borderStyle"],"border-right-style":["borderStyle"],"border-bottom-style":["borderStyle"],"border-left-style":["borderStyle"],"border-width":["thickness"],"border-top-width":["thickness"],"border-right-width":["thickness"],"border-bottom-width":["thickness"],"border-left-width":["thickness"],bottom:["auto"],"caption-side":["captionSide"],clear:["clear","none"],clip:["auto"],color:["color","systemColor"],content:["content"],"counter-increment":["none"],"counter-reset":["none"],cursor:["cursor","none"],direction:["direction"],display:["display","none"],"empty-cells":[],"float":["float","none"],font:["fontStyle","fontVariant","fontWeight","fontFamily"],"font-family":["fontFamily"],"font-size":["fontSize"],"font-size-adjust":[],"font-stretch":[],"font-style":["fontStyle"],"font-variant":["fontVariant"],"font-weight":["fontWeight"],height:["auto"],left:["auto"],"letter-spacing":[],"line-height":[],"list-style":["listStyleType","listStylePosition","none"],"list-style-image":["none"],"list-style-position":["listStylePosition"],"list-style-type":["listStyleType","none"],margin:[],"margin-top":[],"margin-right":[],"margin-bottom":[],"margin-left":[],"marker-offset":["auto"],"min-height":["none"],"max-height":["none"],"min-width":["none"],"max-width":["none"],outline:["borderStyle","color","systemColor","none"],"outline-color":["color","systemColor"],"outline-style":["borderStyle"],"outline-width":[],overflow:["overflow","auto"],"overflow-x":["overflow","auto"],"overflow-y":["overflow","auto"],padding:[],"padding-top":[],"padding-right":[],"padding-bottom":[],"padding-left":[],position:["position"],quotes:["none"],right:["auto"],"table-layout":["tableLayout","auto"],"text-align":["textAlign"],"text-decoration":["textDecoration","none"],"text-indent":[],"text-shadow":[],"text-transform":["textTransform","none"],top:["auto"],"unicode-bidi":[],"vertical-align":["verticalAlign"],"white-space":["whiteSpace"],width:["auto"],"word-spacing":[],"z-index":[],"-moz-appearance":["mozAppearance"],"-moz-border-radius":[],"-moz-border-radius-bottomleft":[],"-moz-border-radius-bottomright":[],"-moz-border-radius-topleft":[],"-moz-border-radius-topright":[],"-moz-border-top-colors":["color","systemColor"],"-moz-border-right-colors":["color","systemColor"],"-moz-border-bottom-colors":["color","systemColor"],"-moz-border-left-colors":["color","systemColor"],"-moz-box-align":["mozBoxAlign"],"-moz-box-direction":["mozBoxDirection"],"-moz-box-flex":[],"-moz-box-ordinal-group":[],"-moz-box-orient":["mozBoxOrient"],"-moz-box-pack":["mozBoxPack"],"-moz-box-sizing":["mozBoxSizing"],"-moz-opacity":[],"-moz-user-focus":["userFocus","none"],"-moz-user-input":["userInput"],"-moz-user-modify":[],"-moz-user-select":["userSelect","none"],"-moz-background-clip":[],"-moz-background-inline-policy":[],"-moz-background-origin":[],"-moz-binding":[],"-moz-column-count":[],"-moz-column-gap":[],"-moz-column-width":[],"-moz-image-region":[]};
this.inheritedStyleNames={"border-collapse":1,"border-spacing":1,"border-style":1,"caption-side":1,color:1,cursor:1,direction:1,"empty-cells":1,font:1,"font-family":1,"font-size-adjust":1,"font-size":1,"font-style":1,"font-variant":1,"font-weight":1,"letter-spacing":1,"line-height":1,"list-style":1,"list-style-image":1,"list-style-position":1,"list-style-type":1,quotes:1,"text-align":1,"text-decoration":1,"text-indent":1,"text-shadow":1,"text-transform":1,"white-space":1,"word-spacing":1};
this.cssKeywords={appearance:["button","button-small","checkbox","checkbox-container","checkbox-small","dialog","listbox","menuitem","menulist","menulist-button","menulist-textfield","menupopup","progressbar","radio","radio-container","radio-small","resizer","scrollbar","scrollbarbutton-down","scrollbarbutton-left","scrollbarbutton-right","scrollbarbutton-up","scrollbartrack-horizontal","scrollbartrack-vertical","separator","statusbar","tab","tab-left-edge","tabpanels","textfield","toolbar","toolbarbutton","toolbox","tooltip","treeheadercell","treeheadersortarrow","treeitem","treetwisty","treetwistyopen","treeview","window"],systemColor:["ActiveBorder","ActiveCaption","AppWorkspace","Background","ButtonFace","ButtonHighlight","ButtonShadow","ButtonText","CaptionText","GrayText","Highlight","HighlightText","InactiveBorder","InactiveCaption","InactiveCaptionText","InfoBackground","InfoText","Menu","MenuText","Scrollbar","ThreeDDarkShadow","ThreeDFace","ThreeDHighlight","ThreeDLightShadow","ThreeDShadow","Window","WindowFrame","WindowText","-moz-field","-moz-fieldtext","-moz-workspace","-moz-visitedhyperlinktext","-moz-use-text-color"],color:["AliceBlue","AntiqueWhite","Aqua","Aquamarine","Azure","Beige","Bisque","Black","BlanchedAlmond","Blue","BlueViolet","Brown","BurlyWood","CadetBlue","Chartreuse","Chocolate","Coral","CornflowerBlue","Cornsilk","Crimson","Cyan","DarkBlue","DarkCyan","DarkGoldenRod","DarkGray","DarkGreen","DarkKhaki","DarkMagenta","DarkOliveGreen","DarkOrange","DarkOrchid","DarkRed","DarkSalmon","DarkSeaGreen","DarkSlateBlue","DarkSlateGray","DarkTurquoise","DarkViolet","DeepPink","DarkSkyBlue","DimGray","DodgerBlue","Feldspar","FireBrick","FloralWhite","ForestGreen","Fuchsia","Gainsboro","GhostWhite","Gold","GoldenRod","Gray","Green","GreenYellow","HoneyDew","HotPink","IndianRed","Indigo","Ivory","Khaki","Lavender","LavenderBlush","LawnGreen","LemonChiffon","LightBlue","LightCoral","LightCyan","LightGoldenRodYellow","LightGrey","LightGreen","LightPink","LightSalmon","LightSeaGreen","LightSkyBlue","LightSlateBlue","LightSlateGray","LightSteelBlue","LightYellow","Lime","LimeGreen","Linen","Magenta","Maroon","MediumAquaMarine","MediumBlue","MediumOrchid","MediumPurple","MediumSeaGreen","MediumSlateBlue","MediumSpringGreen","MediumTurquoise","MediumVioletRed","MidnightBlue","MintCream","MistyRose","Moccasin","NavajoWhite","Navy","OldLace","Olive","OliveDrab","Orange","OrangeRed","Orchid","PaleGoldenRod","PaleGreen","PaleTurquoise","PaleVioletRed","PapayaWhip","PeachPuff","Peru","Pink","Plum","PowderBlue","Purple","Red","RosyBrown","RoyalBlue","SaddleBrown","Salmon","SandyBrown","SeaGreen","SeaShell","Sienna","Silver","SkyBlue","SlateBlue","SlateGray","Snow","SpringGreen","SteelBlue","Tan","Teal","Thistle","Tomato","Turquoise","Violet","VioletRed","Wheat","White","WhiteSmoke","Yellow","YellowGreen","transparent","invert"],auto:["auto"],none:["none"],captionSide:["top","bottom","left","right"],clear:["left","right","both"],cursor:["auto","cell","context-menu","crosshair","default","help","pointer","progress","move","e-resize","all-scroll","ne-resize","nw-resize","n-resize","se-resize","sw-resize","s-resize","w-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","col-resize","row-resize","text","vertical-text","wait","alias","copy","move","no-drop","not-allowed","-moz-alias","-moz-cell","-moz-copy","-moz-grab","-moz-grabbing","-moz-contextmenu","-moz-zoom-in","-moz-zoom-out","-moz-spinning"],direction:["ltr","rtl"],bgAttachment:["scroll","fixed"],bgPosition:["top","center","bottom","left","right"],bgRepeat:["repeat","repeat-x","repeat-y","no-repeat"],borderStyle:["hidden","dotted","dashed","solid","double","groove","ridge","inset","outset","-moz-bg-inset","-moz-bg-outset","-moz-bg-solid"],borderCollapse:["collapse","separate"],overflow:["visible","hidden","scroll","-moz-scrollbars-horizontal","-moz-scrollbars-none","-moz-scrollbars-vertical"],listStyleType:["disc","circle","square","decimal","decimal-leading-zero","lower-roman","upper-roman","lower-greek","lower-alpha","lower-latin","upper-alpha","upper-latin","hebrew","armenian","georgian","cjk-ideographic","hiragana","katakana","hiragana-iroha","katakana-iroha","inherit"],listStylePosition:["inside","outside"],content:["open-quote","close-quote","no-open-quote","no-close-quote","inherit"],fontStyle:["normal","italic","oblique","inherit"],fontVariant:["normal","small-caps","inherit"],fontWeight:["normal","bold","bolder","lighter","inherit"],fontSize:["xx-small","x-small","small","medium","large","x-large","xx-large","smaller","larger"],fontFamily:["Arial","Comic Sans MS","Georgia","Tahoma","Verdana","Times New Roman","Trebuchet MS","Lucida Grande","Helvetica","serif","sans-serif","cursive","fantasy","monospace","caption","icon","menu","message-box","small-caption","status-bar","inherit"],display:["block","inline","inline-block","list-item","marker","run-in","compact","table","inline-table","table-row-group","table-column","table-column-group","table-header-group","table-footer-group","table-row","table-cell","table-caption","-moz-box","-moz-compact","-moz-deck","-moz-grid","-moz-grid-group","-moz-grid-line","-moz-groupbox","-moz-inline-block","-moz-inline-box","-moz-inline-grid","-moz-inline-stack","-moz-inline-table","-moz-marker","-moz-popup","-moz-runin","-moz-stack"],position:["static","relative","absolute","fixed","inherit"],"float":["left","right"],textAlign:["left","right","center","justify"],tableLayout:["fixed"],textDecoration:["underline","overline","line-through","blink"],textTransform:["capitalize","lowercase","uppercase","inherit"],unicodeBidi:["normal","embed","bidi-override"],whiteSpace:["normal","pre","nowrap"],verticalAlign:["baseline","sub","super","top","text-top","middle","bottom","text-bottom","inherit"],thickness:["thin","medium","thick"],userFocus:["ignore","normal"],userInput:["disabled","enabled"],userSelect:["normal"],mozBoxSizing:["content-box","padding-box","border-box"],mozBoxAlign:["start","center","end","baseline","stretch"],mozBoxDirection:["normal","reverse"],mozBoxOrient:["horizontal","vertical"],mozBoxPack:["start","center","end"]};
this.nonEditableTags={HTML:1,HEAD:1,html:1,head:1};
this.innerEditableTags={BODY:1,body:1};
var invisibleTags=this.invisibleTags={HTML:1,HEAD:1,TITLE:1,META:1,LINK:1,STYLE:1,SCRIPT:1,NOSCRIPT:1,BR:1,html:1,head:1,title:1,meta:1,link:1,style:1,script:1,noscript:1,br:1};
if(typeof KeyEvent=="undefined"){this.KeyEvent={DOM_VK_CANCEL:3,DOM_VK_HELP:6,DOM_VK_BACK_SPACE:8,DOM_VK_TAB:9,DOM_VK_CLEAR:12,DOM_VK_RETURN:13,DOM_VK_ENTER:14,DOM_VK_SHIFT:16,DOM_VK_CONTROL:17,DOM_VK_ALT:18,DOM_VK_PAUSE:19,DOM_VK_CAPS_LOCK:20,DOM_VK_ESCAPE:27,DOM_VK_SPACE:32,DOM_VK_PAGE_UP:33,DOM_VK_PAGE_DOWN:34,DOM_VK_END:35,DOM_VK_HOME:36,DOM_VK_LEFT:37,DOM_VK_UP:38,DOM_VK_RIGHT:39,DOM_VK_DOWN:40,DOM_VK_PRINTSCREEN:44,DOM_VK_INSERT:45,DOM_VK_DELETE:46,DOM_VK_0:48,DOM_VK_1:49,DOM_VK_2:50,DOM_VK_3:51,DOM_VK_4:52,DOM_VK_5:53,DOM_VK_6:54,DOM_VK_7:55,DOM_VK_8:56,DOM_VK_9:57,DOM_VK_SEMICOLON:59,DOM_VK_EQUALS:61,DOM_VK_A:65,DOM_VK_B:66,DOM_VK_C:67,DOM_VK_D:68,DOM_VK_E:69,DOM_VK_F:70,DOM_VK_G:71,DOM_VK_H:72,DOM_VK_I:73,DOM_VK_J:74,DOM_VK_K:75,DOM_VK_L:76,DOM_VK_M:77,DOM_VK_N:78,DOM_VK_O:79,DOM_VK_P:80,DOM_VK_Q:81,DOM_VK_R:82,DOM_VK_S:83,DOM_VK_T:84,DOM_VK_U:85,DOM_VK_V:86,DOM_VK_W:87,DOM_VK_X:88,DOM_VK_Y:89,DOM_VK_Z:90,DOM_VK_CONTEXT_MENU:93,DOM_VK_NUMPAD0:96,DOM_VK_NUMPAD1:97,DOM_VK_NUMPAD2:98,DOM_VK_NUMPAD3:99,DOM_VK_NUMPAD4:100,DOM_VK_NUMPAD5:101,DOM_VK_NUMPAD6:102,DOM_VK_NUMPAD7:103,DOM_VK_NUMPAD8:104,DOM_VK_NUMPAD9:105,DOM_VK_MULTIPLY:106,DOM_VK_ADD:107,DOM_VK_SEPARATOR:108,DOM_VK_SUBTRACT:109,DOM_VK_DECIMAL:110,DOM_VK_DIVIDE:111,DOM_VK_F1:112,DOM_VK_F2:113,DOM_VK_F3:114,DOM_VK_F4:115,DOM_VK_F5:116,DOM_VK_F6:117,DOM_VK_F7:118,DOM_VK_F8:119,DOM_VK_F9:120,DOM_VK_F10:121,DOM_VK_F11:122,DOM_VK_F12:123,DOM_VK_F13:124,DOM_VK_F14:125,DOM_VK_F15:126,DOM_VK_F16:127,DOM_VK_F17:128,DOM_VK_F18:129,DOM_VK_F19:130,DOM_VK_F20:131,DOM_VK_F21:132,DOM_VK_F22:133,DOM_VK_F23:134,DOM_VK_F24:135,DOM_VK_NUM_LOCK:144,DOM_VK_SCROLL_LOCK:145,DOM_VK_COMMA:188,DOM_VK_PERIOD:190,DOM_VK_SLASH:191,DOM_VK_BACK_QUOTE:192,DOM_VK_OPEN_BRACKET:219,DOM_VK_BACK_SLASH:220,DOM_VK_CLOSE_BRACKET:221,DOM_VK_QUOTE:222,DOM_VK_META:224}
}this.Ajax={requests:[],transport:null,states:["Uninitialized","Loading","Loaded","Interactive","Complete"],initialize:function(){this.transport=this.getXHRObject()
},getXHRObject:function(){var xhrObj=false;
try{xhrObj=new XMLHttpRequest()
}catch(e){var progid=["MSXML2.XMLHTTP.5.0","MSXML2.XMLHTTP.4.0","MSXML2.XMLHTTP.3.0","MSXML2.XMLHTTP","Microsoft.XMLHTTP"];
for(var i=0;
i<progid.length;
++i){try{xhrObj=new ActiveXObject(progid[i])
}catch(e){continue
}break
}}finally{return xhrObj
}},request:function(options){var o=options||{};
o.type=o.type&&o.type.toLowerCase()||"get";
o.async=o.async||true;
o.dataType=o.dataType||"text";
o.contentType=o.contentType||"application/x-www-form-urlencoded";
this.requests.push(o);
var s=this.getState();
if(s=="Uninitialized"||s=="Complete"||s=="Loaded"){this.sendRequest()
}},serialize:function(data){var r=[""],rl=0;
if(data){if(typeof data=="string"){r[rl++]=data
}else{if(data.innerHTML&&data.elements){for(var i=0,el,l=(el=data.elements).length;
i<l;
i++){if(el[i].name){r[rl++]=encodeURIComponent(el[i].name);
r[rl++]="=";
r[rl++]=encodeURIComponent(el[i].value);
r[rl++]="&"
}}}else{for(param in data){r[rl++]=encodeURIComponent(param);
r[rl++]="=";
r[rl++]=encodeURIComponent(data[param]);
r[rl++]="&"
}}}}return r.join("").replace(/&$/,"")
},sendRequest:function(){var t=FBL.Ajax.transport,r=FBL.Ajax.requests.shift(),data;
t.open(r.type,r.url,r.async);
t.setRequestHeader("X-Requested-With","XMLHttpRequest");
if(data=FBL.Ajax.serialize(r.data)){t.setRequestHeader("Content-Type",r.contentType)
}t.onreadystatechange=function(){FBL.Ajax.onStateChange(r)
};
t.send(data)
},onStateChange:function(options){var fn,o=options,t=this.transport;
var state=this.getState(t);
if(fn=o["on"+state]){fn(this.getResponse(o),o)
}if(state=="Complete"){var success=t.status==200,response=this.getResponse(o);
if(fn=o.onUpdate){fn(response,o)
}if(fn=o["on"+(success?"Success":"Failure")]){fn(response,o)
}t.onreadystatechange=FBL.emptyFn;
if(this.requests.length>0){setTimeout(this.sendRequest,10)
}}},getResponse:function(options){var t=this.transport,type=options.dataType;
if(t.status!=200){return t.statusText
}else{if(type=="text"){return t.responseText
}else{if(type=="html"){return t.responseText
}else{if(type=="xml"){return t.responseXML
}else{if(type=="json"){return eval("("+t.responseText+")")
}}}}}},getState:function(){return this.states[this.transport.readyState]
}};
this.createCookie=function(name,value,days){if("cookie" in document){if(days){var date=new Date();
date.setTime(date.getTime()+(days*24*60*60*1000));
var expires="; expires="+date.toGMTString()
}else{var expires=""
}document.cookie=name+"="+value+expires+"; path=/"
}};
this.readCookie=function(name){if("cookie" in document){var nameEQ=name+"=";
var ca=document.cookie.split(";");
for(var i=0;
i<ca.length;
i++){var c=ca[i];
while(c.charAt(0)==" "){c=c.substring(1,c.length)
}if(c.indexOf(nameEQ)==0){return c.substring(nameEQ.length,c.length)
}}}return null
};
this.removeCookie=function(name){this.createCookie(name,"",-1)
};
var fixIE6BackgroundImageCache=function(doc){doc=doc||document;
try{doc.execCommand("BackgroundImageCache",false,true)
}catch(E){}};
var resetStyle="margin:0; padding:0; border:0; position:absolute; overflow:hidden; display:block;";
var calculatePixelsPerInch=function calculatePixelsPerInch(doc,body){var inch=FBL.createGlobalElement("div");
inch.style.cssText=resetStyle+"width:1in; height:1in; position:absolute; top:-1234px; left:-1234px;";
body.appendChild(inch);
FBL.pixelsPerInch={x:inch.offsetWidth,y:inch.offsetHeight};
body.removeChild(inch)
};
this.SourceLink=function(url,line,type,object,instance){this.href=url;
this.instance=instance;
this.line=line;
this.type=type;
this.object=object
};
this.SourceLink.prototype={toString:function(){return this.href
},toJSON:function(){return'{"href":"'+this.href+'", '+(this.line?('"line":'+this.line+","):"")+(this.type?(' "type":"'+this.type+'",'):"")+"}"
}};
this.SourceText=function(lines,owner){this.lines=lines;
this.owner=owner
};
this.SourceText.getLineAsHTML=function(lineNo){return escapeForSourceLine(this.lines[lineNo-1])
}
}).apply(FBL);
FBL.ns(function(){with(FBL){FBL.cacheID="firebug"+new Date().getTime();
FBL.documentCache={};
var modules=[];
var panelTypes=[];
var panelTypeMap={};
var reps=[];
var parentPanelMap={};
window.Firebug=FBL.Firebug={version:"Firebug Lite 1.3.0",revision:"$Revision: 6859 $",modules:modules,panelTypes:panelTypes,panelTypeMap:panelTypeMap,reps:reps,initialize:function(){if(FBTrace.DBG_INITIALIZE){FBTrace.sysout("Firebug.initialize","initializing application")
}Firebug.browser=new Context(Env.browser);
Firebug.context=Firebug.browser;
cacheDocument();
if(Firebug.Inspector){Firebug.Inspector.create()
}if(FBL.processAllStyleSheets){processAllStyleSheets(Firebug.browser.document)
}FirebugChrome.initialize();
dispatch(modules,"initialize",[]);
if(Env.onLoad){var onLoad=Env.onLoad;
delete Env.onLoad;
setTimeout(onLoad,201)
}},shutdown:function(){if(Firebug.Inspector){Firebug.Inspector.destroy()
}dispatch(modules,"shutdown",[]);
var chromeMap=FirebugChrome.chromeMap;
for(var name in chromeMap){if(chromeMap.hasOwnProperty(name)){chromeMap[name].destroy()
}}for(var name in documentCache){documentCache[name].removeAttribute(cacheID);
documentCache[name]=null;
delete documentCache[name]
}documentCache=null;
delete FBL.documentCache;
Firebug.browser=null;
Firebug.context=null
},registerModule:function(){modules.push.apply(modules,arguments);
if(FBTrace.DBG_INITIALIZE){FBTrace.sysout("Firebug.registerModule")
}},registerPanel:function(){panelTypes.push.apply(panelTypes,arguments);
for(var i=0,panelType;
panelType=arguments[i];
++i){panelTypeMap[panelType.prototype.name]=arguments[i];
if(panelType.prototype.parentPanel){parentPanelMap[panelType.prototype.parentPanel]=1
}}if(FBTrace.DBG_INITIALIZE){for(var i=0;
i<arguments.length;
++i){FBTrace.sysout("Firebug.registerPanel",arguments[i].prototype.name)
}}},registerRep:function(){reps.push.apply(reps,arguments)
},unregisterRep:function(){for(var i=0;
i<arguments.length;
++i){remove(reps,arguments[i])
}},setDefaultReps:function(funcRep,rep){FBL.defaultRep=rep;
FBL.defaultFuncRep=funcRep
},getRep:function(object){var type=typeof object;
if(isIE&&isFunction(object)){type="function"
}for(var i=0;
i<reps.length;
++i){var rep=reps[i];
try{if(rep.supportsObject(object,type)){if(FBTrace.DBG_DOM){FBTrace.sysout("getRep type: "+type+" object: "+object,rep)
}return rep
}}catch(exc){if(FBTrace.DBG_ERRORS){FBTrace.sysout("firebug.getRep FAILS: ",exc.message||exc);
FBTrace.sysout("firebug.getRep reps["+i+"/"+reps.length+"]: Rep="+reps[i].className)
}}}return(type=="function")?defaultFuncRep:defaultRep
},getRepObject:function(node){var target=null;
for(var child=node;
child;
child=child.parentNode){if(hasClass(child,"repTarget")){target=child
}if(child.repObject){if(!target&&hasClass(child,"repIgnore")){break
}else{return child.repObject
}}}},getRepNode:function(node){for(var child=node;
child;
child=child.parentNode){if(child.repObject){return child
}}},getElementByRepObject:function(element,object){for(var child=element.firstChild;
child;
child=child.nextSibling){if(child.repObject==object){return child
}}},getPref:function(name){return Firebug[name]
},setPref:function(name,value){Firebug[name]=value;
this.savePrefs()
},setPrefs:function(prefs){for(var name in prefs){if(prefs.hasOwnProperty(name)){Firebug[name]=prefs[name]
}}this.savePrefs()
},restorePrefs:function(){var Options=Env.Options;
for(var name in Options){Firebug[name]=Options[name]
}},loadPrefs:function(prefs){this.restorePrefs();
prefs=prefs||eval("("+readCookie("FirebugLite")+")");
for(var name in prefs){if(prefs.hasOwnProperty(name)){Firebug[name]=prefs[name]
}}},savePrefs:function(){var json=["{"],jl=0;
var Options=Env.Options;
for(var name in Options){if(Options.hasOwnProperty(name)){var value=Firebug[name];
json[++jl]='"';
json[++jl]=name;
var type=typeof value;
if(type=="boolean"||type=="number"){json[++jl]='":';
json[++jl]=value;
json[++jl]=","
}else{json[++jl]='":"';
json[++jl]=value;
json[++jl]='",'
}}}json.length=jl--;
json[++jl]="}";
createCookie("FirebugLite",json.join(""))
},erasePrefs:function(){removeCookie("FirebugLite")
}};
Firebug.restorePrefs();
if(!Env.Options.enablePersistent||Env.Options.enablePersistent&&Env.isChromeContext||Env.isDebugMode){Env.browser.window.Firebug=FBL.Firebug
}FBL.cacheDocument=function cacheDocument(){var els=Firebug.browser.document.getElementsByTagName("*");
for(var i=0,l=els.length,el;
i<l;
i++){el=els[i];
el[cacheID]=i;
documentCache[i]=el
}};
Firebug.Module={initialize:function(){},shutdown:function(){},initContext:function(context){},reattachContext:function(browser,context){},destroyContext:function(context,persistedState){},showContext:function(browser,context){},loadedContext:function(context){},showPanel:function(browser,panel){},showSidePanel:function(browser,panel){},updateOption:function(name,value){},getObjectByURL:function(context,url){}};
Firebug.Panel={name:"HelloWorld",title:"Hello World!",parentPanel:null,options:{hasCommandLine:false,hasStatusBar:false,hasToolButtons:false,isPreRendered:false,innerHTMLSync:false},tabNode:null,panelNode:null,sidePanelNode:null,statusBarNode:null,toolButtonsNode:null,panelBarNode:null,sidePanelBarBoxNode:null,sidePanelBarNode:null,sidePanelBar:null,searchable:false,editable:true,order:2147483647,statusSeparator:"<",create:function(context,doc){this.hasSidePanel=parentPanelMap.hasOwnProperty(this.name);
this.panelBarNode=$("fbPanelBar1");
this.sidePanelBarBoxNode=$("fbPanelBar2");
if(this.hasSidePanel){this.sidePanelBar=extend({},PanelBar);
this.sidePanelBar.create(this)
}var options=this.options=extend(Firebug.Panel.options,this.options);
var panelId="fb"+this.name;
if(options.isPreRendered){this.panelNode=$(panelId);
this.tabNode=$(panelId+"Tab");
this.tabNode.style.display="block";
if(options.hasToolButtons){this.toolButtonsNode=$(panelId+"Buttons")
}if(options.hasStatusBar){this.statusBarBox=$("fbStatusBarBox");
this.statusBarNode=$(panelId+"StatusBar")
}}else{var containerSufix=this.parentPanel?"2":"1";
var panelNode=this.panelNode=createElement("div",{id:panelId,className:"fbPanel"});
$("fbPanel"+containerSufix).appendChild(panelNode);
var tabHTML='<span class="fbTabL"></span><span class="fbTabText">'+this.title+'</span><span class="fbTabR"></span>';
var tabNode=this.tabNode=createElement("a",{id:panelId+"Tab",className:"fbTab fbHover",innerHTML:tabHTML});
if(isIE6){tabNode.href="javascript:void(0)"
}var panelBarNode=this.parentPanel?Firebug.chrome.getPanel(this.parentPanel).sidePanelBarNode:this.panelBarNode;
panelBarNode.appendChild(tabNode);
tabNode.style.display="block";
if(options.hasToolButtons){this.toolButtonsNode=createElement("span",{id:panelId+"Buttons",className:"fbToolbarButtons"});
$("fbToolbarButtons").appendChild(this.toolButtonsNode)
}if(options.hasStatusBar){this.statusBarBox=$("fbStatusBarBox");
this.statusBarNode=createElement("span",{id:panelId+"StatusBar",className:"fbToolbarButtons fbStatusBar"});
this.statusBarBox.appendChild(this.statusBarNode)
}}var contentNode=this.contentNode=createElement("div");
this.panelNode.appendChild(contentNode);
this.containerNode=this.panelNode.parentNode;
if(FBTrace.DBG_INITIALIZE){FBTrace.sysout("Firebug.Panel.create",this.name)
}},destroy:function(state){if(FBTrace.DBG_INITIALIZE){FBTrace.sysout("Firebug.Panel.destroy",this.name)
}if(this.hasSidePanel){this.sidePanelBar.destroy();
this.sidePanelBar=null
}this.options=null;
this.name=null;
this.parentPanel=null;
this.tabNode=null;
this.panelNode=null;
this.contentNode=null;
this.containerNode=null;
this.toolButtonsNode=null;
this.statusBarBox=null;
this.statusBarNode=null
},initialize:function(){if(FBTrace.DBG_INITIALIZE){FBTrace.sysout("Firebug.Panel.initialize",this.name)
}if(this.hasSidePanel){this.sidePanelBar.initialize()
}var options=this.options=extend(Firebug.Panel.options,this.options);
var panelId="fb"+this.name;
this.panelNode=$(panelId);
this.tabNode=$(panelId+"Tab");
this.tabNode.style.display="block";
if(options.hasStatusBar){this.statusBarBox=$("fbStatusBarBox");
this.statusBarNode=$(panelId+"StatusBar")
}if(options.hasToolButtons){this.toolButtonsNode=$(panelId+"Buttons")
}this.containerNode=this.panelNode.parentNode;
this.containerNode.scrollTop=this.lastScrollTop
},shutdown:function(){if(FBTrace.DBG_INITIALIZE){FBTrace.sysout("Firebug.Panel.shutdown",this.name)
}if(Firebug.chrome.largeCommandLineVisible){Firebug.chrome.hideLargeCommandLine()
}if(this.hasSidePanel){}this.lastScrollTop=this.containerNode.scrollTop
},detach:function(oldChrome,newChrome){if(oldChrome.selectedPanel.name==this.name){this.lastScrollTop=oldChrome.selectedPanel.containerNode.scrollTop
}},reattach:function(doc){if(this.options.innerHTMLSync){this.synchronizeUI()
}},synchronizeUI:function(){this.containerNode.scrollTop=this.lastScrollTop||0
},show:function(state){var options=this.options;
if(options.hasStatusBar){this.statusBarBox.style.display="inline";
this.statusBarNode.style.display="inline"
}if(options.hasToolButtons){this.toolButtonsNode.style.display="inline"
}this.panelNode.style.display="block";
this.visible=true;
if(!this.parentPanel){Firebug.chrome.layout(this)
}},hide:function(state){var options=this.options;
if(options.hasStatusBar){this.statusBarBox.style.display="none";
this.statusBarNode.style.display="none"
}if(options.hasToolButtons){this.toolButtonsNode.style.display="none"
}this.panelNode.style.display="none";
this.visible=false
},watchWindow:function(win){},unwatchWindow:function(win){},updateOption:function(name,value){},showToolbarButtons:function(buttonsId,show){try{if(!this.context.browser){if(FBTrace.DBG_ERRORS){FBTrace.sysout("firebug.Panel showToolbarButtons this.context has no browser, this:",this)
}return
}var buttons=this.context.browser.chrome.$(buttonsId);
if(buttons){collapse(buttons,show?"false":"true")
}}catch(exc){if(FBTrace.DBG_ERRORS){FBTrace.dumpProperties("firebug.Panel showToolbarButtons FAILS",exc);
if(!this.context.browser){FBTrace.dumpStack("firebug.Panel showToolbarButtons no browser")
}}}},supportsObject:function(object){return 0
},hasObject:function(object){return false
},select:function(object,forceUpdate){if(!object){object=this.getDefaultSelection(this.context)
}if(FBTrace.DBG_PANELS){FBTrace.sysout("firebug.select "+this.name+" forceUpdate: "+forceUpdate+" "+object+((object==this.selection)?"==":"!=")+this.selection)
}if(forceUpdate||object!=this.selection){this.selection=object;
this.updateSelection(object)
}},updateSelection:function(object){},markChange:function(skipSelf){if(this.dependents){if(skipSelf){for(var i=0;
i<this.dependents.length;
++i){var panelName=this.dependents[i];
if(panelName!=this.name){this.context.invalidatePanels(panelName)
}}}else{this.context.invalidatePanels.apply(this.context,this.dependents)
}}},startInspecting:function(){},stopInspecting:function(object,cancelled){},getDefaultSelection:function(context){return null
},search:function(text){}};
Firebug.MeasureBox={startMeasuring:function(target){if(!this.measureBox){this.measureBox=target.ownerDocument.createElement("span");
this.measureBox.className="measureBox"
}copyTextStyles(target,this.measureBox);
target.ownerDocument.body.appendChild(this.measureBox)
},getMeasuringElement:function(){return this.measureBox
},measureText:function(value){this.measureBox.innerHTML=value?escapeForSourceLine(value):"m";
return{width:this.measureBox.offsetWidth,height:this.measureBox.offsetHeight-1}
},measureInputText:function(value){value=value?escapeForTextNode(value):"m";
if(!Firebug.showTextNodesWithWhitespace){value=value.replace(/\t/g,"mmmmmm").replace(/\ /g,"m")
}this.measureBox.innerHTML=value;
return{width:this.measureBox.offsetWidth,height:this.measureBox.offsetHeight-1}
},getBox:function(target){var style=this.measureBox.ownerDocument.defaultView.getComputedStyle(this.measureBox,"");
var box=getBoxFromStyles(style,this.measureBox);
return box
},stopMeasuring:function(){this.measureBox.parentNode.removeChild(this.measureBox)
}};
if(FBL.domplate){Firebug.Rep=domplate({className:"",inspectable:true,supportsObject:function(object,type){return false
},inspectObject:function(object,context){Firebug.chrome.select(object)
},browseObject:function(object,context){},persistObject:function(object,context){},getRealObject:function(object,context){return object
},getTitle:function(object){var label=safeToString(object);
var re=/\[object (.*?)\]/;
var m=re.exec(label);
return m?m[1]:label
},getTooltip:function(object){return null
},getContextMenuItems:function(object,target,context){return[]
},STR:function(name){return $STR(name)
},cropString:function(text){return cropString(text)
},cropMultipleLines:function(text,limit){return cropMultipleLines(text,limit)
},toLowerCase:function(text){return text?text.toLowerCase():text
},plural:function(n){return n==1?"":"s"
}})
}}});
FBL.ns(function(){with(FBL){FBL.Controller={controllers:null,controllerContext:null,initialize:function(context){this.controllers=[];
this.controllerContext=context||Firebug.chrome
},shutdown:function(){this.removeControllers()
},addController:function(){for(var i=0,arg;
arg=arguments[i];
i++){if(typeof arg[0]=="string"){arg[0]=$$(arg[0],this.controllerContext)
}var handler=arg[2];
arg[2]=bind(handler,this);
arg[3]=handler;
this.controllers.push(arg);
addEvent.apply(this,arg)
}},removeController:function(){for(var i=0,arg;
arg=arguments[i];
i++){for(var j=0,c;
c=this.controllers[j];
j++){if(arg[0]==c[0]&&arg[1]==c[1]&&arg[2]==c[3]){removeEvent.apply(this,c)
}}}},removeControllers:function(){for(var i=0,c;
c=this.controllers[i];
i++){removeEvent.apply(this,c)
}}};
FBL.PanelBar={panelMap:null,selectedPanel:null,parentPanelName:null,create:function(ownerPanel){this.panelMap={};
this.ownerPanel=ownerPanel;
if(ownerPanel){ownerPanel.sidePanelBarNode=createElement("span");
ownerPanel.sidePanelBarNode.style.display="none";
ownerPanel.sidePanelBarBoxNode.appendChild(ownerPanel.sidePanelBarNode)
}var panels=Firebug.panelTypes;
for(var i=0,p;
p=panels[i];
i++){if(!ownerPanel&&!p.prototype.parentPanel||ownerPanel&&p.prototype.parentPanel&&ownerPanel.name==p.prototype.parentPanel){this.addPanel(p.prototype.name)
}}},destroy:function(){PanelBar.shutdown.call(this);
for(var name in this.panelMap){this.removePanel(name);
var panel=this.panelMap[name];
panel.destroy();
this.panelMap[name]=null;
delete this.panelMap[name]
}this.panelMap=null;
this.ownerPanel=null
},initialize:function(){if(this.ownerPanel){this.ownerPanel.sidePanelBarNode.style.display="inline"
}for(var name in this.panelMap){(function(self,name){var onTabClick=function onTabClick(){self.selectPanel(name);
return false
};
Firebug.chrome.addController([self.panelMap[name].tabNode,"mousedown",onTabClick])
})(this,name)
}},shutdown:function(){var selectedPanel=this.selectedPanel;
if(selectedPanel){removeClass(selectedPanel.tabNode,"fbSelectedTab");
selectedPanel.hide();
selectedPanel.shutdown()
}if(this.ownerPanel){this.ownerPanel.sidePanelBarNode.style.display="none"
}this.selectedPanel=null
},addPanel:function(panelName,parentPanel){var PanelType=Firebug.panelTypeMap[panelName];
var panel=this.panelMap[panelName]=new PanelType();
panel.create()
},removePanel:function(panelName){var panel=this.panelMap[panelName];
if(panel.hasOwnProperty(panelName)){panel.destroy()
}},selectPanel:function(panelName){var selectedPanel=this.selectedPanel;
var panel=this.panelMap[panelName];
if(panel&&selectedPanel!=panel){if(selectedPanel){removeClass(selectedPanel.tabNode,"fbSelectedTab");
selectedPanel.shutdown();
selectedPanel.hide()
}if(!panel.parentPanel){FirebugChrome.selectedPanelName=panelName
}this.selectedPanel=panel;
setClass(panel.tabNode,"fbSelectedTab");
panel.show();
panel.initialize()
}},getPanel:function(panelName){var panel=this.panelMap[panelName];
return panel
}};
FBL.Button=function(options){options=options||{};
append(this,options);
this.state="unpressed";
this.display="unpressed";
if(this.element){this.container=this.element.parentNode
}else{this.shouldDestroy=true;
this.container=this.owner.getPanel().toolButtonsNode;
this.element=createElement("a",{className:this.baseClassName+" "+this.className+" fbHover",innerHTML:this.caption});
if(this.title){this.element.title=this.title
}this.container.appendChild(this.element)
}};
Button.prototype=extend(Controller,{type:"normal",caption:"caption",title:null,className:"",baseClassName:"fbButton",pressedClassName:"fbBtnPressed",element:null,container:null,owner:null,state:null,display:null,destroy:function(){this.shutdown();
if(this.shouldDestroy){this.container.removeChild(this.element)
}this.element=null;
this.container=null;
this.owner=null
},initialize:function(){Controller.initialize.apply(this);
var element=this.element;
this.addController([element,"mousedown",this.handlePress]);
if(this.type=="normal"){this.addController([element,"mouseup",this.handleUnpress],[element,"mouseout",this.handleUnpress],[element,"click",this.handleClick])
}},shutdown:function(){Controller.shutdown.apply(this)
},restore:function(){this.changeState("unpressed")
},changeState:function(state){this.state=state;
this.changeDisplay(state)
},changeDisplay:function(display){if(display!=this.display){if(display=="pressed"){setClass(this.element,this.pressedClassName)
}else{if(display=="unpressed"){removeClass(this.element,this.pressedClassName)
}}this.display=display
}},handlePress:function(event){cancelEvent(event,true);
if(this.type=="normal"){this.changeDisplay("pressed");
this.beforeClick=true
}else{if(this.type=="toggle"){if(this.state=="pressed"){this.changeState("unpressed");
if(this.onUnpress){this.onUnpress.apply(this.owner,arguments)
}}else{this.changeState("pressed");
if(this.onPress){this.onPress.apply(this.owner,arguments)
}}if(this.onClick){this.onClick.apply(this.owner,arguments)
}}}return false
},handleUnpress:function(event){cancelEvent(event,true);
if(this.beforeClick){this.changeDisplay("unpressed")
}return false
},handleClick:function(event){cancelEvent(event,true);
if(this.type=="normal"){if(this.onClick){this.onClick.apply(this.owner)
}this.changeState("unpressed")
}this.beforeClick=false;
return false
}});
FBL.IconButton=function(){Button.apply(this,arguments)
};
IconButton.prototype=extend(Button.prototype,{baseClassName:"fbIconButton",pressedClassName:"fbIconPressed"});
var menuItemProps={"class":"$item.className",type:"$item.type",value:"$item.value",command:"$item.command"};
if(isIE6){menuItemProps.href="javascript:void(0)"
}if(FBL.domplate){var MenuPlate=domplate(Firebug.Rep,{tag:DIV({"class":"fbMenu fbShadow"},DIV({"class":"fbMenuContent fbShadowContent"},FOR("item","$object.items|memberIterator",TAG("$item.tag",{item:"$item"})))),itemTag:A(menuItemProps,"$item.label"),checkBoxTag:A(extend(menuItemProps,{checked:"$item.checked"}),"$item.label"),radioButtonTag:A(extend(menuItemProps,{selected:"$item.selected"}),"$item.label"),groupTag:A(extend(menuItemProps,{child:"$item.child"}),"$item.label"),shortcutTag:A(menuItemProps,"$item.label",SPAN({"class":"fbMenuShortcutKey"},"$item.key")),separatorTag:SPAN({"class":"fbMenuSeparator"}),memberIterator:function(items){var result=[];
for(var i=0,length=items.length;
i<length;
i++){var item=items[i];
if(typeof item=="string"&&item.indexOf("-")==0){result.push({tag:this.separatorTag});
continue
}item=extend(item,{});
item.type=item.type||"";
item.value=item.value||"";
var type=item.type;
item.tag=this.itemTag;
var className=item.className||"";
className+="fbMenuOption fbHover ";
if(type=="checkbox"){className+="fbMenuCheckBox ";
item.tag=this.checkBoxTag
}else{if(type=="radiobutton"){className+="fbMenuRadioButton ";
item.tag=this.radioButtonTag
}else{if(type=="group"){className+="fbMenuGroup ";
item.tag=this.groupTag
}else{if(type=="shortcut"){className+="fbMenuShortcut ";
item.tag=this.shortcutTag
}}}}if(item.checked){className+="fbMenuChecked "
}else{if(item.selected){className+="fbMenuRadioSelected "
}}if(item.disabled){className+="fbMenuDisabled "
}item.className=className;
result.push(item)
}return result
}})
}FBL.Menu=function(options){if(!options.element){if(options.getItems){options.items=options.getItems()
}options.element=MenuPlate.tag.append({object:options},getElementByClass(Firebug.chrome.document,"fbBody"),MenuPlate)
}append(this,options);
if(typeof this.element=="string"){this.id=this.element;
this.element=$(this.id)
}else{if(this.id){this.element.id=this.id
}}this.element.firebugIgnore=true;
this.elementStyle=this.element.style;
this.isVisible=false;
this.handleMouseDown=bind(this.handleMouseDown,this);
this.handleMouseOver=bind(this.handleMouseOver,this);
this.handleMouseOut=bind(this.handleMouseOut,this);
this.handleWindowMouseDown=bind(this.handleWindowMouseDown,this)
};
var menuMap={};
Menu.prototype=extend(Controller,{destroy:function(){this.hide();
if(this.parentMenu){this.parentMenu.childMenu=null
}this.element.parentNode.removeChild(this.element);
this.element=null;
this.elementStyle=null;
this.parentMenu=null;
this.parentTarget=null
},initialize:function(){Controller.initialize.call(this);
this.addController([this.element,"mousedown",this.handleMouseDown],[this.element,"mouseover",this.handleMouseOver])
},shutdown:function(){Controller.shutdown.call(this)
},show:function(x,y){this.initialize();
if(this.isVisible){return
}x=x||0;
y=y||0;
if(this.parentMenu){var oldChildMenu=this.parentMenu.childMenu;
if(oldChildMenu&&oldChildMenu!=this){oldChildMenu.destroy()
}this.parentMenu.childMenu=this
}else{addEvent(Firebug.chrome.document,"mousedown",this.handleWindowMouseDown)
}this.elementStyle.display="block";
this.elementStyle.visibility="hidden";
var size=Firebug.chrome.getSize();
x=Math.min(x,size.width-this.element.clientWidth-10);
x=Math.max(x,0);
y=Math.min(y,size.height-this.element.clientHeight-10);
y=Math.max(y,0);
this.elementStyle.left=x+"px";
this.elementStyle.top=y+"px";
this.elementStyle.visibility="visible";
this.isVisible=true;
if(isFunction(this.onShow)){this.onShow.apply(this,arguments)
}},hide:function(){this.clearHideTimeout();
this.clearShowChildTimeout();
if(!this.isVisible){return
}this.elementStyle.display="none";
if(this.childMenu){this.childMenu.destroy();
this.childMenu=null
}if(this.parentTarget){removeClass(this.parentTarget,"fbMenuGroupSelected")
}this.isVisible=false;
this.shutdown();
if(isFunction(this.onHide)){this.onHide.apply(this,arguments)
}},showChildMenu:function(target){var id=target.getAttribute("child");
var parent=this;
var target=target;
this.showChildTimeout=Firebug.chrome.window.setTimeout(function(){var box=Firebug.chrome.getElementBox(target);
var childMenuObject=menuMap.hasOwnProperty(id)?menuMap[id]:{element:$(id)};
var childMenu=new Menu(extend(childMenuObject,{parentMenu:parent,parentTarget:target}));
var offsetLeft=isIE6?-1:-6;
childMenu.show(box.left+box.width+offsetLeft,box.top-6);
setClass(target,"fbMenuGroupSelected")
},350)
},clearHideTimeout:function(){if(this.hideTimeout){Firebug.chrome.window.clearTimeout(this.hideTimeout);
delete this.hideTimeout
}},clearShowChildTimeout:function(){if(this.showChildTimeout){Firebug.chrome.window.clearTimeout(this.showChildTimeout);
this.showChildTimeout=null
}},handleMouseDown:function(event){cancelEvent(event,true);
var topParent=this;
while(topParent.parentMenu){topParent=topParent.parentMenu
}var target=event.target||event.srcElement;
target=getAncestorByClass(target,"fbMenuOption");
if(!target||hasClass(target,"fbMenuGroup")){return false
}if(target&&!hasClass(target,"fbMenuDisabled")){var type=target.getAttribute("type");
if(type=="checkbox"){var checked=target.getAttribute("checked");
var value=target.getAttribute("value");
var wasChecked=hasClass(target,"fbMenuChecked");
if(wasChecked){removeClass(target,"fbMenuChecked");
target.setAttribute("checked","")
}else{setClass(target,"fbMenuChecked");
target.setAttribute("checked","true")
}if(isFunction(this.onCheck)){this.onCheck.call(this,target,value,!wasChecked)
}}if(type=="radiobutton"){var selectedRadios=getElementsByClass(target.parentNode,"fbMenuRadioSelected");
var group=target.getAttribute("group");
for(var i=0,length=selectedRadios.length;
i<length;
i++){radio=selectedRadios[i];
if(radio.getAttribute("group")==group){removeClass(radio,"fbMenuRadioSelected");
radio.setAttribute("selected","")
}}setClass(target,"fbMenuRadioSelected");
target.setAttribute("selected","true")
}var cmd=target.getAttribute("command");
var handler=this[cmd];
var closeMenu=true;
if(handler){closeMenu=handler.call(this,target)!==false
}if(closeMenu){topParent.hide()
}}return false
},handleWindowMouseDown:function(event){var target=event.target||event.srcElement;
target=getAncestorByClass(target,"fbMenu");
if(!target){removeEvent(Firebug.chrome.document,"mousedown",this.handleWindowMouseDown);
this.hide()
}},handleMouseOver:function(event){this.clearHideTimeout();
this.clearShowChildTimeout();
var target=event.target||event.srcElement;
target=getAncestorByClass(target,"fbMenuOption");
if(!target){return
}var childMenu=this.childMenu;
if(childMenu){removeClass(childMenu.parentTarget,"fbMenuGroupSelected");
if(childMenu.parentTarget!=target&&childMenu.isVisible){childMenu.clearHideTimeout();
childMenu.hideTimeout=Firebug.chrome.window.setTimeout(function(){childMenu.destroy()
},300)
}}if(hasClass(target,"fbMenuGroup")){this.showChildMenu(target)
}}});
Menu.register=function(object){menuMap[object.id]=object
};
Menu.check=function(element){setClass(element,"fbMenuChecked");
element.setAttribute("checked","true")
};
Menu.uncheck=function(element){removeClass(element,"fbMenuChecked");
element.setAttribute("checked","")
};
Menu.disable=function(element){setClass(element,"fbMenuDisabled")
};
Menu.enable=function(element){removeClass(element,"fbMenuDisabled")
};
function StatusBar(){}StatusBar.prototype=extend(Controller,{})
}});
FBL.ns(function(){with(FBL){var refreshDelay=300;
var shouldFixElementFromPoint=isOpera||isSafari&&browserVersion<"532";
var evalError="___firebug_evaluation_error___";
var pixelsPerInch;
var resetStyle="margin:0; padding:0; border:0; position:absolute; overflow:hidden; display:block;";
var offscreenStyle=resetStyle+"top:-1234px; left:-1234px;";
FBL.Context=function(win){this.window=win.window;
this.document=win.document;
this.browser=Env.browser;
if(isIE&&!this.window.eval){this.window.execScript("null");
if(!this.window.eval){throw new Error("Firebug Error: eval() method not found in this window")
}}this.eval=this.window.eval("new Function('try{ return window.eval.apply(window,arguments) }catch(E){ E."+evalError+"=true; return E }')")
};
FBL.Context.prototype={browser:null,loaded:true,setTimeout:function(fn,delay){var win=this.window;
if(win.setTimeout==this.setTimeout){throw new Error("setTimeout recursion")
}var timeout=win.setTimeout.apply?win.setTimeout.apply(win,arguments):win.setTimeout(fn,delay);
if(!this.timeouts){this.timeouts={}
}this.timeouts[timeout]=1;
return timeout
},clearTimeout:function(timeout){clearTimeout(timeout);
if(this.timeouts){delete this.timeouts[timeout]
}},setInterval:function(fn,delay){var win=this.window;
var timeout=win.setInterval.apply?win.setInterval.apply(win,arguments):win.setInterval(fn,delay);
if(!this.intervals){this.intervals={}
}this.intervals[timeout]=1;
return timeout
},clearInterval:function(timeout){clearInterval(timeout);
if(this.intervals){delete this.intervals[timeout]
}},invalidatePanels:function(){if(!this.invalidPanels){this.invalidPanels={}
}for(var i=0;
i<arguments.length;
++i){var panelName=arguments[i];
if(!Firebug.chrome||!Firebug.chrome.selectedPanel){return
}var panel=Firebug.chrome.selectedPanel.sidePanelBar?Firebug.chrome.selectedPanel.sidePanelBar.getPanel(panelName,true):null;
if(panel&&!panel.noRefresh){this.invalidPanels[panelName]=1
}}if(this.refreshTimeout){this.clearTimeout(this.refreshTimeout);
delete this.refreshTimeout
}this.refreshTimeout=this.setTimeout(bindFixed(function(){var invalids=[];
for(var panelName in this.invalidPanels){var panel=Firebug.chrome.selectedPanel.sidePanelBar?Firebug.chrome.selectedPanel.sidePanelBar.getPanel(panelName,true):null;
if(panel){if(panel.visible&&!panel.editing){panel.refresh()
}else{panel.needsRefresh=true
}if(panel.editing){invalids.push(panelName)
}}}delete this.invalidPanels;
delete this.refreshTimeout;
if(invalids.length){this.invalidatePanels.apply(this,invalids)
}},this),refreshDelay)
},evaluate:function(expr,context,api,errorHandler){expr=stripNewLines(expr);
context=context||"window";
var cmd,result;
if(context=="window"){cmd=api?"with("+api+"){ ("+expr+") }":"("+expr+")";
result=this.eval(cmd);
if(result&&result[evalError]){cmd=api?"with("+api+"){ "+expr+" }":expr;
result=this.eval(cmd)
}}else{cmd=api?"(function(arguments){ with("+api+"){ return ("+expr+") } }).call("+context+",undefined)":"(function(arguments){ return ("+expr+") }).call("+context+",undefined)";
result=this.eval(cmd);
if(result&&result[evalError]){cmd=api?"(function(arguments){ with("+api+"){ "+expr+" } }).call("+context+",undefined)":"(function(arguments){ "+expr+" }).call("+context+",undefined)";
result=this.eval(cmd)
}}if(result&&result[evalError]){var msg=result.name?(result.name+": "):"";
msg+=result.message||result;
if(errorHandler){result=errorHandler(msg)
}else{result=msg
}}return result
},getWindowSize:function(){var width=0,height=0,el;
if(typeof this.window.innerWidth=="number"){width=this.window.innerWidth;
height=this.window.innerHeight
}else{if((el=this.document.documentElement)&&(el.clientHeight||el.clientWidth)){width=el.clientWidth;
height=el.clientHeight
}else{if((el=this.document.body)&&(el.clientHeight||el.clientWidth)){width=el.clientWidth;
height=el.clientHeight
}}}return{width:width,height:height}
},getWindowScrollSize:function(){var width=0,height=0,el;
if(!isIEQuiksMode&&(el=this.document.documentElement)&&(el.scrollHeight||el.scrollWidth)){width=el.scrollWidth;
height=el.scrollHeight
}if((el=this.document.body)&&(el.scrollHeight||el.scrollWidth)&&(el.scrollWidth>width||el.scrollHeight>height)){width=el.scrollWidth;
height=el.scrollHeight
}return{width:width,height:height}
},getWindowScrollPosition:function(){var top=0,left=0,el;
if(typeof this.window.pageYOffset=="number"){top=this.window.pageYOffset;
left=this.window.pageXOffset
}else{if((el=this.document.body)&&(el.scrollTop||el.scrollLeft)){top=el.scrollTop;
left=el.scrollLeft
}else{if((el=this.document.documentElement)&&(el.scrollTop||el.scrollLeft)){top=el.scrollTop;
left=el.scrollLeft
}}}return{top:top,left:left}
},getElementFromPoint:function(x,y){if(shouldFixElementFromPoint){var scroll=this.getWindowScrollPosition();
return this.document.elementFromPoint(x+scroll.left,y+scroll.top)
}else{return this.document.elementFromPoint(x,y)
}},getElementPosition:function(el){var left=0;
var top=0;
do{left+=el.offsetLeft;
top+=el.offsetTop
}while(el=el.offsetParent);
return{left:left,top:top}
},getElementBox:function(el){var result={};
if(el.getBoundingClientRect){var rect=el.getBoundingClientRect();
var offset=isIE?this.document.body.clientTop||this.document.documentElement.clientTop:0;
var scroll=this.getWindowScrollPosition();
result.top=Math.round(rect.top-offset+scroll.top);
result.left=Math.round(rect.left-offset+scroll.left);
result.height=Math.round(rect.bottom-rect.top);
result.width=Math.round(rect.right-rect.left)
}else{var position=this.getElementPosition(el);
result.top=position.top;
result.left=position.left;
result.height=el.offsetHeight;
result.width=el.offsetWidth
}return result
},getMeasurement:function(el,name){var result={value:0,unit:"px"};
var cssValue=this.getStyle(el,name);
if(!cssValue){return result
}if(cssValue.toLowerCase()=="auto"){return result
}var reMeasure=/(\d+\.?\d*)(.*)/;
var m=cssValue.match(reMeasure);
if(m){result.value=m[1]-0;
result.unit=m[2].toLowerCase()
}return result
},getMeasurementInPixels:function(el,name){if(!el){return null
}var m=this.getMeasurement(el,name);
var value=m.value;
var unit=m.unit;
if(unit=="px"){return value
}else{if(unit=="pt"){return this.pointsToPixels(name,value)
}}if(unit=="em"){return this.emToPixels(el,value)
}else{if(unit=="%"){return this.percentToPixels(el,value)
}}},getMeasurementBox1:function(el,name){var sufixes=["Top","Left","Bottom","Right"];
var result=[];
for(var i=0,sufix;
sufix=sufixes[i];
i++){result[i]=Math.round(this.getMeasurementInPixels(el,name+sufix))
}return{top:result[0],left:result[1],bottom:result[2],right:result[3]}
},getMeasurementBox:function(el,name){var result=[];
var sufixes=name=="border"?["TopWidth","LeftWidth","BottomWidth","RightWidth"]:["Top","Left","Bottom","Right"];
if(isIE){var propName,cssValue;
var autoMargin=null;
for(var i=0,sufix;
sufix=sufixes[i];
i++){propName=name+sufix;
cssValue=el.currentStyle[propName]||el.style[propName];
if(cssValue=="auto"){if(!autoMargin){autoMargin=this.getCSSAutoMarginBox(el)
}result[i]=autoMargin[sufix.toLowerCase()]
}else{result[i]=this.getMeasurementInPixels(el,propName)
}}}else{for(var i=0,sufix;
sufix=sufixes[i];
i++){result[i]=this.getMeasurementInPixels(el,name+sufix)
}}return{top:result[0],left:result[1],bottom:result[2],right:result[3]}
},getCSSAutoMarginBox:function(el){if(isIE&&" meta title input script link a ".indexOf(" "+el.nodeName.toLowerCase()+" ")!=-1){return{top:0,left:0,bottom:0,right:0}
}if(isIE&&" h1 h2 h3 h4 h5 h6 h7 ul p ".indexOf(" "+el.nodeName.toLowerCase()+" ")==-1){return{top:0,left:0,bottom:0,right:0}
}var offsetTop=0;
if(false&&isIEStantandMode){var scrollSize=Firebug.browser.getWindowScrollSize();
offsetTop=scrollSize.height
}var box=this.document.createElement("div");
box.style.cssText="margin:0; padding:1px; border: 0; visibility: hidden;";
var clone=el.cloneNode(false);
var text=this.document.createTextNode(" ");
clone.appendChild(text);
box.appendChild(clone);
this.document.body.appendChild(box);
var marginTop=clone.offsetTop-box.offsetTop-1;
var marginBottom=box.offsetHeight-clone.offsetHeight-2-marginTop;
var marginLeft=clone.offsetLeft-box.offsetLeft-1;
var marginRight=box.offsetWidth-clone.offsetWidth-2-marginLeft;
this.document.body.removeChild(box);
return{top:marginTop+offsetTop,left:marginLeft,bottom:marginBottom-offsetTop,right:marginRight}
},getFontSizeInPixels:function(el){var size=this.getMeasurement(el,"fontSize");
if(size.unit=="px"){return size.value
}var computeDirtyFontSize=function(el,calibration){var div=this.document.createElement("div");
var divStyle=offscreenStyle;
if(calibration){divStyle+=" font-size:"+calibration+"px;"
}div.style.cssText=divStyle;
div.innerHTML="A";
el.appendChild(div);
var value=div.offsetHeight;
el.removeChild(div);
return value
};
var rate=200/225;
var value=computeDirtyFontSize(el);
return value*rate
},pointsToPixels:function(name,value,returnFloat){var axis=/Top$|Bottom$/.test(name)?"y":"x";
var result=value*pixelsPerInch[axis]/72;
return returnFloat?result:Math.round(result)
},emToPixels:function(el,value){if(!el){return null
}var fontSize=this.getFontSizeInPixels(el);
return Math.round(value*fontSize)
},exToPixels:function(el,value){if(!el){return null
}var div=this.document.createElement("div");
div.style.cssText=offscreenStyle+"width:"+value+"ex;";
el.appendChild(div);
var value=div.offsetWidth;
el.removeChild(div);
return value
},percentToPixels:function(el,value){if(!el){return null
}var div=this.document.createElement("div");
div.style.cssText=offscreenStyle+"width:"+value+"%;";
el.appendChild(div);
var value=div.offsetWidth;
el.removeChild(div);
return value
},getStyle:isIE?function(el,name){return el.currentStyle[name]||el.style[name]||undefined
}:function(el,name){return this.document.defaultView.getComputedStyle(el,null)[name]||el.style[name]||undefined
}}
}});
FBL.ns(function(){with(FBL){var WindowDefaultOptions={type:"frame",id:"FirebugUI",height:250},commandLine,fbTop,fbContent,fbContentStyle,fbBottom,fbBtnInspect,fbToolbar,fbPanelBox1,fbPanelBox1Style,fbPanelBox2,fbPanelBox2Style,fbPanelBar2Box,fbPanelBar2BoxStyle,fbHSplitter,fbVSplitter,fbVSplitterStyle,fbPanel1,fbPanel1Style,fbPanel2,fbPanel2Style,fbConsole,fbConsoleStyle,fbHTML,fbCommandLine,fbLargeCommandLine,fbLargeCommandButtons,topHeight,topPartialHeight,chromeRedrawSkipRate=isIE?75:isOpera?80:75,lastSelectedPanelName,focusCommandLineState=0,lastFocusedPanelName,lastHSplitterMouseMove=0,onHSplitterMouseMoveBuffer=null,onHSplitterMouseMoveTimer=null,lastVSplitterMouseMove=0;
FBL.FirebugChrome={isOpen:false,height:250,sidePanelWidth:350,selectedPanelName:"Console",selectedHTMLElementId:null,chromeMap:{},htmlSelectionStack:[],consoleMessageQueue:[],create:function(){if(FBTrace.DBG_INITIALIZE){FBTrace.sysout("FirebugChrome.create","creating chrome window")
}createChromeWindow()
},initialize:function(){if(FBTrace.DBG_INITIALIZE){FBTrace.sysout("FirebugChrome.initialize","initializing chrome window")
}if(Env.chrome.type=="frame"||Env.chrome.type=="div"){ChromeMini.create(Env.chrome)
}var chrome=Firebug.chrome=new Chrome(Env.chrome);
FirebugChrome.chromeMap[chrome.type]=chrome;
addGlobalEvent("keydown",onGlobalKeyDown);
if(Env.Options.enablePersistent&&chrome.type=="popup"){var frame=FirebugChrome.chromeMap.frame;
if(frame){frame.close()
}chrome.initialize()
}},clone:function(FBChrome){for(var name in FBChrome){var prop=FBChrome[name];
if(FBChrome.hasOwnProperty(name)&&!isFunction(prop)){this[name]=prop
}}}};
var createChromeWindow=function(options){options=extend(WindowDefaultOptions,options||{});
var chrome={},context=options.context||Env.browser,type=chrome.type=Env.Options.enablePersistent?"popup":options.type,isChromeFrame=type=="frame",useLocalSkin=Env.useLocalSkin,url=useLocalSkin?Env.Location.skin:"about:blank",body=context.document.getElementsByTagName("body")[0],formatNode=function(node){if(!Env.isDebugMode){node.firebugIgnore=true
}node.style.border="0";
node.style.visibility="hidden";
node.style.zIndex="2147483647";
node.style.position=noFixedPosition?"absolute":"fixed";
node.style.width="100%";
node.style.left="0";
node.style.bottom=noFixedPosition?"-1px":"0";
node.style.height=options.height+"px";
if(isFirefox){node.style.display="none"
}},createChromeDiv=function(){var node=chrome.node=createGlobalElement("div"),style=createGlobalElement("style"),css=FirebugChrome.Skin.CSS,rules=".fbBody *{margin:0;padding:0;font-size:11px;line-height:13px;color:inherit;}"+css+".fbBody #fbHSplitter{position:absolute !important;} .fbBody #fbHTML span{line-height:14px;} .fbBody .lineNo div{line-height:inherit !important;}";
style.type="text/css";
if(style.styleSheet){style.styleSheet.cssText=rules
}else{style.appendChild(context.document.createTextNode(rules))
}document.getElementsByTagName("head")[0].appendChild(style);
node.className="fbBody";
node.style.overflow="hidden";
node.innerHTML=getChromeDivTemplate();
if(isIE){setTimeout(function(){node.firstChild.style.height="1px";
node.firstChild.style.position="static"
},0)
}formatNode(node);
body.appendChild(node);
chrome.window=window;
chrome.document=document;
onChromeLoad(chrome)
};
try{if(type=="div"){createChromeDiv();
return
}else{if(isChromeFrame){var node=chrome.node=createGlobalElement("iframe");
node.setAttribute("src",url);
node.setAttribute("frameBorder","0");
formatNode(node);
body.appendChild(node);
node.id=options.id
}else{var height=FirebugChrome.height||options.height,options=["true,top=",Math.max(screen.availHeight-height-61,0),",left=0,height=",height,",width=",screen.availWidth-10,",resizable"].join(""),node=chrome.node=context.window.open(url,"popup",options);
if(node){try{node.focus()
}catch(E){alert("Firebug Error: Firebug popup was blocked.");
return
}}else{alert("Firebug Error: Firebug popup was blocked.");
return
}}}if(!useLocalSkin){var tpl=getChromeTemplate(!isChromeFrame),doc=isChromeFrame?node.contentWindow.document:node.document;
doc.write(tpl);
doc.close()
}var win,waitDelay=useLocalSkin?isChromeFrame?200:300:100,waitForWindow=function(){if(isChromeFrame&&(win=node.contentWindow)&&node.contentWindow.document.getElementById("fbCommandLine")||!isChromeFrame&&(win=node.window)&&node.document&&node.document.getElementById("fbCommandLine")){chrome.window=win.window;
chrome.document=win.document;
setTimeout(function(){onChromeLoad(chrome)
},0)
}else{setTimeout(waitForWindow,waitDelay)
}};
waitForWindow()
}catch(e){var msg=e.message||e;
if(/access/i.test(msg)){if(isChromeFrame){body.removeChild(node)
}else{if(type=="popup"){node.close()
}}createChromeDiv()
}else{alert("Firebug Error: Firebug GUI could not be created.")
}}};
var onChromeLoad=function onChromeLoad(chrome){Env.chrome=chrome;
if(FBTrace.DBG_INITIALIZE){FBTrace.sysout("Chrome onChromeLoad","chrome window loaded")
}if(Env.Options.enablePersistent){Env.FirebugChrome=FirebugChrome;
chrome.window.Firebug=chrome.window.Firebug||{};
chrome.window.Firebug.SharedEnv=Env;
if(Env.isDevelopmentMode){Env.browser.window.FBDev.loadChromeApplication(chrome)
}else{var doc=chrome.document;
var script=doc.createElement("script");
script.src=Env.Location.app+"#remote,persist";
doc.getElementsByTagName("head")[0].appendChild(script)
}}else{if(chrome.type=="frame"||chrome.type=="div"){setTimeout(function(){FBL.Firebug.initialize()
},0)
}else{if(chrome.type=="popup"){var oldChrome=FirebugChrome.chromeMap.frame;
var newChrome=new Chrome(chrome);
dispatch(newChrome.panelMap,"detach",[oldChrome,newChrome]);
if(oldChrome){oldChrome.close()
}newChrome.reattach(oldChrome,newChrome)
}}}};
var getChromeDivTemplate=function(){return FirebugChrome.Skin.HTML
};
var getChromeTemplate=function(isPopup){var tpl=FirebugChrome.Skin;
var r=[],i=-1;
r[++i]='<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/DTD/strict.dtd">';
r[++i]="<html><head><title>";
r[++i]=Firebug.version;
r[++i]="</title><style>html,body{margin:0;padding:0;overflow:hidden;}";
r[++i]=tpl.CSS;
r[++i]="</style>";
r[++i]='</head><body class="fbBody'+(isPopup?" FirebugPopup":"")+'">';
r[++i]=tpl.HTML;
r[++i]="</body></html>";
return r.join("")
};
var Chrome=function Chrome(chrome){var type=chrome.type;
var Base=type=="frame"||type=="div"?ChromeFrameBase:ChromePopupBase;
append(this,Base);
append(this,chrome);
append(this,new Context(chrome.window));
FirebugChrome.chromeMap[type]=this;
Firebug.chrome=this;
Env.chrome=chrome.window;
this.commandLineVisible=false;
this.sidePanelVisible=false;
this.create();
return this
};
var ChromeBase={};
append(ChromeBase,Controller);
append(ChromeBase,PanelBar);
append(ChromeBase,{node:null,type:null,document:null,window:null,sidePanelVisible:false,commandLineVisible:false,largeCommandLineVisible:false,inspectButton:null,create:function(){PanelBar.create.call(this);
if(Firebug.Inspector){this.inspectButton=new Button({type:"toggle",element:$("fbChrome_btInspect"),owner:Firebug.Inspector,onPress:Firebug.Inspector.startInspecting,onUnpress:Firebug.Inspector.stopInspecting})
}},destroy:function(){if(Firebug.Inspector){this.inspectButton.destroy()
}PanelBar.destroy.call(this);
this.shutdown()
},testMenu:function(){var firebugMenu=new Menu({id:"fbFirebugMenu",items:[{label:"Open Firebug",type:"shortcut",key:isFirefox?"Shift+F12":"F12",checked:true,command:"toggleChrome"},{label:"Open Firebug in New Window",type:"shortcut",key:isFirefox?"Ctrl+Shift+F12":"Ctrl+F12",command:"openPopup"},{label:"Inspect Element",type:"shortcut",key:"Ctrl+Shift+C",command:"toggleInspect"},{label:"Command Line",type:"shortcut",key:"Ctrl+Shift+L",command:"focusCommandLine"},"-",{label:"Options",type:"group",child:"fbFirebugOptionsMenu"},"-",{label:"Firebug Lite Website...",command:"visitWebsite"},{label:"Discussion Group...",command:"visitDiscussionGroup"},{label:"Issue Tracker...",command:"visitIssueTracker"}],onHide:function(){iconButton.restore()
},toggleChrome:function(){Firebug.chrome.toggle()
},openPopup:function(){Firebug.chrome.toggle(true,true)
},toggleInspect:function(){Firebug.Inspector.toggleInspect()
},focusCommandLine:function(){Firebug.chrome.focusCommandLine()
},visitWebsite:function(){this.visit("http://getfirebug.com/lite.html")
},visitDiscussionGroup:function(){this.visit("http://groups.google.com/group/firebug")
},visitIssueTracker:function(){this.visit("http://code.google.com/p/fbug/issues/list")
},visit:function(url){window.open(url)
}});
var firebugOptionsMenu={id:"fbFirebugOptionsMenu",getItems:function(){var cookiesDisabled=!Firebug.saveCookies;
return[{label:"Save Options in Cookies",type:"checkbox",value:"saveCookies",checked:Firebug.saveCookies,command:"saveOptions"},"-",{label:"Start Opened",type:"checkbox",value:"startOpened",checked:Firebug.startOpened,disabled:cookiesDisabled},{label:"Start in New Window",type:"checkbox",value:"startInNewWindow",checked:Firebug.startInNewWindow,disabled:cookiesDisabled},{label:"Show Icon When Hidden",type:"checkbox",value:"showIconWhenHidden",checked:Firebug.showIconWhenHidden,disabled:cookiesDisabled},"-",{label:"Override Console Object",type:"checkbox",value:"overrideConsole",checked:Firebug.overrideConsole,disabled:cookiesDisabled},{label:"Ignore Firebug Elements",type:"checkbox",value:"ignoreFirebugElements",checked:Firebug.ignoreFirebugElements,disabled:cookiesDisabled},{label:"Disable When Firebug Active",type:"checkbox",value:"disableWhenFirebugActive",checked:Firebug.disableWhenFirebugActive,disabled:cookiesDisabled},"-",{label:"Enable Trace Mode",type:"checkbox",value:"enableTrace",checked:Firebug.enableTrace,disabled:cookiesDisabled},{label:"Enable Persistent Mode (experimental)",type:"checkbox",value:"enablePersistent",checked:Firebug.enablePersistent,disabled:cookiesDisabled},"-",{label:"Restore Options",command:"restorePrefs",disabled:cookiesDisabled}]
},onCheck:function(target,value,checked){Firebug.setPref(value,checked)
},saveOptions:function(target){var saveEnabled=target.getAttribute("checked");
if(!saveEnabled){this.restorePrefs()
}this.updateMenu(target);
return false
},restorePrefs:function(target){Firebug.restorePrefs();
if(Firebug.saveCookies){Firebug.savePrefs()
}else{Firebug.erasePrefs()
}if(target){this.updateMenu(target)
}return false
},updateMenu:function(target){var options=getElementsByClass(target.parentNode,"fbMenuOption");
var firstOption=options[0];
var enabled=Firebug.saveCookies;
if(enabled){Menu.check(firstOption)
}else{Menu.uncheck(firstOption)
}if(enabled){Menu.check(options[0])
}else{Menu.uncheck(options[0])
}for(var i=1,length=options.length;
i<length;
i++){var option=options[i];
var value=option.getAttribute("value");
var pref=Firebug[value];
if(pref){Menu.check(option)
}else{Menu.uncheck(option)
}if(enabled){Menu.enable(option)
}else{Menu.disable(option)
}}}};
Menu.register(firebugOptionsMenu);
var menu=firebugMenu;
var testMenuClick=function(event){cancelEvent(event,true);
var target=event.target||event.srcElement;
if(menu.isVisible){menu.hide()
}else{var offsetLeft=isIE6?1:-4,chrome=Firebug.chrome,box=chrome.getElementBox(target),offset=chrome.type=="div"?chrome.getElementPosition(chrome.node):{top:0,left:0};
menu.show(box.left+offsetLeft-offset.left,box.top+box.height-5-offset.top)
}return false
};
var iconButton=new IconButton({type:"toggle",element:$("fbFirebugButton"),onClick:testMenuClick});
iconButton.initialize()
},initialize:function(){if(Env.bookmarletOutdated){Firebug.Console.logFormatted(["A new bookmarlet version is available. Please visit http://getfirebug.com/firebuglite and update it."],Firebug.browser,"warn")
}if(Firebug.Console){Firebug.Console.flush()
}if(Firebug.Trace){FBTrace.flush(Firebug.Trace)
}if(FBTrace.DBG_INITIALIZE){FBTrace.sysout("Firebug.chrome.initialize","initializing chrome application")
}Controller.initialize.call(this);
PanelBar.initialize.call(this);
fbTop=$("fbTop");
fbContent=$("fbContent");
fbContentStyle=fbContent.style;
fbBottom=$("fbBottom");
fbBtnInspect=$("fbBtnInspect");
fbToolbar=$("fbToolbar");
fbPanelBox1=$("fbPanelBox1");
fbPanelBox1Style=fbPanelBox1.style;
fbPanelBox2=$("fbPanelBox2");
fbPanelBox2Style=fbPanelBox2.style;
fbPanelBar2Box=$("fbPanelBar2Box");
fbPanelBar2BoxStyle=fbPanelBar2Box.style;
fbHSplitter=$("fbHSplitter");
fbVSplitter=$("fbVSplitter");
fbVSplitterStyle=fbVSplitter.style;
fbPanel1=$("fbPanel1");
fbPanel1Style=fbPanel1.style;
fbPanel2=$("fbPanel2");
fbPanel2Style=fbPanel2.style;
fbConsole=$("fbConsole");
fbConsoleStyle=fbConsole.style;
fbHTML=$("fbHTML");
fbCommandLine=$("fbCommandLine");
fbLargeCommandLine=$("fbLargeCommandLine");
fbLargeCommandButtons=$("fbLargeCommandButtons");
topHeight=fbTop.offsetHeight;
topPartialHeight=fbToolbar.offsetHeight;
disableTextSelection($("fbToolbar"));
disableTextSelection($("fbPanelBarBox"));
disableTextSelection($("fbPanelBar1"));
disableTextSelection($("fbPanelBar2"));
if(isIE6&&Firebug.Selector){var as=$$(".fbHover");
for(var i=0,a;
a=as[i];
i++){a.setAttribute("href","javascript:void(0)")
}}if(Firebug.Inspector){this.inspectButton.initialize()
}this.addController([$("fbLargeCommandLineIcon"),"click",this.showLargeCommandLine]);
var self=this;
setTimeout(function(){self.selectPanel(FirebugChrome.selectedPanelName);
if(FirebugChrome.selectedPanelName=="Console"&&Firebug.CommandLine){Firebug.chrome.focusCommandLine()
}},0);
var onPanelMouseDown=function onPanelMouseDown(event){var target=event.target||event.srcElement;
if(FBL.isLeftClick(event)){var editable=FBL.getAncestorByClass(target,"editable");
if(editable){Firebug.Editor.startEditing(editable);
FBL.cancelEvent(event)
}}else{if(FBL.isMiddleClick(event)&&Firebug.getRepNode(target)){FBL.cancelEvent(event)
}}};
Firebug.getElementPanel=function(element){var panelNode=getAncestorByClass(element,"fbPanel");
var id=panelNode.id.substr(2);
var panel=Firebug.chrome.panelMap[id];
if(!panel){if(Firebug.chrome.selectedPanel.sidePanelBar){panel=Firebug.chrome.selectedPanel.sidePanelBar.panelMap[id]
}}return panel
};
Firebug.chrome.keyCodeListen=function(key,filter,listener,capture){if(!filter){filter=FBL.noKeyModifiers
}var keyCode=KeyEvent["DOM_VK_"+key];
var fn=function fn(event){if(event.keyCode==keyCode&&(!filter||filter(event))){listener();
FBL.cancelEvent(event,true);
return false
}};
addEvent(Firebug.chrome.document,"keydown",fn);
return[fn,capture]
};
Firebug.chrome.keyIgnore=function(listener){removeEvent(Firebug.chrome.document,"keydown",listener[0])
};
this.addController([fbPanel1,"mousedown",onPanelMouseDown],[fbPanel2,"mousedown",onPanelMouseDown]);
if(FBL.domplate){this.testMenu()
}},shutdown:function(){if(Firebug.Inspector){this.inspectButton.shutdown()
}restoreTextSelection($("fbToolbar"));
restoreTextSelection($("fbPanelBarBox"));
restoreTextSelection($("fbPanelBar1"));
restoreTextSelection($("fbPanelBar2"));
fbTop=null;
fbContent=null;
fbContentStyle=null;
fbBottom=null;
fbBtnInspect=null;
fbToolbar=null;
fbPanelBox1=null;
fbPanelBox1Style=null;
fbPanelBox2=null;
fbPanelBox2Style=null;
fbPanelBar2Box=null;
fbPanelBar2BoxStyle=null;
fbHSplitter=null;
fbVSplitter=null;
fbVSplitterStyle=null;
fbPanel1=null;
fbPanel1Style=null;
fbPanel2=null;
fbConsole=null;
fbConsoleStyle=null;
fbHTML=null;
fbCommandLine=null;
fbLargeCommandLine=null;
fbLargeCommandButtons=null;
topHeight=null;
topPartialHeight=null;
Controller.shutdown.call(this);
PanelBar.shutdown.call(this)
},toggle:function(forceOpen,popup){if(popup){this.detach()
}else{if(isOpera&&Firebug.chrome.type=="popup"&&Firebug.chrome.node.closed){var frame=FirebugChrome.chromeMap.frame;
frame.reattach();
FirebugChrome.chromeMap.popup=null;
frame.open();
return
}if(Firebug.chrome.type=="popup"){return
}var shouldOpen=forceOpen||!FirebugChrome.isOpen;
if(shouldOpen){this.open()
}else{this.close()
}}},detach:function(){if(!FirebugChrome.chromeMap.popup){createChromeWindow({type:"popup"})
}},reattach:function(oldChrome,newChrome){Firebug.browser.window.Firebug=Firebug;
var newPanelMap=newChrome.panelMap;
var oldPanelMap=oldChrome.panelMap;
var panel;
for(var name in newPanelMap){panel=newPanelMap[name];
if(panel.options.innerHTMLSync){panel.contentNode.innerHTML=oldPanelMap[name].contentNode.innerHTML
}}Firebug.chrome=newChrome;
if(newChrome.type=="popup"){newChrome.initialize()
}else{FirebugChrome.selectedPanelName=oldChrome.selectedPanel.name
}dispatch(newPanelMap,"reattach",[oldChrome,newChrome])
},draw:function(){var size=this.getSize();
var commandLineHeight=Firebug.chrome.commandLineVisible?fbCommandLine.offsetHeight:0,y=Math.max(size.height,topHeight),heightValue=Math.max(y-topHeight-commandLineHeight,0),height=heightValue+"px",sideWidthValue=Firebug.chrome.sidePanelVisible?FirebugChrome.sidePanelWidth:0,width=Math.max(size.width-sideWidthValue,0)+"px";
fbPanelBox1Style.height=height;
fbPanel1Style.height=height;
if(isIE||isOpera){fbVSplitterStyle.height=Math.max(y-topPartialHeight-commandLineHeight,0)+"px"
}fbPanelBox1Style.width=width;
fbPanel1Style.width=width;
if(Firebug.chrome.sidePanelVisible){sideWidthValue=Math.max(sideWidthValue-6,0);
var sideWidth=sideWidthValue+"px";
fbPanelBox2Style.width=sideWidth;
fbVSplitterStyle.right=sideWidth;
if(Firebug.chrome.largeCommandLineVisible){fbLargeCommandLine=$("fbLargeCommandLine");
fbLargeCommandLine.style.height=heightValue-4+"px";
fbLargeCommandLine.style.width=sideWidthValue-2+"px";
fbLargeCommandButtons=$("fbLargeCommandButtons");
fbLargeCommandButtons.style.width=sideWidth
}else{fbPanel2Style.height=height;
fbPanel2Style.width=sideWidth;
fbPanelBar2BoxStyle.width=sideWidth
}}},getSize:function(){return this.type=="div"?{height:this.node.offsetHeight,width:this.node.offsetWidth}:this.getWindowSize()
},resize:function(){var self=this;
setTimeout(function(){self.draw();
if(noFixedPosition&&(self.type=="frame"||self.type=="div")){self.fixIEPosition()
}},0)
},layout:function(panel){if(FBTrace.DBG_CHROME){FBTrace.sysout("Chrome.layout","")
}var options=panel.options;
changeCommandLineVisibility(options.hasCommandLine);
changeSidePanelVisibility(panel.hasSidePanel);
Firebug.chrome.draw()
},showLargeCommandLine:function(hideToggleIcon){var chrome=Firebug.chrome;
if(!chrome.largeCommandLineVisible){chrome.largeCommandLineVisible=true;
if(chrome.selectedPanel.options.hasCommandLine){if(Firebug.CommandLine){Firebug.CommandLine.blur()
}changeCommandLineVisibility(false)
}changeSidePanelVisibility(true);
fbLargeCommandLine.style.display="block";
fbLargeCommandButtons.style.display="block";
fbPanel2Style.display="none";
fbPanelBar2BoxStyle.display="none";
chrome.draw();
fbLargeCommandLine.focus();
if(Firebug.CommandLine){Firebug.CommandLine.setMultiLine(true)
}}},hideLargeCommandLine:function(){if(Firebug.chrome.largeCommandLineVisible){Firebug.chrome.largeCommandLineVisible=false;
if(Firebug.CommandLine){Firebug.CommandLine.setMultiLine(false)
}fbLargeCommandLine.blur();
fbPanel2Style.display="block";
fbPanelBar2BoxStyle.display="block";
fbLargeCommandLine.style.display="none";
fbLargeCommandButtons.style.display="none";
changeSidePanelVisibility(false);
if(Firebug.chrome.selectedPanel.options.hasCommandLine){changeCommandLineVisibility(true)
}Firebug.chrome.draw()
}},focusCommandLine:function(){var selectedPanelName=this.selectedPanel.name,panelToSelect;
if(focusCommandLineState==0||selectedPanelName!="Console"){focusCommandLineState=0;
lastFocusedPanelName=selectedPanelName;
panelToSelect="Console"
}if(focusCommandLineState==1){panelToSelect=lastFocusedPanelName
}this.selectPanel(panelToSelect);
try{if(Firebug.CommandLine){if(panelToSelect=="Console"){Firebug.CommandLine.focus()
}else{Firebug.CommandLine.blur()
}}}catch(e){}focusCommandLineState=++focusCommandLineState%2
}});
var ChromeFrameBase=extend(ChromeBase,{create:function(){ChromeBase.create.call(this);
if(isFirefox){this.node.style.display="block"
}if(Env.Options.startInNewWindow){this.close();
this.toggle(true,true);
return
}if(Env.Options.startOpened){this.open()
}else{this.close()
}},destroy:function(){removeGlobalEvent("keydown",onGlobalKeyDown);
ChromeBase.destroy.call(this);
this.document=null;
delete this.document;
this.window=null;
delete this.window;
this.node.parentNode.removeChild(this.node);
this.node=null;
delete this.node
},initialize:function(){ChromeBase.initialize.call(this);
this.addController([Firebug.browser.window,"resize",this.resize],[$("fbWindow_btClose"),"click",this.close],[$("fbWindow_btDetach"),"click",this.detach],[$("fbWindow_btDeactivate"),"click",this.deactivate]);
if(!Env.Options.enablePersistent){this.addController([Firebug.browser.window,"unload",Firebug.shutdown])
}if(noFixedPosition){this.addController([Firebug.browser.window,"scroll",this.fixIEPosition])
}fbVSplitter.onmousedown=onVSplitterMouseDown;
fbHSplitter.onmousedown=onHSplitterMouseDown;
this.isInitialized=true
},shutdown:function(){fbVSplitter.onmousedown=null;
fbHSplitter.onmousedown=null;
ChromeBase.shutdown.apply(this);
this.isInitialized=false
},reattach:function(){var frame=FirebugChrome.chromeMap.frame;
ChromeBase.reattach(FirebugChrome.chromeMap.popup,this)
},open:function(){if(!FirebugChrome.isOpen){FirebugChrome.isOpen=true;
if(Env.isChromeExtension){localStorage.setItem("Firebug","1,1")
}var node=this.node;
node.style.visibility="hidden";
if(Firebug.showIconWhenHidden){if(ChromeMini.isInitialized){ChromeMini.shutdown()
}}else{node.style.display="block"
}var main=$("fbChrome");
main.style.display="block";
var self=this;
setTimeout(function(){node.style.visibility="visible";
self.initialize();
if(noFixedPosition){self.fixIEPosition()
}self.draw()
},10)
}},close:function(){if(FirebugChrome.isOpen||!this.isInitialized){if(this.isInitialized){this.shutdown()
}FirebugChrome.isOpen=false;
if(Env.isChromeExtension){localStorage.setItem("Firebug","1,0")
}var node=this.node;
if(Firebug.showIconWhenHidden){node.style.visibility="hidden";
var main=$("fbChrome",FirebugChrome.chromeMap.frame.document);
main.style.display="none";
ChromeMini.initialize();
node.style.visibility="visible"
}else{node.style.display="none"
}}},deactivate:function(){Firebug.shutdown();
if(Env.isChromeExtension){localStorage.removeItem("Firebug");
chromeExtensionDispatch("FB_deactivate")
}},fixIEPosition:function(){var doc=this.document;
var offset=isIE?doc.body.clientTop||doc.documentElement.clientTop:0;
var size=Firebug.browser.getWindowSize();
var scroll=Firebug.browser.getWindowScrollPosition();
var maxHeight=size.height;
var height=this.node.offsetHeight;
var bodyStyle=doc.body.currentStyle;
this.node.style.top=maxHeight-height+scroll.top+"px";
if((this.type=="frame"||this.type=="div")&&(bodyStyle.marginLeft||bodyStyle.marginRight)){this.node.style.width=size.width+"px"
}if(fbVSplitterStyle){fbVSplitterStyle.right=FirebugChrome.sidePanelWidth+"px"
}this.draw()
}});
var ChromeMini=extend(Controller,{create:function(chrome){append(this,chrome);
this.type="mini"
},initialize:function(){Controller.initialize.apply(this);
var doc=FirebugChrome.chromeMap.frame.document;
var mini=$("fbMiniChrome",doc);
mini.style.display="block";
var miniIcon=$("fbMiniIcon",doc);
var width=miniIcon.offsetWidth+10;
miniIcon.title="Open "+Firebug.version;
var errors=$("fbMiniErrors",doc);
if(errors.offsetWidth){width+=errors.offsetWidth+10
}var node=this.node;
node.style.height="27px";
node.style.width=width+"px";
node.style.left="";
node.style.right=0;
if(this.node.nodeName.toLowerCase()=="iframe"){node.setAttribute("allowTransparency","true");
this.document.body.style.backgroundColor="transparent"
}else{node.style.background="transparent"
}if(noFixedPosition){this.fixIEPosition()
}this.addController([$("fbMiniIcon",doc),"click",onMiniIconClick]);
if(noFixedPosition){this.addController([Firebug.browser.window,"scroll",this.fixIEPosition])
}this.isInitialized=true
},shutdown:function(){var node=this.node;
node.style.height=FirebugChrome.height+"px";
node.style.width="100%";
node.style.left=0;
node.style.right="";
if(this.node.nodeName.toLowerCase()=="iframe"){node.setAttribute("allowTransparency","false");
this.document.body.style.backgroundColor="#fff"
}else{node.style.background="#fff"
}if(noFixedPosition){this.fixIEPosition()
}var doc=FirebugChrome.chromeMap.frame.document;
var mini=$("fbMiniChrome",doc);
mini.style.display="none";
Controller.shutdown.apply(this);
this.isInitialized=false
},draw:function(){},fixIEPosition:ChromeFrameBase.fixIEPosition});
var ChromePopupBase=extend(ChromeBase,{initialize:function(){setClass(this.document.body,"FirebugPopup");
ChromeBase.initialize.call(this);
this.addController([Firebug.chrome.window,"resize",this.resize],[Firebug.chrome.window,"unload",this.destroy]);
if(Env.Options.enablePersistent){this.persist=bind(this.persist,this);
addEvent(Firebug.browser.window,"unload",this.persist)
}else{this.addController([Firebug.browser.window,"unload",this.close])
}fbVSplitter.onmousedown=onVSplitterMouseDown
},destroy:function(){var frame=FirebugChrome.chromeMap.frame;
if(frame){dispatch(frame.panelMap,"detach",[this,frame]);
frame.reattach(this,frame)
}if(Env.Options.enablePersistent){removeEvent(Firebug.browser.window,"unload",this.persist)
}ChromeBase.destroy.apply(this);
FirebugChrome.chromeMap.popup=null;
this.node.close()
},persist:function(){persistTimeStart=new Date().getTime();
removeEvent(Firebug.browser.window,"unload",this.persist);
Firebug.Inspector.destroy();
Firebug.browser.window.FirebugOldBrowser=true;
var persistTimeStart=new Date().getTime();
var waitMainWindow=function(){var doc,head;
try{if(window.opener&&!window.opener.FirebugOldBrowser&&(doc=window.opener.document)){try{var persistDelay=new Date().getTime()-persistTimeStart;
window.Firebug=Firebug;
window.opener.Firebug=Firebug;
Env.browser=window.opener;
Firebug.browser=Firebug.context=new Context(Env.browser);
registerConsole();
var chrome=Firebug.chrome;
addEvent(Firebug.browser.window,"unload",chrome.persist);
FBL.cacheDocument();
Firebug.Inspector.create();
var htmlPanel=chrome.getPanel("HTML");
htmlPanel.createUI();
Firebug.Console.info("Firebug could not capture console calls during "+persistDelay+"ms")
}catch(pE){alert("persist error: "+(pE.message||pE))
}}else{window.setTimeout(waitMainWindow,0)
}}catch(E){window.close()
}};
waitMainWindow()
},close:function(){this.destroy()
}});
var changeCommandLineVisibility=function changeCommandLineVisibility(visibility){var last=Firebug.chrome.commandLineVisible;
var visible=Firebug.chrome.commandLineVisible=typeof visibility=="boolean"?visibility:!Firebug.chrome.commandLineVisible;
if(visible!=last){if(visible){fbBottom.className="";
if(Firebug.CommandLine){Firebug.CommandLine.activate()
}}else{if(Firebug.CommandLine){Firebug.CommandLine.deactivate()
}fbBottom.className="hide"
}}};
var changeSidePanelVisibility=function changeSidePanelVisibility(visibility){var last=Firebug.chrome.sidePanelVisible;
Firebug.chrome.sidePanelVisible=typeof visibility=="boolean"?visibility:!Firebug.chrome.sidePanelVisible;
if(Firebug.chrome.sidePanelVisible!=last){fbPanelBox2.className=Firebug.chrome.sidePanelVisible?"":"hide";
fbPanelBar2Box.className=Firebug.chrome.sidePanelVisible?"":"hide"
}};
var onGlobalKeyDown=function onGlobalKeyDown(event){var keyCode=event.keyCode;
var shiftKey=event.shiftKey;
var ctrlKey=event.ctrlKey;
if(keyCode==123&&(!isFirefox&&!shiftKey||shiftKey&&isFirefox)){Firebug.chrome.toggle(false,ctrlKey);
cancelEvent(event,true)
}else{if(keyCode==67&&ctrlKey&&shiftKey){Firebug.Inspector.toggleInspect();
cancelEvent(event,true)
}else{if(keyCode==76&&ctrlKey&&shiftKey){Firebug.chrome.focusCommandLine();
cancelEvent(event,true)
}}}};
var onMiniIconClick=function onMiniIconClick(event){Firebug.chrome.toggle(false,event.ctrlKey);
cancelEvent(event,true)
};
var onHSplitterMouseDown=function onHSplitterMouseDown(event){addGlobalEvent("mousemove",onHSplitterMouseMove);
addGlobalEvent("mouseup",onHSplitterMouseUp);
if(isIE){addEvent(Firebug.browser.document.documentElement,"mouseleave",onHSplitterMouseUp)
}fbHSplitter.className="fbOnMovingHSplitter";
return false
};
var onHSplitterMouseMove=function onHSplitterMouseMove(event){cancelEvent(event,true);
var clientY=event.clientY;
var win=isIE?event.srcElement.ownerDocument.parentWindow:event.target.ownerDocument&&event.target.ownerDocument.defaultView;
if(!win){return
}if(win!=win.parent){var frameElement=win.frameElement;
if(frameElement){var framePos=Firebug.browser.getElementPosition(frameElement).top;
clientY+=framePos;
if(frameElement.style.position!="fixed"){clientY-=Firebug.browser.getWindowScrollPosition().top
}}}if(isOpera&&isQuiksMode&&win.frameElement.id=="FirebugUI"){clientY=Firebug.browser.getWindowSize().height-win.frameElement.offsetHeight+clientY
}onHSplitterMouseMoveBuffer=clientY;
if(new Date().getTime()-lastHSplitterMouseMove>chromeRedrawSkipRate){lastHSplitterMouseMove=new Date().getTime();
handleHSplitterMouseMove()
}else{if(!onHSplitterMouseMoveTimer){onHSplitterMouseMoveTimer=setTimeout(handleHSplitterMouseMove,chromeRedrawSkipRate)
}}cancelEvent(event,true);
return false
};
var handleHSplitterMouseMove=function(){if(onHSplitterMouseMoveTimer){clearTimeout(onHSplitterMouseMoveTimer);
onHSplitterMouseMoveTimer=null
}var clientY=onHSplitterMouseMoveBuffer;
var windowSize=Firebug.browser.getWindowSize();
var scrollSize=Firebug.browser.getWindowScrollSize();
var commandLineHeight=Firebug.chrome.commandLineVisible?fbCommandLine.offsetHeight:0;
var fixedHeight=topHeight+commandLineHeight;
var chromeNode=Firebug.chrome.node;
var scrollbarSize=!isIE&&(scrollSize.width>windowSize.width)?17:0;
var height=windowSize.height;
var chromeHeight=Math.max(height-clientY+5-scrollbarSize,fixedHeight);
chromeHeight=Math.min(chromeHeight,windowSize.height-scrollbarSize);
FirebugChrome.height=chromeHeight;
chromeNode.style.height=chromeHeight+"px";
if(noFixedPosition){Firebug.chrome.fixIEPosition()
}Firebug.chrome.draw()
};
var onHSplitterMouseUp=function onHSplitterMouseUp(event){removeGlobalEvent("mousemove",onHSplitterMouseMove);
removeGlobalEvent("mouseup",onHSplitterMouseUp);
if(isIE){removeEvent(Firebug.browser.document.documentElement,"mouseleave",onHSplitterMouseUp)
}fbHSplitter.className="";
Firebug.chrome.draw();
return false
};
var onVSplitterMouseDown=function onVSplitterMouseDown(event){addGlobalEvent("mousemove",onVSplitterMouseMove);
addGlobalEvent("mouseup",onVSplitterMouseUp);
return false
};
var onVSplitterMouseMove=function onVSplitterMouseMove(event){if(new Date().getTime()-lastVSplitterMouseMove>chromeRedrawSkipRate){var target=event.target||event.srcElement;
if(target&&target.ownerDocument){var clientX=event.clientX;
var win=document.all?event.srcElement.ownerDocument.parentWindow:event.target.ownerDocument.defaultView;
if(win!=win.parent){clientX+=win.frameElement?win.frameElement.offsetLeft:0
}var size=Firebug.chrome.getSize();
var x=Math.max(size.width-clientX+3,6);
FirebugChrome.sidePanelWidth=x;
Firebug.chrome.draw()
}lastVSplitterMouseMove=new Date().getTime()
}cancelEvent(event,true);
return false
};
var onVSplitterMouseUp=function onVSplitterMouseUp(event){removeGlobalEvent("mousemove",onVSplitterMouseMove);
removeGlobalEvent("mouseup",onVSplitterMouseUp);
Firebug.chrome.draw()
}
}});
FBL.ns(function(){with(FBL){var chunker=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^[\]]*\]|['"][^'"]*['"]|[^[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,done=0,toString=Object.prototype.toString,hasDuplicate=false,baseHasDuplicate=true;
[0,0].sort(function(){baseHasDuplicate=false;
return 0
});
var Sizzle=function(selector,context,results,seed){results=results||[];
var origContext=context=context||document;
if(context.nodeType!==1&&context.nodeType!==9){return[]
}if(!selector||typeof selector!=="string"){return results
}var parts=[],m,set,checkSet,check,mode,extra,prune=true,contextXML=isXML(context),soFar=selector;
while((chunker.exec(""),m=chunker.exec(soFar))!==null){soFar=m[3];
parts.push(m[1]);
if(m[2]){extra=m[3];
break
}}if(parts.length>1&&origPOS.exec(selector)){if(parts.length===2&&Expr.relative[parts[0]]){set=posProcess(parts[0]+parts[1],context)
}else{set=Expr.relative[parts[0]]?[context]:Sizzle(parts.shift(),context);
while(parts.length){selector=parts.shift();
if(Expr.relative[selector]){selector+=parts.shift()
}set=posProcess(selector,set)
}}}else{if(!seed&&parts.length>1&&context.nodeType===9&&!contextXML&&Expr.match.ID.test(parts[0])&&!Expr.match.ID.test(parts[parts.length-1])){var ret=Sizzle.find(parts.shift(),context,contextXML);
context=ret.expr?Sizzle.filter(ret.expr,ret.set)[0]:ret.set[0]
}if(context){var ret=seed?{expr:parts.pop(),set:makeArray(seed)}:Sizzle.find(parts.pop(),parts.length===1&&(parts[0]==="~"||parts[0]==="+")&&context.parentNode?context.parentNode:context,contextXML);
set=ret.expr?Sizzle.filter(ret.expr,ret.set):ret.set;
if(parts.length>0){checkSet=makeArray(set)
}else{prune=false
}while(parts.length){var cur=parts.pop(),pop=cur;
if(!Expr.relative[cur]){cur=""
}else{pop=parts.pop()
}if(pop==null){pop=context
}Expr.relative[cur](checkSet,pop,contextXML)
}}else{checkSet=parts=[]
}}if(!checkSet){checkSet=set
}if(!checkSet){throw"Syntax error, unrecognized expression: "+(cur||selector)
}if(toString.call(checkSet)==="[object Array]"){if(!prune){results.push.apply(results,checkSet)
}else{if(context&&context.nodeType===1){for(var i=0;
checkSet[i]!=null;
i++){if(checkSet[i]&&(checkSet[i]===true||checkSet[i].nodeType===1&&contains(context,checkSet[i]))){results.push(set[i])
}}}else{for(var i=0;
checkSet[i]!=null;
i++){if(checkSet[i]&&checkSet[i].nodeType===1){results.push(set[i])
}}}}}else{makeArray(checkSet,results)
}if(extra){Sizzle(extra,origContext,results,seed);
Sizzle.uniqueSort(results)
}return results
};
Sizzle.uniqueSort=function(results){if(sortOrder){hasDuplicate=baseHasDuplicate;
results.sort(sortOrder);
if(hasDuplicate){for(var i=1;
i<results.length;
i++){if(results[i]===results[i-1]){results.splice(i--,1)
}}}}return results
};
Sizzle.matches=function(expr,set){return Sizzle(expr,null,null,set)
};
Sizzle.find=function(expr,context,isXML){var set,match;
if(!expr){return[]
}for(var i=0,l=Expr.order.length;
i<l;
i++){var type=Expr.order[i],match;
if((match=Expr.leftMatch[type].exec(expr))){var left=match[1];
match.splice(1,1);
if(left.substr(left.length-1)!=="\\"){match[1]=(match[1]||"").replace(/\\/g,"");
set=Expr.find[type](match,context,isXML);
if(set!=null){expr=expr.replace(Expr.match[type],"");
break
}}}}if(!set){set=context.getElementsByTagName("*")
}return{set:set,expr:expr}
};
Sizzle.filter=function(expr,set,inplace,not){var old=expr,result=[],curLoop=set,match,anyFound,isXMLFilter=set&&set[0]&&isXML(set[0]);
while(expr&&set.length){for(var type in Expr.filter){if((match=Expr.match[type].exec(expr))!=null){var filter=Expr.filter[type],found,item;
anyFound=false;
if(curLoop==result){result=[]
}if(Expr.preFilter[type]){match=Expr.preFilter[type](match,curLoop,inplace,result,not,isXMLFilter);
if(!match){anyFound=found=true
}else{if(match===true){continue
}}}if(match){for(var i=0;
(item=curLoop[i])!=null;
i++){if(item){found=filter(item,match,i,curLoop);
var pass=not^!!found;
if(inplace&&found!=null){if(pass){anyFound=true
}else{curLoop[i]=false
}}else{if(pass){result.push(item);
anyFound=true
}}}}}if(found!==undefined){if(!inplace){curLoop=result
}expr=expr.replace(Expr.match[type],"");
if(!anyFound){return[]
}break
}}}if(expr==old){if(anyFound==null){throw"Syntax error, unrecognized expression: "+expr
}else{break
}}old=expr
}return curLoop
};
var Expr=Sizzle.selectors={order:["ID","NAME","TAG"],match:{ID:/#((?:[\w\u00c0-\uFFFF-]|\\.)+)/,CLASS:/\.((?:[\w\u00c0-\uFFFF-]|\\.)+)/,NAME:/\[name=['"]*((?:[\w\u00c0-\uFFFF-]|\\.)+)['"]*\]/,ATTR:/\[\s*((?:[\w\u00c0-\uFFFF-]|\\.)+)\s*(?:(\S?=)\s*(['"]*)(.*?)\3|)\s*\]/,TAG:/^((?:[\w\u00c0-\uFFFF\*-]|\\.)+)/,CHILD:/:(only|nth|last|first)-child(?:\((even|odd|[\dn+-]*)\))?/,POS:/:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^-]|$)/,PSEUDO:/:((?:[\w\u00c0-\uFFFF-]|\\.)+)(?:\((['"]*)((?:\([^\)]+\)|[^\2\(\)]*)+)\2\))?/},leftMatch:{},attrMap:{"class":"className","for":"htmlFor"},attrHandle:{href:function(elem){return elem.getAttribute("href")
}},relative:{"+":function(checkSet,part,isXML){var isPartStr=typeof part==="string",isTag=isPartStr&&!/\W/.test(part),isPartStrNotTag=isPartStr&&!isTag;
if(isTag&&!isXML){part=part.toUpperCase()
}for(var i=0,l=checkSet.length,elem;
i<l;
i++){if((elem=checkSet[i])){while((elem=elem.previousSibling)&&elem.nodeType!==1){}checkSet[i]=isPartStrNotTag||elem&&elem.nodeName===part?elem||false:elem===part
}}if(isPartStrNotTag){Sizzle.filter(part,checkSet,true)
}},">":function(checkSet,part,isXML){var isPartStr=typeof part==="string";
if(isPartStr&&!/\W/.test(part)){part=isXML?part:part.toUpperCase();
for(var i=0,l=checkSet.length;
i<l;
i++){var elem=checkSet[i];
if(elem){var parent=elem.parentNode;
checkSet[i]=parent.nodeName===part?parent:false
}}}else{for(var i=0,l=checkSet.length;
i<l;
i++){var elem=checkSet[i];
if(elem){checkSet[i]=isPartStr?elem.parentNode:elem.parentNode===part
}}if(isPartStr){Sizzle.filter(part,checkSet,true)
}}},"":function(checkSet,part,isXML){var doneName=done++,checkFn=dirCheck;
if(!/\W/.test(part)){var nodeCheck=part=isXML?part:part.toUpperCase();
checkFn=dirNodeCheck
}checkFn("parentNode",part,doneName,checkSet,nodeCheck,isXML)
},"~":function(checkSet,part,isXML){var doneName=done++,checkFn=dirCheck;
if(typeof part==="string"&&!/\W/.test(part)){var nodeCheck=part=isXML?part:part.toUpperCase();
checkFn=dirNodeCheck
}checkFn("previousSibling",part,doneName,checkSet,nodeCheck,isXML)
}},find:{ID:function(match,context,isXML){if(typeof context.getElementById!=="undefined"&&!isXML){var m=context.getElementById(match[1]);
return m?[m]:[]
}},NAME:function(match,context,isXML){if(typeof context.getElementsByName!=="undefined"){var ret=[],results=context.getElementsByName(match[1]);
for(var i=0,l=results.length;
i<l;
i++){if(results[i].getAttribute("name")===match[1]){ret.push(results[i])
}}return ret.length===0?null:ret
}},TAG:function(match,context){return context.getElementsByTagName(match[1])
}},preFilter:{CLASS:function(match,curLoop,inplace,result,not,isXML){match=" "+match[1].replace(/\\/g,"")+" ";
if(isXML){return match
}for(var i=0,elem;
(elem=curLoop[i])!=null;
i++){if(elem){if(not^(elem.className&&(" "+elem.className+" ").indexOf(match)>=0)){if(!inplace){result.push(elem)
}}else{if(inplace){curLoop[i]=false
}}}}return false
},ID:function(match){return match[1].replace(/\\/g,"")
},TAG:function(match,curLoop){for(var i=0;
curLoop[i]===false;
i++){}return curLoop[i]&&isXML(curLoop[i])?match[1]:match[1].toUpperCase()
},CHILD:function(match){if(match[1]=="nth"){var test=/(-?)(\d*)n((?:\+|-)?\d*)/.exec(match[2]=="even"&&"2n"||match[2]=="odd"&&"2n+1"||!/\D/.test(match[2])&&"0n+"+match[2]||match[2]);
match[2]=(test[1]+(test[2]||1))-0;
match[3]=test[3]-0
}match[0]=done++;
return match
},ATTR:function(match,curLoop,inplace,result,not,isXML){var name=match[1].replace(/\\/g,"");
if(!isXML&&Expr.attrMap[name]){match[1]=Expr.attrMap[name]
}if(match[2]==="~="){match[4]=" "+match[4]+" "
}return match
},PSEUDO:function(match,curLoop,inplace,result,not){if(match[1]==="not"){if((chunker.exec(match[3])||"").length>1||/^\w/.test(match[3])){match[3]=Sizzle(match[3],null,null,curLoop)
}else{var ret=Sizzle.filter(match[3],curLoop,inplace,true^not);
if(!inplace){result.push.apply(result,ret)
}return false
}}else{if(Expr.match.POS.test(match[0])||Expr.match.CHILD.test(match[0])){return true
}}return match
},POS:function(match){match.unshift(true);
return match
}},filters:{enabled:function(elem){return elem.disabled===false&&elem.type!=="hidden"
},disabled:function(elem){return elem.disabled===true
},checked:function(elem){return elem.checked===true
},selected:function(elem){elem.parentNode.selectedIndex;
return elem.selected===true
},parent:function(elem){return !!elem.firstChild
},empty:function(elem){return !elem.firstChild
},has:function(elem,i,match){return !!Sizzle(match[3],elem).length
},header:function(elem){return/h\d/i.test(elem.nodeName)
},text:function(elem){return"text"===elem.type
},radio:function(elem){return"radio"===elem.type
},checkbox:function(elem){return"checkbox"===elem.type
},file:function(elem){return"file"===elem.type
},password:function(elem){return"password"===elem.type
},submit:function(elem){return"submit"===elem.type
},image:function(elem){return"image"===elem.type
},reset:function(elem){return"reset"===elem.type
},button:function(elem){return"button"===elem.type||elem.nodeName.toUpperCase()==="BUTTON"
},input:function(elem){return/input|select|textarea|button/i.test(elem.nodeName)
}},setFilters:{first:function(elem,i){return i===0
},last:function(elem,i,match,array){return i===array.length-1
},even:function(elem,i){return i%2===0
},odd:function(elem,i){return i%2===1
},lt:function(elem,i,match){return i<match[3]-0
},gt:function(elem,i,match){return i>match[3]-0
},nth:function(elem,i,match){return match[3]-0==i
},eq:function(elem,i,match){return match[3]-0==i
}},filter:{PSEUDO:function(elem,match,i,array){var name=match[1],filter=Expr.filters[name];
if(filter){return filter(elem,i,match,array)
}else{if(name==="contains"){return(elem.textContent||elem.innerText||"").indexOf(match[3])>=0
}else{if(name==="not"){var not=match[3];
for(var i=0,l=not.length;
i<l;
i++){if(not[i]===elem){return false
}}return true
}}}},CHILD:function(elem,match){var type=match[1],node=elem;
switch(type){case"only":case"first":while((node=node.previousSibling)){if(node.nodeType===1){return false
}}if(type=="first"){return true
}node=elem;
case"last":while((node=node.nextSibling)){if(node.nodeType===1){return false
}}return true;
case"nth":var first=match[2],last=match[3];
if(first==1&&last==0){return true
}var doneName=match[0],parent=elem.parentNode;
if(parent&&(parent.sizcache!==doneName||!elem.nodeIndex)){var count=0;
for(node=parent.firstChild;
node;
node=node.nextSibling){if(node.nodeType===1){node.nodeIndex=++count
}}parent.sizcache=doneName
}var diff=elem.nodeIndex-last;
if(first==0){return diff==0
}else{return(diff%first==0&&diff/first>=0)
}}},ID:function(elem,match){return elem.nodeType===1&&elem.getAttribute("id")===match
},TAG:function(elem,match){return(match==="*"&&elem.nodeType===1)||elem.nodeName===match
},CLASS:function(elem,match){return(" "+(elem.className||elem.getAttribute("class"))+" ").indexOf(match)>-1
},ATTR:function(elem,match){var name=match[1],result=Expr.attrHandle[name]?Expr.attrHandle[name](elem):elem[name]!=null?elem[name]:elem.getAttribute(name),value=result+"",type=match[2],check=match[4];
return result==null?type==="!=":type==="="?value===check:type==="*="?value.indexOf(check)>=0:type==="~="?(" "+value+" ").indexOf(check)>=0:!check?value&&result!==false:type==="!="?value!=check:type==="^="?value.indexOf(check)===0:type==="$="?value.substr(value.length-check.length)===check:type==="|="?value===check||value.substr(0,check.length+1)===check+"-":false
},POS:function(elem,match,i,array){var name=match[2],filter=Expr.setFilters[name];
if(filter){return filter(elem,i,match,array)
}}}};
var origPOS=Expr.match.POS;
for(var type in Expr.match){Expr.match[type]=new RegExp(Expr.match[type].source+/(?![^\[]*\])(?![^\(]*\))/.source);
Expr.leftMatch[type]=new RegExp(/(^(?:.|\r|\n)*?)/.source+Expr.match[type].source)
}var makeArray=function(array,results){array=Array.prototype.slice.call(array,0);
if(results){results.push.apply(results,array);
return results
}return array
};
try{Array.prototype.slice.call(document.documentElement.childNodes,0)
}catch(e){makeArray=function(array,results){var ret=results||[];
if(toString.call(array)==="[object Array]"){Array.prototype.push.apply(ret,array)
}else{if(typeof array.length==="number"){for(var i=0,l=array.length;
i<l;
i++){ret.push(array[i])
}}else{for(var i=0;
array[i];
i++){ret.push(array[i])
}}}return ret
}
}var sortOrder;
if(document.documentElement.compareDocumentPosition){sortOrder=function(a,b){if(!a.compareDocumentPosition||!b.compareDocumentPosition){if(a==b){hasDuplicate=true
}return 0
}var ret=a.compareDocumentPosition(b)&4?-1:a===b?0:1;
if(ret===0){hasDuplicate=true
}return ret
}
}else{if("sourceIndex" in document.documentElement){sortOrder=function(a,b){if(!a.sourceIndex||!b.sourceIndex){if(a==b){hasDuplicate=true
}return 0
}var ret=a.sourceIndex-b.sourceIndex;
if(ret===0){hasDuplicate=true
}return ret
}
}else{if(document.createRange){sortOrder=function(a,b){if(!a.ownerDocument||!b.ownerDocument){if(a==b){hasDuplicate=true
}return 0
}var aRange=a.ownerDocument.createRange(),bRange=b.ownerDocument.createRange();
aRange.setStart(a,0);
aRange.setEnd(a,0);
bRange.setStart(b,0);
bRange.setEnd(b,0);
var ret=aRange.compareBoundaryPoints(Range.START_TO_END,bRange);
if(ret===0){hasDuplicate=true
}return ret
}
}}}(function(){var form=document.createElement("div"),id="script"+(new Date).getTime();
form.innerHTML="<a name='"+id+"'/>";
var root=document.documentElement;
root.insertBefore(form,root.firstChild);
if(!!document.getElementById(id)){Expr.find.ID=function(match,context,isXML){if(typeof context.getElementById!=="undefined"&&!isXML){var m=context.getElementById(match[1]);
return m?m.id===match[1]||typeof m.getAttributeNode!=="undefined"&&m.getAttributeNode("id").nodeValue===match[1]?[m]:undefined:[]
}};
Expr.filter.ID=function(elem,match){var node=typeof elem.getAttributeNode!=="undefined"&&elem.getAttributeNode("id");
return elem.nodeType===1&&node&&node.nodeValue===match
}
}root.removeChild(form);
root=form=null
})();
(function(){var div=document.createElement("div");
div.appendChild(document.createComment(""));
if(div.getElementsByTagName("*").length>0){Expr.find.TAG=function(match,context){var results=context.getElementsByTagName(match[1]);
if(match[1]==="*"){var tmp=[];
for(var i=0;
results[i];
i++){if(results[i].nodeType===1){tmp.push(results[i])
}}results=tmp
}return results
}
}div.innerHTML="<a href='#'></a>";
if(div.firstChild&&typeof div.firstChild.getAttribute!=="undefined"&&div.firstChild.getAttribute("href")!=="#"){Expr.attrHandle.href=function(elem){return elem.getAttribute("href",2)
}
}div=null
})();
if(document.querySelectorAll){(function(){var oldSizzle=Sizzle,div=document.createElement("div");
div.innerHTML="<p class='TEST'></p>";
if(div.querySelectorAll&&div.querySelectorAll(".TEST").length===0){return
}Sizzle=function(query,context,extra,seed){context=context||document;
if(!seed&&context.nodeType===9&&!isXML(context)){try{return makeArray(context.querySelectorAll(query),extra)
}catch(e){}}return oldSizzle(query,context,extra,seed)
};
for(var prop in oldSizzle){Sizzle[prop]=oldSizzle[prop]
}div=null
})()
}if(document.getElementsByClassName&&document.documentElement.getElementsByClassName){(function(){var div=document.createElement("div");
div.innerHTML="<div class='test e'></div><div class='test'></div>";
if(div.getElementsByClassName("e").length===0){return
}div.lastChild.className="e";
if(div.getElementsByClassName("e").length===1){return
}Expr.order.splice(1,0,"CLASS");
Expr.find.CLASS=function(match,context,isXML){if(typeof context.getElementsByClassName!=="undefined"&&!isXML){return context.getElementsByClassName(match[1])
}};
div=null
})()
}function dirNodeCheck(dir,cur,doneName,checkSet,nodeCheck,isXML){var sibDir=dir=="previousSibling"&&!isXML;
for(var i=0,l=checkSet.length;
i<l;
i++){var elem=checkSet[i];
if(elem){if(sibDir&&elem.nodeType===1){elem.sizcache=doneName;
elem.sizset=i
}elem=elem[dir];
var match=false;
while(elem){if(elem.sizcache===doneName){match=checkSet[elem.sizset];
break
}if(elem.nodeType===1&&!isXML){elem.sizcache=doneName;
elem.sizset=i
}if(elem.nodeName===cur){match=elem;
break
}elem=elem[dir]
}checkSet[i]=match
}}}function dirCheck(dir,cur,doneName,checkSet,nodeCheck,isXML){var sibDir=dir=="previousSibling"&&!isXML;
for(var i=0,l=checkSet.length;
i<l;
i++){var elem=checkSet[i];
if(elem){if(sibDir&&elem.nodeType===1){elem.sizcache=doneName;
elem.sizset=i
}elem=elem[dir];
var match=false;
while(elem){if(elem.sizcache===doneName){match=checkSet[elem.sizset];
break
}if(elem.nodeType===1){if(!isXML){elem.sizcache=doneName;
elem.sizset=i
}if(typeof cur!=="string"){if(elem===cur){match=true;
break
}}else{if(Sizzle.filter(cur,[elem]).length>0){match=elem;
break
}}}elem=elem[dir]
}checkSet[i]=match
}}}var contains=document.compareDocumentPosition?function(a,b){return a.compareDocumentPosition(b)&16
}:function(a,b){return a!==b&&(a.contains?a.contains(b):true)
};
var isXML=function(elem){return elem.nodeType===9&&elem.documentElement.nodeName!=="HTML"||!!elem.ownerDocument&&elem.ownerDocument.documentElement.nodeName!=="HTML"
};
var posProcess=function(selector,context){var tmpSet=[],later="",match,root=context.nodeType?[context]:context;
while((match=Expr.match.PSEUDO.exec(selector))){later+=match[0];
selector=selector.replace(Expr.match.PSEUDO,"")
}selector=Expr.relative[selector]?selector+"*":selector;
for(var i=0,l=root.length;
i<l;
i++){Sizzle(selector,root[i],tmpSet)
}return Sizzle.filter(later,tmpSet)
};
Firebug.Selector=Sizzle
}});
function DomplateTag(tagName){this.tagName=tagName
}function DomplateEmbed(){}function DomplateLoop(){}(function(){var womb=null;
var domplate=FBL.domplate=function(){var lastSubject;
for(var i=0;
i<arguments.length;
++i){lastSubject=lastSubject?copyObject(lastSubject,arguments[i]):arguments[i]
}for(var name in lastSubject){var val=lastSubject[name];
if(isTag(val)){val.tag.subject=lastSubject
}}return lastSubject
};
domplate.context=function(context,fn){var lastContext=domplate.lastContext;
domplate.topContext=context;
fn.apply(context);
domplate.topContext=lastContext
};
FBL.TAG=function(){var embed=new DomplateEmbed();
return embed.merge(arguments)
};
FBL.FOR=function(){var loop=new DomplateLoop();
return loop.merge(arguments)
};
DomplateTag.prototype={merge:function(args,oldTag){if(oldTag){this.tagName=oldTag.tagName
}this.context=oldTag?oldTag.context:null;
this.subject=oldTag?oldTag.subject:null;
this.attrs=oldTag?copyObject(oldTag.attrs):{};
this.classes=oldTag?copyObject(oldTag.classes):{};
this.props=oldTag?copyObject(oldTag.props):null;
this.listeners=oldTag?copyArray(oldTag.listeners):null;
this.children=oldTag?copyArray(oldTag.children):[];
this.vars=oldTag?copyArray(oldTag.vars):[];
var attrs=args.length?args[0]:null;
var hasAttrs=typeof(attrs)=="object"&&!isTag(attrs);
this.children=[];
if(domplate.topContext){this.context=domplate.topContext
}if(args.length){parseChildren(args,hasAttrs?1:0,this.vars,this.children)
}if(hasAttrs){this.parseAttrs(attrs)
}return creator(this,DomplateTag)
},parseAttrs:function(args){for(var name in args){var val=parseValue(args[name]);
readPartNames(val,this.vars);
if(name.indexOf("on")==0){var eventName=name.substr(2);
if(!this.listeners){this.listeners=[]
}this.listeners.push(eventName,val)
}else{if(name.indexOf("_")==0){var propName=name.substr(1);
if(!this.props){this.props={}
}this.props[propName]=val
}else{if(name.indexOf("$")==0){var className=name.substr(1);
if(!this.classes){this.classes={}
}this.classes[className]=val
}else{if(name=="class"&&this.attrs.hasOwnProperty(name)){this.attrs[name]+=" "+val
}else{this.attrs[name]=val
}}}}}},compile:function(){if(this.renderMarkup){return
}this.compileMarkup();
this.compileDOM()
},compileMarkup:function(){this.markupArgs=[];
var topBlock=[],topOuts=[],blocks=[],info={args:this.markupArgs,argIndex:0};
this.generateMarkup(topBlock,topOuts,blocks,info);
this.addCode(topBlock,topOuts,blocks);
var fnBlock=["r=(function (__code__, __context__, __in__, __out__"];
for(var i=0;
i<info.argIndex;
++i){fnBlock.push(", s",i)
}fnBlock.push(") {");
if(this.subject){fnBlock.push("with (this) {")
}if(this.context){fnBlock.push("with (__context__) {")
}fnBlock.push("with (__in__) {");
fnBlock.push.apply(fnBlock,blocks);
if(this.subject){fnBlock.push("}")
}if(this.context){fnBlock.push("}")
}fnBlock.push("}})");
function __link__(tag,code,outputs,args){if(!tag||!tag.tag){return
}tag.tag.compile();
var tagOutputs=[];
var markupArgs=[code,tag.tag.context,args,tagOutputs];
markupArgs.push.apply(markupArgs,tag.tag.markupArgs);
tag.tag.renderMarkup.apply(tag.tag.subject,markupArgs);
outputs.push(tag);
outputs.push(tagOutputs)
}function __escape__(value){function replaceChars(ch){switch(ch){case"<":return"<";
case">":return">";
case"&":return"&";
case"'":return"'";
case'"':return"""
}return"?"
}return String(value).replace(/[<>&"']/g,replaceChars)
}function __loop__(iter,outputs,fn){var iterOuts=[];
outputs.push(iterOuts);
if(iter instanceof Array){iter=new ArrayIterator(iter)
}try{while(1){var value=iter.next();
var itemOuts=[0,0];
iterOuts.push(itemOuts);
fn.apply(this,[value,itemOuts])
}}catch(exc){if(exc!=StopIteration){throw exc
}}}var js=fnBlock.join("");
var r=null;
eval(js);
this.renderMarkup=r
},getVarNames:function(args){if(this.vars){args.push.apply(args,this.vars)
}for(var i=0;
i<this.children.length;
++i){var child=this.children[i];
if(isTag(child)){child.tag.getVarNames(args)
}else{if(child instanceof Parts){for(var i=0;
i<child.parts.length;
++i){if(child.parts[i] instanceof Variable){var name=child.parts[i].name;
var names=name.split(".");
args.push(names[0])
}}}}}},generateMarkup:function(topBlock,topOuts,blocks,info){topBlock.push(',"<',this.tagName,'"');
for(var name in this.attrs){if(name!="class"){var val=this.attrs[name];
topBlock.push(', " ',name,'=\\""');
addParts(val,",",topBlock,info,true);
topBlock.push(', "\\""')
}}if(this.listeners){for(var i=0;
i<this.listeners.length;
i+=2){readPartNames(this.listeners[i+1],topOuts)
}}if(this.props){for(var name in this.props){readPartNames(this.props[name],topOuts)
}}if(this.attrs.hasOwnProperty("class")||this.classes){topBlock.push(', " class=\\""');
if(this.attrs.hasOwnProperty("class")){addParts(this.attrs["class"],",",topBlock,info,true)
}topBlock.push(', " "');
for(var name in this.classes){topBlock.push(", (");
addParts(this.classes[name],"",topBlock,info);
topBlock.push(' ? "',name,'" + " " : "")')
}topBlock.push(', "\\""')
}topBlock.push(',">"');
this.generateChildMarkup(topBlock,topOuts,blocks,info);
topBlock.push(',"</',this.tagName,'>"')
},generateChildMarkup:function(topBlock,topOuts,blocks,info){for(var i=0;
i<this.children.length;
++i){var child=this.children[i];
if(isTag(child)){child.tag.generateMarkup(topBlock,topOuts,blocks,info)
}else{addParts(child,",",topBlock,info,true)
}}},addCode:function(topBlock,topOuts,blocks){if(topBlock.length){blocks.push('__code__.push(""',topBlock.join(""),");")
}if(topOuts.length){blocks.push("__out__.push(",topOuts.join(","),");")
}topBlock.splice(0,topBlock.length);
topOuts.splice(0,topOuts.length)
},addLocals:function(blocks){var varNames=[];
this.getVarNames(varNames);
var map={};
for(var i=0;
i<varNames.length;
++i){var name=varNames[i];
if(map.hasOwnProperty(name)){continue
}map[name]=1;
var names=name.split(".");
blocks.push("var ",names[0]+" = __in__."+names[0]+";")
}},compileDOM:function(){var path=[];
var blocks=[];
this.domArgs=[];
path.embedIndex=0;
path.loopIndex=0;
path.staticIndex=0;
path.renderIndex=0;
var nodeCount=this.generateDOM(path,blocks,this.domArgs);
var fnBlock=["r=(function (root, context, o"];
for(var i=0;
i<path.staticIndex;
++i){fnBlock.push(", ","s"+i)
}for(var i=0;
i<path.renderIndex;
++i){fnBlock.push(", ","d"+i)
}fnBlock.push(") {");
for(var i=0;
i<path.loopIndex;
++i){fnBlock.push("var l",i," = 0;")
}for(var i=0;
i<path.embedIndex;
++i){fnBlock.push("var e",i," = 0;")
}if(this.subject){fnBlock.push("with (this) {")
}if(this.context){fnBlock.push("with (context) {")
}fnBlock.push(blocks.join(""));
if(this.subject){fnBlock.push("}")
}if(this.context){fnBlock.push("}")
}fnBlock.push("return ",nodeCount,";");
fnBlock.push("})");
function __bind__(object,fn){return function(event){return fn.apply(object,[event])
}
}function __link__(node,tag,args){if(!tag||!tag.tag){return
}tag.tag.compile();
var domArgs=[node,tag.tag.context,0];
domArgs.push.apply(domArgs,tag.tag.domArgs);
domArgs.push.apply(domArgs,args);
return tag.tag.renderDOM.apply(tag.tag.subject,domArgs)
}var self=this;
function __loop__(iter,fn){var nodeCount=0;
for(var i=0;
i<iter.length;
++i){iter[i][0]=i;
iter[i][1]=nodeCount;
nodeCount+=fn.apply(this,iter[i])
}return nodeCount
}function __path__(parent,offset){var root=parent;
for(var i=2;
i<arguments.length;
++i){var index=arguments[i];
if(i==3){index+=offset
}if(index==-1){parent=parent.parentNode
}else{parent=parent.childNodes[index]
}}return parent
}var js=fnBlock.join("");
var r=null;
eval(js);
this.renderDOM=r
},generateDOM:function(path,blocks,args){if(this.listeners||this.props){this.generateNodePath(path,blocks)
}if(this.listeners){for(var i=0;
i<this.listeners.length;
i+=2){var val=this.listeners[i+1];
var arg=generateArg(val,path,args);
blocks.push('addEvent(node, "',this.listeners[i],'", __bind__(this, ',arg,"), false);")
}}if(this.props){for(var name in this.props){var val=this.props[name];
var arg=generateArg(val,path,args);
blocks.push("node.",name," = ",arg,";")
}}this.generateChildDOM(path,blocks,args);
return 1
},generateNodePath:function(path,blocks){blocks.push("var node = __path__(root, o");
for(var i=0;
i<path.length;
++i){blocks.push(",",path[i])
}blocks.push(");")
},generateChildDOM:function(path,blocks,args){path.push(0);
for(var i=0;
i<this.children.length;
++i){var child=this.children[i];
if(isTag(child)){path[path.length-1]+="+"+child.tag.generateDOM(path,blocks,args)
}else{path[path.length-1]+="+1"
}}path.pop()
}};
DomplateEmbed.prototype=copyObject(DomplateTag.prototype,{merge:function(args,oldTag){this.value=oldTag?oldTag.value:parseValue(args[0]);
this.attrs=oldTag?oldTag.attrs:{};
this.vars=oldTag?copyArray(oldTag.vars):[];
var attrs=args[1];
for(var name in attrs){var val=parseValue(attrs[name]);
this.attrs[name]=val;
readPartNames(val,this.vars)
}return creator(this,DomplateEmbed)
},getVarNames:function(names){if(this.value instanceof Parts){names.push(this.value.parts[0].name)
}if(this.vars){names.push.apply(names,this.vars)
}},generateMarkup:function(topBlock,topOuts,blocks,info){this.addCode(topBlock,topOuts,blocks);
blocks.push("__link__(");
addParts(this.value,"",blocks,info);
blocks.push(", __code__, __out__, {");
var lastName=null;
for(var name in this.attrs){if(lastName){blocks.push(",")
}lastName=name;
var val=this.attrs[name];
blocks.push('"',name,'":');
addParts(val,"",blocks,info)
}blocks.push("});")
},generateDOM:function(path,blocks,args){var embedName="e"+path.embedIndex++;
this.generateNodePath(path,blocks);
var valueName="d"+path.renderIndex++;
var argsName="d"+path.renderIndex++;
blocks.push(embedName+" = __link__(node, ",valueName,", ",argsName,");");
return embedName
}});
DomplateLoop.prototype=copyObject(DomplateTag.prototype,{merge:function(args,oldTag){this.varName=oldTag?oldTag.varName:args[0];
this.iter=oldTag?oldTag.iter:parseValue(args[1]);
this.vars=[];
this.children=oldTag?copyArray(oldTag.children):[];
var offset=Math.min(args.length,2);
parseChildren(args,offset,this.vars,this.children);
return creator(this,DomplateLoop)
},getVarNames:function(names){if(this.iter instanceof Parts){names.push(this.iter.parts[0].name)
}DomplateTag.prototype.getVarNames.apply(this,[names])
},generateMarkup:function(topBlock,topOuts,blocks,info){this.addCode(topBlock,topOuts,blocks);
var iterName;
if(this.iter instanceof Parts){var part=this.iter.parts[0];
iterName=part.name;
if(part.format){for(var i=0;
i<part.format.length;
++i){iterName=part.format[i]+"("+iterName+")"
}}}else{iterName=this.iter
}blocks.push("__loop__.apply(this, [",iterName,", __out__, function(",this.varName,", __out__) {");
this.generateChildMarkup(topBlock,topOuts,blocks,info);
this.addCode(topBlock,topOuts,blocks);
blocks.push("}]);")
},generateDOM:function(path,blocks,args){var iterName="d"+path.renderIndex++;
var counterName="i"+path.loopIndex;
var loopName="l"+path.loopIndex++;
if(!path.length){path.push(-1,0)
}var preIndex=path.renderIndex;
path.renderIndex=0;
var nodeCount=0;
var subBlocks=[];
var basePath=path[path.length-1];
for(var i=0;
i<this.children.length;
++i){path[path.length-1]=basePath+"+"+loopName+"+"+nodeCount;
var child=this.children[i];
if(isTag(child)){nodeCount+="+"+child.tag.generateDOM(path,subBlocks,args)
}else{nodeCount+="+1"
}}path[path.length-1]=basePath+"+"+loopName;
blocks.push(loopName," = __loop__.apply(this, [",iterName,", function(",counterName,",",loopName);
for(var i=0;
i<path.renderIndex;
++i){blocks.push(",d"+i)
}blocks.push(") {");
blocks.push(subBlocks.join(""));
blocks.push("return ",nodeCount,";");
blocks.push("}]);");
path.renderIndex=preIndex;
return loopName
}});
function Variable(name,format){this.name=name;
this.format=format
}function Parts(parts){this.parts=parts
}function parseParts(str){var re=/\$([_A-Za-z][_A-Za-z0-9.|]*)/g;
var index=0;
var parts=[];
var m;
while(m=re.exec(str)){var pre=str.substr(index,(re.lastIndex-m[0].length)-index);
if(pre){parts.push(pre)
}var expr=m[1].split("|");
parts.push(new Variable(expr[0],expr.slice(1)));
index=re.lastIndex
}if(!index){return str
}var post=str.substr(index);
if(post){parts.push(post)
}return new Parts(parts)
}function parseValue(val){return typeof(val)=="string"?parseParts(val):val
}function parseChildren(args,offset,vars,children){for(var i=offset;
i<args.length;
++i){var val=parseValue(args[i]);
children.push(val);
readPartNames(val,vars)
}}function readPartNames(val,vars){if(val instanceof Parts){for(var i=0;
i<val.parts.length;
++i){var part=val.parts[i];
if(part instanceof Variable){vars.push(part.name)
}}}}function generateArg(val,path,args){if(val instanceof Parts){var vals=[];
for(var i=0;
i<val.parts.length;
++i){var part=val.parts[i];
if(part instanceof Variable){var varName="d"+path.renderIndex++;
if(part.format){for(var j=0;
j<part.format.length;
++j){varName=part.format[j]+"("+varName+")"
}}vals.push(varName)
}else{vals.push('"'+part.replace(/"/g,'\\"')+'"')
}}return vals.join("+")
}else{args.push(val);
return"s"+path.staticIndex++
}}function addParts(val,delim,block,info,escapeIt){var vals=[];
if(val instanceof Parts){for(var i=0;
i<val.parts.length;
++i){var part=val.parts[i];
if(part instanceof Variable){var partName=part.name;
if(part.format){for(var j=0;
j<part.format.length;
++j){partName=part.format[j]+"("+partName+")"
}}if(escapeIt){vals.push("__escape__("+partName+")")
}else{vals.push(partName)
}}else{vals.push('"'+part+'"')
}}}else{if(isTag(val)){info.args.push(val);
vals.push("s"+info.argIndex++)
}else{vals.push('"'+val+'"')
}}var parts=vals.join(delim);
if(parts){block.push(delim,parts)
}}function isTag(obj){return(typeof(obj)=="function"||obj instanceof Function)&&!!obj.tag
}function creator(tag,cons){var fn=new Function("var tag = arguments.callee.tag;var cons = arguments.callee.cons;var newTag = new cons();return newTag.merge(arguments, tag);");
fn.tag=tag;
fn.cons=cons;
extend(fn,Renderer);
return fn
}function copyArray(oldArray){var ary=[];
if(oldArray){for(var i=0;
i<oldArray.length;
++i){ary.push(oldArray[i])
}}return ary
}function copyObject(l,r){var m={};
extend(m,l);
extend(m,r);
return m
}function extend(l,r){for(var n in r){l[n]=r[n]
}}function addEvent(object,name,handler){if(document.all){object.attachEvent("on"+name,handler)
}else{object.addEventListener(name,handler,false)
}}function ArrayIterator(array){var index=-1;
this.next=function(){if(++index>=array.length){throw StopIteration
}return array[index]
}
}function StopIteration(){}FBL.$break=function(){throw StopIteration
};
var Renderer={renderHTML:function(args,outputs,self){var code=[];
var markupArgs=[code,this.tag.context,args,outputs];
markupArgs.push.apply(markupArgs,this.tag.markupArgs);
this.tag.renderMarkup.apply(self?self:this.tag.subject,markupArgs);
return code.join("")
},insertRows:function(args,before,self){this.tag.compile();
var outputs=[];
var html=this.renderHTML(args,outputs,self);
var doc=before.ownerDocument;
var div=doc.createElement("div");
div.innerHTML="<table><tbody>"+html+"</tbody></table>";
var tbody=div.firstChild.firstChild;
var parent=before.tagName=="TR"?before.parentNode:before;
var after=before.tagName=="TR"?before.nextSibling:null;
var firstRow=tbody.firstChild,lastRow;
while(tbody.firstChild){lastRow=tbody.firstChild;
if(after){parent.insertBefore(lastRow,after)
}else{parent.appendChild(lastRow)
}}var offset=0;
if(before.tagName=="TR"){var node=firstRow.parentNode.firstChild;
for(;
node&&node!=firstRow;
node=node.nextSibling){++offset
}}var domArgs=[firstRow,this.tag.context,offset];
domArgs.push.apply(domArgs,this.tag.domArgs);
domArgs.push.apply(domArgs,outputs);
this.tag.renderDOM.apply(self?self:this.tag.subject,domArgs);
return[firstRow,lastRow]
},insertBefore:function(args,before,self){return this.insertNode(args,before.ownerDocument,before,false,self)
},insertAfter:function(args,after,self){return this.insertNode(args,after.ownerDocument,after,true,self)
},insertNode:function(args,doc,element,isAfter,self){if(!args){args={}
}this.tag.compile();
var outputs=[];
var html=this.renderHTML(args,outputs,self);
var doc=element.ownerDocument;
if(!womb||womb.ownerDocument!=doc){womb=doc.createElement("div")
}womb.innerHTML=html;
var root=womb.firstChild;
if(isAfter){while(womb.firstChild){if(element.nextSibling){element.parentNode.insertBefore(womb.firstChild,element.nextSibling)
}else{element.parentNode.appendChild(womb.firstChild)
}}}else{while(womb.lastChild){element.parentNode.insertBefore(womb.lastChild,element)
}}var domArgs=[root,this.tag.context,0];
domArgs.push.apply(domArgs,this.tag.domArgs);
domArgs.push.apply(domArgs,outputs);
this.tag.renderDOM.apply(self?self:this.tag.subject,domArgs);
return root
},replace:function(args,parent,self){this.tag.compile();
var outputs=[];
var html=this.renderHTML(args,outputs,self);
var root;
if(parent.nodeType==1){parent.innerHTML=html;
root=parent.firstChild
}else{if(!parent||parent.nodeType!=9){parent=document
}if(!womb||womb.ownerDocument!=parent){womb=parent.createElement("div")
}womb.innerHTML=html;
root=womb.firstChild
}var domArgs=[root,this.tag.context,0];
domArgs.push.apply(domArgs,this.tag.domArgs);
domArgs.push.apply(domArgs,outputs);
this.tag.renderDOM.apply(self?self:this.tag.subject,domArgs);
return root
},append:function(args,parent,self){this.tag.compile();
var outputs=[];
var html=this.renderHTML(args,outputs,self);
if(!womb||womb.ownerDocument!=parent.ownerDocument){womb=parent.ownerDocument.createElement("div")
}womb.innerHTML=html;
var root=womb.firstChild;
while(womb.firstChild){parent.appendChild(womb.firstChild)
}womb=null;
var domArgs=[root,this.tag.context,0];
domArgs.push.apply(domArgs,this.tag.domArgs);
domArgs.push.apply(domArgs,outputs);
this.tag.renderDOM.apply(self?self:this.tag.subject,domArgs);
return root
}};
function defineTags(){for(var i=0;
i<arguments.length;
++i){var tagName=arguments[i];
var fn=new Function("var newTag = new arguments.callee.DomplateTag('"+tagName+"'); return newTag.merge(arguments);");
fn.DomplateTag=DomplateTag;
var fnName=tagName.toUpperCase();
FBL[fnName]=fn
}}defineTags("a","button","br","canvas","code","col","colgroup","div","fieldset","form","h1","h2","h3","hr","img","input","label","legend","li","ol","optgroup","option","p","pre","select","span","strong","table","tbody","td","textarea","tfoot","th","thead","tr","tt","ul","iframe")
})();
var FirebugReps=FBL.ns(function(){with(FBL){var OBJECTBOX=this.OBJECTBOX=SPAN({"class":"objectBox objectBox-$className"});
var OBJECTBLOCK=this.OBJECTBLOCK=DIV({"class":"objectBox objectBox-$className"});
var OBJECTLINK=this.OBJECTLINK=isIE6?A({"class":"objectLink objectLink-$className a11yFocus",href:"javascript:void(0)",_repObject:"$object"}):A({"class":"objectLink objectLink-$className a11yFocus",_repObject:"$object"});
this.Undefined=domplate(Firebug.Rep,{tag:OBJECTBOX("undefined"),className:"undefined",supportsObject:function(object,type){return type=="undefined"
}});
this.Null=domplate(Firebug.Rep,{tag:OBJECTBOX("null"),className:"null",supportsObject:function(object,type){return object==null
}});
this.Nada=domplate(Firebug.Rep,{tag:SPAN(""),className:"nada"});
this.Number=domplate(Firebug.Rep,{tag:OBJECTBOX("$object"),className:"number",supportsObject:function(object,type){return type=="boolean"||type=="number"
}});
this.String=domplate(Firebug.Rep,{tag:OBJECTBOX(""$object""),shortTag:OBJECTBOX(""$object|cropString""),className:"string",supportsObject:function(object,type){return type=="string"
}});
this.Text=domplate(Firebug.Rep,{tag:OBJECTBOX("$object"),shortTag:OBJECTBOX("$object|cropString"),className:"text"});
this.Caption=domplate(Firebug.Rep,{tag:SPAN({"class":"caption"},"$object")});
this.Warning=domplate(Firebug.Rep,{tag:DIV({"class":"warning focusRow",role:"listitem"},"$object|STR")});
this.Func=domplate(Firebug.Rep,{tag:OBJECTLINK("$object|summarizeFunction"),summarizeFunction:function(fn){var fnRegex=/function ([^(]+\([^)]*\)) \{/;
var fnText=safeToString(fn);
var m=fnRegex.exec(fnText);
return m?m[1]:"function()"
},copySource:function(fn){copyToClipboard(safeToString(fn))
},monitor:function(fn,script,monitored){if(monitored){Firebug.Debugger.unmonitorScript(fn,script,"monitor")
}else{Firebug.Debugger.monitorScript(fn,script,"monitor")
}},className:"function",supportsObject:function(object,type){return isFunction(object)
},inspectObject:function(fn,context){var sourceLink=findSourceForFunction(fn,context);
if(sourceLink){Firebug.chrome.select(sourceLink)
}if(FBTrace.DBG_FUNCTION_NAME){FBTrace.sysout("reps.function.inspectObject selected sourceLink is ",sourceLink)
}},getTooltip:function(fn,context){var script=findScriptForFunctionInContext(context,fn);
if(script){return $STRF("Line",[normalizeURL(script.fileName),script.baseLineNumber])
}else{if(fn.toString){return fn.toString()
}}},getTitle:function(fn,context){var name=fn.name?fn.name:"function";
return name+"()"
},getContextMenuItems:function(fn,target,context,script){if(!script){script=findScriptForFunctionInContext(context,fn)
}if(!script){return
}var scriptInfo=getSourceFileAndLineByScript(context,script);
var monitored=scriptInfo?fbs.isMonitored(scriptInfo.sourceFile.href,scriptInfo.lineNo):false;
var name=script?getFunctionName(script,context):fn.name;
return[{label:"CopySource",command:bindFixed(this.copySource,this,fn)},"-",{label:$STRF("ShowCallsInConsole",[name]),nol10n:true,type:"checkbox",checked:monitored,command:bindFixed(this.monitor,this,fn,script,monitored)}]
}});
this.Obj=domplate(Firebug.Rep,{tag:OBJECTLINK(SPAN({"class":"objectTitle"},"$object|getTitle"),FOR("prop","$object|propIterator"," $prop.name=",SPAN({"class":"objectPropValue"},"$prop.value|cropString"))),propIterator:function(object){if(!object){return[]
}var props=[];
var len=0;
try{for(var name in object){var val;
try{val=object[name]
}catch(exc){continue
}var t=typeof val;
if(t=="boolean"||t=="number"||(t=="string"&&val)||(t=="object"&&!isFunction(val)&&val&&val.toString)){var title=(t=="object")?Firebug.getRep(val).getTitle(val):val+"";
len+=name.length+title.length+1;
if(len<50){props.push({name:name,value:title})
}else{break
}}}}catch(exc){}return props
},className:"object",supportsObject:function(object,type){return true
}});
this.Arr=domplate(Firebug.Rep,{tag:OBJECTBOX({_repObject:"$object"},SPAN({"class":"arrayLeftBracket",role:"presentation"},"["),FOR("item","$object|arrayIterator",TAG("$item.tag",{object:"$item.object"}),SPAN({"class":"arrayComma",role:"presentation"},"$item.delim")),SPAN({"class":"arrayRightBracket",role:"presentation"},"]")),shortTag:OBJECTBOX({_repObject:"$object"},SPAN({"class":"arrayLeftBracket",role:"presentation"},"["),FOR("item","$object|shortArrayIterator",TAG("$item.tag",{object:"$item.object"}),SPAN({"class":"arrayComma",role:"presentation"},"$item.delim")),SPAN({"class":"arrayRightBracket"},"]")),arrayIterator:function(array){var items=[];
for(var i=0;
i<array.length;
++i){var value=array[i];
var rep=Firebug.getRep(value);
var tag=rep.shortTag?rep.shortTag:rep.tag;
var delim=(i==array.length-1?"":", ");
items.push({object:value,tag:tag,delim:delim})
}return items
},shortArrayIterator:function(array){var items=[];
for(var i=0;
i<array.length&&i<3;
++i){var value=array[i];
var rep=Firebug.getRep(value);
var tag=rep.shortTag?rep.shortTag:rep.tag;
var delim=(i==array.length-1?"":", ");
items.push({object:value,tag:tag,delim:delim})
}if(array.length>3){items.push({object:(array.length-3)+" more...",tag:FirebugReps.Caption.tag,delim:""})
}return items
},shortPropIterator:this.Obj.propIterator,getItemIndex:function(child){var arrayIndex=0;
for(child=child.previousSibling;
child;
child=child.previousSibling){if(child.repObject){++arrayIndex
}}return arrayIndex
},className:"array",supportsObject:function(object){return this.isArray(object)
},isArray:function(obj){try{if(!obj){return false
}else{if(isIE&&!isFunction(obj)&&typeof obj=="object"&&isFinite(obj.length)&&obj.nodeType!=8){return true
}else{if(isFinite(obj.length)&&isFunction(obj.splice)){return true
}else{if(isFinite(obj.length)&&isFunction(obj.callee)){return true
}else{if(instanceOf(obj,"HTMLCollection")){return true
}else{if(instanceOf(obj,"NodeList")){return true
}else{return false
}}}}}}}catch(exc){if(FBTrace.DBG_ERRORS){FBTrace.sysout("isArray FAILS:",exc);
FBTrace.sysout("isArray Fails on obj",obj)
}}return false
},getTitle:function(object,context){return"["+object.length+"]"
}});
this.Property=domplate(Firebug.Rep,{supportsObject:function(object){return object instanceof Property
},getRealObject:function(prop,context){return prop.object[prop.name]
},getTitle:function(prop,context){return prop.name
}});
this.NetFile=domplate(this.Obj,{supportsObject:function(object){return object instanceof Firebug.NetFile
},browseObject:function(file,context){openNewTab(file.href);
return true
},getRealObject:function(file,context){return null
}});
this.Except=domplate(Firebug.Rep,{tag:OBJECTBOX({_repObject:"$object"},"$object.message"),className:"exception",supportsObject:function(object){return object instanceof ErrorCopy
}});
this.Element=domplate(Firebug.Rep,{tag:OBJECTLINK("<",SPAN({"class":"nodeTag"},"$object.nodeName|toLowerCase"),FOR("attr","$object|attrIterator"," $attr.nodeName="",SPAN({"class":"nodeValue"},"$attr.nodeValue"),"""),">"),shortTag:OBJECTLINK(SPAN({"class":"$object|getVisible"},SPAN({"class":"selectorTag"},"$object|getSelectorTag"),SPAN({"class":"selectorId"},"$object|getSelectorId"),SPAN({"class":"selectorClass"},"$object|getSelectorClass"),SPAN({"class":"selectorValue"},"$object|getValue"))),getVisible:function(elt){return isVisible(elt)?"":"selectorHidden"
},getSelectorTag:function(elt){return elt.nodeName.toLowerCase()
},getSelectorId:function(elt){return elt.id?"#"+elt.id:""
},getSelectorClass:function(elt){return elt.className?"."+elt.className.split(" ")[0]:""
},getValue:function(elt){return"";
var value;
if(elt instanceof HTMLImageElement){value=getFileName(elt.src)
}else{if(elt instanceof HTMLAnchorElement){value=getFileName(elt.href)
}else{if(elt instanceof HTMLInputElement){value=elt.value
}else{if(elt instanceof HTMLFormElement){value=getFileName(elt.action)
}else{if(elt instanceof HTMLScriptElement){value=getFileName(elt.src)
}}}}}return value?" "+cropString(value,20):""
},attrIterator:function(elt){var attrs=[];
var idAttr,classAttr;
if(elt.attributes){for(var i=0;
i<elt.attributes.length;
++i){var attr=elt.attributes[i];
if(attr.nodeName&&attr.nodeName.indexOf("firebug-")!=-1){continue
}else{if(attr.nodeName=="id"){idAttr=attr
}else{if(attr.nodeName=="class"){classAttr=attr
}else{attrs.push(attr)
}}}}}if(classAttr){attrs.splice(0,0,classAttr)
}if(idAttr){attrs.splice(0,0,idAttr)
}return attrs
},shortAttrIterator:function(elt){var attrs=[];
if(elt.attributes){for(var i=0;
i<elt.attributes.length;
++i){var attr=elt.attributes[i];
if(attr.nodeName=="id"||attr.nodeName=="class"){attrs.push(attr)
}}}return attrs
},getHidden:function(elt){return isVisible(elt)?"":"nodeHidden"
},getXPath:function(elt){return getElementTreeXPath(elt)
},getNodeText:function(element){var text=element.textContent;
if(Firebug.showFullTextNodes){return text
}else{return cropString(text,50)
}},copyHTML:function(elt){var html=getElementXML(elt);
copyToClipboard(html)
},copyInnerHTML:function(elt){copyToClipboard(elt.innerHTML)
},copyXPath:function(elt){var xpath=getElementXPath(elt);
copyToClipboard(xpath)
},persistor:function(context,xpath){var elts=xpath?getElementsByXPath(context.window.document,xpath):null;
return elts&&elts.length?elts[0]:null
},className:"element",supportsObject:function(object){return instanceOf(object,"Element")
},browseObject:function(elt,context){var tag=elt.nodeName.toLowerCase();
if(tag=="script"){openNewTab(elt.src)
}else{if(tag=="link"){openNewTab(elt.href)
}else{if(tag=="a"){openNewTab(elt.href)
}else{if(tag=="img"){openNewTab(elt.src)
}}}}return true
},persistObject:function(elt,context){var xpath=getElementXPath(elt);
return bind(this.persistor,top,xpath)
},getTitle:function(element,context){return getElementCSSSelector(element)
},getTooltip:function(elt){return this.getXPath(elt)
},getContextMenuItems:function(elt,target,context){var monitored=areEventsMonitored(elt,null,context);
return[{label:"CopyHTML",command:bindFixed(this.copyHTML,this,elt)},{label:"CopyInnerHTML",command:bindFixed(this.copyInnerHTML,this,elt)},{label:"CopyXPath",command:bindFixed(this.copyXPath,this,elt)},"-",{label:"ShowEventsInConsole",type:"checkbox",checked:monitored,command:bindFixed(toggleMonitorEvents,FBL,elt,null,monitored,context)},"-",{label:"ScrollIntoView",command:bindFixed(elt.scrollIntoView,elt)}]
}});
this.TextNode=domplate(Firebug.Rep,{tag:OBJECTLINK("<",SPAN({"class":"nodeTag"},"TextNode")," textContent="",SPAN({"class":"nodeValue"},"$object.textContent|cropString"),""",">"),className:"textNode",supportsObject:function(object){return object instanceof Text
}});
this.Document=domplate(Firebug.Rep,{tag:OBJECTLINK("Document ",SPAN({"class":"objectPropValue"},"$object|getLocation")),getLocation:function(doc){return doc.location?getFileName(doc.location.href):""
},className:"object",supportsObject:function(object){return instanceOf(object,"Document")
},browseObject:function(doc,context){openNewTab(doc.location.href);
return true
},persistObject:function(doc,context){return this.persistor
},persistor:function(context){return context.window.document
},getTitle:function(win,context){return"document"
},getTooltip:function(doc){return doc.location.href
}});
this.StyleSheet=domplate(Firebug.Rep,{tag:OBJECTLINK("StyleSheet ",SPAN({"class":"objectPropValue"},"$object|getLocation")),getLocation:function(styleSheet){return getFileName(styleSheet.href)
},copyURL:function(styleSheet){copyToClipboard(styleSheet.href)
},openInTab:function(styleSheet){openNewTab(styleSheet.href)
},className:"object",supportsObject:function(object){return instanceOf(object,"CSSStyleSheet")
},browseObject:function(styleSheet,context){openNewTab(styleSheet.href);
return true
},persistObject:function(styleSheet,context){return bind(this.persistor,top,styleSheet.href)
},getTooltip:function(styleSheet){return styleSheet.href
},getContextMenuItems:function(styleSheet,target,context){return[{label:"CopyLocation",command:bindFixed(this.copyURL,this,styleSheet)},"-",{label:"OpenInTab",command:bindFixed(this.openInTab,this,styleSheet)}]
},persistor:function(context,href){return getStyleSheetByHref(href,context)
}});
this.Window=domplate(Firebug.Rep,{tag:OBJECTLINK("Window ",SPAN({"class":"objectPropValue"},"$object|getLocation")),getLocation:function(win){try{return(win&&win.location&&!win.closed)?getFileName(win.location.href):""
}catch(exc){if(FBTrace.DBG_ERRORS){FBTrace.sysout("reps.Window window closed?")
}}},className:"object",supportsObject:function(object){return instanceOf(object,"Window")
},browseObject:function(win,context){openNewTab(win.location.href);
return true
},persistObject:function(win,context){return this.persistor
},persistor:function(context){return context.window
},getTitle:function(win,context){return"window"
},getTooltip:function(win){if(win&&!win.closed){return win.location.href
}}});
this.Event=domplate(Firebug.Rep,{tag:TAG("$copyEventTag",{object:"$object|copyEvent"}),copyEventTag:OBJECTLINK("$object|summarizeEvent"),summarizeEvent:function(event){var info=[event.type," "];
var eventFamily=getEventFamily(event.type);
if(eventFamily=="mouse"){info.push("clientX=",event.clientX,", clientY=",event.clientY)
}else{if(eventFamily=="key"){info.push("charCode=",event.charCode,", keyCode=",event.keyCode)
}}return info.join("")
},copyEvent:function(event){return new EventCopy(event)
},className:"object",supportsObject:function(object){return instanceOf(object,"Event")||instanceOf(object,"EventCopy")
},getTitle:function(event,context){return"Event "+event.type
}});
this.SourceLink=domplate(Firebug.Rep,{tag:OBJECTLINK({$collapsed:"$object|hideSourceLink"},"$object|getSourceLinkTitle"),hideSourceLink:function(sourceLink){return sourceLink?sourceLink.href.indexOf("XPCSafeJSObjectWrapper")!=-1:true
},getSourceLinkTitle:function(sourceLink){if(!sourceLink){return""
}try{var fileName=getFileName(sourceLink.href);
fileName=decodeURIComponent(fileName);
fileName=cropString(fileName,17)
}catch(exc){if(FBTrace.DBG_ERRORS){FBTrace.sysout("reps.getSourceLinkTitle decodeURIComponent fails for '"+fileName+"': "+exc,exc)
}}return typeof sourceLink.line=="number"?fileName+" (line "+sourceLink.line+")":fileName
},copyLink:function(sourceLink){copyToClipboard(sourceLink.href)
},openInTab:function(sourceLink){openNewTab(sourceLink.href)
},className:"sourceLink",supportsObject:function(object){return object instanceof SourceLink
},getTooltip:function(sourceLink){return decodeURI(sourceLink.href)
},inspectObject:function(sourceLink,context){if(sourceLink.type=="js"){var scriptFile=getSourceFileByHref(sourceLink.href,context);
if(scriptFile){return Firebug.chrome.select(sourceLink)
}}else{if(sourceLink.type=="css"){if(sourceLink.object){Firebug.chrome.select(sourceLink.object);
return
}var stylesheet=getStyleSheetByHref(sourceLink.href,context);
if(stylesheet){var ownerNode=stylesheet.ownerNode;
if(ownerNode){Firebug.chrome.select(sourceLink,"html");
return
}var panel=context.getPanel("stylesheet");
if(panel&&panel.getRuleByLine(stylesheet,sourceLink.line)){return Firebug.chrome.select(sourceLink)
}}}}viewSource(sourceLink.href,sourceLink.line)
},browseObject:function(sourceLink,context){openNewTab(sourceLink.href);
return true
},getContextMenuItems:function(sourceLink,target,context){return[{label:"CopyLocation",command:bindFixed(this.copyLink,this,sourceLink)},"-",{label:"OpenInTab",command:bindFixed(this.openInTab,this,sourceLink)}]
}});
this.SourceFile=domplate(this.SourceLink,{tag:OBJECTLINK({$collapsed:"$object|hideSourceLink"},"$object|getSourceLinkTitle"),persistor:function(context,href){return getSourceFileByHref(href,context)
},className:"sourceFile",supportsObject:function(object){return object instanceof SourceFile
},persistObject:function(sourceFile){return bind(this.persistor,top,sourceFile.href)
},browseObject:function(sourceLink,context){},getTooltip:function(sourceFile){return sourceFile.href
}});
this.StackFrame=domplate(Firebug.Rep,{tag:OBJECTBLOCK(A({"class":"objectLink objectLink-function focusRow a11yFocus",_repObject:"$object.fn"},"$object|getCallName")," ( ",FOR("arg","$object|argIterator",TAG("$arg.tag",{object:"$arg.value"}),SPAN({"class":"arrayComma"},"$arg.delim"))," )",SPAN({"class":"objectLink-sourceLink objectLink"},"$object|getSourceLinkTitle")),getCallName:function(frame){return frame.name||"anonymous"
},getSourceLinkTitle:function(frame){var fileName=cropString(getFileName(frame.href),20);
return fileName+(frame.lineNo?" (line "+frame.lineNo+")":"");
var fileName=cropString(getFileName(frame.href),17);
return $STRF("Line",[fileName,frame.lineNo])
},argIterator:function(frame){if(!frame.args){return[]
}var items=[];
for(var i=0;
i<frame.args.length;
++i){var arg=frame.args[i];
if(!arg){break
}var rep=Firebug.getRep(arg.value);
var tag=rep.shortTag?rep.shortTag:rep.tag;
var delim=(i==frame.args.length-1?"":", ");
items.push({name:arg.name,value:arg.value,tag:tag,delim:delim})
}return items
},className:"stackFrame",supportsObject:function(object){return object instanceof StackFrame
},inspectObject:function(stackFrame,context){var sourceLink=new SourceLink(stackFrame.href,stackFrame.lineNo,"js");
Firebug.chrome.select(sourceLink)
},getTooltip:function(stackFrame,context){return $STRF("Line",[stackFrame.href,stackFrame.lineNo])
}});
this.StackTrace=domplate(Firebug.Rep,{tag:FOR("frame","$object.frames focusRow",TAG(this.StackFrame.tag,{object:"$frame"})),className:"stackTrace",supportsObject:function(object){return object instanceof StackTrace
}});
this.jsdStackFrame=domplate(Firebug.Rep,{inspectable:false,supportsObject:function(object){return(object instanceof jsdIStackFrame)&&(object.isValid)
},getTitle:function(frame,context){if(!frame.isValid){return"(invalid frame)"
}return getFunctionName(frame.script,context)
},getTooltip:function(frame,context){if(!frame.isValid){return"(invalid frame)"
}var sourceInfo=FBL.getSourceFileAndLineByScript(context,frame.script,frame);
if(sourceInfo){return $STRF("Line",[sourceInfo.sourceFile.href,sourceInfo.lineNo])
}else{return $STRF("Line",[frame.script.fileName,frame.line])
}},getContextMenuItems:function(frame,target,context){var fn=frame.script.functionObject.getWrappedValue();
return FirebugReps.Func.getContextMenuItems(fn,target,context,frame.script)
}});
this.ErrorMessage=domplate(Firebug.Rep,{tag:OBJECTBOX({$hasTwisty:"$object|hasStackTrace",$hasBreakSwitch:"$object|hasBreakSwitch",$breakForError:"$object|hasErrorBreak",_repObject:"$object",_stackTrace:"$object|getLastErrorStackTrace",onclick:"$onToggleError"},DIV({"class":"errorTitle a11yFocus",role:"checkbox","aria-checked":"false"},"$object.message|getMessage"),DIV({"class":"errorTrace"}),DIV({"class":"errorSourceBox errorSource-$object|getSourceType"},IMG({"class":"errorBreak a11yFocus",src:"blank.gif",role:"checkbox","aria-checked":"false",title:"Break on this error"}),A({"class":"errorSource a11yFocus"},"$object|getLine")),TAG(this.SourceLink.tag,{object:"$object|getSourceLink"})),getLastErrorStackTrace:function(error){return error.trace
},hasStackTrace:function(error){var url=error.href.toString();
var fromCommandLine=(url.indexOf("XPCSafeJSObjectWrapper")!=-1);
return !fromCommandLine&&error.trace
},hasBreakSwitch:function(error){return error.href&&error.lineNo>0
},hasErrorBreak:function(error){return fbs.hasErrorBreakpoint(error.href,error.lineNo)
},getMessage:function(message){var re=/\[Exception... "(.*?)" nsresult:/;
var m=re.exec(message);
return m?m[1]:message
},getLine:function(error){if(error.category=="js"){if(error.source){return cropString(error.source,80)
}else{if(error.href&&error.href.indexOf("XPCSafeJSObjectWrapper")==-1){return cropString(error.getSourceLine(),80)
}}}},getSourceLink:function(error){var ext=error.category=="css"?"css":"js";
return error.lineNo?new SourceLink(error.href,error.lineNo,ext):null
},getSourceType:function(error){if(error.source){return"syntax"
}else{if(error.lineNo==1&&getFileExtension(error.href)!="js"){return"none"
}else{if(error.category=="css"){return"none"
}else{if(!error.href||!error.lineNo){return"none"
}else{return"exec"
}}}}},onToggleError:function(event){var target=event.currentTarget;
if(hasClass(event.target,"errorBreak")){this.breakOnThisError(target.repObject)
}else{if(hasClass(event.target,"errorSource")){var panel=Firebug.getElementPanel(event.target);
this.inspectObject(target.repObject,panel.context)
}else{if(hasClass(event.target,"errorTitle")){var traceBox=target.childNodes[1];
toggleClass(target,"opened");
event.target.setAttribute("aria-checked",hasClass(target,"opened"));
if(hasClass(target,"opened")){if(target.stackTrace){var node=FirebugReps.StackTrace.tag.append({object:target.stackTrace},traceBox)
}if(Firebug.A11yModel.enabled){var panel=Firebug.getElementPanel(event.target);
dispatch([Firebug.A11yModel],"onLogRowContentCreated",[panel,traceBox])
}}else{clearNode(traceBox)
}}}}},copyError:function(error){var message=[this.getMessage(error.message),error.href,"Line "+error.lineNo];
copyToClipboard(message.join("\n"))
},breakOnThisError:function(error){if(this.hasErrorBreak(error)){Firebug.Debugger.clearErrorBreakpoint(error.href,error.lineNo)
}else{Firebug.Debugger.setErrorBreakpoint(error.href,error.lineNo)
}},className:"errorMessage",inspectable:false,supportsObject:function(object){return object instanceof ErrorMessage
},inspectObject:function(error,context){var sourceLink=this.getSourceLink(error);
FirebugReps.SourceLink.inspectObject(sourceLink,context)
},getContextMenuItems:function(error,target,context){var breakOnThisError=this.hasErrorBreak(error);
var items=[{label:"CopyError",command:bindFixed(this.copyError,this,error)}];
if(error.category=="css"){items.push("-",{label:"BreakOnThisError",type:"checkbox",checked:breakOnThisError,command:bindFixed(this.breakOnThisError,this,error)},optionMenu("BreakOnAllErrors","breakOnErrors"))
}return items
}});
this.Assert=domplate(Firebug.Rep,{tag:DIV(DIV({"class":"errorTitle"}),DIV({"class":"assertDescription"})),className:"assert",inspectObject:function(error,context){var sourceLink=this.getSourceLink(error);
Firebug.chrome.select(sourceLink)
},getContextMenuItems:function(error,target,context){var breakOnThisError=this.hasErrorBreak(error);
return[{label:"CopyError",command:bindFixed(this.copyError,this,error)},"-",{label:"BreakOnThisError",type:"checkbox",checked:breakOnThisError,command:bindFixed(this.breakOnThisError,this,error)},{label:"BreakOnAllErrors",type:"checkbox",checked:Firebug.breakOnErrors,command:bindFixed(this.breakOnAllErrors,this,error)}]
}});
this.SourceText=domplate(Firebug.Rep,{tag:DIV(FOR("line","$object|lineIterator",DIV({"class":"sourceRow",role:"presentation"},SPAN({"class":"sourceLine",role:"presentation"},"$line.lineNo"),SPAN({"class":"sourceRowText",role:"presentation"},"$line.text")))),lineIterator:function(sourceText){var maxLineNoChars=(sourceText.lines.length+"").length;
var list=[];
for(var i=0;
i<sourceText.lines.length;
++i){var lineNo=(i+1)+"";
while(lineNo.length<maxLineNoChars){lineNo=" "+lineNo
}list.push({lineNo:lineNo,text:sourceText.lines[i]})
}return list
},getHTML:function(sourceText){return getSourceLineRange(sourceText,1,sourceText.lines.length)
}});
this.nsIDOMHistory=domplate(Firebug.Rep,{tag:OBJECTBOX({onclick:"$showHistory"},OBJECTLINK("$object|summarizeHistory")),className:"nsIDOMHistory",summarizeHistory:function(history){try{var items=history.length;
return items+" history entries"
}catch(exc){return"object does not support history (nsIDOMHistory)"
}},showHistory:function(history){try{var items=history.length;
Firebug.chrome.select(history)
}catch(exc){}},supportsObject:function(object,type){return(object instanceof Ci.nsIDOMHistory)
}});
this.ApplicationCache=domplate(Firebug.Rep,{tag:OBJECTBOX({onclick:"$showApplicationCache"},OBJECTLINK("$object|summarizeCache")),summarizeCache:function(applicationCache){try{return applicationCache.length+" items in offline cache"
}catch(exc){return"https://bugzilla.mozilla.org/show_bug.cgi?id=422264"
}},showApplicationCache:function(event){openNewTab("https://bugzilla.mozilla.org/show_bug.cgi?id=422264")
},className:"applicationCache",supportsObject:function(object,type){if(Ci.nsIDOMOfflineResourceList){return(object instanceof Ci.nsIDOMOfflineResourceList)
}}});
this.Storage=domplate(Firebug.Rep,{tag:OBJECTBOX({onclick:"$show"},OBJECTLINK("$object|summarize")),summarize:function(storage){return storage.length+" items in Storage"
},show:function(storage){openNewTab("http://dev.w3.org/html5/webstorage/#storage-0")
},className:"Storage",supportsObject:function(object,type){return(object instanceof Storage)
}});
Firebug.registerRep(this.Undefined,this.Null,this.Number,this.String,this.Window,this.Element,this.Document,this.StyleSheet,this.Event,this.Property,this.Except,this.Arr);
Firebug.setDefaultReps(this.Func,this.Obj)
}});
FBL.ns(function(){with(FBL){var saveTimeout=400;
var pageAmount=10;
var currentTarget=null;
var currentGroup=null;
var currentPanel=null;
var currentEditor=null;
var defaultEditor=null;
var originalClassName=null;
var originalValue=null;
var defaultValue=null;
var previousValue=null;
var invalidEditor=false;
var ignoreNextInput=false;
Firebug.Editor=extend(Firebug.Module,{supportsStopEvent:true,dispatchName:"editor",tabCharacter:" ",startEditing:function(target,value,editor){this.stopEditing();
if(hasClass(target,"insertBefore")||hasClass(target,"insertAfter")){return
}var panel=Firebug.getElementPanel(target);
if(!panel.editable){return
}if(FBTrace.DBG_EDITOR){FBTrace.sysout("editor.startEditing "+value,target)
}defaultValue=target.getAttribute("defaultValue");
if(value==undefined){var textContent=isIE?"innerText":"textContent";
value=target[textContent];
if(value==defaultValue){value=""
}}originalValue=previousValue=value;
invalidEditor=false;
currentTarget=target;
currentPanel=panel;
currentGroup=getAncestorByClass(target,"editGroup");
currentPanel.editing=true;
var panelEditor=currentPanel.getEditor(target,value);
currentEditor=editor?editor:panelEditor;
if(!currentEditor){currentEditor=getDefaultEditor(currentPanel)
}var inlineParent=getInlineParent(target);
var targetSize=getOffsetSize(inlineParent);
setClass(panel.panelNode,"editing");
setClass(target,"editing");
if(currentGroup){setClass(currentGroup,"editing")
}currentEditor.show(target,currentPanel,value,targetSize);
currentEditor.beginEditing(target,value);
if(FBTrace.DBG_EDITOR){FBTrace.sysout("Editor start panel "+currentPanel.name)
}this.attachListeners(currentEditor,panel.context)
},stopEditing:function(cancel){if(!currentTarget){return
}if(FBTrace.DBG_EDITOR){FBTrace.sysout("editor.stopEditing cancel:"+cancel+" saveTimeout: "+this.saveTimeout)
}clearTimeout(this.saveTimeout);
delete this.saveTimeout;
this.detachListeners(currentEditor,currentPanel.context);
removeClass(currentPanel.panelNode,"editing");
removeClass(currentTarget,"editing");
if(currentGroup){removeClass(currentGroup,"editing")
}var value=currentEditor.getValue();
if(value==defaultValue){value=""
}var removeGroup=currentEditor.endEditing(currentTarget,value,cancel);
try{if(cancel){if(value!=originalValue){this.saveEditAndNotifyListeners(currentTarget,originalValue,previousValue)
}if(removeGroup&&!originalValue&¤tGroup){currentGroup.parentNode.removeChild(currentGroup)
}}else{if(!value){this.saveEditAndNotifyListeners(currentTarget,null,previousValue);
if(removeGroup&¤tGroup){currentGroup.parentNode.removeChild(currentGroup)
}}else{this.save(value)
}}}catch(exc){}currentEditor.hide();
currentPanel.editing=false;
currentTarget=null;
currentGroup=null;
currentPanel=null;
currentEditor=null;
originalValue=null;
invalidEditor=false;
return value
},cancelEditing:function(){return this.stopEditing(true)
},update:function(saveNow){if(this.saveTimeout){clearTimeout(this.saveTimeout)
}invalidEditor=true;
currentEditor.layout();
if(saveNow){this.save()
}else{var context=currentPanel.context;
this.saveTimeout=context.setTimeout(bindFixed(this.save,this),saveTimeout);
if(FBTrace.DBG_EDITOR){FBTrace.sysout("editor.update saveTimeout: "+this.saveTimeout)
}}},save:function(value){if(!invalidEditor){return
}if(value==undefined){value=currentEditor.getValue()
}if(FBTrace.DBG_EDITOR){FBTrace.sysout("editor.save saveTimeout: "+this.saveTimeout+" currentPanel: "+(currentPanel?currentPanel.name:"null"))
}try{this.saveEditAndNotifyListeners(currentTarget,value,previousValue);
previousValue=value;
invalidEditor=false
}catch(exc){if(FBTrace.DBG_ERRORS){FBTrace.sysout("editor.save FAILS "+exc,exc)
}}},saveEditAndNotifyListeners:function(currentTarget,value,previousValue){currentEditor.saveEdit(currentTarget,value,previousValue);
dispatch(this.fbListeners,"onSaveEdit",[currentPanel,currentEditor,currentTarget,value,previousValue])
},setEditTarget:function(element){if(!element){dispatch([Firebug.A11yModel],"onInlineEditorClose",[currentPanel,currentTarget,true]);
this.stopEditing()
}else{if(hasClass(element,"insertBefore")){this.insertRow(element,"before")
}else{if(hasClass(element,"insertAfter")){this.insertRow(element,"after")
}else{this.startEditing(element)
}}}},tabNextEditor:function(){if(!currentTarget){return
}var value=currentEditor.getValue();
var nextEditable=currentTarget;
do{nextEditable=!value&¤tGroup?getNextOutsider(nextEditable,currentGroup):getNextByClass(nextEditable,"editable")
}while(nextEditable&&!nextEditable.offsetHeight);
this.setEditTarget(nextEditable)
},tabPreviousEditor:function(){if(!currentTarget){return
}var value=currentEditor.getValue();
var prevEditable=currentTarget;
do{prevEditable=!value&¤tGroup?getPreviousOutsider(prevEditable,currentGroup):getPreviousByClass(prevEditable,"editable")
}while(prevEditable&&!prevEditable.offsetHeight);
this.setEditTarget(prevEditable)
},insertRow:function(relative,insertWhere){var group=relative||getAncestorByClass(currentTarget,"editGroup")||currentTarget;
var value=this.stopEditing();
currentPanel=Firebug.getElementPanel(group);
currentEditor=currentPanel.getEditor(group,value);
if(!currentEditor){currentEditor=getDefaultEditor(currentPanel)
}currentGroup=currentEditor.insertNewRow(group,insertWhere);
if(!currentGroup){return
}var editable=hasClass(currentGroup,"editable")?currentGroup:getNextByClass(currentGroup,"editable");
if(editable){this.setEditTarget(editable)
}},insertRowForObject:function(relative){var container=getAncestorByClass(relative,"insertInto");
if(container){relative=getChildByClass(container,"insertBefore");
if(relative){this.insertRow(relative,"before")
}}},attachListeners:function(editor,context){var win=isIE?currentTarget.ownerDocument.parentWindow:currentTarget.ownerDocument.defaultView;
addEvent(win,"resize",this.onResize);
addEvent(win,"blur",this.onBlur);
var chrome=Firebug.chrome;
this.listeners=[chrome.keyCodeListen("ESCAPE",null,bind(this.cancelEditing,this))];
if(editor.arrowCompletion){this.listeners.push(chrome.keyCodeListen("UP",null,bindFixed(editor.completeValue,editor,-1)),chrome.keyCodeListen("DOWN",null,bindFixed(editor.completeValue,editor,1)),chrome.keyCodeListen("PAGE_UP",null,bindFixed(editor.completeValue,editor,-pageAmount)),chrome.keyCodeListen("PAGE_DOWN",null,bindFixed(editor.completeValue,editor,pageAmount)))
}if(currentEditor.tabNavigation){this.listeners.push(chrome.keyCodeListen("RETURN",null,bind(this.tabNextEditor,this)),chrome.keyCodeListen("RETURN",isControl,bind(this.insertRow,this,null,"after")),chrome.keyCodeListen("TAB",null,bind(this.tabNextEditor,this)),chrome.keyCodeListen("TAB",isShift,bind(this.tabPreviousEditor,this)))
}else{if(currentEditor.multiLine){this.listeners.push(chrome.keyCodeListen("TAB",null,insertTab))
}else{this.listeners.push(chrome.keyCodeListen("RETURN",null,bindFixed(this.stopEditing,this)));
if(currentEditor.tabCompletion){this.listeners.push(chrome.keyCodeListen("TAB",null,bind(editor.completeValue,editor,1)),chrome.keyCodeListen("TAB",isShift,bind(editor.completeValue,editor,-1)))
}}}},detachListeners:function(editor,context){if(!this.listeners){return
}var win=isIE?currentTarget.ownerDocument.parentWindow:currentTarget.ownerDocument.defaultView;
removeEvent(win,"resize",this.onResize);
removeEvent(win,"blur",this.onBlur);
var chrome=Firebug.chrome;
if(chrome){for(var i=0;
i<this.listeners.length;
++i){chrome.keyIgnore(this.listeners[i])
}}delete this.listeners
},onResize:function(event){currentEditor.layout(true)
},onBlur:function(event){if(currentEditor.enterOnBlur&&isAncestor(event.target,currentEditor.box)){this.stopEditing()
}},initialize:function(){Firebug.Module.initialize.apply(this,arguments);
this.onResize=bindFixed(this.onResize,this);
this.onBlur=bind(this.onBlur,this)
},disable:function(){this.stopEditing()
},showContext:function(browser,context){this.stopEditing()
},showPanel:function(browser,panel){this.stopEditing()
}});
Firebug.BaseEditor=extend(Firebug.MeasureBox,{getValue:function(){},setValue:function(value){},show:function(target,panel,value,textSize,targetSize){},hide:function(){},layout:function(forceAll){},getContextMenuItems:function(target){var items=[];
items.push({label:"Cut",commandID:"cmd_cut"});
items.push({label:"Copy",commandID:"cmd_copy"});
items.push({label:"Paste",commandID:"cmd_paste"});
return items
},beginEditing:function(target,value){},saveEdit:function(target,value,previousValue){},endEditing:function(target,value,cancel){return true
},insertNewRow:function(target,insertWhere){}});
Firebug.InlineEditor=function(doc){this.initializeInline(doc)
};
Firebug.InlineEditor.prototype=domplate(Firebug.BaseEditor,{enterOnBlur:true,outerMargin:8,shadowExpand:7,tag:DIV({"class":"inlineEditor"},DIV({"class":"textEditorTop1"},DIV({"class":"textEditorTop2"})),DIV({"class":"textEditorInner1"},DIV({"class":"textEditorInner2"},INPUT({"class":"textEditorInner",type:"text",onkeypress:"$onKeyPress",onkeyup:"$onKeyUp",onoverflow:"$onOverflow",oncontextmenu:"$onContextMenu"}))),DIV({"class":"textEditorBottom1"},DIV({"class":"textEditorBottom2"}))),inputTag:INPUT({"class":"textEditorInner",type:"text",onkeypress:"$onKeyPress",onoverflow:"$onOverflow"}),expanderTag:IMG({"class":"inlineExpander",src:"blank.gif"}),initialize:function(){this.fixedWidth=false;
this.completeAsYouType=true;
this.tabNavigation=true;
this.multiLine=false;
this.tabCompletion=false;
this.arrowCompletion=true;
this.noWrap=true;
this.numeric=false
},destroy:function(){this.destroyInput()
},initializeInline:function(doc){if(FBTrace.DBG_EDITOR){FBTrace.sysout("Firebug.InlineEditor initializeInline()")
}this.box=this.tag.append({},doc.body,this);
this.input=this.box.getElementsByTagName("input")[0];
if(isIElt8){this.input.style.top="-8px"
}this.expander=this.expanderTag.replace({},doc,this);
this.initialize()
},destroyInput:function(){},getValue:function(){return this.input.value
},setValue:function(value){return this.input.value=stripNewLines(value)
},show:function(target,panel,value,targetSize){this.target=target;
this.panel=panel;
this.targetSize=targetSize;
var innerHTML=target.innerHTML;
var isEmptyElement=!innerHTML;
if(isEmptyElement){target.innerHTML="."
}this.targetOffset={x:target.offsetLeft,y:target.offsetTop};
if(isEmptyElement){target.innerHTML=innerHTML
}this.originalClassName=this.box.className;
var classNames=target.className.split(" ");
for(var i=0;
i<classNames.length;
++i){setClass(this.box,"editor-"+classNames[i])
}copyTextStyles(target,this.box);
this.setValue(value);
if(this.fixedWidth){this.updateLayout(true)
}else{this.startMeasuring(target);
this.textSize=this.measureInputText(value);
var parent=this.input.parentNode;
if(hasClass(parent,"textEditorInner2")){var yDiff=this.textSize.height-this.shadowExpand;
if(isIE6){yDiff-=2
}parent.style.height=yDiff+"px";
parent.parentNode.style.height=yDiff+"px"
}this.updateLayout(true)
}this.getAutoCompleter().reset();
if(isIElt8){panel.panelNode.appendChild(this.box)
}else{target.offsetParent.appendChild(this.box)
}if(isIE){this.input.style.fontFamily="Monospace";
this.input.style.fontSize="11px"
}if(!this.fixedWidth){copyBoxStyles(target,this.expander);
target.parentNode.replaceChild(this.expander,target);
collapse(target,true);
this.expander.parentNode.insertBefore(target,this.expander)
}this.box.style.display="block";
var self=this;
setTimeout(function(){self.input.focus();
self.input.select()
},0)
},hide:function(){this.box.className=this.originalClassName;
if(!this.fixedWidth){this.stopMeasuring();
collapse(this.target,false);
if(this.expander.parentNode){this.expander.parentNode.removeChild(this.expander)
}}if(this.box.parentNode){setSelectionRange(this.input,0,0);
this.box.parentNode.removeChild(this.box)
}delete this.target;
delete this.panel
},layout:function(forceAll){if(!this.fixedWidth){this.textSize=this.measureInputText(this.input.value)
}if(forceAll){this.targetOffset=getClientOffset(this.expander)
}this.updateLayout(false,forceAll)
},beginEditing:function(target,value){},saveEdit:function(target,value,previousValue){},endEditing:function(target,value,cancel){return true
},insertNewRow:function(target,insertWhere){},advanceToNext:function(target,charCode){return false
},getAutoCompleteRange:function(value,offset){},getAutoCompleteList:function(preExpr,expr,postExpr){},getAutoCompleter:function(){if(!this.autoCompleter){this.autoCompleter=new Firebug.AutoCompleter(null,bind(this.getAutoCompleteRange,this),bind(this.getAutoCompleteList,this),true,false)
}return this.autoCompleter
},completeValue:function(amt){if(this.getAutoCompleter().complete(currentPanel.context,this.input,true,amt<0)){Firebug.Editor.update(true)
}else{this.incrementValue(amt)
}},incrementValue:function(amt){var value=this.input.value;
if(isIE){var start=getInputCaretPosition(this.input),end=start
}else{var start=this.input.selectionStart,end=this.input.selectionEnd
}var range=this.getAutoCompleteRange(value,start);
if(!range||range.type!="int"){range={start:0,end:value.length-1}
}var expr=value.substr(range.start,range.end-range.start+1);
preExpr=value.substr(0,range.start);
postExpr=value.substr(range.end+1);
var intValue=parseInt(expr);
if(!!intValue||intValue==0){var m=/\d+/.exec(expr);
var digitPost=expr.substr(m.index+m[0].length);
var completion=intValue-amt;
this.input.value=preExpr+completion+digitPost+postExpr;
setSelectionRange(this.input,start,end);
Firebug.Editor.update(true);
return true
}else{return false
}},onKeyUp:function(event){if(isIE||isSafari){this.onKeyPress(event)
}},onKeyPress:function(event){if(event.keyCode==27&&!this.completeAsYouType){var reverted=this.getAutoCompleter().revert(this.input);
if(reverted){cancelEvent(event)
}}else{if(event.charCode&&this.advanceToNext(this.target,event.charCode)){Firebug.Editor.tabNextEditor();
cancelEvent(event)
}else{if(this.numeric&&event.charCode&&(event.charCode<48||event.charCode>57)&&event.charCode!=45&&event.charCode!=46){FBL.cancelEvent(event)
}else{this.ignoreNextInput=event.keyCode==8;
var self=this;
setTimeout(function(){self.onInput()
},0)
}}}},onOverflow:function(){this.updateLayout(false,false,3)
},onInput:function(){if(this.ignoreNextInput){this.ignoreNextInput=false;
this.getAutoCompleter().reset()
}else{if(this.completeAsYouType){this.getAutoCompleter().complete(currentPanel.context,this.input,false)
}else{this.getAutoCompleter().reset()
}}Firebug.Editor.update()
},onContextMenu:function(event){cancelEvent(event);
var popup=$("fbInlineEditorPopup");
FBL.eraseNode(popup);
var target=event.target||event.srcElement;
var menu=this.getContextMenuItems(target);
if(menu){for(var i=0;
i<menu.length;
++i){FBL.createMenuItem(popup,menu[i])
}}if(!popup.firstChild){return false
}popup.openPopupAtScreen(event.screenX,event.screenY,true);
return true
},updateLayout:function(initial,forceAll,extraWidth){if(this.fixedWidth){this.box.style.left=(this.targetOffset.x)+"px";
this.box.style.top=(this.targetOffset.y)+"px";
var w=this.target.offsetWidth;
var h=this.target.offsetHeight;
this.input.style.width=w+"px";
this.input.style.height=(h-3)+"px"
}else{if(initial||forceAll){this.box.style.left=this.targetOffset.x+"px";
this.box.style.top=this.targetOffset.y+"px"
}var approxTextWidth=this.textSize.width;
var maxWidth=(currentPanel.panelNode.scrollWidth-this.targetOffset.x)-this.outerMargin;
var wrapped=initial?this.noWrap&&this.targetSize.height>this.textSize.height+3:this.noWrap&&approxTextWidth>maxWidth;
if(wrapped){var style=isIE?this.target.currentStyle:this.target.ownerDocument.defaultView.getComputedStyle(this.target,"");
targetMargin=parseInt(style.marginLeft)+parseInt(style.marginRight);
approxTextWidth=maxWidth-targetMargin;
this.input.style.width="100%";
this.box.style.width=approxTextWidth+"px"
}else{var charWidth=this.measureInputText("m").width;
if(extraWidth){charWidth*=extraWidth
}var inputWidth=approxTextWidth+charWidth;
if(initial){if(isIE){var xDiff=13;
this.box.style.width=(inputWidth+xDiff)+"px"
}else{this.box.style.width="auto"
}}else{var xDiff=isIE?13:this.box.scrollWidth-this.input.offsetWidth;
this.box.style.width=(inputWidth+xDiff)+"px"
}this.input.style.width=inputWidth+"px"
}this.expander.style.width=approxTextWidth+"px";
this.expander.style.height=(this.textSize.height-3)+"px"
}if(forceAll){scrollIntoCenterView(this.box,null,true)
}}});
Firebug.AutoCompleter=function(getExprOffset,getRange,evaluator,selectMode,caseSensitive){var candidates=null;
var originalValue=null;
var originalOffset=-1;
var lastExpr=null;
var lastOffset=-1;
var exprOffset=0;
var lastIndex=0;
var preParsed=null;
var preExpr=null;
var postExpr=null;
this.revert=function(textBox){if(originalOffset!=-1){textBox.value=originalValue;
setSelectionRange(textBox,originalOffset,originalOffset);
this.reset();
return true
}else{this.reset();
return false
}};
this.reset=function(){candidates=null;
originalValue=null;
originalOffset=-1;
lastExpr=null;
lastOffset=0;
exprOffset=0
};
this.complete=function(context,textBox,cycle,reverse){var value=textBox.value;
var offset=getInputCaretPosition(textBox);
if(!selectMode&&originalOffset!=-1){offset=originalOffset
}if(!candidates||!cycle||offset!=lastOffset){originalOffset=offset;
originalValue=value;
var parseStart=getExprOffset?getExprOffset(value,offset,context):0;
preParsed=value.substr(0,parseStart);
var parsed=value.substr(parseStart);
var range=getRange?getRange(parsed,offset-parseStart,context):null;
if(!range){range={start:0,end:parsed.length-1}
}var expr=parsed.substr(range.start,range.end-range.start+1);
preExpr=parsed.substr(0,range.start);
postExpr=parsed.substr(range.end+1);
exprOffset=parseStart+range.start;
if(!cycle){if(!expr){return
}else{if(lastExpr&&lastExpr.indexOf(expr)!=0){candidates=null
}else{if(lastExpr&&lastExpr.length>=expr.length){candidates=null;
lastExpr=expr;
return
}}}}lastExpr=expr;
lastOffset=offset;
var searchExpr;
if(expr&&offset!=parseStart+range.end+1){if(cycle){offset=range.start;
searchExpr=expr;
expr=""
}else{return
}}var values=evaluator(preExpr,expr,postExpr,context);
if(!values){return
}if(expr){candidates=[];
if(caseSensitive){for(var i=0;
i<values.length;
++i){var name=values[i];
if(name.indexOf&&name.indexOf(expr)==0){candidates.push(name)
}}}else{var lowerExpr=caseSensitive?expr:expr.toLowerCase();
for(var i=0;
i<values.length;
++i){var name=values[i];
if(name.indexOf&&name.toLowerCase().indexOf(lowerExpr)==0){candidates.push(name)
}}}lastIndex=reverse?candidates.length-1:0
}else{if(searchExpr){var searchIndex=-1;
if(caseSensitive){searchIndex=values.indexOf(expr)
}else{var lowerExpr=searchExpr.toLowerCase();
for(var i=0;
i<values.length;
++i){var name=values[i];
if(name&&name.toLowerCase().indexOf(lowerExpr)==0){searchIndex=i;
break
}}}if(searchIndex==-1){return this.reset()
}expr=searchExpr;
candidates=cloneArray(values);
lastIndex=searchIndex
}else{expr="";
candidates=[];
for(var i=0;
i<values.length;
++i){if(values[i].substr){candidates.push(values[i])
}}lastIndex=-1
}}}if(cycle){expr=lastExpr;
lastIndex+=reverse?-1:1
}if(!candidates.length){return
}if(lastIndex>=candidates.length){lastIndex=0
}else{if(lastIndex<0){lastIndex=candidates.length-1
}}var completion=candidates[lastIndex];
var preCompletion=expr.substr(0,offset-exprOffset);
var postCompletion=completion.substr(offset-exprOffset);
textBox.value=preParsed+preExpr+preCompletion+postCompletion+postExpr;
var offsetEnd=preParsed.length+preExpr.length+completion.length;
setTimeout(function(){if(selectMode){setSelectionRange(textBox,offset,offsetEnd)
}else{setSelectionRange(textBox,offsetEnd,offsetEnd)
}},0);
return true
}
};
var getDefaultEditor=function getDefaultEditor(panel){if(!defaultEditor){var doc=panel.document;
defaultEditor=new Firebug.InlineEditor(doc)
}return defaultEditor
};
var getOutsider=function getOutsider(element,group,stepper){var parentGroup=getAncestorByClass(group.parentNode,"editGroup");
var next;
do{next=stepper(next||element)
}while(isAncestor(next,group)||isGroupInsert(next,parentGroup));
return next
};
var isGroupInsert=function isGroupInsert(next,group){return(!group||isAncestor(next,group))&&(hasClass(next,"insertBefore")||hasClass(next,"insertAfter"))
};
var getNextOutsider=function getNextOutsider(element,group){return getOutsider(element,group,bind(getNextByClass,FBL,"editable"))
};
var getPreviousOutsider=function getPreviousOutsider(element,group){return getOutsider(element,group,bind(getPreviousByClass,FBL,"editable"))
};
var getInlineParent=function getInlineParent(element){var lastInline=element;
for(;
element;
element=element.parentNode){var s=isIE?element.currentStyle:element.ownerDocument.defaultView.getComputedStyle(element,"");
if(s.display!="inline"){return lastInline
}else{lastInline=element
}}return null
};
var insertTab=function insertTab(){insertTextIntoElement(currentEditor.input,Firebug.Editor.tabCharacter)
};
Firebug.registerModule(Firebug.Editor)
}});
FBL.ns(function(){with(FBL){var inspectorTS,inspectorTimer,isInspecting;
Firebug.Inspector={create:function(){offlineFragment=Env.browser.document.createDocumentFragment();
createBoxModelInspector();
createOutlineInspector()
},destroy:function(){destroyBoxModelInspector();
destroyOutlineInspector();
offlineFragment=null
},toggleInspect:function(){if(isInspecting){this.stopInspecting()
}else{Firebug.chrome.inspectButton.changeState("pressed");
this.startInspecting()
}},startInspecting:function(){isInspecting=true;
Firebug.chrome.selectPanel("HTML");
createInspectorFrame();
var size=Firebug.browser.getWindowScrollSize();
fbInspectFrame.style.width=size.width+"px";
fbInspectFrame.style.height=size.height+"px";
addEvent(fbInspectFrame,"mousemove",Firebug.Inspector.onInspecting);
addEvent(fbInspectFrame,"mousedown",Firebug.Inspector.onInspectingClick)
},stopInspecting:function(){isInspecting=false;
if(outlineVisible){this.hideOutline()
}removeEvent(fbInspectFrame,"mousemove",Firebug.Inspector.onInspecting);
removeEvent(fbInspectFrame,"mousedown",Firebug.Inspector.onInspectingClick);
destroyInspectorFrame();
Firebug.chrome.inspectButton.restore();
if(Firebug.chrome.type=="popup"){Firebug.chrome.node.focus()
}},onInspectingClick:function(e){fbInspectFrame.style.display="none";
var targ=Firebug.browser.getElementFromPoint(e.clientX,e.clientY);
fbInspectFrame.style.display="block";
var id=targ.id;
if(id&&/^fbOutline\w$/.test(id)){return
}if(id=="FirebugUI"){return
}while(targ.nodeType!=1){targ=targ.parentNode
}Firebug.Inspector.stopInspecting()
},onInspecting:function(e){if(new Date().getTime()-lastInspecting>30){fbInspectFrame.style.display="none";
var targ=Firebug.browser.getElementFromPoint(e.clientX,e.clientY);
fbInspectFrame.style.display="block";
var id=targ.id;
if(id&&/^fbOutline\w$/.test(id)){return
}if(id=="FirebugUI"){return
}while(targ.nodeType!=1){targ=targ.parentNode
}if(targ.nodeName.toLowerCase()=="body"){return
}Firebug.Inspector.drawOutline(targ);
if(targ[cacheID]){var target=""+targ[cacheID];
var lazySelect=function(){inspectorTS=new Date().getTime();
Firebug.HTML.selectTreeNode(""+targ[cacheID])
};
if(inspectorTimer){clearTimeout(inspectorTimer);
inspectorTimer=null
}if(new Date().getTime()-inspectorTS>200){setTimeout(lazySelect,0)
}else{inspectorTimer=setTimeout(lazySelect,300)
}}lastInspecting=new Date().getTime()
}},onInspectingBody:function(e){if(new Date().getTime()-lastInspecting>30){var targ=e.target;
var id=targ.id;
if(id&&/^fbOutline\w$/.test(id)){return
}if(id=="FirebugUI"){return
}while(targ.nodeType!=1){targ=targ.parentNode
}if(targ.nodeName.toLowerCase()=="body"){return
}Firebug.Inspector.drawOutline(targ);
if(targ[cacheID]){FBL.Firebug.HTML.selectTreeNode(""+targ[cacheID])
}lastInspecting=new Date().getTime()
}},drawOutline:function(el){var border=2;
var scrollbarSize=17;
var windowSize=Firebug.browser.getWindowSize();
var scrollSize=Firebug.browser.getWindowScrollSize();
var scrollPosition=Firebug.browser.getWindowScrollPosition();
var box=Firebug.browser.getElementBox(el);
var top=box.top;
var left=box.left;
var height=box.height;
var width=box.width;
var freeHorizontalSpace=scrollPosition.left+windowSize.width-left-width-(!isIE&&scrollSize.height>windowSize.height?scrollbarSize:0);
var freeVerticalSpace=scrollPosition.top+windowSize.height-top-height-(!isIE&&scrollSize.width>windowSize.width?scrollbarSize:0);
var numVerticalBorders=freeVerticalSpace>0?2:1;
var o=outlineElements;
var style;
style=o.fbOutlineT.style;
style.top=top-border+"px";
style.left=left+"px";
style.height=border+"px";
style.width=width+"px";
style=o.fbOutlineL.style;
style.top=top-border+"px";
style.left=left-border+"px";
style.height=height+numVerticalBorders*border+"px";
style.width=border+"px";
style=o.fbOutlineB.style;
if(freeVerticalSpace>0){style.top=top+height+"px";
style.left=left+"px";
style.width=width+"px"
}else{style.top=-2*border+"px";
style.left=-2*border+"px";
style.width=border+"px"
}style=o.fbOutlineR.style;
if(freeHorizontalSpace>0){style.top=top-border+"px";
style.left=left+width+"px";
style.height=height+numVerticalBorders*border+"px";
style.width=(freeHorizontalSpace<border?freeHorizontalSpace:border)+"px"
}else{style.top=-2*border+"px";
style.left=-2*border+"px";
style.height=border+"px";
style.width=border+"px"
}if(!outlineVisible){this.showOutline()
}},hideOutline:function(){if(!outlineVisible){return
}for(var name in outline){offlineFragment.appendChild(outlineElements[name])
}outlineVisible=false
},showOutline:function(){if(outlineVisible){return
}if(boxModelVisible){this.hideBoxModel()
}for(var name in outline){Firebug.browser.document.getElementsByTagName("body")[0].appendChild(outlineElements[name])
}outlineVisible=true
},drawBoxModel:function(el){var box=Firebug.browser.getElementBox(el);
var windowSize=Firebug.browser.getWindowSize();
var scrollPosition=Firebug.browser.getWindowScrollPosition();
var offsetHeight=Firebug.chrome.type=="frame"?FirebugChrome.height:0;
if(box.top>scrollPosition.top+windowSize.height-offsetHeight||box.left>scrollPosition.left+windowSize.width||scrollPosition.top>box.top+box.height||scrollPosition.left>box.left+box.width){return
}var top=box.top;
var left=box.left;
var height=box.height;
var width=box.width;
var margin=Firebug.browser.getMeasurementBox(el,"margin");
var padding=Firebug.browser.getMeasurementBox(el,"padding");
var border=Firebug.browser.getMeasurementBox(el,"border");
boxModelStyle.top=top-margin.top+"px";
boxModelStyle.left=left-margin.left+"px";
boxModelStyle.height=height+margin.top+margin.bottom+"px";
boxModelStyle.width=width+margin.left+margin.right+"px";
boxBorderStyle.top=margin.top+"px";
boxBorderStyle.left=margin.left+"px";
boxBorderStyle.height=height+"px";
boxBorderStyle.width=width+"px";
boxPaddingStyle.top=margin.top+border.top+"px";
boxPaddingStyle.left=margin.left+border.left+"px";
boxPaddingStyle.height=height-border.top-border.bottom+"px";
boxPaddingStyle.width=width-border.left-border.right+"px";
boxContentStyle.top=margin.top+border.top+padding.top+"px";
boxContentStyle.left=margin.left+border.left+padding.left+"px";
boxContentStyle.height=height-border.top-padding.top-padding.bottom-border.bottom+"px";
boxContentStyle.width=width-border.left-padding.left-padding.right-border.right+"px";
if(!boxModelVisible){this.showBoxModel()
}},hideBoxModel:function(){if(!boxModelVisible){return
}offlineFragment.appendChild(boxModel);
boxModelVisible=false
},showBoxModel:function(){if(boxModelVisible){return
}if(outlineVisible){this.hideOutline()
}Firebug.browser.document.getElementsByTagName("body")[0].appendChild(boxModel);
boxModelVisible=true
}};
var offlineFragment=null;
var boxModelVisible=false;
var boxModel,boxModelStyle,boxMargin,boxMarginStyle,boxBorder,boxBorderStyle,boxPadding,boxPaddingStyle,boxContent,boxContentStyle;
var resetStyle="margin:0; padding:0; border:0; position:absolute; overflow:hidden; display:block;";
var offscreenStyle=resetStyle+"top:-1234px; left:-1234px;";
var inspectStyle=resetStyle+"z-index: 2147483500;";
var inspectFrameStyle=resetStyle+"z-index: 2147483550; top:0; left:0; background:url("+Env.Location.skinDir+"pixel_transparent.gif);";
var inspectModelOpacity=isIE?"filter:alpha(opacity=80);":"opacity:0.8;";
var inspectModelStyle=inspectStyle+inspectModelOpacity;
var inspectMarginStyle=inspectStyle+"background: #EDFF64; height:100%; width:100%;";
var inspectBorderStyle=inspectStyle+"background: #666;";
var inspectPaddingStyle=inspectStyle+"background: SlateBlue;";
var inspectContentStyle=inspectStyle+"background: SkyBlue;";
var outlineStyle={fbHorizontalLine:"background: #3875D7;height: 2px;",fbVerticalLine:"background: #3875D7;width: 2px;"};
var lastInspecting=0;
var fbInspectFrame=null;
var outlineVisible=false;
var outlineElements={};
var outline={fbOutlineT:"fbHorizontalLine",fbOutlineL:"fbVerticalLine",fbOutlineB:"fbHorizontalLine",fbOutlineR:"fbVerticalLine"};
var getInspectingTarget=function(){};
var createInspectorFrame=function createInspectorFrame(){fbInspectFrame=createGlobalElement("div");
fbInspectFrame.id="fbInspectFrame";
fbInspectFrame.firebugIgnore=true;
fbInspectFrame.style.cssText=inspectFrameStyle;
Firebug.browser.document.getElementsByTagName("body")[0].appendChild(fbInspectFrame)
};
var destroyInspectorFrame=function destroyInspectorFrame(){if(fbInspectFrame){Firebug.browser.document.getElementsByTagName("body")[0].removeChild(fbInspectFrame);
fbInspectFrame=null
}};
var createOutlineInspector=function createOutlineInspector(){for(var name in outline){var el=outlineElements[name]=createGlobalElement("div");
el.id=name;
el.firebugIgnore=true;
el.style.cssText=inspectStyle+outlineStyle[outline[name]];
offlineFragment.appendChild(el)
}};
var destroyOutlineInspector=function destroyOutlineInspector(){for(var name in outline){var el=outlineElements[name];
el.parentNode.removeChild(el)
}};
var createBoxModelInspector=function createBoxModelInspector(){boxModel=createGlobalElement("div");
boxModel.id="fbBoxModel";
boxModel.firebugIgnore=true;
boxModelStyle=boxModel.style;
boxModelStyle.cssText=inspectModelStyle;
boxMargin=createGlobalElement("div");
boxMargin.id="fbBoxMargin";
boxMarginStyle=boxMargin.style;
boxMarginStyle.cssText=inspectMarginStyle;
boxModel.appendChild(boxMargin);
boxBorder=createGlobalElement("div");
boxBorder.id="fbBoxBorder";
boxBorderStyle=boxBorder.style;
boxBorderStyle.cssText=inspectBorderStyle;
boxModel.appendChild(boxBorder);
boxPadding=createGlobalElement("div");
boxPadding.id="fbBoxPadding";
boxPaddingStyle=boxPadding.style;
boxPaddingStyle.cssText=inspectPaddingStyle;
boxModel.appendChild(boxPadding);
boxContent=createGlobalElement("div");
boxContent.id="fbBoxContent";
boxContentStyle=boxContent.style;
boxContentStyle.cssText=inspectContentStyle;
boxModel.appendChild(boxContent);
offlineFragment.appendChild(boxModel)
};
var destroyBoxModelInspector=function destroyBoxModelInspector(){boxModel.parentNode.removeChild(boxModel)
}
}});
FBL.ns(function(){with(FBL){var consoleQueue=[];
var lastHighlightedObject;
var FirebugContext=Env.browser;
var $STRF=function(){return"$STRF not supported yet"
};
var maxQueueRequests=500;
Firebug.ConsoleBase={log:function(object,context,className,rep,noThrottle,sourceLink){return this.logRow(appendObject,object,context,className,rep,sourceLink,noThrottle)
},logFormatted:function(objects,context,className,noThrottle,sourceLink){return this.logRow(appendFormatted,objects,context,className,null,sourceLink,noThrottle)
},openGroup:function(objects,context,className,rep,noThrottle,sourceLink,noPush){return this.logRow(appendOpenGroup,objects,context,className,rep,sourceLink,noThrottle)
},closeGroup:function(context,noThrottle){return this.logRow(appendCloseGroup,null,context,null,null,null,noThrottle,true)
},logRow:function(appender,objects,context,className,rep,sourceLink,noThrottle,noRow){noThrottle=true;
if(!context){context=FirebugContext
}if(FBTrace.DBG_ERRORS&&!context){FBTrace.sysout("Console.logRow has no context, skipping objects",objects)
}if(!context){return
}if(noThrottle||!context){var panel=this.getPanel(context);
if(panel){var row=panel.append(appender,objects,className,rep,sourceLink,noRow);
var container=panel.panelNode;
return row
}else{consoleQueue.push([appender,objects,context,className,rep,sourceLink,noThrottle,noRow])
}}else{if(!context.throttle){return
}var args=[appender,objects,context,className,rep,sourceLink,true,noRow];
context.throttle(this.logRow,this,args)
}},appendFormatted:function(args,row,context){if(!context){context=FirebugContext
}var panel=this.getPanel(context);
panel.appendFormatted(args,row)
},clear:function(context){if(!context){context=Firebug.context
}var panel=this.getPanel(context,true);
if(panel){panel.clear()
}},getPanel:function(context,noCreate){return Firebug.chrome?Firebug.chrome.getPanel("Console"):null
}};
var ActivableConsole=extend(Firebug.ConsoleBase,{isAlwaysEnabled:function(){return true
}});
Firebug.Console=Firebug.Console=extend(ActivableConsole,{dispatchName:"console",error:function(){Firebug.Console.logFormatted(arguments,Firebug.browser,"error")
},flush:function(){for(var i=0,length=consoleQueue.length;
i<length;
i++){var args=consoleQueue[i];
this.logRow.apply(this,args)
}},showPanel:function(browser,panel){},getFirebugConsoleElement:function(context,win){var element=win.document.getElementById("_firebugConsole");
if(!element){if(FBTrace.DBG_CONSOLE){FBTrace.sysout("getFirebugConsoleElement forcing element")
}var elementForcer="(function(){var r=null; try { r = window._getFirebugConsoleElement();}catch(exc){r=exc;} return r;})();";
if(context.stopped){Firebug.Console.injector.evaluateConsoleScript(context)
}else{var r=Firebug.CommandLine.evaluateInWebPage(elementForcer,context,win)
}if(FBTrace.DBG_CONSOLE){FBTrace.sysout("getFirebugConsoleElement forcing element result "+r,r)
}var element=win.document.getElementById("_firebugConsole");
if(!element){if(FBTrace.DBG_ERRORS){FBTrace.sysout("console.getFirebugConsoleElement: no _firebugConsole in win:",win)
}Firebug.Console.logFormatted(["Firebug cannot find _firebugConsole element",r,win],context,"error",true)
}}return element
},isReadyElsePreparing:function(context,win){if(FBTrace.DBG_CONSOLE){FBTrace.sysout("console.isReadyElsePreparing, win is "+(win?"an argument: ":"null, context.window: ")+(win?win.location:context.window.location),(win?win:context.window))
}if(win){return this.injector.attachIfNeeded(context,win)
}else{var attached=true;
for(var i=0;
i<context.windows.length;
i++){attached=attached&&this.injector.attachIfNeeded(context,context.windows[i])
}if(context.windows.indexOf(context.window)==-1){FBTrace.sysout("isReadyElsePreparing ***************** context.window not in context.windows")
}if(FBTrace.DBG_CONSOLE){FBTrace.sysout("console.isReadyElsePreparing attached to "+context.windows.length+" and returns "+attached)
}return attached
}},initialize:function(){this.panelName="console"
},enable:function(){if(Firebug.Console.isAlwaysEnabled()){this.watchForErrors()
}},disable:function(){if(Firebug.Console.isAlwaysEnabled()){this.unwatchForErrors()
}},initContext:function(context,persistedState){Firebug.ActivableModule.initContext.apply(this,arguments);
context.consoleReloadWarning=true
},loadedContext:function(context){for(var url in context.sourceFileMap){return
}this.clearReloadWarning(context)
},clearReloadWarning:function(context){if(context.consoleReloadWarning){var panel=context.getPanel(this.panelName);
panel.clearReloadWarning();
delete context.consoleReloadWarning
}},togglePersist:function(context){var panel=context.getPanel(this.panelName);
panel.persistContent=panel.persistContent?false:true;
Firebug.chrome.setGlobalAttribute("cmd_togglePersistConsole","checked",panel.persistContent)
},showContext:function(browser,context){Firebug.chrome.setGlobalAttribute("cmd_clearConsole","disabled",!context);
Firebug.ActivableModule.showContext.apply(this,arguments)
},destroyContext:function(context,persistedState){Firebug.Console.injector.detachConsole(context,context.window)
},onPanelEnable:function(panelName){if(panelName!=this.panelName){return
}if(FBTrace.DBG_CONSOLE){FBTrace.sysout("console.onPanelEnable**************")
}this.watchForErrors();
Firebug.Debugger.addDependentModule(this)
},onPanelDisable:function(panelName){if(panelName!=this.panelName){return
}if(FBTrace.DBG_CONSOLE){FBTrace.sysout("console.onPanelDisable**************")
}Firebug.Debugger.removeDependentModule(this);
this.unwatchForErrors();
this.clear()
},onSuspendFirebug:function(){if(FBTrace.DBG_CONSOLE){FBTrace.sysout("console.onSuspendFirebug\n")
}if(Firebug.Console.isAlwaysEnabled()){this.unwatchForErrors()
}},onResumeFirebug:function(){if(FBTrace.DBG_CONSOLE){FBTrace.sysout("console.onResumeFirebug\n")
}if(Firebug.Console.isAlwaysEnabled()){this.watchForErrors()
}},watchForErrors:function(){Firebug.Errors.checkEnabled();
$("fbStatusIcon").setAttribute("console","on")
},unwatchForErrors:function(){Firebug.Errors.checkEnabled();
$("fbStatusIcon").removeAttribute("console")
},onMonitorScript:function(context,frame){Firebug.Console.log(frame,context)
},onFunctionCall:function(context,frame,depth,calling){if(calling){Firebug.Console.openGroup([frame,"depth:"+depth],context)
}else{Firebug.Console.closeGroup(context)
}},logRow:function(appender,objects,context,className,rep,sourceLink,noThrottle,noRow){if(!context){context=FirebugContext
}if(FBTrace.DBG_WINDOWS&&!context){FBTrace.sysout("Console.logRow: no context \n")
}if(this.isAlwaysEnabled()){return Firebug.ConsoleBase.logRow.apply(this,arguments)
}}});
Firebug.ConsoleListener={log:function(context,object,className,sourceLink){},logFormatted:function(context,objects,className,sourceLink){}};
Firebug.ConsolePanel=function(){};
Firebug.ConsolePanel.prototype=extend(Firebug.Panel,{wasScrolledToBottom:false,messageCount:0,lastLogTime:0,groups:null,limit:null,append:function(appender,objects,className,rep,sourceLink,noRow){var container=this.getTopContainer();
if(noRow){appender.apply(this,[objects])
}else{var row=this.createRow("logRow",className);
appender.apply(this,[objects,row,rep]);
if(sourceLink){FirebugReps.SourceLink.tag.append({object:sourceLink},row)
}container.appendChild(row);
this.filterLogRow(row,this.wasScrolledToBottom);
if(this.wasScrolledToBottom){scrollToBottom(this.panelNode)
}return row
}},clear:function(){if(this.panelNode){if(FBTrace.DBG_CONSOLE){FBTrace.sysout("ConsolePanel.clear")
}clearNode(this.panelNode);
this.insertLogLimit(this.context)
}},insertLogLimit:function(){var row=this.createRow("limitRow");
var limitInfo={totalCount:0,limitPrefsTitle:$STRF("LimitPrefsTitle",[Firebug.prefDomain+".console.logLimit"])};
return;
var netLimitRep=Firebug.NetMonitor.NetLimit;
var nodes=netLimitRep.createTable(row,limitInfo);
this.limit=nodes[1];
var container=this.panelNode;
container.insertBefore(nodes[0],container.firstChild)
},insertReloadWarning:function(){this.warningRow=this.append(appendObject,$STR("message.Reload to activate window console"),"info")
},clearReloadWarning:function(){if(this.warningRow){this.warningRow.parentNode.removeChild(this.warningRow);
delete this.warningRow
}},appendObject:function(object,row,rep){if(!rep){rep=Firebug.getRep(object)
}return rep.tag.append({object:object},row)
},appendFormatted:function(objects,row,rep){if(!objects||!objects.length){return
}function logText(text,row){var node=row.ownerDocument.createTextNode(text);
row.appendChild(node)
}var format=objects[0];
var objIndex=0;
if(typeof(format)!="string"){format="";
objIndex=-1
}else{if(objects.length===1){if(format.length<1){logText("(an empty string)",row);
return
}}}var parts=parseFormat(format);
var trialIndex=objIndex;
for(var i=0;
i<parts.length;
i++){var part=parts[i];
if(part&&typeof(part)=="object"){if(++trialIndex>objects.length){format="";
objIndex=-1;
parts.length=0;
break
}}}for(var i=0;
i<parts.length;
++i){var part=parts[i];
if(part&&typeof(part)=="object"){var object=objects[++objIndex];
if(typeof(object)!="undefined"){this.appendObject(object,row,part.rep)
}else{this.appendObject(part.type,row,FirebugReps.Text)
}}else{FirebugReps.Text.tag.append({object:part},row)
}}for(var i=objIndex+1;
i<objects.length;
++i){logText(" ",row);
var object=objects[i];
if(typeof(object)=="string"){FirebugReps.Text.tag.append({object:object},row)
}else{this.appendObject(object,row)
}}},appendOpenGroup:function(objects,row,rep){if(!this.groups){this.groups=[]
}setClass(row,"logGroup");
setClass(row,"opened");
var innerRow=this.createRow("logRow");
setClass(innerRow,"logGroupLabel");
if(rep){rep.tag.replace({objects:objects},innerRow)
}else{this.appendFormatted(objects,innerRow,rep)
}row.appendChild(innerRow);
var groupBody=this.createRow("logGroupBody");
row.appendChild(groupBody);
groupBody.setAttribute("role","group");
this.groups.push(groupBody);
addEvent(innerRow,"mousedown",function(event){if(isLeftClick(event)){var target=event.target||event.srcElement;
target=getAncestorByClass(target,"logGroupLabel");
var groupRow=target.parentNode;
if(hasClass(groupRow,"opened")){removeClass(groupRow,"opened");
target.setAttribute("aria-expanded","false")
}else{setClass(groupRow,"opened");
target.setAttribute("aria-expanded","true")
}}})
},appendCloseGroup:function(object,row,rep){if(this.groups){this.groups.pop()
}},onMouseMove:function(event){var target=event.srcElement||event.target;
var object=getAncestorByClass(target,"objectLink-element");
object=object?object.repObject:null;
if(object&&instanceOf(object,"Element")&&object.nodeType==1){if(object!=lastHighlightedObject){Firebug.Inspector.drawBoxModel(object);
object=lastHighlightedObject
}}else{Firebug.Inspector.hideBoxModel()
}},onMouseDown:function(event){var target=event.srcElement||event.target;
var object=getAncestorByClass(target,"objectLink");
var repObject=object?object.repObject:null;
if(!repObject){return
}if(hasClass(object,"objectLink-object")){Firebug.chrome.selectPanel("DOM");
Firebug.chrome.getPanel("DOM").select(repObject,true)
}else{if(hasClass(object,"objectLink-element")){Firebug.chrome.selectPanel("HTML");
Firebug.chrome.getPanel("HTML").select(repObject,true)
}}},name:"Console",title:"Console",options:{hasCommandLine:true,hasToolButtons:true,isPreRendered:true},create:function(){Firebug.Panel.create.apply(this,arguments);
this.context=Firebug.browser.window;
this.document=Firebug.chrome.document;
this.onMouseMove=bind(this.onMouseMove,this);
this.onMouseDown=bind(this.onMouseDown,this);
this.clearButton=new Button({element:$("fbConsole_btClear"),owner:Firebug.Console,onClick:Firebug.Console.clear})
},initialize:function(){Firebug.Panel.initialize.apply(this,arguments);
if(!this.persistedContent&&Firebug.Console.isAlwaysEnabled()){this.insertLogLimit(this.context);
this.updateMaxLimit();
if(this.context.consoleReloadWarning){this.insertReloadWarning()
}}addEvent(this.panelNode,"mouseover",this.onMouseMove);
addEvent(this.panelNode,"mousedown",this.onMouseDown);
this.clearButton.initialize()
},initializeNode:function(){if(FBTrace.DBG_CONSOLE){this.onScroller=bind(this.onScroll,this);
addEvent(this.panelNode,"scroll",this.onScroller)
}this.onResizer=bind(this.onResize,this);
this.resizeEventTarget=Firebug.chrome.$("fbContentBox");
addEvent(this.resizeEventTarget,"resize",this.onResizer)
},destroyNode:function(){if(this.onScroller){removeEvent(this.panelNode,"scroll",this.onScroller)
}removeEvent(this.resizeEventTarget,"resize",this.onResizer)
},shutdown:function(){this.clearButton.shutdown();
removeEvent(this.panelNode,"mousemove",this.onMouseMove);
removeEvent(this.panelNode,"mousedown",this.onMouseDown);
this.destroyNode();
Firebug.Panel.shutdown.apply(this,arguments)
},ishow:function(state){if(FBTrace.DBG_CONSOLE){FBTrace.sysout("Console.panel show; "+this.context.getName(),state)
}var enabled=Firebug.Console.isAlwaysEnabled();
if(enabled){Firebug.Console.disabledPanelPage.hide(this);
this.showCommandLine(true);
this.showToolbarButtons("fbConsoleButtons",true);
Firebug.chrome.setGlobalAttribute("cmd_togglePersistConsole","checked",this.persistContent);
if(state&&state.wasScrolledToBottom){this.wasScrolledToBottom=state.wasScrolledToBottom;
delete state.wasScrolledToBottom
}if(this.wasScrolledToBottom){scrollToBottom(this.panelNode)
}if(FBTrace.DBG_CONSOLE){FBTrace.sysout("console.show ------------------ wasScrolledToBottom: "+this.wasScrolledToBottom+", "+this.context.getName())
}}else{this.hide(state);
Firebug.Console.disabledPanelPage.show(this)
}},ihide:function(state){if(FBTrace.DBG_CONSOLE){FBTrace.sysout("Console.panel hide; "+this.context.getName(),state)
}this.showToolbarButtons("fbConsoleButtons",false);
this.showCommandLine(false);
if(FBTrace.DBG_CONSOLE){FBTrace.sysout("console.hide ------------------ wasScrolledToBottom: "+this.wasScrolledToBottom+", "+this.context.getName())
}},destroy:function(state){if(this.panelNode.offsetHeight){this.wasScrolledToBottom=isScrolledToBottom(this.panelNode)
}if(state){state.wasScrolledToBottom=this.wasScrolledToBottom
}if(FBTrace.DBG_CONSOLE){FBTrace.sysout("console.destroy ------------------ wasScrolledToBottom: "+this.wasScrolledToBottom+", "+this.context.getName())
}},shouldBreakOnNext:function(){return Firebug.getPref(Firebug.servicePrefDomain,"breakOnErrors")
},getBreakOnNextTooltip:function(enabled){return(enabled?$STR("console.Disable Break On All Errors"):$STR("console.Break On All Errors"))
},enablePanel:function(module){if(FBTrace.DBG_CONSOLE){FBTrace.sysout("console.ConsolePanel.enablePanel; "+this.context.getName())
}Firebug.ActivablePanel.enablePanel.apply(this,arguments);
this.showCommandLine(true);
if(this.wasScrolledToBottom){scrollToBottom(this.panelNode)
}},disablePanel:function(module){if(FBTrace.DBG_CONSOLE){FBTrace.sysout("console.ConsolePanel.disablePanel; "+this.context.getName())
}Firebug.ActivablePanel.disablePanel.apply(this,arguments);
this.showCommandLine(false)
},getOptionsMenuItems:function(){return[optionMenu("ShowJavaScriptErrors","showJSErrors"),optionMenu("ShowJavaScriptWarnings","showJSWarnings"),optionMenu("ShowCSSErrors","showCSSErrors"),optionMenu("ShowXMLErrors","showXMLErrors"),optionMenu("ShowXMLHttpRequests","showXMLHttpRequests"),optionMenu("ShowChromeErrors","showChromeErrors"),optionMenu("ShowChromeMessages","showChromeMessages"),optionMenu("ShowExternalErrors","showExternalErrors"),optionMenu("ShowNetworkErrors","showNetworkErrors"),this.getShowStackTraceMenuItem(),this.getStrictOptionMenuItem(),"-",optionMenu("LargeCommandLine","largeCommandLine")]
},getShowStackTraceMenuItem:function(){var menuItem=serviceOptionMenu("ShowStackTrace","showStackTrace");
if(FirebugContext&&!Firebug.Debugger.isAlwaysEnabled()){menuItem.disabled=true
}return menuItem
},getStrictOptionMenuItem:function(){var strictDomain="javascript.options";
var strictName="strict";
var strictValue=prefs.getBoolPref(strictDomain+"."+strictName);
return{label:"JavascriptOptionsStrict",type:"checkbox",checked:strictValue,command:bindFixed(Firebug.setPref,Firebug,strictDomain,strictName,!strictValue)}
},getBreakOnMenuItems:function(){return[]
},search:function(text){if(!text){return
}if(this.matchSet){for(var i in this.matchSet){removeClass(this.matchSet[i],"matched")
}}this.matchSet=[];
function findRow(node){return getAncestorByClass(node,"logRow")
}var search=new TextSearch(this.panelNode,findRow);
var logRow=search.find(text);
if(!logRow){dispatch([Firebug.A11yModel],"onConsoleSearchMatchFound",[this,text,[]]);
return false
}for(;
logRow;
logRow=search.findNext()){setClass(logRow,"matched");
this.matchSet.push(logRow)
}dispatch([Firebug.A11yModel],"onConsoleSearchMatchFound",[this,text,this.matchSet]);
return true
},breakOnNext:function(breaking){Firebug.setPref(Firebug.servicePrefDomain,"breakOnErrors",breaking)
},createRow:function(rowName,className){var elt=this.document.createElement("div");
elt.className=rowName+(className?" "+rowName+"-"+className:"");
return elt
},getTopContainer:function(){if(this.groups&&this.groups.length){return this.groups[this.groups.length-1]
}else{return this.panelNode
}},filterLogRow:function(logRow,scrolledToBottom){if(this.searchText){setClass(logRow,"matching");
setClass(logRow,"matched");
setTimeout(bindFixed(function(){if(this.searchFilter(this.searchText,logRow)){this.matchSet.push(logRow)
}else{removeClass(logRow,"matched")
}removeClass(logRow,"matching");
if(scrolledToBottom){scrollToBottom(this.panelNode)
}},this),100)
}},searchFilter:function(text,logRow){var count=this.panelNode.childNodes.length;
var searchRange=this.document.createRange();
searchRange.setStart(this.panelNode,0);
searchRange.setEnd(this.panelNode,count);
var startPt=this.document.createRange();
startPt.setStartBefore(logRow);
var endPt=this.document.createRange();
endPt.setStartAfter(logRow);
return finder.Find(text,searchRange,startPt,endPt)!=null
},observe:function(subject,topic,data){if(topic!="nsPref:changed"){return
}var prefDomain="Firebug.extension.";
var prefName=data.substr(prefDomain.length);
if(prefName=="console.logLimit"){this.updateMaxLimit()
}},updateMaxLimit:function(){var value=1000;
maxQueueRequests=value?value:maxQueueRequests
},showCommandLine:function(shouldShow){return;
if(shouldShow){collapse(Firebug.chrome.$("fbCommandBox"),false);
Firebug.CommandLine.setMultiLine(Firebug.largeCommandLine,Firebug.chrome)
}else{Firebug.CommandLine.setMultiLine(false,Firebug.chrome,Firebug.largeCommandLine);
collapse(Firebug.chrome.$("fbCommandBox"),true)
}},onScroll:function(event){this.wasScrolledToBottom=FBL.isScrolledToBottom(this.panelNode);
if(FBTrace.DBG_CONSOLE){FBTrace.sysout("console.onScroll ------------------ wasScrolledToBottom: "+this.wasScrolledToBottom+", wasScrolledToBottom: "+this.context.getName(),event)
}},onResize:function(event){if(FBTrace.DBG_CONSOLE){FBTrace.sysout("console.onResize ------------------ wasScrolledToBottom: "+this.wasScrolledToBottom+", offsetHeight: "+this.panelNode.offsetHeight+", scrollTop: "+this.panelNode.scrollTop+", scrollHeight: "+this.panelNode.scrollHeight+", "+this.context.getName(),event)
}if(this.wasScrolledToBottom){scrollToBottom(this.panelNode)
}}});
function parseFormat(format){var parts=[];
if(format.length<=0){return parts
}var reg=/((^%|.%)(\d+)?(\.)([a-zA-Z]))|((^%|.%)([a-zA-Z]))/;
for(var m=reg.exec(format);
m;
m=reg.exec(format)){if(m[0].substr(0,2)=="%%"){parts.push(format.substr(0,m.index));
parts.push(m[0].substr(1))
}else{var type=m[8]?m[8]:m[5];
var precision=m[3]?parseInt(m[3]):(m[4]=="."?-1:0);
var rep=null;
switch(type){case"s":rep=FirebugReps.Text;
break;
case"f":case"i":case"d":rep=FirebugReps.Number;
break;
case"o":rep=null;
break
}parts.push(format.substr(0,m[0][0]=="%"?m.index:m.index+1));
parts.push({rep:rep,precision:precision,type:("%"+type)})
}format=format.substr(m.index+m[0].length)
}parts.push(format);
return parts
}var appendObject=Firebug.ConsolePanel.prototype.appendObject;
var appendFormatted=Firebug.ConsolePanel.prototype.appendFormatted;
var appendOpenGroup=Firebug.ConsolePanel.prototype.appendOpenGroup;
var appendCloseGroup=Firebug.ConsolePanel.prototype.appendCloseGroup;
Firebug.registerModule(Firebug.Console);
Firebug.registerPanel(Firebug.ConsolePanel)
}});
FBL.ns(function(){with(FBL){var frameCounters={};
Firebug.Console.injector={install:function(context){var win=context.window;
var consoleHandler=new FirebugConsoleHandler(context,win);
var properties=["log","debug","info","warn","error","assert","dir","dirxml","group","groupCollapsed","groupEnd","time","timeEnd","count","trace","profile","profileEnd","clear","open","close"];
var Handler=function(name){var c=consoleHandler;
var f=consoleHandler[name];
return function(){return f.apply(c,arguments)
}
};
var installer=function(c){for(var i=0,l=properties.length;
i<l;
i++){var name=properties[i];
c[name]=new Handler(name);
c.firebuglite=Firebug.version
}};
var consoleNS=(!isFirefox||isFirefox&&!("console" in win))?"console":"firebug";
var sandbox=new win.Function("arguments.callee.install(window."+consoleNS+"={})");
sandbox.install=installer;
sandbox()
},isAttached:function(context,win){if(win.wrappedJSObject){var attached=(win.wrappedJSObject._getFirebugConsoleElement?true:false);
if(FBTrace.DBG_CONSOLE){FBTrace.sysout("Console.isAttached:"+attached+" to win.wrappedJSObject "+safeGetWindowLocation(win.wrappedJSObject))
}return attached
}else{if(FBTrace.DBG_CONSOLE){FBTrace.sysout("Console.isAttached? to win "+win.location+" fnc:"+win._getFirebugConsoleElement)
}return(win._getFirebugConsoleElement?true:false)
}},attachIfNeeded:function(context,win){if(FBTrace.DBG_CONSOLE){FBTrace.sysout("Console.attachIfNeeded has win "+(win?((win.wrappedJSObject?"YES":"NO")+" wrappedJSObject"):"null"))
}if(this.isAttached(context,win)){return true
}if(FBTrace.DBG_CONSOLE){FBTrace.sysout("Console.attachIfNeeded found isAttached false ")
}this.attachConsoleInjector(context,win);
this.addConsoleListener(context,win);
Firebug.Console.clearReloadWarning(context);
var attached=this.isAttached(context,win);
if(attached){dispatch(Firebug.Console.fbListeners,"onConsoleInjected",[context,win])
}return attached
},attachConsoleInjector:function(context,win){var consoleInjection=this.getConsoleInjectionScript();
if(FBTrace.DBG_CONSOLE){FBTrace.sysout("attachConsoleInjector evaluating in "+win.location,consoleInjection)
}Firebug.CommandLine.evaluateInWebPage(consoleInjection,context,win);
if(FBTrace.DBG_CONSOLE){FBTrace.sysout("attachConsoleInjector evaluation completed for "+win.location)
}},getConsoleInjectionScript:function(){if(!this.consoleInjectionScript){var script="";
script+="window.__defineGetter__('console', function() {\n";
script+=" return (window._firebug ? window._firebug : window.loadFirebugConsole()); })\n\n";
script+="window.loadFirebugConsole = function() {\n";
script+="window._firebug = new _FirebugConsole();";
if(FBTrace.DBG_CONSOLE){script+=" window.dump('loadFirebugConsole '+window.location+'\\n');\n"
}script+=" return window._firebug };\n";
var theFirebugConsoleScript=getResource("chrome://firebug/content/consoleInjected.js");
script+=theFirebugConsoleScript;
this.consoleInjectionScript=script
}return this.consoleInjectionScript
},forceConsoleCompilationInPage:function(context,win){if(!win){if(FBTrace.DBG_CONSOLE){FBTrace.sysout("no win in forceConsoleCompilationInPage!")
}return
}var consoleForcer="window.loadFirebugConsole();";
if(context.stopped){Firebug.Console.injector.evaluateConsoleScript(context)
}else{Firebug.CommandLine.evaluateInWebPage(consoleForcer,context,win)
}if(FBTrace.DBG_CONSOLE){FBTrace.sysout("forceConsoleCompilationInPage "+win.location,consoleForcer)
}},evaluateConsoleScript:function(context){var scriptSource=this.getConsoleInjectionScript();
Firebug.Debugger.evaluate(scriptSource,context)
},addConsoleListener:function(context,win){if(!context.activeConsoleHandlers){context.activeConsoleHandlers=[]
}else{for(var i=0;
i<context.activeConsoleHandlers.length;
i++){if(context.activeConsoleHandlers[i].window==win){context.activeConsoleHandlers[i].detach();
if(FBTrace.DBG_CONSOLE){FBTrace.sysout("consoleInjector addConsoleListener removed handler("+context.activeConsoleHandlers[i].handler_name+") from _firebugConsole in : "+win.location+"\n")
}context.activeConsoleHandlers.splice(i,1)
}}}var element=Firebug.Console.getFirebugConsoleElement(context,win);
if(element){element.setAttribute("FirebugVersion",Firebug.version)
}else{return false
}var handler=new FirebugConsoleHandler(context,win);
handler.attachTo(element);
context.activeConsoleHandlers.push(handler);
if(FBTrace.DBG_CONSOLE){FBTrace.sysout("consoleInjector addConsoleListener attached handler("+handler.handler_name+") to _firebugConsole in : "+win.location+"\n")
}return true
},detachConsole:function(context,win){if(win&&win.document){var element=win.document.getElementById("_firebugConsole");
if(element){element.parentNode.removeChild(element)
}}}};
var total_handlers=0;
var FirebugConsoleHandler=function FirebugConsoleHandler(context,win){this.window=win;
this.attachTo=function(element){this.element=element;
this.boundHandler=bind(this.handleEvent,this);
this.element.addEventListener("firebugAppendConsole",this.boundHandler,true)
};
this.detach=function(){this.element.removeEventListener("firebugAppendConsole",this.boundHandler,true)
};
this.handler_name=++total_handlers;
this.handleEvent=function(event){if(FBTrace.DBG_CONSOLE){FBTrace.sysout("FirebugConsoleHandler("+this.handler_name+") "+event.target.getAttribute("methodName")+", event",event)
}if(!Firebug.CommandLine.CommandHandler.handle(event,this,win)){if(FBTrace.DBG_CONSOLE){FBTrace.sysout("FirebugConsoleHandler",this)
}var methodName=event.target.getAttribute("methodName");
Firebug.Console.log($STRF("console.MethodNotSupported",[methodName]))
}};
this.firebuglite=Firebug.version;
this.init=function(){var consoleElement=win.document.getElementById("_firebugConsole");
consoleElement.setAttribute("FirebugVersion",Firebug.version)
};
this.log=function(){logFormatted(arguments,"log")
};
this.debug=function(){logFormatted(arguments,"debug",true)
};
this.info=function(){logFormatted(arguments,"info",true)
};
this.warn=function(){logFormatted(arguments,"warn",true)
};
this.error=function(){logFormatted(arguments,"error",true)
};
this.exception=function(){logAssert("error",arguments)
};
this.assert=function(x){if(!x){var rest=[];
for(var i=1;
i<arguments.length;
i++){rest.push(arguments[i])
}logAssert("assert",rest)
}};
this.dir=function(o){Firebug.Console.log(o,context,"dir",Firebug.DOMPanel.DirTable)
};
this.dirxml=function(o){if(o instanceof Window){o=o.document.documentElement
}else{if(o instanceof Document){o=o.documentElement
}}Firebug.Console.log(o,context,"dirxml",Firebug.HTMLPanel.SoloElement)
};
this.group=function(){var sourceLink=null;
Firebug.Console.openGroup(arguments,null,"group",null,false,sourceLink)
};
this.groupEnd=function(){Firebug.Console.closeGroup(context)
};
this.groupCollapsed=function(){var sourceLink=getStackLink();
var row=Firebug.Console.openGroup(arguments,null,"group",null,true,sourceLink);
removeClass(row,"opened")
};
this.profile=function(title){logFormatted(["console.profile() not supported."],"warn",true)
};
this.profileEnd=function(){logFormatted(["console.profile() not supported."],"warn",true)
};
this.count=function(key){var frameId="0";
if(frameId){if(!frameCounters){frameCounters={}
}if(key!=undefined){frameId+=key
}var frameCounter=frameCounters[frameId];
if(!frameCounter){var logRow=logFormatted(["0"],null,true,true);
frameCounter={logRow:logRow,count:1};
frameCounters[frameId]=frameCounter
}else{++frameCounter.count
}var label=key==undefined?frameCounter.count:key+" "+frameCounter.count;
frameCounter.logRow.firstChild.firstChild.nodeValue=label
}};
this.trace=function(){var getFuncName=function getFuncName(f){if(f.getName instanceof Function){return f.getName()
}if(f.name){return f.name
}var name=f.toString().match(/function\s*([_$\w\d]*)/)[1];
return name||"anonymous"
};
var wasVisited=function(fn){for(var i=0,l=frames.length;
i<l;
i++){if(frames[i].fn==fn){return true
}}return false
};
var frames=[];
for(var fn=arguments.callee.caller.caller;
fn;
fn=fn.caller){if(wasVisited(fn)){break
}var args=[];
for(var i=0,l=fn.arguments.length;
i<l;
++i){args.push({value:fn.arguments[i]})
}frames.push({fn:fn,name:getFuncName(fn),args:args})
}try{(0)()
}catch(e){var result=e;
var stack=result.stack||result.stacktrace||"";
stack=stack.replace(/\n\r|\r\n/g,"\n");
var items=stack.split(/[\n\r]/);
if(FBL.isSafari){var reChromeStackItem=/^\s+at\s+(.*)((?:http|https|ftp|file):\/\/.*)$/;
var reChromeStackItemName=/\s*\($/;
var reChromeStackItemValue=/^(.+)\:(\d+\:\d+)\)?$/;
var framePos=0;
for(var i=4,length=items.length;
i<length;
i++,framePos++){var frame=frames[framePos];
var item=items[i];
var match=item.match(reChromeStackItem);
if(match){var name=match[1];
if(name){name=name.replace(reChromeStackItemName,"");
frame.name=name
}var value=match[2].match(reChromeStackItemValue);
if(value){frame.href=value[1];
frame.lineNo=value[2]
}}}}else{if(FBL.isFirefox){var reFirefoxStackItem=/^(.*)@(.*)$/;
var reFirefoxStackItemValue=/^(.+)\:(\d+)$/;
var framePos=0;
for(var i=2,length=items.length;
i<length;
i++,framePos++){var frame=frames[framePos]||{};
var item=items[i];
var match=item.match(reFirefoxStackItem);
if(match){var name=match[1];
var value=match[2].match(reFirefoxStackItemValue);
if(value){frame.href=value[1];
frame.lineNo=value[2]
}}}}}}Firebug.Console.log({frames:frames},context,"stackTrace",FirebugReps.StackTrace)
};
this.trace_ok=function(){var getFuncName=function getFuncName(f){if(f.getName instanceof Function){return f.getName()
}if(f.name){return f.name
}var name=f.toString().match(/function\s*([_$\w\d]*)/)[1];
return name||"anonymous"
};
var wasVisited=function(fn){for(var i=0,l=frames.length;
i<l;
i++){if(frames[i].fn==fn){return true
}}return false
};
var frames=[];
for(var fn=arguments.callee.caller;
fn;
fn=fn.caller){if(wasVisited(fn)){break
}var args=[];
for(var i=0,l=fn.arguments.length;
i<l;
++i){args.push({value:fn.arguments[i]})
}frames.push({fn:fn,name:getFuncName(fn),args:args})
}Firebug.Console.log({frames:frames},context,"stackTrace",FirebugReps.StackTrace)
};
this.clear=function(){Firebug.Console.clear(context)
};
this.time=function(name,reset){if(!name){return
}var time=new Date().getTime();
if(!this.timeCounters){this.timeCounters={}
}var key="KEY"+name.toString();
if(!reset&&this.timeCounters[key]){return
}this.timeCounters[key]=time
};
this.timeEnd=function(name){var time=new Date().getTime();
if(!this.timeCounters){return
}var key="KEY"+name.toString();
var timeCounter=this.timeCounters[key];
if(timeCounter){var diff=time-timeCounter;
var label=name+": "+diff+"ms";
this.info(label);
delete this.timeCounters[key]
}return diff
};
this.evaluated=function(result,context){if(FBTrace.DBG_CONSOLE){FBTrace.sysout("consoleInjector.FirebugConsoleHandler evalutated default called",result)
}Firebug.Console.log(result,context)
};
this.evaluateError=function(result,context){Firebug.Console.log(result,context,"errorMessage")
};
function logFormatted(args,className,linkToSource,noThrottle){var sourceLink=linkToSource?getStackLink():null;
return Firebug.Console.logFormatted(args,context,className,noThrottle,sourceLink)
}function logAssert(category,args){Firebug.Errors.increaseCount(context);
if(!args||!args.length||args.length==0){var msg=[FBL.$STR("Assertion")]
}else{var msg=args[0]
}if(Firebug.errorStackTrace){var trace=Firebug.errorStackTrace;
delete Firebug.errorStackTrace;
if(FBTrace.DBG_CONSOLE){FBTrace.sysout("logAssert trace from errorStackTrace",trace)
}}else{if(msg.stack){var trace=parseToStackTrace(msg.stack);
if(FBTrace.DBG_CONSOLE){FBTrace.sysout("logAssert trace from msg.stack",trace)
}}else{var trace=getJSDUserStack();
if(FBTrace.DBG_CONSOLE){FBTrace.sysout("logAssert trace from getJSDUserStack",trace)
}}}var errorObject=new FBL.ErrorMessage(msg,(msg.fileName?msg.fileName:win.location),(msg.lineNumber?msg.lineNumber:0),"",category,context,trace);
if(trace&&trace.frames&&trace.frames[0]){errorObject.correctWithStackTrace(trace)
}errorObject.resetSource();
var objects=errorObject;
if(args.length>1){objects=[errorObject];
for(var i=1;
i<args.length;
i++){objects.push(args[i])
}}var row=Firebug.Console.log(objects,context,"errorMessage",null,true);
row.scrollIntoView()
}function getComponentsStackDump(){var frame=Components.stack;
var userURL=win.location.href.toString();
if(FBTrace.DBG_CONSOLE){FBTrace.sysout("consoleInjector.getComponentsStackDump initial stack for userURL "+userURL,frame)
}while(frame&&FBL.isSystemURL(frame.filename)){frame=frame.caller
}if(frame){frame=frame.caller
}if(frame){frame=frame.caller
}if(FBTrace.DBG_CONSOLE){FBTrace.sysout("consoleInjector.getComponentsStackDump final stack for userURL "+userURL,frame)
}return frame
}function getStackLink(){return
}function getJSDUserStack(){var trace=FBL.getCurrentStackTrace(context);
var frames=trace?trace.frames:null;
if(frames&&(frames.length>0)){var oldest=frames.length-1;
for(var i=0;
i<frames.length;
i++){if(frames[oldest-i].href.indexOf("chrome:")==0){break
}var fn=frames[oldest-i].fn+"";
if(fn&&(fn.indexOf("_firebugEvalEvent")!=-1)){break
}}FBTrace.sysout("consoleInjector getJSDUserStack: "+frames.length+" oldest: "+oldest+" i: "+i+" i - oldest + 2: "+(i-oldest+2),trace);
trace.frames=trace.frames.slice(2-i);
return trace
}else{return"Firebug failed to get stack trace with any frames"
}}};
FBL.registerConsole=function(){var win=Env.browser.window;
Firebug.Console.injector.install(win)
};
registerConsole()
}});
FBL.ns(function(){with(FBL){var commandPrefix=">>>";
var reOpenBracket=/[\[\(\{]/;
var reCloseBracket=/[\]\)\}]/;
var commandHistory=[];
var commandPointer=-1;
var isAutoCompleting=null;
var autoCompletePrefix=null;
var autoCompleteExpr=null;
var autoCompleteBuffer=null;
var autoCompletePosition=null;
var fbCommandLine=null;
var fbLargeCommandLine=null;
var fbLargeCommandButtons=null;
var _completion={window:["console"],document:["getElementById","getElementsByTagName"]};
var _stack=function(command){commandHistory.push(command);
commandPointer=commandHistory.length
};
Firebug.CommandLine=extend(Firebug.Module,{element:null,isMultiLine:false,isActive:false,initialize:function(doc){this.clear=bind(this.clear,this);
this.enter=bind(this.enter,this);
this.onError=bind(this.onError,this);
this.onKeyDown=bind(this.onKeyDown,this);
this.onMultiLineKeyDown=bind(this.onMultiLineKeyDown,this);
addEvent(Firebug.browser.window,"error",this.onError);
addEvent(Firebug.chrome.window,"error",this.onError)
},shutdown:function(doc){this.deactivate();
removeEvent(Firebug.browser.window,"error",this.onError);
removeEvent(Firebug.chrome.window,"error",this.onError)
},activate:function(multiLine,hideToggleIcon,onRun){defineCommandLineAPI();
if(this.isActive){if(this.isMultiLine==multiLine){return
}this.deactivate()
}fbCommandLine=$("fbCommandLine");
fbLargeCommandLine=$("fbLargeCommandLine");
fbLargeCommandButtons=$("fbLargeCommandButtons");
if(multiLine){onRun=onRun||this.enter;
this.isMultiLine=true;
this.element=fbLargeCommandLine;
addEvent(this.element,"keydown",this.onMultiLineKeyDown);
addEvent($("fbSmallCommandLineIcon"),"click",Firebug.chrome.hideLargeCommandLine);
this.runButton=new Button({element:$("fbCommand_btRun"),owner:Firebug.CommandLine,onClick:onRun});
this.runButton.initialize();
this.clearButton=new Button({element:$("fbCommand_btClear"),owner:Firebug.CommandLine,onClick:this.clear});
this.clearButton.initialize()
}else{this.isMultiLine=false;
this.element=fbCommandLine;
if(!fbCommandLine){return
}addEvent(this.element,"keydown",this.onKeyDown)
}if(isOpera){fixOperaTabKey(this.element)
}if(this.lastValue){this.element.value=this.lastValue
}this.isActive=true
},deactivate:function(){if(!this.isActive){return
}this.isActive=false;
this.lastValue=this.element.value;
if(this.isMultiLine){removeEvent(this.element,"keydown",this.onMultiLineKeyDown);
removeEvent($("fbSmallCommandLineIcon"),"click",Firebug.chrome.hideLargeCommandLine);
this.runButton.destroy();
this.clearButton.destroy()
}else{removeEvent(this.element,"keydown",this.onKeyDown)
}this.element=null;
delete this.element;
fbCommandLine=null;
fbLargeCommandLine=null;
fbLargeCommandButtons=null
},focus:function(){this.element.focus()
},blur:function(){this.element.blur()
},clear:function(){this.element.value=""
},evaluate:function(expr){var api="Firebug.CommandLine.API";
var result=Firebug.context.evaluate(expr,"window",api,Firebug.Console.error);
return result
},enter:function(){var command=this.element.value;
if(!command){return
}_stack(command);
Firebug.Console.log(commandPrefix+" "+stripNewLines(command),Firebug.browser,"command",FirebugReps.Text);
var result=this.evaluate(command);
if(result!=Firebug.Console.LOG_COMMAND){Firebug.Console.log(result)
}},prevCommand:function(){if(commandPointer>0&&commandHistory.length>0){this.element.value=commandHistory[--commandPointer]
}},nextCommand:function(){var element=this.element;
var limit=commandHistory.length-1;
var i=commandPointer;
if(i<limit){element.value=commandHistory[++commandPointer]
}else{if(i==limit){++commandPointer;
element.value=""
}}},autocomplete:function(reverse){var element=this.element;
var command=element.value;
var offset=getExpressionOffset(command);
var valBegin=offset?command.substr(0,offset):"";
var val=command.substr(offset);
var buffer,obj,objName,commandBegin,result,prefix;
if(!isAutoCompleting){var reObj=/(.*[^_$\w\d\.])?((?:[_$\w][_$\w\d]*\.)*)([_$\w][_$\w\d]*)?$/;
var r=reObj.exec(val);
if(r[1]||r[2]||r[3]){commandBegin=r[1]||"";
objName=r[2]||"";
prefix=r[3]||""
}else{if(val==""){commandBegin=objName=prefix=""
}else{return
}}isAutoCompleting=true;
if(objName==""){obj=window
}else{objName=objName.replace(/\.$/,"");
var n=objName.split(".");
var target=window,o;
for(var i=0,ni;
ni=n[i];
i++){if(o=target[ni]){target=o
}else{target=null;
break
}}obj=target
}if(obj){autoCompletePrefix=prefix;
autoCompleteExpr=valBegin+commandBegin+(objName?objName+".":"");
autoCompletePosition=-1;
buffer=autoCompleteBuffer=isIE?_completion[objName||"window"]||[]:[];
for(var p in obj){buffer.push(p)
}}}else{buffer=autoCompleteBuffer
}if(buffer){prefix=autoCompletePrefix;
var diff=reverse?-1:1;
for(var i=autoCompletePosition+diff,l=buffer.length,bi;
i>=0&&i<l;
i+=diff){bi=buffer[i];
if(bi.indexOf(prefix)==0){autoCompletePosition=i;
result=bi;
break
}}}if(result){element.value=autoCompleteExpr+result
}},setMultiLine:function(multiLine){if(multiLine==this.isMultiLine){return
}this.activate(multiLine)
},onError:function(msg,href,lineNo){var html=[];
var lastSlash=href.lastIndexOf("/");
var fileName=lastSlash==-1?href:href.substr(lastSlash+1);
html.push('<span class="errorMessage">',msg,"</span>",'<div class="objectBox-sourceLink">',fileName," (line ",lineNo,")</div>");
Firebug.Console.writeRow(html,"error")
},onKeyDown:function(e){e=e||event;
var code=e.keyCode;
if(code!=9&&code!=16&&code!=17&&code!=18){isAutoCompleting=false
}if(code==13){this.enter();
this.clear()
}else{if(code==27){setTimeout(this.clear,0)
}else{if(code==38){this.prevCommand()
}else{if(code==40){this.nextCommand()
}else{if(code==9){this.autocomplete(e.shiftKey)
}else{return
}}}}}cancelEvent(e,true);
return false
},onMultiLineKeyDown:function(e){e=e||event;
var code=e.keyCode;
if(code==13&&e.ctrlKey){this.enter()
}}});
Firebug.registerModule(Firebug.CommandLine);
function getExpressionOffset(command){var bracketCount=0;
var start=command.length-1;
for(;
start>=0;
--start){var c=command[start];
if((c==","||c==";"||c==" ")&&!bracketCount){break
}if(reOpenBracket.test(c)){if(bracketCount){--bracketCount
}else{break
}}else{if(reCloseBracket.test(c)){++bracketCount
}}}return start+1
}var CommandLineAPI={$:function(id){return Firebug.browser.document.getElementById(id)
},$$:function(selector,context){context=context||Firebug.browser.document;
return Firebug.Selector?Firebug.Selector(selector,context):Firebug.Console.error("Firebug.Selector module not loaded.")
},$0:null,$1:null,dir:function(o){Firebug.Console.log(o,Firebug.context,"dir",Firebug.DOMPanel.DirTable)
},dirxml:function(o){if(o instanceof Window){o=o.document.documentElement
}else{if(o instanceof Document){o=o.documentElement
}}Firebug.Console.log(o,Firebug.context,"dirxml",Firebug.HTMLPanel.SoloElement)
}};
var defineCommandLineAPI=function defineCommandLineAPI(){Firebug.CommandLine.API={};
for(var m in CommandLineAPI){if(!Env.browser.window[m]){Firebug.CommandLine.API[m]=CommandLineAPI[m]
}}var stack=FirebugChrome.htmlSelectionStack;
if(stack){Firebug.CommandLine.API.$0=stack[0];
Firebug.CommandLine.API.$1=stack[1]
}}
}});
(function(){with(FBL){var XHRSpy=function(){this.requestHeaders=[];
this.responseHeaders=[]
};
XHRSpy.prototype={method:null,url:null,async:null,xhrRequest:null,href:null,loaded:false,logRow:null,responseText:null,requestHeaders:null,responseHeaders:null,sourceLink:null,getURL:function(){return this.href
}};
var XMLHttpRequestWrapper=function(activeXObject){var xhrRequest=typeof activeXObject!="undefined"?activeXObject:new _XMLHttpRequest(),spy=new XHRSpy(),self=this,reqType,reqUrl,reqStartTS;
var logXHR=function(){var row=Firebug.Console.log(spy,null,"spy",Firebug.Spy.XHR);
if(row){setClass(row,"loading");
spy.logRow=row
}};
var finishXHR=function(){var duration=new Date().getTime()-reqStartTS;
var success=xhrRequest.status==200;
var responseHeadersText=xhrRequest.getAllResponseHeaders();
var responses=responseHeadersText?responseHeadersText.split(/[\n\r]/):[];
var reHeader=/^(\S+):\s*(.*)/;
for(var i=0,l=responses.length;
i<l;
i++){var text=responses[i];
var match=text.match(reHeader);
if(match){spy.responseHeaders.push({name:[match[1]],value:[match[2]]})
}}with({row:spy.logRow,status:xhrRequest.status+" "+xhrRequest.statusText,time:duration,success:success}){setTimeout(function(){row=row||spy.logRow;
if(!row){return
}FBL.removeClass(row,"loading");
if(!success){FBL.setClass(row,"error")
}var item=FBL.$$(".spyStatus",row)[0];
item.innerHTML=status;
var item=FBL.$$(".spyTime",row)[0];
item.innerHTML=time+"ms"
},200)
}spy.loaded=true;
spy.responseText=xhrRequest.responseText;
self.status=xhrRequest.status;
self.statusText=xhrRequest.statusText;
self.responseText=xhrRequest.responseText;
self.responseXML=xhrRequest.responseXML
};
var handleStateChange=function(){self.readyState=xhrRequest.readyState;
if(xhrRequest.readyState==4){finishXHR();
xhrRequest.onreadystatechange=function(){}
}self.onreadystatechange()
};
this.readyState=0;
this.onreadystatechange=function(){};
this.open=function(method,url,async){if(spy.loaded){spy=new XHRSpy()
}spy.method=method;
spy.url=url;
spy.async=async;
spy.href=url;
spy.xhrRequest=xhrRequest;
spy.urlParams=parseURLParamsArray(url);
if(!FBL.isIE&&async){xhrRequest.onreadystatechange=handleStateChange
}if(xhrRequest.open.apply){xhrRequest.open.apply(xhrRequest,arguments)
}else{xhrRequest.open(method,url,async)
}if(FBL.isIE&&async){xhrRequest.onreadystatechange=handleStateChange
}};
this.send=function(data){spy.data=data;
reqStartTS=new Date().getTime();
try{xhrRequest.send(data)
}catch(e){throw e
}finally{logXHR();
if(!spy.async){self.readyState=xhrRequest.readyState;
finishXHR()
}}};
this.setRequestHeader=function(header,value){spy.requestHeaders.push({name:[header],value:[value]});
xhrRequest.setRequestHeader(header,value)
};
this.getResponseHeader=function(header){return xhrRequest.getResponseHeader(header)
};
this.getAllResponseHeaders=function(){return xhrRequest.getAllResponseHeaders()
};
this.abort=function(){return xhrRequest.abort()
};
return this
};
var _ActiveXObject;
var isIE6=/msie 6/i.test(navigator.appVersion);
if(isIE6){window._ActiveXObject=window.ActiveXObject;
var xhrObjects=" MSXML2.XMLHTTP.5.0 MSXML2.XMLHTTP.4.0 MSXML2.XMLHTTP.3.0 MSXML2.XMLHTTP Microsoft.XMLHTTP ";
window.ActiveXObject=function(name){var error=null;
try{var activeXObject=new window._ActiveXObject(name)
}catch(e){error=e
}finally{if(!error){if(xhrObjects.indexOf(" "+name+" ")!=-1){return new XMLHttpRequestWrapper(activeXObject)
}else{return activeXObject
}}else{throw error.message
}}}
}if(!isIE6){var _XMLHttpRequest=XMLHttpRequest;
window.XMLHttpRequest=function(){return new XMLHttpRequestWrapper()
}
}}})();
FBL.ns(function(){with(FBL){var oSTR={NoMembersWarning:"There are no properties to show for this object.","net.label.Parameters":"Parameters","net.label.Source":"Source",URLParameters:"Params"};
FBL.$STR=function(name){return oSTR.hasOwnProperty(name)?oSTR[name]:name
};
var reIgnore=/about:|javascript:|resource:|chrome:|jar:/;
var layoutInterval=300;
var indentWidth=18;
var cacheSession=null;
var contexts=new Array();
var panelName="net";
var maxQueueRequests=500;
var activeRequests=[];
var mimeExtensionMap={txt:"text/plain",html:"text/html",htm:"text/html",xhtml:"text/html",xml:"text/xml",css:"text/css",js:"application/x-javascript",jss:"application/x-javascript",jpg:"image/jpg",jpeg:"image/jpeg",gif:"image/gif",png:"image/png",bmp:"image/bmp",swf:"application/x-shockwave-flash",flv:"video/x-flv"};
var fileCategories={"undefined":1,html:1,css:1,js:1,xhr:1,image:1,flash:1,txt:1,bin:1};
var textFileCategories={txt:1,html:1,xhr:1,css:1,js:1};
var binaryFileCategories={bin:1,flash:1};
var mimeCategoryMap={"text/plain":"txt","application/octet-stream":"bin","text/html":"html","text/xml":"html","text/css":"css","application/x-javascript":"js","text/javascript":"js","application/javascript":"js","image/jpeg":"image","image/jpg":"image","image/gif":"image","image/png":"image","image/bmp":"image","application/x-shockwave-flash":"flash","video/x-flv":"flash"};
var binaryCategoryMap={image:1,flash:1};
Firebug.NetMonitor=extend(Firebug.ActivableModule,{dispatchName:"netMonitor",clear:function(context){var panel=context.getPanel(panelName,true);
if(panel){panel.clear()
}},initialize:function(){return;
this.panelName=panelName;
Firebug.ActivableModule.initialize.apply(this,arguments);
if(Firebug.TraceModule){Firebug.TraceModule.addListener(this.TraceListener)
}NetHttpObserver.registerObserver();
NetHttpActivityObserver.registerObserver();
Firebug.Debugger.addListener(this.DebuggerListener)
},shutdown:function(){return;
prefs.removeObserver(Firebug.prefDomain,this,false);
if(Firebug.TraceModule){Firebug.TraceModule.removeListener(this.TraceListener)
}NetHttpObserver.unregisterObserver();
NetHttpActivityObserver.unregisterObserver();
Firebug.Debugger.removeListener(this.DebuggerListener)
}});
Firebug.NetMonitor.NetInfoBody=domplate(Firebug.Rep,{tag:DIV({"class":"netInfoBody",_repObject:"$file"},TAG("$infoTabs",{file:"$file"}),TAG("$infoBodies",{file:"$file"})),infoTabs:DIV({"class":"netInfoTabs focusRow subFocusRow",role:"tablist"},A({"class":"netInfoParamsTab netInfoTab a11yFocus",onclick:"$onClickTab",role:"tab",view:"Params",$collapsed:"$file|hideParams"},$STR("URLParameters")),A({"class":"netInfoHeadersTab netInfoTab a11yFocus",onclick:"$onClickTab",role:"tab",view:"Headers"},$STR("Headers")),A({"class":"netInfoPostTab netInfoTab a11yFocus",onclick:"$onClickTab",role:"tab",view:"Post",$collapsed:"$file|hidePost"},$STR("Post")),A({"class":"netInfoPutTab netInfoTab a11yFocus",onclick:"$onClickTab",role:"tab",view:"Put",$collapsed:"$file|hidePut"},$STR("Put")),A({"class":"netInfoResponseTab netInfoTab a11yFocus",onclick:"$onClickTab",role:"tab",view:"Response",$collapsed:"$file|hideResponse"},$STR("Response")),A({"class":"netInfoCacheTab netInfoTab a11yFocus",onclick:"$onClickTab",role:"tab",view:"Cache",$collapsed:"$file|hideCache"},$STR("Cache")),A({"class":"netInfoHtmlTab netInfoTab a11yFocus",onclick:"$onClickTab",role:"tab",view:"Html",$collapsed:"$file|hideHtml"},$STR("HTML"))),infoBodies:DIV({"class":"netInfoBodies outerFocusRow"},TABLE({"class":"netInfoParamsText netInfoText netInfoParamsTable",role:"tabpanel",cellpadding:0,cellspacing:0},TBODY()),DIV({"class":"netInfoHeadersText netInfoText",role:"tabpanel"}),DIV({"class":"netInfoPostText netInfoText",role:"tabpanel"}),DIV({"class":"netInfoPutText netInfoText",role:"tabpanel"}),PRE({"class":"netInfoResponseText netInfoText",role:"tabpanel"}),DIV({"class":"netInfoCacheText netInfoText",role:"tabpanel"},TABLE({"class":"netInfoCacheTable",cellpadding:0,cellspacing:0,role:"presentation"},TBODY({role:"list","aria-label":$STR("Cache")}))),DIV({"class":"netInfoHtmlText netInfoText",role:"tabpanel"},IFRAME({"class":"netInfoHtmlPreview",role:"document"}))),headerDataTag:FOR("param","$headers",TR({role:"listitem"},TD({"class":"netInfoParamName",role:"presentation"},TAG("$param|getNameTag",{param:"$param"})),TD({"class":"netInfoParamValue",role:"list","aria-label":"$param.name"},FOR("line","$param|getParamValueIterator",CODE({"class":"focusRow subFocusRow",role:"listitem"},"$line"))))),customTab:A({"class":"netInfo$tabId\\Tab netInfoTab",onclick:"$onClickTab",view:"$tabId",role:"tab"},"$tabTitle"),customBody:DIV({"class":"netInfo$tabId\\Text netInfoText",role:"tabpanel"}),nameTag:SPAN("$param|getParamName"),nameWithTooltipTag:SPAN({title:"$param.name"},"$param|getParamName"),getNameTag:function(param){return(this.getParamName(param)==param.name)?this.nameTag:this.nameWithTooltipTag
},getParamName:function(param){var limit=25;
var name=param.name;
if(name.length>limit){name=name.substr(0,limit)+"..."
}return name
},getParamTitle:function(param){var limit=25;
var name=param.name;
if(name.length>limit){return name
}return""
},hideParams:function(file){return !file.urlParams||!file.urlParams.length
},hidePost:function(file){return file.method.toUpperCase()!="POST"
},hidePut:function(file){return file.method.toUpperCase()!="PUT"
},hideResponse:function(file){return false
},hideCache:function(file){return true;
return !file.cacheEntry
},hideHtml:function(file){return true;
return(file.mimeType!="text/html")&&(file.mimeType!="application/xhtml+xml")
},onClickTab:function(event){this.selectTab(event.currentTarget||event.srcElement)
},getParamValueIterator:function(param){return param.value;
return wrapText(param.value,true)
},appendTab:function(netInfoBox,tabId,tabTitle){var args={tabId:tabId,tabTitle:tabTitle};
this.customTab.append(args,netInfoBox.getElementsByClassName("netInfoTabs").item(0));
this.customBody.append(args,netInfoBox.getElementsByClassName("netInfoBodies").item(0))
},selectTabByName:function(netInfoBox,tabName){var tab=getChildByClass(netInfoBox,"netInfoTabs","netInfo"+tabName+"Tab");
if(tab){this.selectTab(tab)
}},selectTab:function(tab){var view=tab.getAttribute("view");
var netInfoBox=getAncestorByClass(tab,"netInfoBody");
var selectedTab=netInfoBox.selectedTab;
if(selectedTab){removeClass(netInfoBox.selectedText,"netInfoTextSelected");
removeClass(selectedTab,"netInfoTabSelected");
selectedTab.setAttribute("aria-selected","false")
}var textBodyName="netInfo"+view+"Text";
selectedTab=netInfoBox.selectedTab=tab;
netInfoBox.selectedText=$$("."+textBodyName,netInfoBox)[0];
setClass(netInfoBox.selectedText,"netInfoTextSelected");
setClass(selectedTab,"netInfoTabSelected");
selectedTab.setAttribute("selected","true");
selectedTab.setAttribute("aria-selected","true");
var file=Firebug.getRepObject(netInfoBox);
var context=Firebug.chrome;
this.updateInfo(netInfoBox,file,context)
},updateInfo:function(netInfoBox,file,context){if(FBTrace.DBG_NET){FBTrace.sysout("net.updateInfo; file",file)
}if(!netInfoBox){if(FBTrace.DBG_NET||FBTrace.DBG_ERRORS){FBTrace.sysout("net.updateInfo; ERROR netInfo == null "+file.href,file)
}return
}var tab=netInfoBox.selectedTab;
if(hasClass(tab,"netInfoParamsTab")){if(file.urlParams&&!netInfoBox.urlParamsPresented){netInfoBox.urlParamsPresented=true;
this.insertHeaderRows(netInfoBox,file.urlParams,"Params")
}}else{if(hasClass(tab,"netInfoHeadersTab")){var headersText=$$(".netInfoHeadersText",netInfoBox)[0];
if(file.responseHeaders&&!netInfoBox.responseHeadersPresented){netInfoBox.responseHeadersPresented=true;
NetInfoHeaders.renderHeaders(headersText,file.responseHeaders,"ResponseHeaders")
}if(file.requestHeaders&&!netInfoBox.requestHeadersPresented){netInfoBox.requestHeadersPresented=true;
NetInfoHeaders.renderHeaders(headersText,file.requestHeaders,"RequestHeaders")
}}else{if(hasClass(tab,"netInfoPostTab")){if(!netInfoBox.postPresented){netInfoBox.postPresented=true;
var postText=$$(".netInfoPostText",netInfoBox)[0];
NetInfoPostData.render(context,postText,file)
}}else{if(hasClass(tab,"netInfoPutTab")){if(!netInfoBox.putPresented){netInfoBox.putPresented=true;
var putText=$$(".netInfoPutText",netInfoBox)[0];
NetInfoPostData.render(context,putText,file)
}}else{if(hasClass(tab,"netInfoResponseTab")&&file.loaded&&!netInfoBox.responsePresented){var responseTextBox=$$(".netInfoResponseText",netInfoBox)[0];
if(file.category=="image"){netInfoBox.responsePresented=true;
var responseImage=netInfoBox.ownerDocument.createElement("img");
responseImage.src=file.href;
clearNode(responseTextBox);
responseTextBox.appendChild(responseImage,responseTextBox)
}else{this.setResponseText(file,netInfoBox,responseTextBox,context)
}}else{if(hasClass(tab,"netInfoCacheTab")&&file.loaded&&!netInfoBox.cachePresented){var responseTextBox=netInfoBox.getElementsByClassName("netInfoCacheText").item(0);
if(file.cacheEntry){netInfoBox.cachePresented=true;
this.insertHeaderRows(netInfoBox,file.cacheEntry,"Cache")
}}else{if(hasClass(tab,"netInfoHtmlTab")&&file.loaded&&!netInfoBox.htmlPresented){netInfoBox.htmlPresented=true;
var text=Utils.getResponseText(file,context);
var iframe=netInfoBox.getElementsByClassName("netInfoHtmlPreview").item(0);
iframe.contentWindow.document.body.innerHTML=text
}}}}}}}},setResponseText:function(file,netInfoBox,responseTextBox,context){netInfoBox.responsePresented=true;
if(isIE){responseTextBox.style.whiteSpace="nowrap"
}responseTextBox[typeof responseTextBox.textContent!="undefined"?"textContent":"innerText"]=file.responseText;
return;
var text=Utils.getResponseText(file,context);
var limit=Firebug.netDisplayedResponseLimit+15;
var limitReached=text?(text.length>limit):false;
if(limitReached){text=text.substr(0,limit)+"..."
}if(text){insertWrappedText(text,responseTextBox)
}else{insertWrappedText("",responseTextBox)
}if(limitReached){var object={text:$STR("net.responseSizeLimitMessage"),onClickLink:function(){var panel=context.getPanel("net",true);
panel.openResponseInTab(file)
}};
Firebug.NetMonitor.ResponseSizeLimit.append(object,responseTextBox)
}netInfoBox.responsePresented=true;
if(FBTrace.DBG_NET){FBTrace.sysout("net.setResponseText; response text updated")
}},insertHeaderRows:function(netInfoBox,headers,tableName,rowName){if(!headers.length){return
}var headersTable=$$(".netInfo"+tableName+"Table",netInfoBox)[0];
var tbody=getChildByClass(headersTable,"netInfo"+rowName+"Body");
if(!tbody){tbody=headersTable.firstChild
}var titleRow=getChildByClass(tbody,"netInfo"+rowName+"Title");
this.headerDataTag.insertRows({headers:headers},titleRow?titleRow:tbody);
removeClass(titleRow,"collapsed")
}});
var NetInfoBody=Firebug.NetMonitor.NetInfoBody;
Firebug.NetMonitor.NetInfoHeaders=domplate(Firebug.Rep,{tag:DIV({"class":"netInfoHeadersTable",role:"tabpanel"},DIV({"class":"netInfoHeadersGroup netInfoResponseHeadersTitle"},SPAN($STR("ResponseHeaders")),SPAN({"class":"netHeadersViewSource response collapsed",onclick:"$onViewSource",_sourceDisplayed:false,_rowName:"ResponseHeaders"},$STR("net.headers.view source"))),TABLE({cellpadding:0,cellspacing:0},TBODY({"class":"netInfoResponseHeadersBody",role:"list","aria-label":$STR("ResponseHeaders")})),DIV({"class":"netInfoHeadersGroup netInfoRequestHeadersTitle"},SPAN($STR("RequestHeaders")),SPAN({"class":"netHeadersViewSource request collapsed",onclick:"$onViewSource",_sourceDisplayed:false,_rowName:"RequestHeaders"},$STR("net.headers.view source"))),TABLE({cellpadding:0,cellspacing:0},TBODY({"class":"netInfoRequestHeadersBody",role:"list","aria-label":$STR("RequestHeaders")}))),sourceTag:TR({role:"presentation"},TD({colspan:2,role:"presentation"},PRE({"class":"source"}))),onViewSource:function(event){var target=event.target;
var requestHeaders=(target.rowName=="RequestHeaders");
var netInfoBox=getAncestorByClass(target,"netInfoBody");
var file=netInfoBox.repObject;
if(target.sourceDisplayed){var headers=requestHeaders?file.requestHeaders:file.responseHeaders;
this.insertHeaderRows(netInfoBox,headers,target.rowName);
target.innerHTML=$STR("net.headers.view source")
}else{var source=requestHeaders?file.requestHeadersText:file.responseHeadersText;
this.insertSource(netInfoBox,source,target.rowName);
target.innerHTML=$STR("net.headers.pretty print")
}target.sourceDisplayed=!target.sourceDisplayed;
cancelEvent(event)
},insertSource:function(netInfoBox,source,rowName){var tbody=netInfoBox.getElementsByClassName("netInfo"+rowName+"Body").item(0);
var node=this.sourceTag.replace({},tbody);
var sourceNode=node.getElementsByClassName("source").item(0);
sourceNode.innerHTML=source
},insertHeaderRows:function(netInfoBox,headers,rowName){var headersTable=$$(".netInfoHeadersTable",netInfoBox)[0];
var tbody=$$(".netInfo"+rowName+"Body",headersTable)[0];
clearNode(tbody);
if(!headers.length){return
}NetInfoBody.headerDataTag.insertRows({headers:headers},tbody);
var titleRow=getChildByClass(headersTable,"netInfo"+rowName+"Title");
removeClass(titleRow,"collapsed")
},init:function(parent){var rootNode=this.tag.append({},parent);
var netInfoBox=getAncestorByClass(parent,"netInfoBody");
var file=netInfoBox.repObject;
var viewSource;
viewSource=$$(".request",rootNode)[0];
if(file.requestHeadersText){removeClass(viewSource,"collapsed")
}viewSource=$$(".response",rootNode)[0];
if(file.responseHeadersText){removeClass(viewSource,"collapsed")
}},renderHeaders:function(parent,headers,rowName){if(!parent.firstChild){this.init(parent)
}this.insertHeaderRows(parent,headers,rowName)
}});
var NetInfoHeaders=Firebug.NetMonitor.NetInfoHeaders;
Firebug.NetMonitor.NetInfoPostData=domplate(Firebug.Rep,{paramsTable:TABLE({"class":"netInfoPostParamsTable",cellpadding:0,cellspacing:0,role:"presentation"},TBODY({role:"list","aria-label":$STR("net.label.Parameters")},TR({"class":"netInfoPostParamsTitle",role:"presentation"},TD({colspan:3,role:"presentation"},DIV({"class":"netInfoPostParams"},$STR("net.label.Parameters"),SPAN({"class":"netInfoPostContentType"},"application/x-www-form-urlencoded")))))),partsTable:TABLE({"class":"netInfoPostPartsTable",cellpadding:0,cellspacing:0,role:"presentation"},TBODY({role:"list","aria-label":$STR("net.label.Parts")},TR({"class":"netInfoPostPartsTitle",role:"presentation"},TD({colspan:2,role:"presentation"},DIV({"class":"netInfoPostParams"},$STR("net.label.Parts"),SPAN({"class":"netInfoPostContentType"},"multipart/form-data")))))),jsonTable:TABLE({"class":"netInfoPostJSONTable",cellpadding:0,cellspacing:0,role:"presentation"},TBODY({role:"list","aria-label":$STR("jsonviewer.tab.JSON")},TR({"class":"netInfoPostJSONTitle",role:"presentation"},TD({role:"presentation"},DIV({"class":"netInfoPostParams"},$STR("jsonviewer.tab.JSON")))),TR(TD({"class":"netInfoPostJSONBody"})))),xmlTable:TABLE({"class":"netInfoPostXMLTable",cellpadding:0,cellspacing:0,role:"presentation"},TBODY({role:"list","aria-label":$STR("xmlviewer.tab.XML")},TR({"class":"netInfoPostXMLTitle",role:"presentation"},TD({role:"presentation"},DIV({"class":"netInfoPostParams"},$STR("xmlviewer.tab.XML")))),TR(TD({"class":"netInfoPostXMLBody"})))),sourceTable:TABLE({"class":"netInfoPostSourceTable",cellpadding:0,cellspacing:0,role:"presentation"},TBODY({role:"list","aria-label":$STR("net.label.Source")},TR({"class":"netInfoPostSourceTitle",role:"presentation"},TD({colspan:2,role:"presentation"},DIV({"class":"netInfoPostSource"},$STR("net.label.Source")))))),sourceBodyTag:TR({role:"presentation"},TD({colspan:2,role:"presentation"},FOR("line","$param|getParamValueIterator",CODE({"class":"focusRow subFocusRow",role:"listitem"},"$line")))),getParamValueIterator:function(param){return NetInfoBody.getParamValueIterator(param)
},render:function(context,parentNode,file){var spy=getAncestorByClass(parentNode,"spyHead");
var spyObject=spy.repObject;
var data=spyObject.data;
var params=parseURLEncodedTextArray(data);
if(params){this.insertParameters(parentNode,params)
}var postText=data;
if(postText){this.insertSource(parentNode,postText)
}return;
var text=Utils.getPostText(file,context,true);
if(text==undefined){return
}if(Utils.isURLEncodedRequest(file,context)){var lines=text.split("\n");
var params=parseURLEncodedText(lines[lines.length-1]);
if(params){this.insertParameters(parentNode,params)
}}if(Utils.isMultiPartRequest(file,context)){var data=this.parseMultiPartText(file,context);
if(data){this.insertParts(parentNode,data)
}}var contentType=Utils.findHeader(file.requestHeaders,"content-type");
if(Firebug.JSONViewerModel.isJSON(contentType)){this.insertJSON(parentNode,file,context)
}if(Firebug.XMLViewerModel.isXML(contentType)){this.insertXML(parentNode,file,context)
}var postText=Utils.getPostText(file,context);
postText=Utils.formatPostText(postText);
if(postText){this.insertSource(parentNode,postText)
}},insertParameters:function(parentNode,params){if(!params||!params.length){return
}var paramTable=this.paramsTable.append({object:{}},parentNode);
var row=$$(".netInfoPostParamsTitle",paramTable)[0];
var tbody=paramTable.getElementsByTagName("tbody")[0];
NetInfoBody.headerDataTag.insertRows({headers:params},row)
},insertParts:function(parentNode,data){if(!data.params||!data.params.length){return
}var partsTable=this.partsTable.append({object:{}},parentNode);
var row=$$(".netInfoPostPartsTitle",paramTable)[0];
NetInfoBody.headerDataTag.insertRows({headers:data.params},row)
},insertJSON:function(parentNode,file,context){var text=Utils.getPostText(file,context);
var data=parseJSONString(text,"http://"+file.request.originalURI.host);
if(!data){return
}var jsonTable=this.jsonTable.append(null,parentNode);
var jsonBody=jsonTable.getElementsByClassName("netInfoPostJSONBody").item(0);
if(!this.toggles){this.toggles={}
}Firebug.DOMPanel.DirTable.tag.replace({object:data,toggles:this.toggles},jsonBody)
},insertXML:function(parentNode,file,context){var text=Utils.getPostText(file,context);
var jsonTable=this.xmlTable.append(null,parentNode);
var jsonBody=jsonTable.getElementsByClassName("netInfoPostXMLBody").item(0);
Firebug.XMLViewerModel.insertXML(jsonBody,text)
},insertSource:function(parentNode,text){var sourceTable=this.sourceTable.append({object:{}},parentNode);
var row=$$(".netInfoPostSourceTitle",sourceTable)[0];
var param={value:[text]};
this.sourceBodyTag.insertRows({param:param},row)
},parseMultiPartText:function(file,context){var text=Utils.getPostText(file,context);
if(text==undefined){return null
}FBTrace.sysout("net.parseMultiPartText; boundary: ",text);
var boundary=text.match(/\s*boundary=\s*(.*)/)[1];
var divider="\r\n\r\n";
var bodyStart=text.indexOf(divider);
var body=text.substr(bodyStart+divider.length);
var postData={};
postData.mimeType="multipart/form-data";
postData.params=[];
var parts=body.split("--"+boundary);
for(var i=0;
i<parts.length;
i++){var part=parts[i].split(divider);
if(part.length!=2){continue
}var m=part[0].match(/\s*name=\"(.*)\"(;|$)/);
postData.params.push({name:(m&&m.length>1)?m[1]:"",value:trim(part[1])})
}return postData
}});
var NetInfoPostData=Firebug.NetMonitor.NetInfoPostData;
var $STRP=function(a){return a
};
Firebug.NetMonitor.NetLimit=domplate(Firebug.Rep,{collapsed:true,tableTag:DIV(TABLE({width:"100%",cellpadding:0,cellspacing:0},TBODY())),limitTag:TR({"class":"netRow netLimitRow",$collapsed:"$isCollapsed"},TD({"class":"netCol netLimitCol",colspan:6},TABLE({cellpadding:0,cellspacing:0},TBODY(TR(TD(SPAN({"class":"netLimitLabel"},$STRP("plural.Limit_Exceeded",[0]))),TD({style:"width:100%"}),TD(BUTTON({"class":"netLimitButton",title:"$limitPrefsTitle",onclick:"$onPreferences"},$STR("LimitPrefs"))),TD(" ")))))),isCollapsed:function(){return this.collapsed
},onPreferences:function(event){openNewTab("about:config")
},updateCounter:function(row){removeClass(row,"collapsed");
var limitLabel=row.getElementsByClassName("netLimitLabel").item(0);
limitLabel.firstChild.nodeValue=$STRP("plural.Limit_Exceeded",[row.limitInfo.totalCount])
},createTable:function(parent,limitInfo){var table=this.tableTag.replace({},parent);
var row=this.createRow(table.firstChild.firstChild,limitInfo);
return[table,row]
},createRow:function(parent,limitInfo){var row=this.limitTag.insertRows(limitInfo,parent,this)[0];
row.limitInfo=limitInfo;
return row
},observe:function(subject,topic,data){if(topic!="nsPref:changed"){return
}if(data.indexOf("net.logLimit")!=-1){this.updateMaxLimit()
}},updateMaxLimit:function(){var value=Firebug.getPref(Firebug.prefDomain,"net.logLimit");
maxQueueRequests=value?value:maxQueueRequests
}});
var NetLimit=Firebug.NetMonitor.NetLimit;
Firebug.NetMonitor.ResponseSizeLimit=domplate(Firebug.Rep,{tag:DIV({"class":"netInfoResponseSizeLimit"},SPAN("$object.beforeLink"),A({"class":"objectLink",onclick:"$onClickLink"},"$object.linkText"),SPAN("$object.afterLink")),reLink:/^(.*)<a>(.*)<\/a>(.*$)/,append:function(obj,parent){var m=obj.text.match(this.reLink);
return this.tag.append({onClickLink:obj.onClickLink,object:{beforeLink:m[1],linkText:m[2],afterLink:m[3]}},parent,this)
}});
Firebug.NetMonitor.Utils={findHeader:function(headers,name){if(!headers){return null
}name=name.toLowerCase();
for(var i=0;
i<headers.length;
++i){var headerName=headers[i].name.toLowerCase();
if(headerName==name){return headers[i].value
}}},formatPostText:function(text){if(text instanceof XMLDocument){return getElementXML(text.documentElement)
}else{return text
}},getPostText:function(file,context,noLimit){if(!file.postText){file.postText=readPostTextFromRequest(file.request,context);
if(!file.postText&&context){file.postText=readPostTextFromPage(file.href,context)
}}if(!file.postText){return file.postText
}var limit=Firebug.netDisplayedPostBodyLimit;
if(file.postText.length>limit&&!noLimit){return cropString(file.postText,limit,"\n\n... "+$STR("net.postDataSizeLimitMessage")+" ...\n\n")
}return file.postText
},getResponseText:function(file,context){return(typeof(file.responseText)!="undefined")?file.responseText:context.sourceCache.loadText(file.href,file.method,file)
},isURLEncodedRequest:function(file,context){var text=Utils.getPostText(file,context);
if(text&&text.toLowerCase().indexOf("content-type: application/x-www-form-urlencoded")==0){return true
}var headerValue=Utils.findHeader(file.requestHeaders,"content-type");
if(headerValue&&headerValue.indexOf("application/x-www-form-urlencoded")==0){return true
}return false
},isMultiPartRequest:function(file,context){var text=Utils.getPostText(file,context);
if(text&&text.toLowerCase().indexOf("content-type: multipart/form-data")==0){return true
}return false
},getMimeType:function(mimeType,uri){if(!mimeType||!(mimeCategoryMap.hasOwnProperty(mimeType))){var ext=getFileExtension(uri);
if(!ext){return mimeType
}else{var extMimeType=mimeExtensionMap[ext.toLowerCase()];
return extMimeType?extMimeType:mimeType
}}else{return mimeType
}},getDateFromSeconds:function(s){var d=new Date();
d.setTime(s*1000);
return d
},getHttpHeaders:function(request,file){try{var http=QI(request,Ci.nsIHttpChannel);
file.status=request.responseStatus;
file.method=http.requestMethod;
file.urlParams=parseURLParams(file.href);
file.mimeType=Utils.getMimeType(request.contentType,request.name);
if(!file.responseHeaders&&Firebug.collectHttpHeaders){var requestHeaders=[],responseHeaders=[];
http.visitRequestHeaders({visitHeader:function(name,value){requestHeaders.push({name:name,value:value})
}});
http.visitResponseHeaders({visitHeader:function(name,value){responseHeaders.push({name:name,value:value})
}});
file.requestHeaders=requestHeaders;
file.responseHeaders=responseHeaders
}}catch(exc){if(FBTrace.DBG_ERRORS){FBTrace.sysout("net.getHttpHeaders FAILS "+file.href,exc)
}}},isXHR:function(request){try{var callbacks=request.notificationCallbacks;
var xhrRequest=callbacks?callbacks.getInterface(Ci.nsIXMLHttpRequest):null;
if(FBTrace.DBG_NET){FBTrace.sysout("net.isXHR; "+(xhrRequest!=null)+", "+safeGetName(request))
}return(xhrRequest!=null)
}catch(exc){}return false
},getFileCategory:function(file){if(file.category){if(FBTrace.DBG_NET){FBTrace.sysout("net.getFileCategory; current: "+file.category+" for: "+file.href,file)
}return file.category
}if(file.isXHR){if(FBTrace.DBG_NET){FBTrace.sysout("net.getFileCategory; XHR for: "+file.href,file)
}return file.category="xhr"
}if(!file.mimeType){var ext=getFileExtension(file.href);
if(ext){file.mimeType=mimeExtensionMap[ext.toLowerCase()]
}}if(!file.mimeType){return""
}var mimeType=file.mimeType;
if(mimeType){mimeType=mimeType.split(";")[0]
}return(file.category=mimeCategoryMap[mimeType])
}};
var Utils=Firebug.NetMonitor.Utils;
Firebug.registerModule(Firebug.NetMonitor)
}});
FBL.ns(function(){with(FBL){var contexts=[];
Firebug.Spy=extend(Firebug.Module,{dispatchName:"spy",initialize:function(){if(Firebug.TraceModule){Firebug.TraceModule.addListener(this.TraceListener)
}Firebug.Module.initialize.apply(this,arguments)
},shutdown:function(){Firebug.Module.shutdown.apply(this,arguments);
if(Firebug.TraceModule){Firebug.TraceModule.removeListener(this.TraceListener)
}},initContext:function(context){context.spies=[];
if(Firebug.showXMLHttpRequests&&Firebug.Console.isAlwaysEnabled()){this.attachObserver(context,context.window)
}if(FBTrace.DBG_SPY){FBTrace.sysout("spy.initContext "+contexts.length+" ",context.getName())
}},destroyContext:function(context){this.detachObserver(context,null);
if(FBTrace.DBG_SPY&&context.spies.length){FBTrace.sysout("spy.destroyContext; ERROR There are leaking Spies ("+context.spies.length+") "+context.getName())
}delete context.spies;
if(FBTrace.DBG_SPY){FBTrace.sysout("spy.destroyContext "+contexts.length+" ",context.getName())
}},watchWindow:function(context,win){if(Firebug.showXMLHttpRequests&&Firebug.Console.isAlwaysEnabled()){this.attachObserver(context,win)
}},unwatchWindow:function(context,win){try{this.detachObserver(context,win)
}catch(ex){ERROR(ex)
}},updateOption:function(name,value){if(name=="showXMLHttpRequests"){var tach=value?this.attachObserver:this.detachObserver;
for(var i=0;
i<TabWatcher.contexts.length;
++i){var context=TabWatcher.contexts[i];
iterateWindows(context.window,function(win){tach.apply(this,[context,win])
})
}}},skipSpy:function(win){if(!win){return true
}var uri=safeGetWindowLocation(win);
if(uri&&(uri.indexOf("about:")==0||uri.indexOf("chrome:")==0)){return true
}},attachObserver:function(context,win){if(Firebug.Spy.skipSpy(win)){return
}for(var i=0;
i<contexts.length;
++i){if((contexts[i].context==context)&&(contexts[i].win==win)){return
}}if(contexts.length==0){httpObserver.addObserver(SpyHttpObserver,"firebug-http-event",false);
SpyHttpActivityObserver.registerObserver()
}contexts.push({context:context,win:win});
if(FBTrace.DBG_SPY){FBTrace.sysout("spy.attachObserver (HTTP) "+contexts.length+" ",context.getName())
}},detachObserver:function(context,win){for(var i=0;
i<contexts.length;
++i){if(contexts[i].context==context){if(win&&(contexts[i].win!=win)){continue
}contexts.splice(i,1);
if(contexts.length==0){httpObserver.removeObserver(SpyHttpObserver,"firebug-http-event");
SpyHttpActivityObserver.unregisterObserver()
}if(FBTrace.DBG_SPY){FBTrace.sysout("spy.detachObserver (HTTP) "+contexts.length+" ",context.getName())
}return
}}},getXHR:function(request){if(!(request instanceof Ci.nsIHttpChannel)){return null
}try{var callbacks=request.notificationCallbacks;
return(callbacks?callbacks.getInterface(Ci.nsIXMLHttpRequest):null)
}catch(exc){if(exc.name=="NS_NOINTERFACE"){if(FBTrace.DBG_SPY){FBTrace.sysout("spy.getXHR; Request is not nsIXMLHttpRequest: "+safeGetRequestName(request))
}}}return null
}});
Firebug.Spy.XHR=domplate(Firebug.Rep,{tag:DIV({"class":"spyHead",_repObject:"$object"},TABLE({"class":"spyHeadTable focusRow outerFocusRow",cellpadding:0,cellspacing:0,role:"listitem","aria-expanded":"false"},TBODY({role:"presentation"},TR({"class":"spyRow"},TD({"class":"spyTitleCol spyCol",onclick:"$onToggleBody"},DIV({"class":"spyTitle"},"$object|getCaption"),DIV({"class":"spyFullTitle spyTitle"},"$object|getFullUri")),TD({"class":"spyCol"},DIV({"class":"spyStatus"},"$object|getStatus")),TD({"class":"spyCol"},SPAN({"class":"spyIcon"})),TD({"class":"spyCol"},SPAN({"class":"spyTime"})),TD({"class":"spyCol"},TAG(FirebugReps.SourceLink.tag,{object:"$object.sourceLink"})))))),getCaption:function(spy){return spy.method.toUpperCase()+" "+cropString(spy.getURL(),100)
},getFullUri:function(spy){return spy.method.toUpperCase()+" "+spy.getURL()
},getStatus:function(spy){var text="";
if(spy.statusCode){text+=spy.statusCode+" "
}if(spy.statusText){return text+=spy.statusText
}return text
},onToggleBody:function(event){var target=event.currentTarget||event.srcElement;
var logRow=getAncestorByClass(target,"logRow-spy");
if(isLeftClick(event)){toggleClass(logRow,"opened");
var spy=getChildByClass(logRow,"spyHead").repObject;
var spyHeadTable=getAncestorByClass(target,"spyHeadTable");
if(hasClass(logRow,"opened")){updateHttpSpyInfo(spy,logRow);
if(spyHeadTable){spyHeadTable.setAttribute("aria-expanded","true")
}}else{}}},copyURL:function(spy){copyToClipboard(spy.getURL())
},copyParams:function(spy){var text=spy.postText;
if(!text){return
}var url=reEncodeURL(spy,text,true);
copyToClipboard(url)
},copyResponse:function(spy){copyToClipboard(spy.responseText)
},openInTab:function(spy){openNewTab(spy.getURL(),spy.postText)
},supportsObject:function(object){return false;
return object instanceof Firebug.Spy.XMLHttpRequestSpy
},browseObject:function(spy,context){var url=spy.getURL();
openNewTab(url);
return true
},getRealObject:function(spy,context){return spy.xhrRequest
},getContextMenuItems:function(spy){var items=[{label:"CopyLocation",command:bindFixed(this.copyURL,this,spy)}];
if(spy.postText){items.push({label:"CopyLocationParameters",command:bindFixed(this.copyParams,this,spy)})
}items.push({label:"CopyResponse",command:bindFixed(this.copyResponse,this,spy)},"-",{label:"OpenInTab",command:bindFixed(this.openInTab,this,spy)});
return items
}});
function updateTime(spy){var timeBox=spy.logRow.getElementsByClassName("spyTime").item(0);
if(spy.responseTime){timeBox.textContent=" "+formatTime(spy.responseTime)
}}function updateLogRow(spy){updateTime(spy);
var statusBox=spy.logRow.getElementsByClassName("spyStatus").item(0);
statusBox.textContent=Firebug.Spy.XHR.getStatus(spy);
removeClass(spy.logRow,"loading");
setClass(spy.logRow,"loaded");
try{var errorRange=Math.floor(spy.xhrRequest.status/100);
if(errorRange==4||errorRange==5){setClass(spy.logRow,"error")
}}catch(exc){}}var updateHttpSpyInfo=function updateHttpSpyInfo(spy,logRow){if(!spy.logRow&&logRow){spy.logRow=logRow
}if(!spy.logRow||!hasClass(spy.logRow,"opened")){return
}if(!spy.params){spy.params=parseURLParams(spy.href+"")
}if(!spy.requestHeaders){spy.requestHeaders=getRequestHeaders(spy)
}if(!spy.responseHeaders&&spy.loaded){spy.responseHeaders=getResponseHeaders(spy)
}var template=Firebug.NetMonitor.NetInfoBody;
var netInfoBox=getChildByClass(spy.logRow,"spyHead","netInfoBody");
if(!netInfoBox){var head=getChildByClass(spy.logRow,"spyHead");
netInfoBox=template.tag.append({file:spy},head);
template.selectTabByName(netInfoBox,"Response")
}else{template.updateInfo(netInfoBox,spy,spy.context)
}};
function getRequestHeaders(spy){var headers=[];
var channel=spy.xhrRequest.channel;
if(channel instanceof Ci.nsIHttpChannel){channel.visitRequestHeaders({visitHeader:function(name,value){headers.push({name:name,value:value})
}})
}return headers
}function getResponseHeaders(spy){var headers=[];
try{var channel=spy.xhrRequest.channel;
if(channel instanceof Ci.nsIHttpChannel){channel.visitResponseHeaders({visitHeader:function(name,value){headers.push({name:name,value:value})
}})
}}catch(exc){if(FBTrace.DBG_SPY||FBTrace.DBG_ERRORS){FBTrace.sysout("spy.getResponseHeaders; EXCEPTION "+safeGetRequestName(spy.request),exc)
}}return headers
}Firebug.registerModule(Firebug.Spy)
}});
FBL.ns(function(){with(FBL){var ignoreHTMLProps={sizcache:1,sizset:1};
ignoreHTMLProps[cacheID]=1;
ignoreHTMLProps[cacheID+"b"]=1;
Firebug.HTML=extend(Firebug.Module,{appendTreeNode:function(nodeArray,html){var reTrim=/^\s+|\s+$/g;
if(!nodeArray.length){nodeArray=[nodeArray]
}for(var n=0,node;
node=nodeArray[n];
n++){if(node.nodeType==1){if(Firebug.ignoreFirebugElements&&node.firebugIgnore){continue
}var uid=node[cacheID];
var child=node.childNodes;
var childLength=child.length;
var nodeName=node.nodeName.toLowerCase();
var nodeVisible=isVisible(node);
var hasSingleTextChild=childLength==1&&node.firstChild.nodeType==3&&nodeName!="script"&&nodeName!="style";
var nodeControl=!hasSingleTextChild&&childLength>0?('<div class="nodeControl"></div>'):"";
var isIE=false;
if(isIE&&nodeControl){html.push(nodeControl)
}if(typeof uid!="undefined"){html.push('<div class="objectBox-element" ','id="',uid,'">',!isIE&&nodeControl?nodeControl:"","<span ",cacheID,'="',uid,'" class="nodeBox',nodeVisible?"":" nodeHidden",'"><<span class="nodeTag">',nodeName,"</span>")
}else{html.push('<div class="objectBox-element"><span class="nodeBox',nodeVisible?"":" nodeHidden",'"><<span class="nodeTag">',nodeName,"</span>")
}for(var i=0;
i<node.attributes.length;
++i){var attr=node.attributes[i];
if(!attr.specified||Firebug.ignoreFirebugElements&&ignoreHTMLProps.hasOwnProperty(attr.nodeName)){continue
}var name=attr.nodeName.toLowerCase();
var value=name=="style"?formatStyles(node.style.cssText):attr.nodeValue;
html.push(' <span class="nodeName">',name,'</span>="<span class="nodeValue">',escapeHTML(value),"</span>"")
}if(hasSingleTextChild){var value=child[0].nodeValue.replace(reTrim,"");
if(value){html.push('><span class="nodeText">',escapeHTML(value),'</span></<span class="nodeTag">',nodeName,"</span>></span></div>")
}else{html.push("/></span></div>")
}}else{if(childLength>0){html.push("></span></div>")
}else{html.push("/></span></div>")
}}}else{if(node.nodeType==3){if(node.parentNode&&(node.parentNode.nodeName.toLowerCase()=="script"||node.parentNode.nodeName.toLowerCase()=="style")){var value=node.nodeValue.replace(reTrim,"");
if(isIE){var src=value+"\n"
}else{var src="\n"+value+"\n"
}var match=src.match(/\n/g);
var num=match?match.length:0;
var s=[],sl=0;
for(var c=1;
c<num;
c++){s[sl++]='<div line="'+c+'">'+c+"</div>"
}html.push('<div class="lineNo">',s.join(""),'</div><pre class="sourceCode">',escapeHTML(src),"</pre>")
}else{var value=node.nodeValue.replace(reTrim,"");
if(value){html.push('<div class="nodeText">',escapeHTML(value),"</div>")
}}}}}},appendTreeChildren:function(treeNode){var doc=Firebug.chrome.document;
var uid=treeNode.id;
var parentNode=documentCache[uid];
if(parentNode.childNodes.length==0){return
}var treeNext=treeNode.nextSibling;
var treeParent=treeNode.parentNode;
var isIE=false;
var control=isIE?treeNode.previousSibling:treeNode.firstChild;
control.className="nodeControl nodeMaximized";
var html=[];
var children=doc.createElement("div");
children.className="nodeChildren";
this.appendTreeNode(parentNode.childNodes,html);
children.innerHTML=html.join("");
treeParent.insertBefore(children,treeNext);
var closeElement=doc.createElement("div");
closeElement.className="objectBox-element";
closeElement.innerHTML='</<span class="nodeTag">'+parentNode.nodeName.toLowerCase()+"></span>";
treeParent.insertBefore(closeElement,treeNext)
},removeTreeChildren:function(treeNode){var children=treeNode.nextSibling;
var closeTag=children.nextSibling;
var isIE=false;
var control=isIE?treeNode.previousSibling:treeNode.firstChild;
control.className="nodeControl";
children.parentNode.removeChild(children);
closeTag.parentNode.removeChild(closeTag)
},isTreeNodeVisible:function(id){return $(id)
},select:function(el){var id=el&&el[cacheID];
if(id){this.selectTreeNode(id)
}},selectTreeNode:function(id){id=""+id;
var node,stack=[];
while(id&&!this.isTreeNodeVisible(id)){stack.push(id);
var node=documentCache[id].parentNode;
if(node&&typeof node[cacheID]!="undefined"){id=""+node[cacheID]
}else{break
}}stack.push(id);
while(stack.length>0){id=stack.pop();
node=$(id);
if(stack.length>0&&documentCache[id].childNodes.length>0){this.appendTreeChildren(node)
}}selectElement(node);
fbPanel1.scrollTop=Math.round(node.offsetTop-fbPanel1.clientHeight/2)
}});
Firebug.registerModule(Firebug.HTML);
function HTMLPanel(){}HTMLPanel.prototype=extend(Firebug.Panel,{name:"HTML",title:"HTML",options:{hasSidePanel:true,isPreRendered:true,innerHTMLSync:true},create:function(){Firebug.Panel.create.apply(this,arguments);
this.panelNode.style.padding="4px 3px 1px 15px";
this.contentNode.style.minWidth="500px";
if(Env.Options.enablePersistent||Firebug.chrome.type!="popup"){this.createUI()
}if(!this.sidePanelBar.selectedPanel){this.sidePanelBar.selectPanel("css")
}},destroy:function(){selectedElement=null;
fbPanel1=null;
selectedSidePanelTS=null;
selectedSidePanelTimer=null;
Firebug.Panel.destroy.apply(this,arguments)
},createUI:function(){var rootNode=Firebug.browser.document.documentElement;
var html=[];
Firebug.HTML.appendTreeNode(rootNode,html);
var d=this.contentNode;
d.innerHTML=html.join("");
this.panelNode.appendChild(d)
},initialize:function(){Firebug.Panel.initialize.apply(this,arguments);
addEvent(this.panelNode,"click",Firebug.HTML.onTreeClick);
fbPanel1=$("fbPanel1");
if(!selectedElement){Firebug.HTML.selectTreeNode(Firebug.browser.document.body[cacheID])
}addEvent(fbPanel1,"mousemove",Firebug.HTML.onListMouseMove);
addEvent($("fbContent"),"mouseout",Firebug.HTML.onListMouseMove);
addEvent(Firebug.chrome.node,"mouseout",Firebug.HTML.onListMouseMove)
},shutdown:function(){removeEvent(fbPanel1,"mousemove",Firebug.HTML.onListMouseMove);
removeEvent($("fbContent"),"mouseout",Firebug.HTML.onListMouseMove);
removeEvent(Firebug.chrome.node,"mouseout",Firebug.HTML.onListMouseMove);
removeEvent(this.panelNode,"click",Firebug.HTML.onTreeClick);
fbPanel1=null;
Firebug.Panel.shutdown.apply(this,arguments)
},reattach:function(){if(FirebugChrome.selectedHTMLElementId){Firebug.HTML.selectTreeNode(FirebugChrome.selectedHTMLElementId)
}},updateSelection:function(object){var id=object[cacheID];
if(id){Firebug.HTML.selectTreeNode(id)
}}});
Firebug.registerPanel(HTMLPanel);
var formatStyles=function(styles){return isIE?styles.replace(/([^\s]+)\s*:/g,function(m,g){return g.toLowerCase()+":"
}):styles
};
var selectedElement=null;
var fbPanel1=null;
var selectedSidePanelTS,selectedSidePanelTimer;
var selectElement=function selectElement(e){if(e!=selectedElement){if(selectedElement){selectedElement.className="objectBox-element"
}e.className=e.className+" selectedElement";
if(FBL.isFirefox){e.style.MozBorderRadius="2px"
}else{if(FBL.isSafari){e.style.WebkitBorderRadius="2px"
}}selectedElement=e;
FirebugChrome.selectedHTMLElementId=e.id;
var target=documentCache[e.id];
var selectedSidePanel=Firebug.chrome.getPanel("HTML").sidePanelBar.selectedPanel;
var stack=FirebugChrome.htmlSelectionStack;
stack.unshift(target);
if(stack.length>2){stack.pop()
}var lazySelect=function(){selectedSidePanelTS=new Date().getTime();
selectedSidePanel.select(target,true)
};
if(selectedSidePanelTimer){clearTimeout(selectedSidePanelTimer);
selectedSidePanelTimer=null
}if(new Date().getTime()-selectedSidePanelTS>100){setTimeout(lazySelect,0)
}else{selectedSidePanelTimer=setTimeout(lazySelect,150)
}}};
Firebug.HTML.onTreeClick=function(e){e=e||event;
var targ;
if(e.target){targ=e.target
}else{if(e.srcElement){targ=e.srcElement
}}if(targ.nodeType==3){targ=targ.parentNode
}if(targ.className.indexOf("nodeControl")!=-1||targ.className=="nodeTag"){var isIE=false;
if(targ.className=="nodeTag"){var control=isIE?(targ.parentNode.previousSibling||targ):(targ.parentNode.previousSibling||targ);
selectElement(targ.parentNode.parentNode);
if(control.className.indexOf("nodeControl")==-1){return
}}else{control=targ
}FBL.cancelEvent(e);
var treeNode=isIE?control.nextSibling:control.parentNode;
if(control.className.indexOf(" nodeMaximized")!=-1){FBL.Firebug.HTML.removeTreeChildren(treeNode)
}else{FBL.Firebug.HTML.appendTreeChildren(treeNode)
}}else{if(targ.className=="nodeValue"||targ.className=="nodeName"){}}};
function onListMouseOut(e){e=e||event||window;
var targ;
if(e.target){targ=e.target
}else{if(e.srcElement){targ=e.srcElement
}}if(targ.nodeType==3){targ=targ.parentNode
}if(hasClass(targ,"fbPanel")){FBL.Firebug.Inspector.hideBoxModel();
hoverElement=null
}}var hoverElement=null;
var hoverElementTS=0;
Firebug.HTML.onListMouseMove=function onListMouseMove(e){try{e=e||event||window;
var targ;
if(e.target){targ=e.target
}else{if(e.srcElement){targ=e.srcElement
}}if(targ.nodeType==3){targ=targ.parentNode
}var found=false;
while(targ&&!found){if(!/\snodeBox\s|\sobjectBox-selector\s/.test(" "+targ.className+" ")){targ=targ.parentNode
}else{found=true
}}if(!targ){FBL.Firebug.Inspector.hideBoxModel();
hoverElement=null;
return
}if(typeof targ.attributes[FBL.cacheID]=="undefined"){return
}var uid=targ.attributes[FBL.cacheID];
if(!uid){return
}var el=FBL.documentCache[uid.value];
var nodeName=el.nodeName.toLowerCase();
if(FBL.isIE&&" meta title script link ".indexOf(" "+nodeName+" ")!=-1){return
}if(!/\snodeBox\s|\sobjectBox-selector\s/.test(" "+targ.className+" ")){return
}if(el.id=="FirebugUI"||" html head body br script link iframe ".indexOf(" "+nodeName+" ")!=-1){FBL.Firebug.Inspector.hideBoxModel();
hoverElement=null;
return
}if((new Date().getTime()-hoverElementTS>40)&&hoverElement!=el){hoverElementTS=new Date().getTime();
hoverElement=el;
FBL.Firebug.Inspector.drawBoxModel(el)
}}catch(E){}}
}});
(function(){this.getElementXPath=function(element){if(element&&element.id){return'//*[@id="'+element.id+'"]'
}else{return this.getElementTreeXPath(element)
}};
this.getElementTreeXPath=function(element){var paths=[];
for(;
element&&element.nodeType==1;
element=element.parentNode){var index=0;
for(var sibling=element.previousSibling;
sibling;
sibling=sibling.previousSibling){if(sibling.nodeName==element.nodeName){++index
}}var tagName=element.nodeName.toLowerCase();
var pathIndex=(index?"["+(index+1)+"]":"");
paths.splice(0,0,tagName+pathIndex)
}return paths.length?"/"+paths.join("/"):null
};
this.getElementsByXPath=function(doc,xpath){var nodes=[];
try{var result=doc.evaluate(xpath,doc,null,XPathResult.ANY_TYPE,null);
for(var item=result.iterateNext();
item;
item=result.iterateNext()){nodes.push(item)
}}catch(exc){}return nodes
};
this.getRuleMatchingElements=function(rule,doc){var css=rule.selectorText;
var xpath=this.cssToXPath(css);
return this.getElementsByXPath(doc,xpath)
}
}).call(FBL);
FBL.ns(function(){with(FBL){var toCamelCase=function toCamelCase(s){return s.replace(reSelectorCase,toCamelCaseReplaceFn)
};
var toSelectorCase=function toSelectorCase(s){return s.replace(reCamelCase,"-$1").toLowerCase()
};
var reCamelCase=/([A-Z])/g;
var reSelectorCase=/\-(.)/g;
var toCamelCaseReplaceFn=function toCamelCaseReplaceFn(m,g){return g.toUpperCase()
};
var cacheUID=-1;
var createCache=function(){var map={};
var CID=cacheID+"b";
var cacheFunction=function(element){return cacheAPI.set(element)
};
var cacheAPI={get:function(key){return map.hasOwnProperty(key)?map[key]:null
},set:function(element){var id=element[CID];
if(!id){id=++cacheUID;
element[CID]=id
}if(!map.hasOwnProperty(id)){map[id]=element
}return id
},key:function(element){return element[CID]
},has:function(element){return map.hasOwnProperty(element[CID])
},clear:function(){for(var name in map){var element=map[name];
element[CID]=null;
delete element[CID];
map[name]=null;
delete map[name]
}}};
append(cacheFunction,cacheAPI);
return cacheFunction
};
var globalCSSRuleIndex;
FBL.processAllStyleSheets=function(doc,styleSheetIterator){styleSheetIterator=styleSheetIterator||processStyleSheet;
globalCSSRuleIndex=-1;
var index=0;
var styleSheets=doc.styleSheets;
if(FBTrace.DBG_CSS){var start=new Date().getTime()
}for(var i=0,length=styleSheets.length;
i<length;
i++){try{var styleSheet=styleSheets[i];
if(isIE){var imports=styleSheet.imports;
for(var j=0,importsLength=imports.length;
j<importsLength;
j++){styleSheetIterator(doc,imports[j])
}}else{var rules=styleSheet.cssRules;
for(var j=0,rulesLength=rules.length;
j<rulesLength;
j++){var rule=rules[j];
if(rule.styleSheet){styleSheetIterator(doc,rule.styleSheet)
}else{break
}}index=j
}}catch(e){styleSheet.restricted=true;
var ssid=StyleSheetCache(styleSheet)
}styleSheetIterator(doc,styleSheet)
}if(FBTrace.DBG_CSS){FBTrace.sysout("FBL.processAllStyleSheets","all stylesheet rules processed in "+(new Date().getTime()-start)+"ms")
}};
var StyleSheetCache=FBL.StyleSheetCache=createCache();
var ElementCache=FBL.ElementCache=createCache();
var CSSRuleMap={};
var ElementCSSRulesMap={};
var processStyleSheet=function(doc,styleSheet){if(styleSheet.restricted){return
}var rules=isIE?styleSheet.rules:styleSheet.cssRules;
var ssid=StyleSheetCache(styleSheet);
for(var i=0,length=rules.length;
i<length;
i++){var rid=ssid+":"+i;
var rule=rules[i];
var selector=rule.selectorText;
if(isIE){selector=selector.replace(reSelectorTag,function(s){return s.toLowerCase()
})
}CSSRuleMap[rid]={styleSheetId:ssid,styleSheetIndex:i,order:++globalCSSRuleIndex,specificity:selector?getCSSRuleSpecificity(selector):0,rule:rule,selector:selector,cssText:rule.style?rule.style.cssText:rule.cssText?rule.cssText:""};
var elements=Firebug.Selector(selector,doc);
for(var j=0,elementsLength=elements.length;
j<elementsLength;
j++){var element=elements[j];
var eid=ElementCache(element);
if(!ElementCSSRulesMap[eid]){ElementCSSRulesMap[eid]=[]
}ElementCSSRulesMap[eid].push(rid)
}}for(var name in ElementCSSRulesMap){if(ElementCSSRulesMap.hasOwnProperty(name)){var rules=ElementCSSRulesMap[name];
rules.sort(sortElementRules)
}}};
var sortElementRules=function(a,b){var ruleA=CSSRuleMap[a];
var ruleB=CSSRuleMap[b];
var specificityA=ruleA.specificity;
var specificityB=ruleB.specificity;
if(specificityA>specificityB){return 1
}else{if(specificityA<specificityB){return -1
}else{return ruleA.order>ruleB.order?1:-1
}}};
var solveRulesTied=function(a,b){var ruleA=CSSRuleMap[a];
var ruleB=CSSRuleMap[b];
if(ruleA.specificity==ruleB.specificity){return ruleA.order>ruleB.order?1:-1
}return null
};
var reSelectorTag=/(^|\s)(?:\w+)/g;
var reSelectorClass=/\.[\w\d_-]+/g;
var reSelectorId=/#[\w\d_-]+/g;
var getCSSRuleSpecificity=function(selector){var match=selector.match(reSelectorTag);
var tagCount=match?match.length:0;
match=selector.match(reSelectorClass);
var classCount=match?match.length:0;
match=selector.match(reSelectorId);
var idCount=match?match.length:0;
return tagCount+10*classCount+100*idCount
};
Firebug.SourceBoxPanel=Firebug.Panel;
var domUtils=null;
var textContent=isIE?"innerText":"textContent";
var CSSDomplateBase={isEditable:function(rule){return !rule.isSystemSheet
},isSelectorEditable:function(rule){return rule.isSelectorEditable&&this.isEditable(rule)
}};
var CSSPropTag=domplate(CSSDomplateBase,{tag:DIV({"class":"cssProp focusRow",$disabledStyle:"$prop.disabled",$editGroup:"$rule|isEditable",$cssOverridden:"$prop.overridden",role:"option"},A({"class":"cssPropDisable"}," "),SPAN({"class":"cssPropName",$editable:"$rule|isEditable"},"$prop.name"),SPAN({"class":"cssColon"},":"),SPAN({"class":"cssPropValue",$editable:"$rule|isEditable"},"$prop.value$prop.important"),SPAN({"class":"cssSemi"},";"))});
var CSSRuleTag=TAG("$rule.tag",{rule:"$rule"});
var CSSImportRuleTag=domplate({tag:DIV({"class":"cssRule insertInto focusRow importRule",_repObject:"$rule.rule"},"@import "",A({"class":"objectLink",_repObject:"$rule.rule.styleSheet"},"$rule.rule.href"),"";")});
var CSSStyleRuleTag=domplate(CSSDomplateBase,{tag:DIV({"class":"cssRule insertInto",$cssEditableRule:"$rule|isEditable",$editGroup:"$rule|isSelectorEditable",_repObject:"$rule.rule",ruleId:"$rule.id",role:"presentation"},DIV({"class":"cssHead focusRow",role:"listitem"},SPAN({"class":"cssSelector",$editable:"$rule|isSelectorEditable"},"$rule.selector")," {"),DIV({role:"group"},DIV({"class":"cssPropertyListBox",role:"listbox"},FOR("prop","$rule.props",TAG(CSSPropTag.tag,{rule:"$rule",prop:"$prop"})))),DIV({"class":"editable insertBefore",role:"presentation"},"}"))});
var reSplitCSS=/(url\("?[^"\)]+?"?\))|(rgb\(.*?\))|(#[\dA-Fa-f]+)|(-?\d+(\.\d+)?(%|[a-z]{1,2})?)|([^,\s]+)|"(.*?)"/;
var reURL=/url\("?([^"\)]+)?"?\)/;
var reRepeat=/no-repeat|repeat-x|repeat-y|repeat/;
var sothinkInstalled=false;
var styleGroups={text:["font-family","font-size","font-weight","font-style","color","text-transform","text-decoration","letter-spacing","word-spacing","line-height","text-align","vertical-align","direction","column-count","column-gap","column-width"],background:["background-color","background-image","background-repeat","background-position","background-attachment","opacity"],box:["width","height","top","right","bottom","left","margin-top","margin-right","margin-bottom","margin-left","padding-top","padding-right","padding-bottom","padding-left","border-top-width","border-right-width","border-bottom-width","border-left-width","border-top-color","border-right-color","border-bottom-color","border-left-color","border-top-style","border-right-style","border-bottom-style","border-left-style","-moz-border-top-radius","-moz-border-right-radius","-moz-border-bottom-radius","-moz-border-left-radius","outline-top-width","outline-right-width","outline-bottom-width","outline-left-width","outline-top-color","outline-right-color","outline-bottom-color","outline-left-color","outline-top-style","outline-right-style","outline-bottom-style","outline-left-style"],layout:["position","display","visibility","z-index","overflow-x","overflow-y","overflow-clip","white-space","clip","float","clear","-moz-box-sizing"],other:["cursor","list-style-image","list-style-position","list-style-type","marker-offset","user-focus","user-select","user-modify","user-input"]};
var styleGroupTitles={text:"Text",background:"Background",box:"Box Model",layout:"Layout",other:"Other"};
Firebug.CSSModule=extend(Firebug.Module,{freeEdit:function(styleSheet,value){if(!styleSheet.editStyleSheet){var ownerNode=getStyleSheetOwnerNode(styleSheet);
styleSheet.disabled=true;
var url=CCSV("@mozilla.org/network/standard-url;1",Components.interfaces.nsIURL);
url.spec=styleSheet.href;
var editStyleSheet=ownerNode.ownerDocument.createElementNS("http://www.w3.org/1999/xhtml","style");
unwrapObject(editStyleSheet).firebugIgnore=true;
editStyleSheet.setAttribute("type","text/css");
editStyleSheet.setAttributeNS("http://www.w3.org/XML/1998/namespace","base",url.directory);
if(ownerNode.hasAttribute("media")){editStyleSheet.setAttribute("media",ownerNode.getAttribute("media"))
}ownerNode.parentNode.insertBefore(editStyleSheet,ownerNode.nextSibling);
styleSheet.editStyleSheet=editStyleSheet
}styleSheet.editStyleSheet.innerHTML=value;
if(FBTrace.DBG_CSS){FBTrace.sysout("css.saveEdit styleSheet.href:"+styleSheet.href+" got innerHTML:"+value+"\n")
}dispatch(this.fbListener,"onCSSFreeEdit",[styleSheet,value])
},insertRule:function(styleSheet,cssText,ruleIndex){if(FBTrace.DBG_CSS){FBTrace.sysout("Insert: "+ruleIndex+" "+cssText)
}var insertIndex=styleSheet.insertRule(cssText,ruleIndex);
dispatch(this.fbListeners,"onCSSInsertRule",[styleSheet,cssText,ruleIndex]);
return insertIndex
},deleteRule:function(styleSheet,ruleIndex){if(FBTrace.DBG_CSS){FBTrace.sysout("deleteRule: "+ruleIndex+" "+styleSheet.cssRules.length,styleSheet.cssRules)
}dispatch(this.fbListeners,"onCSSDeleteRule",[styleSheet,ruleIndex]);
styleSheet.deleteRule(ruleIndex)
},setProperty:function(rule,propName,propValue,propPriority){var style=rule.style||rule;
var baseText=style.cssText;
if(style.getPropertyValue){var prevValue=style.getPropertyValue(propName);
var prevPriority=style.getPropertyPriority(propName);
style.removeProperty(propName);
style.setProperty(propName,propValue,propPriority)
}else{style[toCamelCase(propName)]=propValue
}},removeProperty:function(rule,propName,parent){var style=rule.style||rule;
var baseText=style.cssText;
if(style.getPropertyValue){var prevValue=style.getPropertyValue(propName);
var prevPriority=style.getPropertyPriority(propName);
style.removeProperty(propName)
}else{style[toCamelCase(propName)]=""
}if(propName){dispatch(this.fbListeners,"onCSSRemoveProperty",[style,propName,prevValue,prevPriority,rule,baseText])
}}});
Firebug.CSSStyleSheetPanel=function(){};
Firebug.CSSStyleSheetPanel.prototype=extend(Firebug.SourceBoxPanel,{template:domplate({tag:DIV({"class":"cssSheet insertInto a11yCSSView"},FOR("rule","$rules",CSSRuleTag),DIV({"class":"cssSheet editable insertBefore"},""))}),refresh:function(){if(this.location){this.updateLocation(this.location)
}else{if(this.selection){this.updateSelection(this.selection)
}}},toggleEditing:function(){if(!this.stylesheetEditor){this.stylesheetEditor=new StyleSheetEditor(this.document)
}if(this.editing){Firebug.Editor.stopEditing()
}else{if(!this.location){return
}var styleSheet=this.location.editStyleSheet?this.location.editStyleSheet.sheet:this.location;
var css=getStyleSheetCSS(styleSheet,this.context);
this.stylesheetEditor.styleSheet=this.location;
Firebug.Editor.startEditing(this.panelNode,css,this.stylesheetEditor)
}},getStylesheetURL:function(rule){if(this.location.href){return this.location.href
}else{return this.context.window.location.href
}},getRuleByLine:function(styleSheet,line){if(!domUtils){return null
}var cssRules=styleSheet.cssRules;
for(var i=0;
i<cssRules.length;
++i){var rule=cssRules[i];
if(rule instanceof CSSStyleRule){var ruleLine=domUtils.getRuleLine(rule);
if(ruleLine>=line){return rule
}}}},highlightRule:function(rule){var ruleElement=Firebug.getElementByRepObject(this.panelNode.firstChild,rule);
if(ruleElement){scrollIntoCenterView(ruleElement,this.panelNode);
setClassTimed(ruleElement,"jumpHighlight",this.context)
}},getStyleSheetRules:function(context,styleSheet){var isSystemSheet=isSystemStyleSheet(styleSheet);
function appendRules(cssRules){for(var i=0;
i<cssRules.length;
++i){var rule=cssRules[i];
if(instanceOf(rule,"CSSStyleRule")){var props=this.getRuleProperties(context,rule);
var line=null;
var selector=rule.selectorText;
if(isIE){selector=selector.replace(reSelectorTag,function(s){return s.toLowerCase()
})
}var ruleId=rule.selectorText+"/"+line;
rules.push({tag:CSSStyleRuleTag.tag,rule:rule,id:ruleId,selector:selector,props:props,isSystemSheet:isSystemSheet,isSelectorEditable:true})
}else{if(instanceOf(rule,"CSSImportRule")){rules.push({tag:CSSImportRuleTag.tag,rule:rule})
}else{if(instanceOf(rule,"CSSMediaRule")){appendRules.apply(this,[rule.cssRules])
}else{if(FBTrace.DBG_ERRORS||FBTrace.DBG_CSS){FBTrace.sysout("css getStyleSheetRules failed to classify a rule ",rule)
}}}}}}var rules=[];
appendRules.apply(this,[styleSheet.cssRules||styleSheet.rules]);
return rules
},parseCSSProps:function(style,inheritMode){var props=[];
if(Firebug.expandShorthandProps){var count=style.length-1,index=style.length;
while(index--){var propName=style.item(count-index);
this.addProperty(propName,style.getPropertyValue(propName),!!style.getPropertyPriority(propName),false,inheritMode,props)
}}else{var lines=style.cssText.match(/(?:[^;\(]*(?:\([^\)]*?\))?[^;\(]*)*;?/g);
var propRE=/\s*([^:\s]*)\s*:\s*(.*?)\s*(! important)?;?$/;
var line,i=0;
var m;
while(line=lines[i++]){m=propRE.exec(line);
if(!m){continue
}if(m[2]){this.addProperty(m[1],m[2],!!m[3],false,inheritMode,props)
}}}return props
},getRuleProperties:function(context,rule,inheritMode){var props=this.parseCSSProps(rule.style,inheritMode);
var line;
var ruleId=rule.selectorText+"/"+line;
this.addOldProperties(context,ruleId,inheritMode,props);
sortProperties(props);
return props
},addOldProperties:function(context,ruleId,inheritMode,props){if(context.selectorMap&&context.selectorMap.hasOwnProperty(ruleId)){var moreProps=context.selectorMap[ruleId];
for(var i=0;
i<moreProps.length;
++i){var prop=moreProps[i];
this.addProperty(prop.name,prop.value,prop.important,true,inheritMode,props)
}}},addProperty:function(name,value,important,disabled,inheritMode,props){name=name.toLowerCase();
if(inheritMode&&!inheritedStyleNames[name]){return
}name=this.translateName(name,value);
if(name){value=stripUnits(rgbToHex(value));
important=important?" !important":"";
var prop={name:name,value:value,important:important,disabled:disabled};
props.push(prop)
}},translateName:function(name,value){if((value=="-moz-initial"&&(name=="-moz-background-clip"||name=="-moz-background-origin"||name=="-moz-background-inline-policy"))||(value=="physical"&&(name=="margin-left-ltr-source"||name=="margin-left-rtl-source"||name=="margin-right-ltr-source"||name=="margin-right-rtl-source"))||(value=="physical"&&(name=="padding-left-ltr-source"||name=="padding-left-rtl-source"||name=="padding-right-ltr-source"||name=="padding-right-rtl-source"))){return null
}if(name=="margin-left-value"){return"margin-left"
}else{if(name=="margin-right-value"){return"margin-right"
}else{if(name=="margin-top-value"){return"margin-top"
}else{if(name=="margin-bottom-value"){return"margin-bottom"
}else{if(name=="padding-left-value"){return"padding-left"
}else{if(name=="padding-right-value"){return"padding-right"
}else{if(name=="padding-top-value"){return"padding-top"
}else{if(name=="padding-bottom-value"){return"padding-bottom"
}else{return name
}}}}}}}}},editElementStyle:function(){var rulesBox=this.panelNode.getElementsByClassName("cssElementRuleContainer")[0];
var styleRuleBox=rulesBox&&Firebug.getElementByRepObject(rulesBox,this.selection);
if(!styleRuleBox){var rule={rule:this.selection,inherited:false,selector:"element.style",props:[]};
if(!rulesBox){styleRuleBox=this.template.cascadedTag.replace({rules:[rule],inherited:[],inheritLabel:"Inherited from"},this.panelNode);
styleRuleBox=styleRuleBox.getElementsByClassName("cssElementRuleContainer")[0]
}else{styleRuleBox=this.template.ruleTag.insertBefore({rule:rule},rulesBox)
}styleRuleBox=styleRuleBox.getElementsByClassName("insertInto")[0]
}Firebug.Editor.insertRowForObject(styleRuleBox)
},insertPropertyRow:function(row){Firebug.Editor.insertRowForObject(row)
},insertRule:function(row){var location=getAncestorByClass(row,"cssRule");
if(!location){location=getChildByClass(this.panelNode,"cssSheet");
Firebug.Editor.insertRowForObject(location)
}else{Firebug.Editor.insertRow(location,"before")
}},editPropertyRow:function(row){var propValueBox=getChildByClass(row,"cssPropValue");
Firebug.Editor.startEditing(propValueBox)
},deletePropertyRow:function(row){var rule=Firebug.getRepObject(row);
var propName=getChildByClass(row,"cssPropName")[textContent];
Firebug.CSSModule.removeProperty(rule,propName);
var ruleId=Firebug.getRepNode(row).getAttribute("ruleId");
if(this.context.selectorMap&&this.context.selectorMap.hasOwnProperty(ruleId)){var map=this.context.selectorMap[ruleId];
for(var i=0;
i<map.length;
++i){if(map[i].name==propName){map.splice(i,1);
break
}}}if(this.name=="stylesheet"){dispatch([Firebug.A11yModel],"onInlineEditorClose",[this,row.firstChild,true])
}row.parentNode.removeChild(row);
this.markChange(this.name=="stylesheet")
},disablePropertyRow:function(row){toggleClass(row,"disabledStyle");
var rule=Firebug.getRepObject(row);
var propName=getChildByClass(row,"cssPropName")[textContent];
if(!this.context.selectorMap){this.context.selectorMap={}
}var ruleId=Firebug.getRepNode(row).getAttribute("ruleId");
if(!(this.context.selectorMap.hasOwnProperty(ruleId))){this.context.selectorMap[ruleId]=[]
}var map=this.context.selectorMap[ruleId];
var propValue=getChildByClass(row,"cssPropValue")[textContent];
var parsedValue=parsePriority(propValue);
if(hasClass(row,"disabledStyle")){Firebug.CSSModule.removeProperty(rule,propName);
map.push({name:propName,value:parsedValue.value,important:parsedValue.priority})
}else{Firebug.CSSModule.setProperty(rule,propName,parsedValue.value,parsedValue.priority);
var index=findPropByName(map,propName);
map.splice(index,1)
}this.markChange(this.name=="stylesheet")
},onMouseDown:function(event){var offset=event.clientX-this.panelNode.parentNode.offsetLeft;
if(!isLeftClick(event)||offset>20){return
}var target=event.target||event.srcElement;
if(hasClass(target,"textEditor")){return
}var row=getAncestorByClass(target,"cssProp");
if(row&&hasClass(row,"editGroup")){this.disablePropertyRow(row);
cancelEvent(event)
}},onClick:function(event){var offset=event.clientX-this.panelNode.parentNode.offsetLeft;
if(!isLeftClick(event)||offset<=20){return
}var target=event.target||event.srcElement;
if(hasClass(target,"textEditorInner")){return
}var row=getAncestorByClass(target,"cssRule");
if(row&&!getAncestorByClass(target,"cssPropName")&&!getAncestorByClass(target,"cssPropValue")){this.insertPropertyRow(row);
cancelEvent(event)
}},name:"stylesheet",title:"CSS",parentPanel:null,searchable:true,dependents:["css","stylesheet","dom","domSide","layout"],options:{hasToolButtons:true},create:function(){Firebug.Panel.create.apply(this,arguments);
this.onMouseDown=bind(this.onMouseDown,this);
this.onClick=bind(this.onClick,this);
if(this.name=="stylesheet"){this.onChangeSelect=bind(this.onChangeSelect,this);
var doc=Firebug.browser.document;
var selectNode=this.selectNode=createElement("select");
processAllStyleSheets(doc,function(doc,styleSheet){var key=StyleSheetCache.key(styleSheet);
var fileName=getFileName(styleSheet.href)||getFileName(doc.location.href);
var option=createElement("option",{value:key});
option.appendChild(Firebug.chrome.document.createTextNode(fileName));
selectNode.appendChild(option)
});
this.toolButtonsNode.appendChild(selectNode)
}},onChangeSelect:function(event){event=event||window.event;
var target=event.srcElement||event.currentTarget;
var key=target.value;
var styleSheet=StyleSheetCache.get(key);
this.updateLocation(styleSheet)
},initialize:function(){Firebug.Panel.initialize.apply(this,arguments);
this.context=Firebug.chrome;
this.document=Firebug.chrome.document;
this.initializeNode();
if(this.name=="stylesheet"){var styleSheets=Firebug.browser.document.styleSheets;
if(styleSheets.length>0){addEvent(this.selectNode,"change",this.onChangeSelect);
this.updateLocation(styleSheets[0])
}}},shutdown:function(){if(this.name=="stylesheet"){removeEvent(this.selectNode,"change",this.onChangeSelect)
}this.destroyNode();
Firebug.Panel.shutdown.apply(this,arguments)
},destroy:function(state){Firebug.Editor.stopEditing();
Firebug.Panel.destroy.apply(this,arguments)
},initializeNode:function(oldPanelNode){addEvent(this.panelNode,"mousedown",this.onMouseDown);
addEvent(this.panelNode,"click",this.onClick)
},destroyNode:function(){removeEvent(this.panelNode,"mousedown",this.onMouseDown);
removeEvent(this.panelNode,"click",this.onClick)
},ishow:function(state){Firebug.Inspector.stopInspecting(true);
this.showToolbarButtons("fbCSSButtons",true);
if(this.context.loaded&&!this.location){restoreObjects(this,state);
if(!this.location){this.location=this.getDefaultLocation()
}if(state&&state.scrollTop){this.panelNode.scrollTop=state.scrollTop
}}},ihide:function(){this.showToolbarButtons("fbCSSButtons",false);
this.lastScrollTop=this.panelNode.scrollTop
},supportsObject:function(object){if(object instanceof CSSStyleSheet){return 1
}else{if(object instanceof CSSStyleRule){return 2
}else{if(object instanceof CSSStyleDeclaration){return 2
}else{if(object instanceof SourceLink&&object.type=="css"&&reCSS.test(object.href)){return 2
}else{return 0
}}}}},updateLocation:function(styleSheet){if(!styleSheet){return
}if(styleSheet.editStyleSheet){styleSheet=styleSheet.editStyleSheet.sheet
}if(styleSheet.restricted){FirebugReps.Warning.tag.replace({object:"AccessRestricted"},this.panelNode);
return
}var rules=this.getStyleSheetRules(this.context,styleSheet);
var result;
if(rules.length){result=this.template.tag.replace({rules:rules},this.panelNode)
}else{result=FirebugReps.Warning.tag.replace({object:"EmptyStyleSheet"},this.panelNode)
}},updateSelection:function(object){this.selection=null;
if(object instanceof CSSStyleDeclaration){object=object.parentRule
}if(object instanceof CSSStyleRule){this.navigate(object.parentStyleSheet);
this.highlightRule(object)
}else{if(object instanceof CSSStyleSheet){this.navigate(object)
}else{if(object instanceof SourceLink){try{var sourceLink=object;
var sourceFile=getSourceFileByHref(sourceLink.href,this.context);
if(sourceFile){clearNode(this.panelNode);
this.showSourceFile(sourceFile);
var lineNo=object.line;
if(lineNo){this.scrollToLine(lineNo,this.jumpHighlightFactory(lineNo,this.context))
}}else{var stylesheet=getStyleSheetByHref(sourceLink.href,this.context);
if(stylesheet){this.navigate(stylesheet)
}else{if(FBTrace.DBG_CSS){FBTrace.sysout("css.updateSelection no sourceFile for "+sourceLink.href,sourceLink)
}}}}catch(exc){if(FBTrace.DBG_CSS){FBTrace.sysout("css.upDateSelection FAILS "+exc,exc)
}}}}}},updateOption:function(name,value){if(name=="expandShorthandProps"){this.refresh()
}},getLocationList:function(){var styleSheets=getAllStyleSheets(this.context);
return styleSheets
},getOptionsMenuItems:function(){return[{label:"Expand Shorthand Properties",type:"checkbox",checked:Firebug.expandShorthandProps,command:bindFixed(Firebug.togglePref,Firebug,"expandShorthandProps")},"-",{label:"Refresh",command:bind(this.refresh,this)}]
},getContextMenuItems:function(style,target){var items=[];
if(this.infoTipType=="color"){items.push({label:"CopyColor",command:bindFixed(copyToClipboard,FBL,this.infoTipObject)})
}else{if(this.infoTipType=="image"){items.push({label:"CopyImageLocation",command:bindFixed(copyToClipboard,FBL,this.infoTipObject)},{label:"OpenImageInNewTab",command:bindFixed(openNewTab,FBL,this.infoTipObject)})
}}if(this.selection instanceof Element){items.push("-",{label:"EditStyle",command:bindFixed(this.editElementStyle,this)})
}else{if(!isSystemStyleSheet(this.selection)){items.push("-",{label:"NewRule",command:bindFixed(this.insertRule,this,target)})
}}var cssRule=getAncestorByClass(target,"cssRule");
if(cssRule&&hasClass(cssRule,"cssEditableRule")){items.push("-",{label:"NewProp",command:bindFixed(this.insertPropertyRow,this,target)});
var propRow=getAncestorByClass(target,"cssProp");
if(propRow){var propName=getChildByClass(propRow,"cssPropName")[textContent];
var isDisabled=hasClass(propRow,"disabledStyle");
items.push({label:$STRF("EditProp",[propName]),nol10n:true,command:bindFixed(this.editPropertyRow,this,propRow)},{label:$STRF("DeleteProp",[propName]),nol10n:true,command:bindFixed(this.deletePropertyRow,this,propRow)},{label:$STRF("DisableProp",[propName]),nol10n:true,type:"checkbox",checked:isDisabled,command:bindFixed(this.disablePropertyRow,this,propRow)})
}}items.push("-",{label:"Refresh",command:bind(this.refresh,this)});
return items
},browseObject:function(object){if(this.infoTipType=="image"){openNewTab(this.infoTipObject);
return true
}},showInfoTip:function(infoTip,target,x,y){var propValue=getAncestorByClass(target,"cssPropValue");
if(propValue){var offset=getClientOffset(propValue);
var offsetX=x-offset.x;
var text=propValue[textContent];
var charWidth=propValue.offsetWidth/text.length;
var charOffset=Math.floor(offsetX/charWidth);
var cssValue=parseCSSValue(text,charOffset);
if(cssValue){if(cssValue.value==this.infoTipValue){return true
}this.infoTipValue=cssValue.value;
if(cssValue.type=="rgb"||(!cssValue.type&&isColorKeyword(cssValue.value))){this.infoTipType="color";
this.infoTipObject=cssValue.value;
return Firebug.InfoTip.populateColorInfoTip(infoTip,cssValue.value)
}else{if(cssValue.type=="url"){var propNameNode=target.parentNode.getElementsByClassName("cssPropName").item(0);
if(propNameNode&&isImageRule(propNameNode[textContent])){var rule=Firebug.getRepObject(target);
var baseURL=this.getStylesheetURL(rule);
var relURL=parseURLValue(cssValue.value);
var absURL=isDataURL(relURL)?relURL:absoluteURL(relURL,baseURL);
var repeat=parseRepeatValue(text);
this.infoTipType="image";
this.infoTipObject=absURL;
return Firebug.InfoTip.populateImageInfoTip(infoTip,absURL,repeat)
}}}}}delete this.infoTipType;
delete this.infoTipValue;
delete this.infoTipObject
},getEditor:function(target,value){if(target==this.panelNode||hasClass(target,"cssSelector")||hasClass(target,"cssRule")||hasClass(target,"cssSheet")){if(!this.ruleEditor){this.ruleEditor=new CSSRuleEditor(this.document)
}return this.ruleEditor
}else{if(!this.editor){this.editor=new CSSEditor(this.document)
}return this.editor
}},getDefaultLocation:function(){try{var styleSheets=this.context.window.document.styleSheets;
if(styleSheets.length){var sheet=styleSheets[0];
return(Firebug.filterSystemURLs&&isSystemURL(getURLForStyleSheet(sheet)))?null:sheet
}}catch(exc){if(FBTrace.DBG_LOCATIONS){FBTrace.sysout("css.getDefaultLocation FAILS "+exc,exc)
}}},getObjectDescription:function(styleSheet){var url=getURLForStyleSheet(styleSheet);
var instance=getInstanceForStyleSheet(styleSheet);
var baseDescription=splitURLBase(url);
if(instance){baseDescription.name=baseDescription.name+" #"+(instance+1)
}return baseDescription
},search:function(text,reverse){var curDoc=this.searchCurrentDoc(!Firebug.searchGlobal,text,reverse);
if(!curDoc&&Firebug.searchGlobal){return this.searchOtherDocs(text,reverse)
}return curDoc
},searchOtherDocs:function(text,reverse){var scanRE=Firebug.Search.getTestingRegex(text);
function scanDoc(styleSheet){for(var i=0;
i<styleSheet.cssRules.length;
i++){if(scanRE.test(styleSheet.cssRules[i].cssText)){return true
}}}if(this.navigateToNextDocument(scanDoc,reverse)){return this.searchCurrentDoc(true,text,reverse)
}},searchCurrentDoc:function(wrapSearch,text,reverse){if(!text){delete this.currentSearch;
return false
}var row;
if(this.currentSearch&&text==this.currentSearch.text){row=this.currentSearch.findNext(wrapSearch,false,reverse,Firebug.Search.isCaseSensitive(text))
}else{if(this.editing){this.currentSearch=new TextSearch(this.stylesheetEditor.box);
row=this.currentSearch.find(text,reverse,Firebug.Search.isCaseSensitive(text));
if(row){var sel=this.document.defaultView.getSelection();
sel.removeAllRanges();
sel.addRange(this.currentSearch.range);
scrollSelectionIntoView(this);
return true
}else{return false
}}else{function findRow(node){return node.nodeType==1?node:node.parentNode
}this.currentSearch=new TextSearch(this.panelNode,findRow);
row=this.currentSearch.find(text,reverse,Firebug.Search.isCaseSensitive(text))
}}if(row){this.document.defaultView.getSelection().selectAllChildren(row);
scrollIntoCenterView(row,this.panelNode);
dispatch([Firebug.A11yModel],"onCSSSearchMatchFound",[this,text,row]);
return true
}else{dispatch([Firebug.A11yModel],"onCSSSearchMatchFound",[this,text,null]);
return false
}},getSearchOptionsMenuItems:function(){return[Firebug.Search.searchOptionMenu("search.Case_Sensitive","searchCaseSensitive"),Firebug.Search.searchOptionMenu("search.Multiple_Files","searchGlobal")]
}});
function CSSElementPanel(){}CSSElementPanel.prototype=extend(Firebug.CSSStyleSheetPanel.prototype,{template:domplate({cascadedTag:DIV({"class":"a11yCSSView",role:"presentation"},DIV({role:"list","aria-label":$STR("aria.labels.style rules")},FOR("rule","$rules",TAG("$ruleTag",{rule:"$rule"}))),DIV({role:"list","aria-label":$STR("aria.labels.inherited style rules")},FOR("section","$inherited",H1({"class":"cssInheritHeader groupHeader focusRow",role:"listitem"},SPAN({"class":"cssInheritLabel"},"$inheritLabel"),TAG(FirebugReps.Element.shortTag,{object:"$section.element"})),DIV({role:"group"},FOR("rule","$section.rules",TAG("$ruleTag",{rule:"$rule"})))))),ruleTag:isIE?DIV({"class":"cssElementRuleContainer"},TAG(FirebugReps.SourceLink.tag,{object:"$rule.sourceLink"}),TAG(CSSStyleRuleTag.tag,{rule:"$rule"})):DIV({"class":"cssElementRuleContainer"},TAG(CSSStyleRuleTag.tag,{rule:"$rule"}),TAG(FirebugReps.SourceLink.tag,{object:"$rule.sourceLink"}))}),updateCascadeView:function(element){var rules=[],sections=[],usedProps={};
this.getInheritedRules(element,sections,usedProps);
this.getElementRules(element,rules,usedProps);
if(rules.length||sections.length){var inheritLabel="Inherited from";
var result=this.template.cascadedTag.replace({rules:rules,inherited:sections,inheritLabel:inheritLabel},this.panelNode)
}else{var result=FirebugReps.Warning.tag.replace({object:"EmptyElementCSS"},this.panelNode)
}},getStylesheetURL:function(rule){if(rule&&rule.parentStyleSheet.href){return rule.parentStyleSheet.href
}else{return this.selection.ownerDocument.location.href
}},getInheritedRules:function(element,sections,usedProps){var parent=element.parentNode;
if(parent&&parent.nodeType==1){this.getInheritedRules(parent,sections,usedProps);
var rules=[];
this.getElementRules(parent,rules,usedProps,true);
if(rules.length){sections.splice(0,0,{element:parent,rules:rules})
}}},getElementRules:function(element,rules,usedProps,inheritMode){var inspectedRules,displayedRules={};
var eid=ElementCache(element);
inspectedRules=ElementCSSRulesMap[eid];
if(inspectedRules){for(var i=0,length=inspectedRules.length;
i<length;
++i){var ruleId=inspectedRules[i];
var ruleData=CSSRuleMap[ruleId];
var rule=ruleData.rule;
var ssid=ruleData.styleSheetId;
var parentStyleSheet=StyleSheetCache.get(ssid);
var href=parentStyleSheet.href;
var instance=null;
var isSystemSheet=false;
if(!Firebug.showUserAgentCSS&&isSystemSheet){continue
}if(!href){href=element.ownerDocument.location.href
}var props=this.getRuleProperties(this.context,rule,inheritMode);
if(inheritMode&&!props.length){continue
}var line;
var ruleId=rule.selectorText+"/"+line;
var sourceLink=new SourceLink(href,line,"css",rule,instance);
this.markOverridenProps(props,usedProps,inheritMode);
rules.splice(0,0,{rule:rule,id:ruleId,selector:ruleData.selector,sourceLink:sourceLink,props:props,inherited:inheritMode,isSystemSheet:isSystemSheet})
}}if(element.style){this.getStyleProperties(element,rules,usedProps,inheritMode)
}if(FBTrace.DBG_CSS){FBTrace.sysout("getElementRules "+rules.length+" rules for "+getElementXPath(element),rules)
}},markOverridenProps:function(props,usedProps,inheritMode){for(var i=0;
i<props.length;
++i){var prop=props[i];
if(usedProps.hasOwnProperty(prop.name)){var deadProps=usedProps[prop.name];
for(var j=0;
j<deadProps.length;
++j){var deadProp=deadProps[j];
if(!deadProp.disabled&&!deadProp.wasInherited&&deadProp.important&&!prop.important){prop.overridden=true
}else{if(!prop.disabled){deadProp.overridden=true
}}}}else{usedProps[prop.name]=[]
}prop.wasInherited=inheritMode?true:false;
usedProps[prop.name].push(prop)
}},getStyleProperties:function(element,rules,usedProps,inheritMode){var props=this.parseCSSProps(element.style,inheritMode);
this.addOldProperties(this.context,getElementXPath(element),inheritMode,props);
sortProperties(props);
this.markOverridenProps(props,usedProps,inheritMode);
if(props.length){rules.splice(0,0,{rule:element,id:getElementXPath(element),selector:"element.style",props:props,inherited:inheritMode})
}},name:"css",title:"Style",parentPanel:"HTML",order:0,initialize:function(){this.context=Firebug.chrome;
this.document=Firebug.chrome.document;
Firebug.CSSStyleSheetPanel.prototype.initialize.apply(this,arguments);
var selection=documentCache[FirebugChrome.selectedHTMLElementId];
if(selection){this.select(selection,true)
}},ishow:function(state){},watchWindow:function(win){if(domUtils){var doc=win.document;
addEvent(doc,"mouseover",this.onHoverChange);
addEvent(doc,"mousedown",this.onActiveChange)
}},unwatchWindow:function(win){var doc=win.document;
removeEvent(doc,"mouseover",this.onHoverChange);
removeEvent(doc,"mousedown",this.onActiveChange);
if(isAncestor(this.stateChangeEl,doc)){this.removeStateChangeHandlers()
}},supportsObject:function(object){return object instanceof Element?1:0
},updateView:function(element){this.updateCascadeView(element);
if(domUtils){this.contentState=safeGetContentState(element);
this.addStateChangeHandlers(element)
}},updateSelection:function(element){if(!instanceOf(element,"Element")){return
}if(sothinkInstalled){FirebugReps.Warning.tag.replace({object:"SothinkWarning"},this.panelNode);
return
}if(!element){return
}this.updateView(element)
},updateOption:function(name,value){if(name=="showUserAgentCSS"||name=="expandShorthandProps"){this.refresh()
}},getOptionsMenuItems:function(){var ret=[{label:"Show User Agent CSS",type:"checkbox",checked:Firebug.showUserAgentCSS,command:bindFixed(Firebug.togglePref,Firebug,"showUserAgentCSS")},{label:"Expand Shorthand Properties",type:"checkbox",checked:Firebug.expandShorthandProps,command:bindFixed(Firebug.togglePref,Firebug,"expandShorthandProps")}];
if(domUtils&&this.selection){var state=safeGetContentState(this.selection);
ret.push("-");
ret.push({label:":active",type:"checkbox",checked:state&STATE_ACTIVE,command:bindFixed(this.updateContentState,this,STATE_ACTIVE,state&STATE_ACTIVE)});
ret.push({label:":hover",type:"checkbox",checked:state&STATE_HOVER,command:bindFixed(this.updateContentState,this,STATE_HOVER,state&STATE_HOVER)})
}return ret
},updateContentState:function(state,remove){domUtils.setContentState(remove?this.selection.ownerDocument.documentElement:this.selection,state);
this.refresh()
},addStateChangeHandlers:function(el){this.removeStateChangeHandlers();
addEvent(el,"focus",this.onStateChange);
addEvent(el,"blur",this.onStateChange);
addEvent(el,"mouseup",this.onStateChange);
addEvent(el,"mousedown",this.onStateChange);
addEvent(el,"mouseover",this.onStateChange);
addEvent(el,"mouseout",this.onStateChange);
this.stateChangeEl=el
},removeStateChangeHandlers:function(){var sel=this.stateChangeEl;
if(sel){removeEvent(sel,"focus",this.onStateChange);
removeEvent(sel,"blur",this.onStateChange);
removeEvent(sel,"mouseup",this.onStateChange);
removeEvent(sel,"mousedown",this.onStateChange);
removeEvent(sel,"mouseover",this.onStateChange);
removeEvent(sel,"mouseout",this.onStateChange)
}},contentStateCheck:function(state){if(!state||this.contentState&state){var timeoutRunner=bindFixed(function(){var newState=safeGetContentState(this.selection);
if(newState!=this.contentState){this.context.invalidatePanels(this.name)
}},this);
setTimeout(timeoutRunner,0)
}}});
function safeGetContentState(selection){try{return domUtils.getContentState(selection)
}catch(e){if(FBTrace.DBG_ERRORS){FBTrace.sysout("css.safeGetContentState; EXCEPTION",e)
}}}function CSSComputedElementPanel(){}CSSComputedElementPanel.prototype=extend(CSSElementPanel.prototype,{template:domplate({computedTag:DIV({"class":"a11yCSSView",role:"list","aria-label":$STR("aria.labels.computed styles")},FOR("group","$groups",H1({"class":"cssInheritHeader groupHeader focusRow",role:"listitem"},SPAN({"class":"cssInheritLabel"},"$group.title")),TABLE({width:"100%",role:"group"},TBODY({role:"presentation"},FOR("prop","$group.props",TR({"class":"focusRow computedStyleRow",role:"listitem"},TD({"class":"stylePropName",role:"presentation"},"$prop.name"),TD({"class":"stylePropValue",role:"presentation"},"$prop.value")))))))}),updateComputedView:function(element){var win=isIE?element.ownerDocument.parentWindow:element.ownerDocument.defaultView;
var style=isIE?element.currentStyle:win.getComputedStyle(element,"");
var groups=[];
for(var groupName in styleGroups){var title=styleGroupTitles[groupName];
var group={title:title,props:[]};
groups.push(group);
var props=styleGroups[groupName];
for(var i=0;
i<props.length;
++i){var propName=props[i];
var propValue=style.getPropertyValue?style.getPropertyValue(propName):""+style[toCamelCase(propName)];
if(propValue===undefined||propValue===null){continue
}propValue=stripUnits(rgbToHex(propValue));
if(propValue){group.props.push({name:propName,value:propValue})
}}}var result=this.template.computedTag.replace({groups:groups},this.panelNode)
},name:"computed",title:"Computed",parentPanel:"HTML",order:1,updateView:function(element){this.updateComputedView(element)
},getOptionsMenuItems:function(){return[{label:"Refresh",command:bind(this.refresh,this)}]
}});
function CSSEditor(doc){this.initializeInline(doc)
}CSSEditor.prototype=domplate(Firebug.InlineEditor.prototype,{insertNewRow:function(target,insertWhere){var rule=Firebug.getRepObject(target);
var emptyProp={name:"",value:"",important:""};
if(insertWhere=="before"){return CSSPropTag.tag.insertBefore({prop:emptyProp,rule:rule},target)
}else{return CSSPropTag.tag.insertAfter({prop:emptyProp,rule:rule},target)
}},saveEdit:function(target,value,previousValue){target.innerHTML=escapeForCss(value);
var row=getAncestorByClass(target,"cssProp");
if(hasClass(row,"disabledStyle")){toggleClass(row,"disabledStyle")
}var rule=Firebug.getRepObject(target);
if(hasClass(target,"cssPropName")){if(value&&previousValue!=value){var propValue=getChildByClass(row,"cssPropValue")[textContent];
var parsedValue=parsePriority(propValue);
if(propValue&&propValue!="undefined"){if(FBTrace.DBG_CSS){FBTrace.sysout("CSSEditor.saveEdit : "+previousValue+"->"+value+" = "+propValue+"\n")
}if(previousValue){Firebug.CSSModule.removeProperty(rule,previousValue)
}Firebug.CSSModule.setProperty(rule,value,parsedValue.value,parsedValue.priority)
}}else{if(!value){Firebug.CSSModule.removeProperty(rule,previousValue)
}}}else{if(getAncestorByClass(target,"cssPropValue")){var propName=getChildByClass(row,"cssPropName")[textContent];
var propValue=getChildByClass(row,"cssPropValue")[textContent];
if(FBTrace.DBG_CSS){FBTrace.sysout("CSSEditor.saveEdit propName=propValue: "+propName+" = "+propValue+"\n")
}if(value&&value!="null"){var parsedValue=parsePriority(value);
Firebug.CSSModule.setProperty(rule,propName,parsedValue.value,parsedValue.priority)
}else{if(previousValue&&previousValue!="null"){Firebug.CSSModule.removeProperty(rule,propName)
}}}}this.panel.markChange(this.panel.name=="stylesheet")
},advanceToNext:function(target,charCode){if(charCode==58&&hasClass(target,"cssPropName")){return true
}},getAutoCompleteRange:function(value,offset){if(hasClass(this.target,"cssPropName")){return{start:0,end:value.length-1}
}else{return parseCSSValue(value,offset)
}},getAutoCompleteList:function(preExpr,expr,postExpr){if(hasClass(this.target,"cssPropName")){return getCSSPropertyNames()
}else{var row=getAncestorByClass(this.target,"cssProp");
var propName=getChildByClass(row,"cssPropName")[textContent];
return getCSSKeywordsByProperty(propName)
}}});
function CSSRuleEditor(doc){this.initializeInline(doc);
this.completeAsYouType=false
}CSSRuleEditor.uniquifier=0;
CSSRuleEditor.prototype=domplate(Firebug.InlineEditor.prototype,{insertNewRow:function(target,insertWhere){var emptyRule={selector:"",id:"",props:[],isSelectorEditable:true};
if(insertWhere=="before"){return CSSStyleRuleTag.tag.insertBefore({rule:emptyRule},target)
}else{return CSSStyleRuleTag.tag.insertAfter({rule:emptyRule},target)
}},saveEdit:function(target,value,previousValue){if(FBTrace.DBG_CSS){FBTrace.sysout("CSSRuleEditor.saveEdit: '"+value+"' '"+previousValue+"'",target)
}target.innerHTML=escapeForCss(value);
if(value===previousValue){return
}var row=getAncestorByClass(target,"cssRule");
var styleSheet=this.panel.location;
styleSheet=styleSheet.editStyleSheet?styleSheet.editStyleSheet.sheet:styleSheet;
var cssRules=styleSheet.cssRules;
var rule=Firebug.getRepObject(target),oldRule=rule;
var ruleIndex=cssRules.length;
if(rule||Firebug.getRepObject(row.nextSibling)){var searchRule=rule||Firebug.getRepObject(row.nextSibling);
for(ruleIndex=0;
ruleIndex<cssRules.length&&searchRule!=cssRules[ruleIndex];
ruleIndex++){}}if(oldRule){Firebug.CSSModule.deleteRule(styleSheet,ruleIndex)
}if(value){var cssText=[value,"{",];
var props=row.getElementsByClassName("cssProp");
for(var i=0;
i<props.length;
i++){var propEl=props[i];
if(!hasClass(propEl,"disabledStyle")){cssText.push(getChildByClass(propEl,"cssPropName")[textContent]);
cssText.push(":");
cssText.push(getChildByClass(propEl,"cssPropValue")[textContent]);
cssText.push(";")
}}cssText.push("}");
cssText=cssText.join("");
try{var insertLoc=Firebug.CSSModule.insertRule(styleSheet,cssText,ruleIndex);
rule=cssRules[insertLoc];
ruleIndex++
}catch(err){if(FBTrace.DBG_CSS||FBTrace.DBG_ERRORS){FBTrace.sysout("CSS Insert Error: "+err,err)
}target.innerHTML=escapeForCss(previousValue);
row.repObject=undefined;
return
}}else{rule=undefined
}row.repObject=rule;
if(!oldRule){var ruleId="new/"+value+"/"+(++CSSRuleEditor.uniquifier);
row.setAttribute("ruleId",ruleId)
}this.panel.markChange(this.panel.name=="stylesheet")
}});
function StyleSheetEditor(doc){this.box=this.tag.replace({},doc,this);
this.input=this.box.firstChild
}StyleSheetEditor.prototype=domplate(Firebug.BaseEditor,{multiLine:true,tag:DIV(TEXTAREA({"class":"styleSheetEditor fullPanelEditor",oninput:"$onInput"})),getValue:function(){return this.input.value
},setValue:function(value){return this.input.value=value
},show:function(target,panel,value,textSize,targetSize){this.target=target;
this.panel=panel;
this.panel.panelNode.appendChild(this.box);
this.input.value=value;
this.input.focus();
var command=Firebug.chrome.$("cmd_toggleCSSEditing");
command.setAttribute("checked",true)
},hide:function(){var command=Firebug.chrome.$("cmd_toggleCSSEditing");
command.setAttribute("checked",false);
if(this.box.parentNode==this.panel.panelNode){this.panel.panelNode.removeChild(this.box)
}delete this.target;
delete this.panel;
delete this.styleSheet
},saveEdit:function(target,value,previousValue){Firebug.CSSModule.freeEdit(this.styleSheet,value)
},endEditing:function(){this.panel.refresh();
return true
},onInput:function(){Firebug.Editor.update()
},scrollToLine:function(line,offset){this.startMeasuring(this.input);
var lineHeight=this.measureText().height;
this.stopMeasuring();
this.input.scrollTop=(line*lineHeight)+offset
}});
var rgbToHex=function rgbToHex(value){return value.replace(/\brgb\((\d{1,3}),\s*(\d{1,3}),\s*(\d{1,3})\)/gi,rgbToHexReplacer)
};
var rgbToHexReplacer=function(_,r,g,b){return"#"+((1<<24)+(r<<16)+(g<<8)+(b<<0)).toString(16).substr(-6).toUpperCase()
};
var stripUnits=function stripUnits(value){return value.replace(/(url\(.*?\)|[^0]\S*\s*)|0(%|em|ex|px|in|cm|mm|pt|pc)(\s|$)/gi,stripUnitsReplacer)
};
var stripUnitsReplacer=function(_,skip,remove,whitespace){return skip||("0"+whitespace)
};
function parsePriority(value){var rePriority=/(.*?)\s*(!important)?$/;
var m=rePriority.exec(value);
var propValue=m?m[1]:"";
var priority=m&&m[2]?"important":"";
return{value:propValue,priority:priority}
}function parseURLValue(value){var m=reURL.exec(value);
return m?m[1]:""
}function parseRepeatValue(value){var m=reRepeat.exec(value);
return m?m[0]:""
}function parseCSSValue(value,offset){var start=0;
var m;
while(1){m=reSplitCSS.exec(value);
if(m&&m.index+m[0].length<offset){value=value.substr(m.index+m[0].length);
start+=m.index+m[0].length;
offset-=m.index+m[0].length
}else{break
}}if(m){var type;
if(m[1]){type="url"
}else{if(m[2]||m[3]){type="rgb"
}else{if(m[4]){type="int"
}}}return{value:m[0],start:start+m.index,end:start+m.index+(m[0].length-1),type:type}
}}function findPropByName(props,name){for(var i=0;
i<props.length;
++i){if(props[i].name==name){return i
}}}function sortProperties(props){props.sort(function(a,b){return a.name>b.name?1:-1
})
}function getTopmostRuleLine(panelNode){for(var child=panelNode.firstChild;
child;
child=child.nextSibling){if(child.offsetTop+child.offsetHeight>panelNode.scrollTop){var rule=child.repObject;
if(rule){return{line:domUtils.getRuleLine(rule),offset:panelNode.scrollTop-child.offsetTop}
}}}return 0
}function getStyleSheetCSS(sheet,context){if(sheet.ownerNode instanceof HTMLStyleElement){return sheet.ownerNode.innerHTML
}else{return context.sourceCache.load(sheet.href).join("")
}}function getStyleSheetOwnerNode(sheet){for(;
sheet&&!sheet.ownerNode;
sheet=sheet.parentStyleSheet){}return sheet.ownerNode
}function scrollSelectionIntoView(panel){var selCon=getSelectionController(panel);
selCon.scrollSelectionIntoView(nsISelectionController.SELECTION_NORMAL,nsISelectionController.SELECTION_FOCUS_REGION,true)
}function getSelectionController(panel){var browser=Firebug.chrome.getPanelBrowser(panel);
return browser.docShell.QueryInterface(nsIInterfaceRequestor).getInterface(nsISelectionDisplay).QueryInterface(nsISelectionController)
}Firebug.registerModule(Firebug.CSSModule);
Firebug.registerPanel(Firebug.CSSStyleSheetPanel);
Firebug.registerPanel(CSSElementPanel);
Firebug.registerPanel(CSSComputedElementPanel)
}});
FBL.ns(function(){with(FBL){Firebug.Script=extend(Firebug.Module,{getPanel:function(){return Firebug.chrome?Firebug.chrome.getPanel("Script"):null
},selectSourceCode:function(index){this.getPanel().selectSourceCode(index)
}});
Firebug.registerModule(Firebug.Script);
function ScriptPanel(){}ScriptPanel.prototype=extend(Firebug.Panel,{name:"Script",title:"Script",selectIndex:0,sourceIndex:-1,options:{hasToolButtons:true},create:function(){Firebug.Panel.create.apply(this,arguments);
this.onChangeSelect=bind(this.onChangeSelect,this);
var doc=Firebug.browser.document;
var scripts=doc.getElementsByTagName("script");
var selectNode=this.selectNode=createElement("select");
for(var i=0,script;
script=scripts[i];
i++){if(Firebug.ignoreFirebugElements&&script.getAttribute("firebugIgnore")){continue
}var fileName=getFileName(script.src)||getFileName(doc.location.href);
var option=createElement("option",{value:i});
option.appendChild(Firebug.chrome.document.createTextNode(fileName));
selectNode.appendChild(option)
}this.toolButtonsNode.appendChild(selectNode)
},initialize:function(){this.selectSourceCode(this.selectIndex);
Firebug.Panel.initialize.apply(this,arguments);
addEvent(this.selectNode,"change",this.onChangeSelect)
},shutdown:function(){removeEvent(this.selectNode,"change",this.onChangeSelect);
Firebug.Panel.shutdown.apply(this,arguments)
},detach:function(oldChrome,newChrome){Firebug.Panel.detach.apply(this,arguments);
var oldPanel=oldChrome.getPanel("Script");
var index=oldPanel.selectIndex;
this.selectNode.selectedIndex=index;
this.selectIndex=index;
this.sourceIndex=-1
},onChangeSelect:function(event){var select=this.selectNode;
this.selectIndex=select.selectedIndex;
var option=select.options[select.selectedIndex];
if(!option){return
}var selectedSourceIndex=parseInt(option.value);
this.renderSourceCode(selectedSourceIndex)
},selectSourceCode:function(index){var select=this.selectNode;
select.selectedIndex=index;
var option=select.options[index];
if(!option){return
}var selectedSourceIndex=parseInt(option.value);
this.renderSourceCode(selectedSourceIndex)
},renderSourceCode:function(index){if(this.sourceIndex!=index){var renderProcess=function renderProcess(src){var html=[],hl=0;
src=isIE&&!isExternal?src+"\n":"\n"+src;
src=src.replace(/\n\r|\r\n/g,"\n");
var match=src.match(/[\n]/g);
var lines=match?match.length:0;
html[hl++]='<div><div class="sourceBox" style="left:';
html[hl++]=35+7*(lines+"").length;
html[hl++]='px;"><pre class="sourceCode">';
html[hl++]=escapeHTML(src);
html[hl++]='</pre></div><div class="lineNo">';
for(var l=1,lines;
l<=lines;
l++){html[hl++]='<div line="';
html[hl++]=l;
html[hl++]='">';
html[hl++]=l;
html[hl++]="</div>"
}html[hl++]="</div></div>";
updatePanel(html)
};
var updatePanel=function(html){self.panelNode.innerHTML=html.join("");
setTimeout(function(){self.synchronizeUI()
},0)
};
var onFailure=function(){FirebugReps.Warning.tag.replace({object:"AccessRestricted"},self.panelNode)
};
var self=this;
var doc=Firebug.browser.document;
var script=doc.getElementsByTagName("script")[index];
var url=getScriptURL(script);
var isExternal=url&&url!=doc.location.href;
try{if(isExternal){Ajax.request({url:url,onSuccess:renderProcess,onFailure:onFailure})
}else{var src=script.innerHTML;
renderProcess(src)
}}catch(e){onFailure()
}this.sourceIndex=index
}}});
Firebug.registerPanel(ScriptPanel);
var getScriptURL=function getScriptURL(script){var reFile=/([^\/\?#]+)(#.+)?$/;
var rePath=/^(.*\/)/;
var reProtocol=/^\w+:\/\//;
var path=null;
var doc=Firebug.browser.document;
var file=reFile.exec(script.src);
if(file){var fileName=file[1];
var fileOptions=file[2];
if(reProtocol.test(script.src)){path=rePath.exec(script.src)[1]
}else{var r=rePath.exec(script.src);
var src=r?r[1]:script.src;
var backDir=/^((?:\.\.\/)+)(.*)/.exec(src);
var reLastDir=/^(.*\/)[^\/]+\/$/;
path=rePath.exec(doc.location.href)[1];
if(backDir){var j=backDir[1].length/3;
var p;
while(j-->0){path=reLastDir.exec(path)[1]
}path+=backDir[2]
}else{if(src.indexOf("/")!=-1){if(/^\.\/./.test(src)){path+=src.substring(2)
}else{if(/^\/./.test(src)){var domain=/^(\w+:\/\/[^\/]+)/.exec(path);
path=domain[1]+src
}else{path+=src
}}}}}}var m=path&&path.match(/([^\/]+)\/$/)||null;
if(path&&m){return path+fileName
}};
var getFileName=function getFileName(path){if(!path){return""
}var match=path&&path.match(/[^\/]+(\?.*)?(#.*)?$/);
return match&&match[0]||path
}
}});
FBL.ns(function(){with(FBL){var insertSliceSize=18;
var insertInterval=40;
var ignoreVars={__firebug__:1,"eval":1,java:1,sun:1,Packages:1,JavaArray:1,JavaMember:1,JavaObject:1,JavaClass:1,JavaPackage:1,_firebug:1,_FirebugConsole:1,_FirebugCommandLine:1};
if(Firebug.ignoreFirebugElements){ignoreVars[cacheID]=1
}var memberPanelRep=isIE6?{"class":"memberLabel $member.type\\Label",href:"javacript:void(0)"}:{"class":"memberLabel $member.type\\Label"};
var RowTag=TR({"class":"memberRow $member.open $member.type\\Row",$hasChildren:"$member.hasChildren",role:"presentation",level:"$member.level"},TD({"class":"memberLabelCell",style:"padding-left: $member.indent\\px",role:"presentation"},A(memberPanelRep,SPAN({},"$member.name"))),TD({"class":"memberValueCell",role:"presentation"},TAG("$member.tag",{object:"$member.value"})));
var oSTR={NoMembersWarning:"There are no properties to show for this object.",EmptyStyleSheet:"There are no rules in this stylesheet.",EmptyElementCSS:"This element has no style rules.",AccessRestricted:"Access to restricted URI denied."};
FBL.$STR=function(name){return oSTR.hasOwnProperty(name)?oSTR[name]:name
};
var WatchRowTag=TR({"class":"watchNewRow",level:0},TD({"class":"watchEditCell",colspan:2},DIV({"class":"watchEditBox a11yFocusNoTab",role:"button",tabindex:"0","aria-label":$STR("press enter to add new watch expression")},$STR("NewWatch"))));
var SizerRow=TR({role:"presentation"},TD({width:"30%"}),TD({width:"70%"}));
var domTableClass=isIElt8?"domTable domTableIE":"domTable";
var DirTablePlate=domplate(Firebug.Rep,{tag:TABLE({"class":domTableClass,cellpadding:0,cellspacing:0,onclick:"$onClick",role:"tree"},TBODY({role:"presentation"},SizerRow,FOR("member","$object|memberIterator",RowTag))),watchTag:TABLE({"class":domTableClass,cellpadding:0,cellspacing:0,_toggles:"$toggles",_domPanel:"$domPanel",onclick:"$onClick",role:"tree"},TBODY({role:"presentation"},SizerRow,WatchRowTag)),tableTag:TABLE({"class":domTableClass,cellpadding:0,cellspacing:0,_toggles:"$toggles",_domPanel:"$domPanel",onclick:"$onClick",role:"tree"},TBODY({role:"presentation"},SizerRow)),rowTag:FOR("member","$members",RowTag),memberIterator:function(object,level){return getMembers(object,level)
},onClick:function(event){if(!isLeftClick(event)){return
}var target=event.target||event.srcElement;
var row=getAncestorByClass(target,"memberRow");
var label=getAncestorByClass(target,"memberLabel");
if(label&&hasClass(row,"hasChildren")){var row=label.parentNode.parentNode;
this.toggleRow(row)
}else{var object=Firebug.getRepObject(target);
if(typeof(object)=="function"){Firebug.chrome.select(object,"script");
cancelEvent(event)
}else{if(event.detail==2&&!object){var panel=row.parentNode.parentNode.domPanel;
if(panel){var rowValue=panel.getRowPropertyValue(row);
if(typeof(rowValue)=="boolean"){panel.setPropertyValue(row,!rowValue)
}else{panel.editProperty(row)
}cancelEvent(event)
}}}}return false
},toggleRow:function(row){var level=parseInt(row.getAttribute("level"));
var toggles=row.parentNode.parentNode.toggles;
if(hasClass(row,"opened")){removeClass(row,"opened");
if(toggles){var path=getPath(row);
for(var i=0;
i<path.length;
++i){if(i==path.length-1){delete toggles[path[i]]
}else{toggles=toggles[path[i]]
}}}var rowTag=this.rowTag;
var tbody=row.parentNode;
setTimeout(function(){for(var firstRow=row.nextSibling;
firstRow;
firstRow=row.nextSibling){if(parseInt(firstRow.getAttribute("level"))<=level){break
}tbody.removeChild(firstRow)
}},row.insertTimeout?row.insertTimeout:0)
}else{setClass(row,"opened");
if(toggles){var path=getPath(row);
for(var i=0;
i<path.length;
++i){var name=path[i];
if(toggles.hasOwnProperty(name)){toggles=toggles[name]
}else{toggles=toggles[name]={}
}}}var value=row.lastChild.firstChild.repObject;
var members=getMembers(value,level+1);
var rowTag=this.rowTag;
var lastRow=row;
var delay=0;
while(members.length){with({slice:members.splice(0,insertSliceSize),isLast:!members.length}){setTimeout(function(){if(lastRow.parentNode){var result=rowTag.insertRows({members:slice},lastRow);
lastRow=result[1]
}if(isLast){row.removeAttribute("insertTimeout")
}},delay)
}delay+=insertInterval
}row.insertTimeout=delay
}}});
Firebug.DOMBasePanel=function(){};
Firebug.DOMBasePanel.prototype=extend(Firebug.Panel,{tag:DirTablePlate.tableTag,getRealObject:function(object){if(!object){return object
}if(object.wrappedJSObject){return object.wrappedJSObject
}return object
},rebuild:function(update,scrollTop){var members=getMembers(this.selection);
expandMembers(members,this.toggles,0,0);
this.showMembers(members,update,scrollTop);
if(!this.parentPanel){updateStatusBar(this)
}},showMembers:function(members,update,scrollTop){if(this.timeouts){for(var i=0;
i<this.timeouts.length;
++i){this.context.clearTimeout(this.timeouts[i])
}delete this.timeouts
}if(!members.length){return this.showEmptyMembers()
}var panelNode=this.panelNode;
var priorScrollTop=scrollTop==undefined?panelNode.scrollTop:scrollTop;
var offscreen=update&&panelNode.firstChild;
var dest=offscreen?panelNode.ownerDocument:panelNode;
var table=this.tag.replace({domPanel:this,toggles:this.toggles},dest);
var tbody=table.lastChild;
var rowTag=DirTablePlate.rowTag;
var panel=this;
var result;
var timeouts=[];
var delay=0;
var renderStart=new Date().getTime();
while(members.length){with({slice:members.splice(0,insertSliceSize),isLast:!members.length}){timeouts.push(this.context.setTimeout(function(){if(!tbody.lastChild){return
}result=rowTag.insertRows({members:slice},tbody.lastChild);
if((panelNode.scrollHeight+panelNode.offsetHeight)>=priorScrollTop){panelNode.scrollTop=priorScrollTop
}},delay));
delay+=insertInterval
}}if(offscreen){timeouts.push(this.context.setTimeout(function(){if(panelNode.firstChild){panelNode.replaceChild(table,panelNode.firstChild)
}else{panelNode.appendChild(table)
}panelNode.scrollTop=priorScrollTop
},delay))
}else{timeouts.push(this.context.setTimeout(function(){panelNode.scrollTop=scrollTop==undefined?0:scrollTop
},delay))
}this.timeouts=timeouts
},showEmptyMembers:function(){FirebugReps.Warning.tag.replace({object:"NoMembersWarning"},this.panelNode)
},findPathObject:function(object){var pathIndex=-1;
for(var i=0;
i<this.objectPath.length;
++i){if(this.getPathObject(i)===object){return i
}}return -1
},getPathObject:function(index){var object=this.objectPath[index];
if(object instanceof Property){return object.getObject()
}else{return object
}},getRowObject:function(row){var object=getRowOwnerObject(row);
return object?object:this.selection
},getRowPropertyValue:function(row){var object=this.getRowObject(row);
object=this.getRealObject(object);
if(object){var propName=getRowName(row);
if(object instanceof jsdIStackFrame){return Firebug.Debugger.evaluate(propName,this.context)
}else{return object[propName]
}}},onMouseMove:function(event){var target=event.srcElement||event.target;
var object=getAncestorByClass(target,"objectLink-element");
object=object?object.repObject:null;
if(object&&instanceOf(object,"Element")&&object.nodeType==1){if(object!=lastHighlightedObject){Firebug.Inspector.drawBoxModel(object);
object=lastHighlightedObject
}}else{Firebug.Inspector.hideBoxModel()
}},create:function(){this.context=Firebug.browser;
this.objectPath=[];
this.propertyPath=[];
this.viewPath=[];
this.pathIndex=-1;
this.toggles={};
Firebug.Panel.create.apply(this,arguments);
this.panelNode.style.padding="0 1px"
},initialize:function(){Firebug.Panel.initialize.apply(this,arguments);
addEvent(this.panelNode,"mousemove",this.onMouseMove)
},shutdown:function(){removeEvent(this.panelNode,"mousemove",this.onMouseMove);
Firebug.Panel.shutdown.apply(this,arguments)
},ishow:function(state){if(this.context.loaded&&!this.selection){if(!state){this.select(null);
return
}if(state.viewPath){this.viewPath=state.viewPath
}if(state.propertyPath){this.propertyPath=state.propertyPath
}var selectObject=defaultObject=this.getDefaultSelection(this.context);
if(state.firstSelection){var restored=state.firstSelection(this.context);
if(restored){selectObject=restored;
this.objectPath=[defaultObject,restored]
}else{this.objectPath=[defaultObject]
}}else{this.objectPath=[defaultObject]
}if(this.propertyPath.length>1){for(var i=1;
i<this.propertyPath.length;
++i){var name=this.propertyPath[i];
if(!name){continue
}var object=selectObject;
try{selectObject=object[name]
}catch(exc){selectObject=null
}if(selectObject){this.objectPath.push(new Property(object,name))
}else{this.viewPath.splice(i);
this.propertyPath.splice(i);
this.objectPath.splice(i);
selectObject=this.getPathObject(this.objectPath.length-1);
break
}}}var selection=state.pathIndex<=this.objectPath.length-1?this.getPathObject(state.pathIndex):this.getPathObject(this.objectPath.length-1);
this.select(selection)
}},supportsObject:function(object){if(object==null){return 1000
}if(typeof(object)=="undefined"){return 1000
}else{if(object instanceof SourceLink){return 0
}else{return 1
}}},refresh:function(){this.rebuild(true)
},updateSelection:function(object){var previousIndex=this.pathIndex;
var previousView=previousIndex==-1?null:this.viewPath[previousIndex];
var newPath=this.pathToAppend;
delete this.pathToAppend;
var pathIndex=this.findPathObject(object);
if(newPath||pathIndex==-1){this.toggles={};
if(newPath){if(previousView){if(this.panelNode.scrollTop){previousView.scrollTop=this.panelNode.scrollTop
}var start=previousIndex+1,length=this.objectPath.length-start;
this.objectPath.splice(start,length);
this.propertyPath.splice(start,length);
this.viewPath.splice(start,length)
}var value=this.getPathObject(previousIndex);
if(!value){if(FBTrace.DBG_ERRORS){FBTrace.sysout("dom.updateSelection no pathObject for "+previousIndex+"\n")
}return
}for(var i=0,length=newPath.length;
i<length;
++i){var name=newPath[i];
var object=value;
try{value=value[name]
}catch(exc){if(FBTrace.DBG_ERRORS){FBTrace.sysout("dom.updateSelection FAILS at path_i="+i+" for name:"+name+"\n")
}return
}++this.pathIndex;
this.objectPath.push(new Property(object,name));
this.propertyPath.push(name);
this.viewPath.push({toggles:this.toggles,scrollTop:0})
}}else{this.toggles={};
var win=Firebug.browser.window;
if(object===win){this.pathIndex=0;
this.objectPath=[win];
this.propertyPath=[null];
this.viewPath=[{toggles:this.toggles,scrollTop:0}]
}else{this.pathIndex=1;
this.objectPath=[win,object];
this.propertyPath=[null,null];
this.viewPath=[{toggles:{},scrollTop:0},{toggles:this.toggles,scrollTop:0}]
}}this.panelNode.scrollTop=0;
this.rebuild()
}else{this.pathIndex=pathIndex;
var view=this.viewPath[pathIndex];
this.toggles=view.toggles;
if(previousView&&this.panelNode.scrollTop){previousView.scrollTop=this.panelNode.scrollTop
}this.rebuild(false,view.scrollTop)
}},getObjectPath:function(object){return this.objectPath
},getDefaultSelection:function(){return Firebug.browser.window
}});
var updateStatusBar=function(panel){var path=panel.propertyPath;
var index=panel.pathIndex;
var r=[];
for(var i=0,l=path.length;
i<l;
i++){r.push(i==index?'<a class="fbHover fbButton fbBtnSelected" ':'<a class="fbHover fbButton" ');
r.push("pathIndex=");
r.push(i);
if(isIE6){r.push(' href="javascript:void(0)"')
}r.push(">");
r.push(i==0?"window":path[i]||"Object");
r.push("</a>");
if(i<l-1){r.push('<span class="fbStatusSeparator">></span>')
}}panel.statusBarNode.innerHTML=r.join("")
};
var DOMMainPanel=Firebug.DOMPanel=function(){};
Firebug.DOMPanel.DirTable=DirTablePlate;
DOMMainPanel.prototype=extend(Firebug.DOMBasePanel.prototype,{onClickStatusBar:function(event){var target=event.srcElement||event.target;
var element=getAncestorByClass(target,"fbHover");
if(element){var pathIndex=element.getAttribute("pathIndex");
if(pathIndex){this.select(this.getPathObject(pathIndex))
}}},selectRow:function(row,target){if(!target){target=row.lastChild.firstChild
}if(!target||!target.repObject){return
}this.pathToAppend=getPath(row);
var valueBox=row.lastChild.firstChild;
if(hasClass(valueBox,"objectBox-array")){var arrayIndex=FirebugReps.Arr.getItemIndex(target);
this.pathToAppend.push(arrayIndex)
}this.select(target.repObject,true)
},onClick:function(event){var target=event.srcElement||event.target;
var repNode=Firebug.getRepNode(target);
if(repNode){var row=getAncestorByClass(target,"memberRow");
if(row){this.selectRow(row,repNode);
cancelEvent(event)
}}},name:"DOM",title:"DOM",searchable:true,statusSeparator:">",options:{hasToolButtons:true,hasStatusBar:true},create:function(){Firebug.DOMBasePanel.prototype.create.apply(this,arguments);
this.onClick=bind(this.onClick,this);
this.onClickStatusBar=bind(this.onClickStatusBar,this);
this.panelNode.style.padding="0 1px"
},initialize:function(oldPanelNode){Firebug.DOMBasePanel.prototype.initialize.apply(this,arguments);
addEvent(this.panelNode,"click",this.onClick);
this.ishow();
addEvent(this.statusBarNode,"click",this.onClickStatusBar)
},shutdown:function(){removeEvent(this.panelNode,"click",this.onClick);
Firebug.DOMBasePanel.prototype.shutdown.apply(this,arguments)
}});
Firebug.registerPanel(DOMMainPanel);
var getMembers=function getMembers(object,level){if(!level){level=0
}var ordinals=[],userProps=[],userClasses=[],userFuncs=[],domProps=[],domFuncs=[],domConstants=[];
try{var domMembers=getDOMMembers(object);
if(object.wrappedJSObject){var insecureObject=object.wrappedJSObject
}else{var insecureObject=object
}if(isIE&&isFunction(object)){addMember("user",userProps,"prototype",object.prototype,level)
}for(var name in insecureObject){if(ignoreVars[name]==1){continue
}var val;
try{val=insecureObject[name]
}catch(exc){if(FBTrace.DBG_ERRORS&&FBTrace.DBG_DOM){FBTrace.sysout("dom.getMembers cannot access "+name,exc)
}}var ordinal=parseInt(name);
if(ordinal||ordinal==0){addMember("ordinal",ordinals,name,val,level)
}else{if(isFunction(val)){if(isClassFunction(val)){addMember("userClass",userClasses,name,val,level)
}else{if(name in domMembers){addMember("domFunction",domFuncs,name,val,level,domMembers[name])
}else{addMember("userFunction",userFuncs,name,val,level)
}}}else{var prefix="";
if(name in domMembers){addMember("dom",domProps,(prefix+name),val,level,domMembers[name])
}else{if(name in domConstantMap){addMember("dom",domConstants,(prefix+name),val,level)
}else{addMember("user",userProps,(prefix+name),val,level)
}}}}}}catch(exc){throw exc;
if(FBTrace.DBG_ERRORS&&FBTrace.DBG_DOM){FBTrace.sysout("dom.getMembers FAILS: ",exc)
}}function sortName(a,b){return a.name>b.name?1:-1
}function sortOrder(a,b){return a.order>b.order?1:-1
}var members=[];
members.push.apply(members,ordinals);
Firebug.showUserProps=true;
Firebug.showUserFuncs=true;
Firebug.showDOMProps=true;
Firebug.showDOMFuncs=true;
Firebug.showDOMConstants=true;
if(Firebug.showUserProps){userProps.sort(sortName);
members.push.apply(members,userProps)
}if(Firebug.showUserFuncs){userClasses.sort(sortName);
members.push.apply(members,userClasses);
userFuncs.sort(sortName);
members.push.apply(members,userFuncs)
}if(Firebug.showDOMProps){domProps.sort(sortName);
members.push.apply(members,domProps)
}if(Firebug.showDOMFuncs){domFuncs.sort(sortName);
members.push.apply(members,domFuncs)
}if(Firebug.showDOMConstants){members.push.apply(members,domConstants)
}return members
};
function expandMembers(members,toggles,offset,level){var expanded=0;
for(var i=offset;
i<members.length;
++i){var member=members[i];
if(member.level>level){break
}if(toggles.hasOwnProperty(member.name)){member.open="opened";
var newMembers=getMembers(member.value,level+1);
var args=[i+1,0];
args.push.apply(args,newMembers);
members.splice.apply(members,args);
expanded+=newMembers.length;
i+=newMembers.length+expandMembers(members,toggles[member.name],i+1,level+1)
}}return expanded
}function isClassFunction(fn){try{for(var name in fn.prototype){return true
}}catch(exc){}return false
}var hasProperties=function hasProperties(ob){try{for(var name in ob){return true
}}catch(exc){}if(isFunction(ob)){return true
}return false
};
FBL.ErrorCopy=function(message){this.message=message
};
var addMember=function addMember(type,props,name,value,level,order){var rep=Firebug.getRep(value);
var tag=rep.shortTag?rep.shortTag:rep.tag;
var ErrorCopy=function(){};
var valueType=typeof(value);
var hasChildren=hasProperties(value)&&!(value instanceof ErrorCopy)&&(isFunction(value)||(valueType=="object"&&value!=null)||(valueType=="string"&&value.length>Firebug.stringCropLength));
props.push({name:name,value:value,type:type,rowClass:"memberRow-"+type,open:"",order:order,level:level,indent:level*16,hasChildren:hasChildren,tag:tag})
};
var getWatchRowIndex=function getWatchRowIndex(row){var index=-1;
for(;
row&&hasClass(row,"watchRow");
row=row.previousSibling){++index
}return index
};
var getRowName=function getRowName(row){var node=row.firstChild;
return node.textContent?node.textContent:node.innerText
};
var getRowValue=function getRowValue(row){return row.lastChild.firstChild.repObject
};
var getRowOwnerObject=function getRowOwnerObject(row){var parentRow=getParentRow(row);
if(parentRow){return getRowValue(parentRow)
}};
var getParentRow=function getParentRow(row){var level=parseInt(row.getAttribute("level"))-1;
for(row=row.previousSibling;
row;
row=row.previousSibling){if(parseInt(row.getAttribute("level"))==level){return row
}}};
var getPath=function getPath(row){var name=getRowName(row);
var path=[name];
var level=parseInt(row.getAttribute("level"))-1;
for(row=row.previousSibling;
row;
row=row.previousSibling){if(parseInt(row.getAttribute("level"))==level){var name=getRowName(row);
path.splice(0,0,name);
--level
}}return path
};
Firebug.DOM=extend(Firebug.Module,{getPanel:function(){return Firebug.chrome?Firebug.chrome.getPanel("DOM"):null
}});
Firebug.registerModule(Firebug.DOM);
var lastHighlightedObject;
function DOMSidePanel(){}DOMSidePanel.prototype=extend(Firebug.DOMBasePanel.prototype,{selectRow:function(row,target){if(!target){target=row.lastChild.firstChild
}if(!target||!target.repObject){return
}this.pathToAppend=getPath(row);
var valueBox=row.lastChild.firstChild;
if(hasClass(valueBox,"objectBox-array")){var arrayIndex=FirebugReps.Arr.getItemIndex(target);
this.pathToAppend.push(arrayIndex)
}var object=target.repObject;
if(instanceOf(object,"Element")&&object[cacheID]){Firebug.HTML.selectTreeNode(object[cacheID])
}else{Firebug.chrome.selectPanel("DOM");
Firebug.chrome.getPanel("DOM").select(object,true)
}},onClick:function(event){var target=event.srcElement||event.target;
var repNode=Firebug.getRepNode(target);
if(repNode){var row=getAncestorByClass(target,"memberRow");
if(row){this.selectRow(row,repNode);
cancelEvent(event)
}}},name:"DOMSidePanel",parentPanel:"HTML",title:"DOM",options:{hasToolButtons:true},isInitialized:false,create:function(){Firebug.DOMBasePanel.prototype.create.apply(this,arguments);
this.onClick=bind(this.onClick,this)
},initialize:function(){Firebug.DOMBasePanel.prototype.initialize.apply(this,arguments);
addEvent(this.panelNode,"click",this.onClick);
var selection=documentCache[FirebugChrome.selectedHTMLElementId];
if(selection){this.select(selection,true)
}},shutdown:function(){removeEvent(this.panelNode,"click",this.onClick);
Firebug.DOMBasePanel.prototype.shutdown.apply(this,arguments)
},reattach:function(oldChrome){this.toggles=oldChrome.getPanel("DOMSidePanel").toggles
}});
Firebug.registerPanel(DOMSidePanel)
}});
FBL.FBTrace={};
(function(){var traceOptions={DBG_TIMESTAMP:1,DBG_INITIALIZE:1,DBG_CHROME:1,DBG_ERRORS:1,DBG_DISPATCH:1,DBG_CSS:1};
this.module=null;
this.initialize=function(){if(!this.messageQueue){this.messageQueue=[]
}for(var name in traceOptions){this[name]=traceOptions[name]
}};
this.sysout=function(){return this.logFormatted(arguments,"")
};
this.dumpProperties=function(title,object){return this.logFormatted("dumpProperties() not supported.","warning")
};
this.dumpStack=function(){return this.logFormatted("dumpStack() not supported.","warning")
};
this.flush=function(module){this.module=module;
var queue=this.messageQueue;
this.messageQueue=[];
for(var i=0;
i<queue.length;
++i){this.writeMessage(queue[i][0],queue[i][1],queue[i][2])
}};
this.getPanel=function(){return this.module?this.module.getPanel():null
};
this.logFormatted=function(objects,className){var html=this.DBG_TIMESTAMP?[getTimestamp()," | "]:[];
var length=objects.length;
for(var i=0;
i<length;
++i){appendText(" ",html);
var object=objects[i];
if(i==0){html.push("<b>");
appendText(object,html);
html.push("</b>")
}else{appendText(object,html)
}}return this.logRow(html,className)
};
this.logRow=function(message,className){var panel=this.getPanel();
if(panel&&panel.contentNode){this.writeMessage(message,className)
}else{this.messageQueue.push([message,className])
}return this.LOG_COMMAND
};
this.writeMessage=function(message,className){var container=this.getPanel().containerNode;
var isScrolledToBottom=container.scrollTop+container.offsetHeight>=container.scrollHeight;
this.writeRow.call(this,message,className);
if(isScrolledToBottom){container.scrollTop=container.scrollHeight-container.offsetHeight
}};
this.appendRow=function(row){var container=this.getPanel().contentNode;
container.appendChild(row)
};
this.writeRow=function(message,className){var row=this.getPanel().contentNode.ownerDocument.createElement("div");
row.className="logRow"+(className?" logRow-"+className:"");
row.innerHTML=message.join("");
this.appendRow(row)
};
function appendText(object,html){html.push(escapeHTML(objectToString(object)))
}function getTimestamp(){var now=new Date();
var ms=""+(now.getMilliseconds()/1000).toFixed(3);
ms=ms.substr(2);
return now.toLocaleTimeString()+"."+ms
}var HTMLtoEntity={"<":"<",">":">","&":"&","'":"'",'"':"""};
function replaceChars(ch){return HTMLtoEntity[ch]
}function escapeHTML(value){return(value+"").replace(/[<>&"']/g,replaceChars)
}function objectToString(object){try{return object+""
}catch(exc){return null
}}}).apply(FBL.FBTrace);
FBL.ns(function(){with(FBL){if(!Env.Options.enableTrace){return
}Firebug.Trace=extend(Firebug.Module,{getPanel:function(){return Firebug.chrome?Firebug.chrome.getPanel("Trace"):null
},clear:function(){this.getPanel().contentNode.innerHTML=""
}});
Firebug.registerModule(Firebug.Trace);
function TracePanel(){}TracePanel.prototype=extend(Firebug.Panel,{name:"Trace",title:"Trace",options:{hasToolButtons:true,innerHTMLSync:true},create:function(){Firebug.Panel.create.apply(this,arguments);
this.clearButton=new Button({caption:"Clear",title:"Clear FBTrace logs",owner:Firebug.Trace,onClick:Firebug.Trace.clear})
},initialize:function(){Firebug.Panel.initialize.apply(this,arguments);
this.clearButton.initialize()
}});
Firebug.registerPanel(TracePanel)
}});
FBL.ns(function(){with(FBL){var modules=[];
var panelTypes=[];
var panelTypeMap={};
var parentPanelMap={};
var registerModule=Firebug.registerModule;
var registerPanel=Firebug.registerPanel;
append(Firebug,{extend:function(fn){if(Firebug.chrome&&Firebug.chrome.addPanel){var namespace=ns(fn);
fn.call(namespace,FBL)
}else{setTimeout(function(){Firebug.extend(fn)
},100)
}},registerModule:function(){registerModule.apply(Firebug,arguments);
modules.push.apply(modules,arguments);
dispatch(modules,"initialize",[]);
if(FBTrace.DBG_INITIALIZE){FBTrace.sysout("Firebug.registerModule")
}},registerPanel:function(){registerPanel.apply(Firebug,arguments);
panelTypes.push.apply(panelTypes,arguments);
for(var i=0,panelType;
panelType=arguments[i];
++i){if(panelType.prototype.name=="Dev"){continue
}panelTypeMap[panelType.prototype.name]=arguments[i];
var parentPanelName=panelType.prototype.parentPanel;
if(parentPanelName){parentPanelMap[parentPanelName]=1
}else{var panelName=panelType.prototype.name;
var chrome=Firebug.chrome;
chrome.addPanel(panelName);
var onTabClick=function onTabClick(){chrome.selectPanel(panelName);
return false
};
chrome.addController([chrome.panelMap[panelName].tabNode,"mousedown",onTabClick])
}}if(FBTrace.DBG_INITIALIZE){for(var i=0;
i<arguments.length;
++i){FBTrace.sysout("Firebug.registerPanel",arguments[i].prototype.name)
}}}})
}});
FBL.ns(function(){with(FBL){FirebugChrome.Skin={CSS:'.collapsed{display:none;}[collapsed="true"]{display:none;}#fbCSS{padding:0 !important;}.cssPropDisable{float:left;display:block;width:2em;cursor:default;}.infoTip{z-index:2147483647;position:fixed;padding:2px 3px;border:1px solid #CBE087;background:LightYellow;font-family:Monaco,monospace;color:#000000;display:none;white-space:nowrap;pointer-events:none;}.infoTip[active="true"]{display:block;}.infoTipLoading{width:16px;height:16px;background:url(https://getfirebug.com/releases/lite/latest/skin/xp/chrome://firebug/skin/loading_16.gif) no-repeat;}.infoTipImageBox{min-width:100px;text-align:center;}.infoTipCaption{font:message-box;}.infoTipLoading > .infoTipImage,.infoTipLoading > .infoTipCaption{display:none;}h1.groupHeader{padding:2px 4px;margin:0 0 4px 0;border-top:1px solid #CCCCCC;border-bottom:1px solid #CCCCCC;background:#eee url(https://getfirebug.com/releases/lite/latest/skin/xp/group.gif) repeat-x;font-size:11px;font-weight:bold;_position:relative;}.inlineEditor,.fixedWidthEditor{z-index:2147483647;position:absolute;display:none;}.inlineEditor{margin-left:-6px;margin-top:-3px;}.textEditorInner,.fixedWidthEditor{margin:0 0 0 0 !important;padding:0;border:none !important;font:inherit;text-decoration:inherit;background-color:#FFFFFF;}.fixedWidthEditor{border-top:1px solid #888888 !important;border-bottom:1px solid #888888 !important;}.textEditorInner{position:relative;top:-7px;left:-5px;outline:none;resize:none;}.textEditorInner1{padding-left:11px;background:url(https://getfirebug.com/releases/lite/latest/skin/xp/textEditorBorders.png) repeat-y;_background:url(https://getfirebug.com/releases/lite/latest/skin/xp/textEditorBorders.gif) repeat-y;_overflow:hidden;}.textEditorInner2{position:relative;padding-right:2px;background:url(https://getfirebug.com/releases/lite/latest/skin/xp/textEditorBorders.png) repeat-y 100% 0;_background:url(https://getfirebug.com/releases/lite/latest/skin/xp/textEditorBorders.gif) repeat-y 100% 0;_position:fixed;}.textEditorTop1{background:url(https://getfirebug.com/releases/lite/latest/skin/xp/textEditorCorners.png) no-repeat 100% 0;margin-left:11px;height:10px;_background:url(https://getfirebug.com/releases/lite/latest/skin/xp/textEditorCorners.gif) no-repeat 100% 0;_overflow:hidden;}.textEditorTop2{position:relative;left:-11px;width:11px;height:10px;background:url(https://getfirebug.com/releases/lite/latest/skin/xp/textEditorCorners.png) no-repeat;_background:url(https://getfirebug.com/releases/lite/latest/skin/xp/textEditorCorners.gif) no-repeat;}.textEditorBottom1{position:relative;background:url(https://getfirebug.com/releases/lite/latest/skin/xp/textEditorCorners.png) no-repeat 100% 100%;margin-left:11px;height:12px;_background:url(https://getfirebug.com/releases/lite/latest/skin/xp/textEditorCorners.gif) no-repeat 100% 100%;}.textEditorBottom2{position:relative;left:-11px;width:11px;height:12px;background:url(https://getfirebug.com/releases/lite/latest/skin/xp/textEditorCorners.png) no-repeat 0 100%;_background:url(https://getfirebug.com/releases/lite/latest/skin/xp/textEditorCorners.gif) no-repeat 0 100%;}.panelNode-css{overflow-x:hidden;}.cssSheet > .insertBefore{height:1.5em;}.cssRule{position:relative;margin:0;padding:1em 0 0 6px;font-family:Monaco,monospace;color:#000000;}.cssRule:first-child{padding-top:6px;}.cssElementRuleContainer{position:relative;}.cssHead{padding-right:150px;}.cssProp{}.cssPropName{color:DarkGreen;}.cssPropValue{margin-left:8px;color:DarkBlue;}.cssOverridden span{text-decoration:line-through;}.cssInheritedRule{}.cssInheritLabel{margin-right:0.5em;font-weight:bold;}.cssRule .objectLink-sourceLink{top:0;}.cssProp.editGroup:hover{background:url(https://getfirebug.com/releases/lite/latest/skin/xp/disable.png) no-repeat 2px 1px;_background:url(https://getfirebug.com/releases/lite/latest/skin/xp/disable.gif) no-repeat 2px 1px;}.cssProp.editGroup.editing{background:none;}.cssProp.disabledStyle{background:url(https://getfirebug.com/releases/lite/latest/skin/xp/disableHover.png) no-repeat 2px 1px;_background:url(https://getfirebug.com/releases/lite/latest/skin/xp/disableHover.gif) no-repeat 2px 1px;opacity:1;color:#CCCCCC;}.disabledStyle .cssPropName,.disabledStyle .cssPropValue{color:#CCCCCC;}.cssPropValue.editing + .cssSemi,.inlineExpander + .cssSemi{display:none;}.cssPropValue.editing{white-space:nowrap;}.stylePropName{font-weight:bold;padding:0 4px 4px 4px;width:50%;}.stylePropValue{width:50%;}.panelNode-net{overflow-x:hidden;}.netTable{width:100%;}.hideCategory-undefined .category-undefined,.hideCategory-html .category-html,.hideCategory-css .category-css,.hideCategory-js .category-js,.hideCategory-image .category-image,.hideCategory-xhr .category-xhr,.hideCategory-flash .category-flash,.hideCategory-txt .category-txt,.hideCategory-bin .category-bin{display:none;}.netHeadRow{background:url(https://getfirebug.com/releases/lite/latest/skin/xp/chrome://firebug/skin/group.gif) repeat-x #FFFFFF;}.netHeadCol{border-bottom:1px solid #CCCCCC;padding:2px 4px 2px 18px;font-weight:bold;}.netHeadLabel{white-space:nowrap;overflow:hidden;}.netHeaderRow{height:16px;}.netHeaderCell{cursor:pointer;-moz-user-select:none;border-bottom:1px solid #9C9C9C;padding:0 !important;font-weight:bold;background:#BBBBBB url(https://getfirebug.com/releases/lite/latest/skin/xp/chrome://firebug/skin/tableHeader.gif) repeat-x;white-space:nowrap;}.netHeaderRow > .netHeaderCell:first-child > .netHeaderCellBox{padding:2px 14px 2px 18px;}.netHeaderCellBox{padding:2px 14px 2px 10px;border-left:1px solid #D9D9D9;border-right:1px solid #9C9C9C;}.netHeaderCell:hover:active{background:#959595 url(https://getfirebug.com/releases/lite/latest/skin/xp/chrome://firebug/skin/tableHeaderActive.gif) repeat-x;}.netHeaderSorted{background:#7D93B2 url(https://getfirebug.com/releases/lite/latest/skin/xp/chrome://firebug/skin/tableHeaderSorted.gif) repeat-x;}.netHeaderSorted > .netHeaderCellBox{border-right-color:#6B7C93;background:url(https://getfirebug.com/releases/lite/latest/skin/xp/chrome://firebug/skin/arrowDown.png) no-repeat right;}.netHeaderSorted.sortedAscending > .netHeaderCellBox{background-image:url(https://getfirebug.com/releases/lite/latest/skin/xp/chrome://firebug/skin/arrowUp.png);}.netHeaderSorted:hover:active{background:#536B90 url(https://getfirebug.com/releases/lite/latest/skin/xp/chrome://firebug/skin/tableHeaderSortedActive.gif) repeat-x;}.panelNode-net .netRowHeader{display:block;}.netRowHeader{cursor:pointer;display:none;height:15px;margin-right:0 !important;}.netRow .netRowHeader{background-position:5px 1px;}.netRow[breakpoint="true"] .netRowHeader{background-image:url(https://getfirebug.com/releases/lite/latest/skin/xp/chrome://firebug/skin/breakpoint.png);}.netRow[breakpoint="true"][disabledBreakpoint="true"] .netRowHeader{background-image:url(https://getfirebug.com/releases/lite/latest/skin/xp/chrome://firebug/skin/breakpointDisabled.png);}.netRow.category-xhr:hover .netRowHeader{background-color:#F6F6F6;}#netBreakpointBar{max-width:38px;}#netHrefCol > .netHeaderCellBox{border-left:0px;}.netRow .netRowHeader{width:3px;}.netInfoRow .netRowHeader{display:table-cell;}.netTable[hiddenCols~=netHrefCol] TD[id="netHrefCol"],.netTable[hiddenCols~=netHrefCol] TD.netHrefCol,.netTable[hiddenCols~=netStatusCol] TD[id="netStatusCol"],.netTable[hiddenCols~=netStatusCol] TD.netStatusCol,.netTable[hiddenCols~=netDomainCol] TD[id="netDomainCol"],.netTable[hiddenCols~=netDomainCol] TD.netDomainCol,.netTable[hiddenCols~=netSizeCol] TD[id="netSizeCol"],.netTable[hiddenCols~=netSizeCol] TD.netSizeCol,.netTable[hiddenCols~=netTimeCol] TD[id="netTimeCol"],.netTable[hiddenCols~=netTimeCol] TD.netTimeCol{display:none;}.netRow{background:LightYellow;}.netRow.loaded{background:#FFFFFF;}.netRow.loaded:hover{background:#EFEFEF;}.netCol{padding:0;vertical-align:top;border-bottom:1px solid #EFEFEF;white-space:nowrap;height:17px;}.netLabel{width:100%;}.netStatusCol{padding-left:10px;color:rgb(128,128,128);}.responseError > .netStatusCol{color:red;}.netDomainCol{padding-left:5px;}.netSizeCol{text-align:right;padding-right:10px;}.netHrefLabel{-moz-box-sizing:padding-box;overflow:hidden;z-index:10;position:absolute;padding-left:18px;padding-top:1px;max-width:15%;font-weight:bold;}.netFullHrefLabel{display:none;-moz-user-select:none;padding-right:10px;padding-bottom:3px;max-width:100%;background:#FFFFFF;z-index:200;}.netHrefCol:hover > .netFullHrefLabel{display:block;}.netRow.loaded:hover .netCol > .netFullHrefLabel{background-color:#EFEFEF;}.useA11y .a11yShowFullLabel{display:block;background-image:none !important;border:1px solid #CBE087;background-color:LightYellow;font-family:Monaco,monospace;color:#000000;font-size:10px;z-index:2147483647;}.netSizeLabel{padding-left:6px;}.netStatusLabel,.netDomainLabel,.netSizeLabel,.netBar{padding:1px 0 2px 0 !important;}.responseError{color:red;}.hasHeaders .netHrefLabel:hover{cursor:pointer;color:blue;text-decoration:underline;}.netLoadingIcon{position:absolute;border:0;margin-left:14px;width:16px;height:16px;background:transparent no-repeat 0 0;background-image:url(https://getfirebug.com/releases/lite/latest/skin/xp/chrome://firebug/skin/loading_16.gif);display:inline-block;}.loaded .netLoadingIcon{display:none;}.netBar,.netSummaryBar{position:relative;border-right:50px solid transparent;}.netResolvingBar{position:absolute;left:0;top:0;bottom:0;background:#FFFFFF url(https://getfirebug.com/releases/lite/latest/skin/xp/chrome://firebug/skin/netBarResolving.gif) repeat-x;z-index:60;}.netConnectingBar{position:absolute;left:0;top:0;bottom:0;background:#FFFFFF url(https://getfirebug.com/releases/lite/latest/skin/xp/chrome://firebug/skin/netBarConnecting.gif) repeat-x;z-index:50;}.netBlockingBar{position:absolute;left:0;top:0;bottom:0;background:#FFFFFF url(https://getfirebug.com/releases/lite/latest/skin/xp/chrome://firebug/skin/netBarWaiting.gif) repeat-x;z-index:40;}.netSendingBar{position:absolute;left:0;top:0;bottom:0;background:#FFFFFF url(https://getfirebug.com/releases/lite/latest/skin/xp/chrome://firebug/skin/netBarSending.gif) repeat-x;z-index:30;}.netWaitingBar{position:absolute;left:0;top:0;bottom:0;background:#FFFFFF url(https://getfirebug.com/releases/lite/latest/skin/xp/chrome://firebug/skin/netBarResponded.gif) repeat-x;z-index:20;min-width:1px;}.netReceivingBar{position:absolute;left:0;top:0;bottom:0;background:#38D63B url(https://getfirebug.com/releases/lite/latest/skin/xp/chrome://firebug/skin/netBarLoading.gif) repeat-x;z-index:10;}.netWindowLoadBar,.netContentLoadBar{position:absolute;left:0;top:0;bottom:0;width:1px;background-color:red;z-index:70;opacity:0.5;display:none;margin-bottom:-1px;}.netContentLoadBar{background-color:Blue;}.netTimeLabel{-moz-box-sizing:padding-box;position:absolute;top:1px;left:100%;padding-left:6px;color:#444444;min-width:16px;}.loaded .netReceivingBar,.loaded.netReceivingBar{background:#B6B6B6 url(https://getfirebug.com/releases/lite/latest/skin/xp/chrome://firebug/skin/netBarLoaded.gif) repeat-x;border-color:#B6B6B6;}.fromCache .netReceivingBar,.fromCache.netReceivingBar{background:#D6D6D6 url(https://getfirebug.com/releases/lite/latest/skin/xp/chrome://firebug/skin/netBarCached.gif) repeat-x;border-color:#D6D6D6;}.netSummaryRow .netTimeLabel,.loaded .netTimeLabel{background:transparent;}.timeInfoTip{width:150px; height:40px}.timeInfoTipBar,.timeInfoTipEventBar{position:relative;display:block;margin:0;opacity:1;height:15px;width:4px;}.timeInfoTipEventBar{width:1px !important;}.timeInfoTipCell.startTime{padding-right:8px;}.timeInfoTipCell.elapsedTime{text-align:right;padding-right:8px;}.sizeInfoLabelCol{font-weight:bold;padding-right:10px;font-family:Lucida Grande,Tahoma,sans-serif;font-size:11px;}.sizeInfoSizeCol{font-weight:bold;}.sizeInfoDetailCol{color:gray;text-align:right;}.sizeInfoDescCol{font-style:italic;}.netSummaryRow .netReceivingBar{background:#BBBBBB;border:none;}.netSummaryLabel{color:#222222;}.netSummaryRow{background:#BBBBBB !important;font-weight:bold;}.netSummaryRow .netBar{border-right-color:#BBBBBB;}.netSummaryRow > .netCol{border-top:1px solid #999999;border-bottom:2px solid;-moz-border-bottom-colors:#EFEFEF #999999;padding-top:1px;padding-bottom:2px;}.netSummaryRow > .netHrefCol:hover{background:transparent !important;}.netCountLabel{padding-left:18px;}.netTotalSizeCol{text-align:right;padding-right:10px;}.netTotalTimeCol{text-align:right;}.netCacheSizeLabel{position:absolute;z-index:1000;left:0;top:0;}.netLimitRow{background:rgb(255,255,225) !important;font-weight:normal;color:black;font-weight:normal;}.netLimitLabel{padding-left:18px;}.netLimitRow > .netCol{border-bottom:2px solid;-moz-border-bottom-colors:#EFEFEF #999999;vertical-align:middle !important;padding-top:2px;padding-bottom:2px;}.netLimitButton{font-size:11px;padding-top:1px;padding-bottom:1px;}.netInfoCol{border-top:1px solid #EEEEEE;background:url(https://getfirebug.com/releases/lite/latest/skin/xp/chrome://firebug/skin/group.gif) repeat-x #FFFFFF;}.netInfoBody{margin:10px 0 4px 10px;}.netInfoTabs{position:relative;padding-left:17px;}.netInfoTab{position:relative;top:-3px;margin-top:10px;padding:4px 6px;border:1px solid transparent;border-bottom:none;_border:none;font-weight:bold;color:#565656;cursor:pointer;}.netInfoTabSelected{cursor:default !important;border:1px solid #D7D7D7 !important;border-bottom:none !important;-moz-border-radius:4px 4px 0 0;background-color:#FFFFFF;}.logRow-netInfo.error .netInfoTitle{color:red;}.logRow-netInfo.loading .netInfoResponseText{font-style:italic;color:#888888;}.loading .netInfoResponseHeadersTitle{display:none;}.netInfoResponseSizeLimit{font-family:Lucida Grande,Tahoma,sans-serif;padding-top:10px;font-size:11px;}.netInfoText{display:none;margin:0;border:1px solid #D7D7D7;border-right:none;padding:8px;background-color:#FFFFFF;font-family:Monaco,monospace;}.netInfoTextSelected{display:block;}.netInfoParamName{padding-right:10px;font-family:Lucida Grande,Tahoma,sans-serif;font-weight:bold;vertical-align:top;text-align:right;white-space:nowrap;}.netInfoPostText .netInfoParamName{width:1px;}.netInfoParamValue{width:100%;}.netInfoHeadersText,.netInfoPostText,.netInfoPutText{padding-top:0;}.netInfoHeadersGroup,.netInfoPostParams,.netInfoPostSource{margin-bottom:4px;border-bottom:1px solid #D7D7D7;padding-top:8px;padding-bottom:2px;font-family:Lucida Grande,Tahoma,sans-serif;font-weight:bold;color:#565656;}.netInfoPostParamsTable,.netInfoPostPartsTable,.netInfoPostJSONTable,.netInfoPostXMLTable,.netInfoPostSourceTable{margin-bottom:10px;width:100%;}.netInfoPostContentType{color:#bdbdbd;padding-left:50px;font-weight:normal;}.netInfoHtmlPreview{border:0;width:100%;height:100%;}.netHeadersViewSource{color:#bdbdbd;margin-left:200px;font-weight:normal;}.netHeadersViewSource:hover{color:blue;cursor:pointer;}.netActivationRow,.netPageSeparatorRow{background:rgb(229,229,229) !important;font-weight:normal;color:black;}.netActivationLabel{background:url(https://getfirebug.com/releases/lite/latest/skin/xp/chrome://firebug/skin/infoIcon.png) no-repeat 3px 2px;padding-left:22px;}.netPageSeparatorRow{height:5px !important;}.netPageSeparatorLabel{padding-left:22px;height:5px !important;}.netPageRow{background-color:rgb(255,255,255);}.netPageRow:hover{background:#EFEFEF;}.netPageLabel{padding:1px 0 2px 18px !important;font-weight:bold;}.netActivationRow > .netCol{border-bottom:2px solid;-moz-border-bottom-colors:#EFEFEF #999999;padding-top:2px;padding-bottom:3px;}.logRow-spy .spyHead .spyTitle,.logGroup .logGroupLabel,.hasChildren .memberLabelCell .memberLabel,.hasHeaders .netHrefLabel{background-image:url(https://getfirebug.com/releases/lite/latest/skin/xp/tree_open.gif);background-repeat:no-repeat;background-position:2px 2px;}.opened .spyHead .spyTitle,.opened .logGroupLabel,.opened .memberLabelCell .memberLabel{background-image:url(https://getfirebug.com/releases/lite/latest/skin/xp/tree_close.gif);}.twisty{background-position:2px 0;}.panelNode-console{overflow-x:hidden;}.objectLink{text-decoration:none;}.objectLink:hover{cursor:pointer;text-decoration:underline;}.logRow{position:relative;margin:0;border-bottom:1px solid #D7D7D7;padding:2px 4px 1px 6px;background-color:#FFFFFF;overflow:hidden !important;}.useA11y .logRow:focus{border-bottom:1px solid #000000 !important;outline:none !important;background-color:#FFFFAD !important;}.useA11y .logRow:focus a.objectLink-sourceLink{background-color:#FFFFAD;}.useA11y .a11yFocus:focus,.useA11y .objectBox:focus{outline:2px solid #FF9933;background-color:#FFFFAD;}.useA11y .objectBox-null:focus,.useA11y .objectBox-undefined:focus{background-color:#888888 !important;}.useA11y .logGroup.opened > .logRow{border-bottom:1px solid #ffffff;}.logGroup{background:url(https://getfirebug.com/releases/lite/latest/skin/xp/group.gif) repeat-x #FFFFFF;padding:0 !important;border:none !important;}.logGroupBody{display:none;margin-left:16px;border-left:1px solid #D7D7D7;border-top:1px solid #D7D7D7;background:#FFFFFF;}.logGroup > .logRow{background-color:transparent !important;font-weight:bold;}.logGroup.opened > .logRow{border-bottom:none;}.logGroup.opened > .logGroupBody{display:block;}.logRow-command > .objectBox-text{font-family:Monaco,monospace;color:#0000FF;white-space:pre-wrap;}.logRow-info,.logRow-warn,.logRow-error,.logRow-assert,.logRow-warningMessage,.logRow-errorMessage{padding-left:22px;background-repeat:no-repeat;background-position:4px 2px;}.logRow-assert,.logRow-warningMessage,.logRow-errorMessage{padding-top:0;padding-bottom:0;}.logRow-info,.logRow-info .objectLink-sourceLink{background-color:#FFFFFF;}.logRow-warn,.logRow-warningMessage,.logRow-warn .objectLink-sourceLink,.logRow-warningMessage .objectLink-sourceLink{background-color:cyan;}.logRow-error,.logRow-assert,.logRow-errorMessage,.logRow-error .objectLink-sourceLink,.logRow-errorMessage .objectLink-sourceLink{background-color:LightYellow;}.logRow-error,.logRow-assert,.logRow-errorMessage{color:#FF0000;}.logRow-info{}.logRow-warn,.logRow-warningMessage{}.logRow-error,.logRow-assert,.logRow-errorMessage{}.objectBox-string,.objectBox-text,.objectBox-number,.objectLink-element,.objectLink-textNode,.objectLink-function,.objectBox-stackTrace,.objectLink-profile{font-family:Monaco,monospace;}.objectBox-string,.objectBox-text,.objectLink-textNode{white-space:pre-wrap;}.objectBox-number,.objectLink-styleRule,.objectLink-element,.objectLink-textNode{color:#000088;}.objectBox-string{color:#FF0000;}.objectLink-function,.objectBox-stackTrace,.objectLink-profile{color:DarkGreen;}.objectBox-null,.objectBox-undefined{padding:0 2px;border:1px solid #666666;background-color:#888888;color:#FFFFFF;}.objectBox-exception{padding:0 2px 0 18px;color:red;}.objectLink-sourceLink{position:absolute;right:4px;top:2px;padding-left:8px;font-family:Lucida Grande,sans-serif;font-weight:bold;color:#0000FF;}.errorTitle{margin-top:0px;margin-bottom:1px;padding-top:2px;padding-bottom:2px;}.errorTrace{margin-left:17px;}.errorSourceBox{margin:2px 0;}.errorSource-none{display:none;}.errorSource-syntax > .errorBreak{visibility:hidden;}.errorSource{cursor:pointer;font-family:Monaco,monospace;color:DarkGreen;}.errorSource:hover{text-decoration:underline;}.errorBreak{cursor:pointer;display:none;margin:0 6px 0 0;width:13px;height:14px;vertical-align:bottom;opacity:0.1;}.hasBreakSwitch .errorBreak{display:inline;}.breakForError .errorBreak{opacity:1;}.assertDescription{margin:0;}.logRow-profile > .logRow > .objectBox-text{font-family:Lucida Grande,Tahoma,sans-serif;color:#000000;}.logRow-profile > .logRow > .objectBox-text:last-child{color:#555555;font-style:italic;}.logRow-profile.opened > .logRow{padding-bottom:4px;}.profilerRunning > .logRow{padding-left:22px !important;}.profileSizer{width:100%;overflow-x:auto;overflow-y:scroll;}.profileTable{border-bottom:1px solid #D7D7D7;padding:0 0 4px 0;}.profileTable tr[odd="1"]{background-color:#F5F5F5;vertical-align:middle;}.profileTable a{vertical-align:middle;}.profileTable td{padding:1px 4px 0 4px;}.headerCell{cursor:pointer;-moz-user-select:none;border-bottom:1px solid #9C9C9C;padding:0 !important;font-weight:bold;}.headerCellBox{padding:2px 4px;border-left:1px solid #D9D9D9;border-right:1px solid #9C9C9C;}.headerCell:hover:active{}.headerSorted{}.headerSorted > .headerCellBox{border-right-color:#6B7C93;}.headerSorted.sortedAscending > .headerCellBox{}.headerSorted:hover:active{}.linkCell{text-align:right;}.linkCell > .objectLink-sourceLink{position:static;}.logRow-stackTrace{padding-top:0;background:#f8f8f8;}.logRow-stackTrace > .objectBox-stackFrame{position:relative;padding-top:2px;}.objectLink-object{font-family:Lucida Grande,sans-serif;font-weight:bold;color:DarkGreen;white-space:pre-wrap;}.objectPropValue{font-weight:normal;font-style:italic;color:#555555;}.selectorTag,.selectorId,.selectorClass{font-family:Monaco,monospace;font-weight:normal;}.selectorTag{color:#0000FF;}.selectorId{color:DarkBlue;}.selectorClass{color:red;}.selectorHidden > .selectorTag{color:#5F82D9;}.selectorHidden > .selectorId{color:#888888;}.selectorHidden > .selectorClass{color:#D86060;}.selectorValue{font-family:Lucida Grande,sans-serif;font-style:italic;color:#555555;}.panelNode.searching .logRow{display:none;}.logRow.matched{display:block !important;}.logRow.matching{position:absolute;left:-1000px;top:-1000px;max-width:0;max-height:0;overflow:hidden;}.arrayLeftBracket,.arrayRightBracket,.arrayComma{font-family:Monaco,monospace;}.arrayLeftBracket,.arrayRightBracket{font-weight:bold;}.arrayLeftBracket{margin-right:4px;}.arrayRightBracket{margin-left:4px;}.logRow-dir{padding:0;}.logRow-errorMessage .hasTwisty .errorTitle,.logRow-spy .spyHead .spyTitle,.logGroup .logRow{cursor:pointer;padding-left:18px;background-repeat:no-repeat;background-position:3px 3px;}.logRow-errorMessage > .hasTwisty > .errorTitle{background-position:2px 3px;}.logRow-errorMessage > .hasTwisty > .errorTitle:hover,.logRow-spy .spyHead .spyTitle:hover,.logGroup > .logRow:hover{text-decoration:underline;}.logRow-spy{padding:0 !important;}.logRow-spy,.logRow-spy .objectLink-sourceLink{background:url(https://getfirebug.com/releases/lite/latest/skin/xp/group.gif) repeat-x #FFFFFF;padding-right:4px;right:0;}.logRow-spy.opened{padding-bottom:4px;border-bottom:none;}.spyTitle{color:#000000;font-weight:bold;-moz-box-sizing:padding-box;overflow:hidden;z-index:100;padding-left:18px;}.spyCol{padding:0;white-space:nowrap;height:16px;}.spyTitleCol:hover > .objectLink-sourceLink,.spyTitleCol:hover > .spyTime,.spyTitleCol:hover > .spyStatus,.spyTitleCol:hover > .spyTitle{display:none;}.spyFullTitle{display:none;-moz-user-select:none;max-width:100%;background-color:Transparent;}.spyTitleCol:hover > .spyFullTitle{display:block;}.spyStatus{padding-left:10px;color:rgb(128,128,128);}.spyTime{margin-left:4px;margin-right:4px;color:rgb(128,128,128);}.spyIcon{margin-right:4px;margin-left:4px;width:16px;height:16px;vertical-align:middle;background:transparent no-repeat 0 0;display:none;}.loading .spyHead .spyRow .spyIcon{background-image:url(https://getfirebug.com/releases/lite/latest/skin/xp/loading_16.gif);display:block;}.logRow-spy.loaded:not(.error) .spyHead .spyRow .spyIcon{width:0;margin:0;}.logRow-spy.error .spyHead .spyRow .spyIcon{background-image:url(https://getfirebug.com/releases/lite/latest/skin/xp/errorIcon-sm.png);display:block;background-position:2px 2px;}.logRow-spy .spyHead .netInfoBody{display:none;}.logRow-spy.opened .spyHead .netInfoBody{margin-top:10px;display:block;}.logRow-spy.error .spyTitle,.logRow-spy.error .spyStatus,.logRow-spy.error .spyTime{color:red;}.logRow-spy.loading .spyResponseText{font-style:italic;color:#888888;}.caption{font-family:Lucida Grande,Tahoma,sans-serif;font-weight:bold;color:#444444;}.warning{padding:10px;font-family:Lucida Grande,Tahoma,sans-serif;font-weight:bold;color:#888888;}.panelNode-dom{overflow-x:hidden !important;}.domTable{font-size:1em;width:100%;table-layout:fixed;background:#fff;}.domTableIE{width:auto;}.memberLabelCell{padding:2px 0 2px 0;vertical-align:top;}.memberValueCell{padding:1px 0 1px 5px;display:block;overflow:hidden;}.memberLabel{display:block;cursor:default;-moz-user-select:none;overflow:hidden;padding-left:18px;background-color:#FFFFFF;text-decoration:none;}.memberRow.hasChildren .memberLabelCell .memberLabel:hover{cursor:pointer;color:blue;text-decoration:underline;}.userLabel{color:#000000;font-weight:bold;}.userClassLabel{color:#E90000;font-weight:bold;}.userFunctionLabel{color:#025E2A;font-weight:bold;}.domLabel{color:#000000;}.domFunctionLabel{color:#025E2A;}.ordinalLabel{color:SlateBlue;font-weight:bold;}.scopesRow{padding:2px 18px;background-color:LightYellow;border-bottom:5px solid #BEBEBE;color:#666666;}.scopesLabel{background-color:LightYellow;}.watchEditCell{padding:2px 18px;background-color:LightYellow;border-bottom:1px solid #BEBEBE;color:#666666;}.editor-watchNewRow,.editor-memberRow{font-family:Monaco,monospace !important;}.editor-memberRow{padding:1px 0 !important;}.editor-watchRow{padding-bottom:0 !important;}.watchRow > .memberLabelCell{font-family:Monaco,monospace;padding-top:1px;padding-bottom:1px;}.watchRow > .memberLabelCell > .memberLabel{background-color:transparent;}.watchRow > .memberValueCell{padding-top:2px;padding-bottom:2px;}.watchRow > .memberLabelCell,.watchRow > .memberValueCell{background-color:#F5F5F5;border-bottom:1px solid #BEBEBE;}.watchToolbox{z-index:2147483647;position:absolute;right:0;padding:1px 2px;}#fbConsole{overflow-x:hidden !important;}#fbCSS{font:1em Monaco,monospace;padding:0 7px;}#fbstylesheetButtons select,#fbScriptButtons select{font:11px Lucida Grande,Tahoma,sans-serif;margin-top:1px;padding-left:3px;background:#fafafa;border:1px inset #fff;width:220px;outline:none;}.Selector{margin-top:10px}.CSSItem{margin-left:4%}.CSSText{padding-left:20px;}.CSSProperty{color:#005500;}.CSSValue{padding-left:5px; color:#000088;}#fbHTMLStatusBar{display:inline;}.fbToolbarButtons{display:none;}.fbStatusSeparator{display:block;float:left;padding-top:4px;}#fbStatusBarBox{display:none;}#fbToolbarContent{display:block;position:absolute;_position:absolute;top:0;padding-top:4px;height:23px;clip:rect(0,2048px,27px,0);}.fbTabMenuTarget{display:none !important;float:left;width:10px;height:10px;margin-top:6px;background:url(https://getfirebug.com/releases/lite/latest/skin/xp/tabMenuTarget.png);}.fbTabMenuTarget:hover{background:url(https://getfirebug.com/releases/lite/latest/skin/xp/tabMenuTargetHover.png);}.fbShadow{float:left;background:url(https://getfirebug.com/releases/lite/latest/skin/xp/shadowAlpha.png) no-repeat bottom right !important;background:url(https://getfirebug.com/releases/lite/latest/skin/xp/shadow2.gif) no-repeat bottom right;margin:10px 0 0 10px !important;margin:10px 0 0 5px;}.fbShadowContent{display:block;position:relative;background-color:#fff;border:1px solid #a9a9a9;top:-6px;left:-6px;}.fbMenu{display:none;position:absolute;font-size:11px;z-index:2147483647;}.fbMenuContent{padding:2px;}.fbMenuSeparator{display:block;position:relative;padding:1px 18px 0;text-decoration:none;color:#000;cursor:default;background:#ACA899;margin:4px 0;}.fbMenuOption{display:block;position:relative;padding:2px 18px;text-decoration:none;color:#000;cursor:default;}.fbMenuOption:hover{color:#fff;background:#316AC5;}.fbMenuGroup{background:transparent url(https://getfirebug.com/releases/lite/latest/skin/xp/tabMenuPin.png) no-repeat right 0;}.fbMenuGroup:hover{background:#316AC5 url(https://getfirebug.com/releases/lite/latest/skin/xp/tabMenuPin.png) no-repeat right -17px;}.fbMenuGroupSelected{color:#fff;background:#316AC5 url(https://getfirebug.com/releases/lite/latest/skin/xp/tabMenuPin.png) no-repeat right -17px;}.fbMenuChecked{background:transparent url(https://getfirebug.com/releases/lite/latest/skin/xp/tabMenuCheckbox.png) no-repeat 4px 0;}.fbMenuChecked:hover{background:#316AC5 url(https://getfirebug.com/releases/lite/latest/skin/xp/tabMenuCheckbox.png) no-repeat 4px -17px;}.fbMenuRadioSelected{background:transparent url(https://getfirebug.com/releases/lite/latest/skin/xp/tabMenuRadio.png) no-repeat 4px 0;}.fbMenuRadioSelected:hover{background:#316AC5 url(https://getfirebug.com/releases/lite/latest/skin/xp/tabMenuRadio.png) no-repeat 4px -17px;}.fbMenuShortcut{padding-right:85px;}.fbMenuShortcutKey{position:absolute;right:0;top:2px;width:77px;}#fbFirebugMenu{top:22px;left:0;}.fbMenuDisabled{color:#ACA899 !important;}#fbFirebugSettingsMenu{left:245px;top:99px;}#fbConsoleMenu{top:42px;left:48px;}.fbIconButton{display:block;}.fbIconButton{display:block;}.fbIconButton{display:block;float:left;height:20px;width:20px;color:#000;margin-right:2px;text-decoration:none;cursor:default;}.fbIconButton:hover{position:relative;top:-1px;left:-1px;margin-right:0;_margin-right:1px;color:#333;border:1px solid #fff;border-bottom:1px solid #bbb;border-right:1px solid #bbb;}.fbIconPressed{position:relative;margin-right:0;_margin-right:1px;top:0 !important;left:0 !important;height:19px;color:#333 !important;border:1px solid #bbb !important;border-bottom:1px solid #cfcfcf !important;border-right:1px solid #ddd !important;}#fbErrorPopup{position:absolute;right:0;bottom:0;height:19px;width:75px;background:url(https://getfirebug.com/releases/lite/latest/skin/xp/sprite.png) #f1f2ee 0 0;z-index:999;}#fbErrorPopupContent{position:absolute;right:0;top:1px;height:18px;width:75px;_width:74px;border-left:1px solid #aca899;}#fbErrorIndicator{position:absolute;top:2px;right:5px;}.fbBtnInspectActive{background:#aaa;color:#fff !important;}.fbBody{margin:0;padding:0;overflow:hidden;font-family:Lucida Grande,Tahoma,sans-serif;font-size:11px;background:#fff;}.clear{clear:both;}#fbMiniChrome{display:none;right:0;height:27px;background:url(https://getfirebug.com/releases/lite/latest/skin/xp/sprite.png) #f1f2ee 0 0;margin-left:1px;}#fbMiniContent{display:block;position:relative;left:-1px;right:0;top:1px;height:25px;border-left:1px solid #aca899;}#fbToolbarSearch{float:right;border:1px solid #ccc;margin:0 5px 0 0;background:#fff url(https://getfirebug.com/releases/lite/latest/skin/xp/search.png) no-repeat 4px 2px !important;background:#fff url(https://getfirebug.com/releases/lite/latest/skin/xp/search.gif) no-repeat 4px 2px;padding-left:20px;font-size:11px;}#fbToolbarErrors{float:right;margin:1px 4px 0 0;font-size:11px;}#fbLeftToolbarErrors{float:left;margin:7px 0px 0 5px;font-size:11px;}.fbErrors{padding-left:20px;height:14px;background:url(https://getfirebug.com/releases/lite/latest/skin/xp/errorIcon.png) no-repeat !important;background:url(https://getfirebug.com/releases/lite/latest/skin/xp/errorIcon.gif) no-repeat;color:#f00;font-weight:bold;}#fbMiniErrors{display:inline;display:none;float:right;margin:5px 2px 0 5px;}#fbMiniIcon{float:right;margin:3px 4px 0;height:20px;width:20px;float:right;background:url(https://getfirebug.com/releases/lite/latest/skin/xp/sprite.png) 0 -135px;cursor:pointer;}#fbChrome{font-family:Lucida Grande,Tahoma,sans-serif;font-size:11px;position:absolute;_position:static;top:0;left:0;height:100%;width:100%;border-collapse:collapse;background:#fff;overflow:hidden;}#fbTop{height:49px;}#fbToolbar{background:url(https://getfirebug.com/releases/lite/latest/skin/xp/sprite.png) #f1f2ee 0 0;height:27px;font-size:11px;}#fbPanelBarBox{background:url(https://getfirebug.com/releases/lite/latest/skin/xp/sprite.png) #dbd9c9 0 -27px;height:22px;}#fbContent{height:100%;vertical-align:top;}#fbBottom{height:18px;background:#fff;}#fbToolbarIcon{float:left;padding:0 5px 0;}#fbToolbarIcon a{background:url(https://getfirebug.com/releases/lite/latest/skin/xp/sprite.png) 0 -135px;}#fbToolbarButtons{padding:0 2px 0 5px;}#fbToolbarButtons{padding:0 2px 0 5px;}.fbButton{text-decoration:none;display:block;float:left;color:#000;padding:4px 6px 4px 7px;cursor:default;}.fbButton:hover{color:#333;background:#f5f5ef url(https://getfirebug.com/releases/lite/latest/skin/xp/buttonBg.png);padding:3px 5px 3px 6px;border:1px solid #fff;border-bottom:1px solid #bbb;border-right:1px solid #bbb;}.fbBtnPressed{background:#e3e3db url(https://getfirebug.com/releases/lite/latest/skin/xp/buttonBgHover.png) !important;padding:3px 4px 2px 6px !important;margin:1px 0 0 1px !important;border:1px solid #ACA899 !important;border-color:#ACA899 #ECEBE3 #ECEBE3 #ACA899 !important;}#fbStatusBarBox{top:4px;cursor:default;}.fbToolbarSeparator{overflow:hidden;border:1px solid;border-color:transparent #fff transparent #777;_border-color:#eee #fff #eee #777;height:7px;margin:6px 3px;float:left;}.fbBtnSelected{font-weight:bold;}.fbStatusBar{color:#aca899;}.fbStatusBar a{text-decoration:none;color:black;}.fbStatusBar a:hover{color:blue;cursor:pointer;}#fbWindowButtons{position:absolute;white-space:nowrap;right:0;top:0;height:17px;width:48px;padding:5px;z-index:6;background:url(https://getfirebug.com/releases/lite/latest/skin/xp/sprite.png) #f1f2ee 0 0;}#fbPanelBar1{width:1024px; z-index:8;left:0;white-space:nowrap;background:url(https://getfirebug.com/releases/lite/latest/skin/xp/sprite.png) #dbd9c9 0 -27px;position:absolute;left:4px;}#fbPanelBar2Box{background:url(https://getfirebug.com/releases/lite/latest/skin/xp/sprite.png) #dbd9c9 0 -27px;position:absolute;height:22px;width:300px; z-index:9;right:0;}#fbPanelBar2{position:absolute;width:290px; height:22px;padding-left:4px;}.fbPanel{display:none;}#fbPanelBox1,#fbPanelBox2{max-height:inherit;height:100%;font-size:1em;}#fbPanelBox2{background:#fff;}#fbPanelBox2{width:300px;background:#fff;}#fbPanel2{margin-left:6px;background:#fff;}#fbLargeCommandLine{display:none;position:absolute;z-index:9;top:27px;right:0;width:294px;height:201px;border-width:0;margin:0;padding:2px 0 0 2px;resize:none;outline:none;font-size:11px;overflow:auto;border-top:1px solid #B9B7AF;_right:-1px;_border-left:1px solid #fff;}#fbLargeCommandButtons{display:none;background:#ECE9D8;bottom:0;right:0;width:294px;height:21px;padding-top:1px;position:fixed;border-top:1px solid #ACA899;z-index:9;}#fbSmallCommandLineIcon{background:url(https://getfirebug.com/releases/lite/latest/skin/xp/down.png) no-repeat;position:absolute;right:2px;bottom:3px;z-index:99;}#fbSmallCommandLineIcon:hover{background:url(https://getfirebug.com/releases/lite/latest/skin/xp/downHover.png) no-repeat;}.hide{overflow:hidden !important;position:fixed !important;display:none !important;visibility:hidden !important;}#fbCommand{height:18px;}#fbCommandBox{position:fixed;_position:absolute;width:100%;height:18px;bottom:0;overflow:hidden;z-index:9;background:#fff;border:0;border-top:1px solid #ccc;}#fbCommandIcon{position:absolute;color:#00f;top:2px;left:6px;display:inline;font:11px Monaco,monospace;z-index:10;}#fbCommandLine{position:absolute;width:100%;top:0;left:0;border:0;margin:0;padding:2px 0 2px 32px;font:11px Monaco,monospace;z-index:9;outline:none;}#fbLargeCommandLineIcon{background:url(https://getfirebug.com/releases/lite/latest/skin/xp/up.png) no-repeat;position:absolute;right:1px;bottom:1px;z-index:10;}#fbLargeCommandLineIcon:hover{background:url(https://getfirebug.com/releases/lite/latest/skin/xp/upHover.png) no-repeat;}div.fbFitHeight{overflow:auto;position:relative;}.fbSmallButton{overflow:hidden;width:16px;height:16px;display:block;text-decoration:none;cursor:default;}#fbWindowButtons .fbSmallButton{float:right;}#fbWindow_btClose{background:url(https://getfirebug.com/releases/lite/latest/skin/xp/min.png);}#fbWindow_btClose:hover{background:url(https://getfirebug.com/releases/lite/latest/skin/xp/minHover.png);}#fbWindow_btDetach{background:url(https://getfirebug.com/releases/lite/latest/skin/xp/detach.png);}#fbWindow_btDetach:hover{background:url(https://getfirebug.com/releases/lite/latest/skin/xp/detachHover.png);}#fbWindow_btDeactivate{background:url(https://getfirebug.com/releases/lite/latest/skin/xp/off.png);}#fbWindow_btDeactivate:hover{background:url(https://getfirebug.com/releases/lite/latest/skin/xp/offHover.png);}.fbTab{text-decoration:none;display:none;float:left;width:auto;float:left;cursor:default;font-family:Lucida Grande,Tahoma,sans-serif;font-size:11px;font-weight:bold;height:22px;color:#565656;}.fbPanelBar span{float:left;}.fbPanelBar .fbTabL,.fbPanelBar .fbTabR{height:22px;width:8px;}.fbPanelBar .fbTabText{padding:4px 1px 0;}a.fbTab:hover{background:url(https://getfirebug.com/releases/lite/latest/skin/xp/sprite.png) 0 -73px;}a.fbTab:hover .fbTabL{background:url(https://getfirebug.com/releases/lite/latest/skin/xp/sprite.png) -16px -96px;}a.fbTab:hover .fbTabR{background:url(https://getfirebug.com/releases/lite/latest/skin/xp/sprite.png) -24px -96px;}.fbSelectedTab{background:url(https://getfirebug.com/releases/lite/latest/skin/xp/sprite.png) #f1f2ee 0 -50px !important;color:#000;}.fbSelectedTab .fbTabL{background:url(https://getfirebug.com/releases/lite/latest/skin/xp/sprite.png) 0 -96px !important;}.fbSelectedTab .fbTabR{background:url(https://getfirebug.com/releases/lite/latest/skin/xp/sprite.png) -8px -96px !important;}#fbHSplitter{position:fixed;_position:absolute;left:0;top:0;width:100%;height:5px;overflow:hidden;cursor:n-resize !important;background:url(https://getfirebug.com/releases/lite/latest/skin/xp/pixel_transparent.gif);z-index:9;}#fbHSplitter.fbOnMovingHSplitter{height:100%;z-index:100;}.fbVSplitter{background:#ece9d8;color:#000;border:1px solid #716f64;border-width:0 1px;border-left-color:#aca899;width:4px;cursor:e-resize;overflow:hidden;right:294px;text-decoration:none;z-index:10;position:absolute;height:100%;top:27px;}div.lineNo{font:1em Monaco,monospace;position:relative;float:left;top:0;left:0;margin:0 5px 0 0;padding:0 5px 0 10px;background:#eee;color:#888;border-right:1px solid #ccc;text-align:right;}.sourceBox{position:absolute;}.sourceCode{font:1em Monaco,monospace;overflow:hidden;white-space:pre;display:inline;}.nodeControl{margin-top:3px;margin-left:-14px;float:left;width:9px;height:9px;overflow:hidden;cursor:default;background:url(https://getfirebug.com/releases/lite/latest/skin/xp/tree_open.gif);_float:none;_display:inline;_position:absolute;}div.nodeMaximized{background:url(https://getfirebug.com/releases/lite/latest/skin/xp/tree_close.gif);}div.objectBox-element{padding:1px 3px;}.objectBox-selector{cursor:default;}.selectedElement{background:highlight;color:#fff !important;}.selectedElement span{color:#fff !important;}* html .selectedElement{position:relative;}@media screen and (-webkit-min-device-pixel-ratio:0){.selectedElement{background:#316AC5;color:#fff !important;}}.logRow *{font-size:1em;}.logRow{position:relative;border-bottom:1px solid #D7D7D7;padding:2px 4px 1px 6px;zbackground-color:#FFFFFF;}.logRow-command{font-family:Monaco,monospace;color:blue;}.objectBox-string,.objectBox-text,.objectBox-number,.objectBox-function,.objectLink-element,.objectLink-textNode,.objectLink-function,.objectBox-stackTrace,.objectLink-profile{font-family:Monaco,monospace;}.objectBox-null{padding:0 2px;border:1px solid #666666;background-color:#888888;color:#FFFFFF;}.objectBox-string{color:red;}.objectBox-number{color:#000088;}.objectBox-function{color:DarkGreen;}.objectBox-object{color:DarkGreen;font-weight:bold;font-family:Lucida Grande,sans-serif;}.objectBox-array{color:#000;}.logRow-info,.logRow-error,.logRow-warn{background:#fff no-repeat 2px 2px;padding-left:20px;padding-bottom:3px;}.logRow-info{background-image:url(https://getfirebug.com/releases/lite/latest/skin/xp/infoIcon.png) !important;background-image:url(https://getfirebug.com/releases/lite/latest/skin/xp/infoIcon.gif);}.logRow-warn{background-color:cyan;background-image:url(https://getfirebug.com/releases/lite/latest/skin/xp/warningIcon.png) !important;background-image:url(https://getfirebug.com/releases/lite/latest/skin/xp/warningIcon.gif);}.logRow-error{background-color:LightYellow;background-image:url(https://getfirebug.com/releases/lite/latest/skin/xp/errorIcon.png) !important;background-image:url(https://getfirebug.com/releases/lite/latest/skin/xp/errorIcon.gif);color:#f00;}.errorMessage{vertical-align:top;color:#f00;}.objectBox-sourceLink{position:absolute;right:4px;top:2px;padding-left:8px;font-family:Lucida Grande,sans-serif;font-weight:bold;color:#0000FF;}.selectorTag,.selectorId,.selectorClass{font-family:Monaco,monospace;font-weight:normal;}.selectorTag{color:#0000FF;}.selectorId{color:DarkBlue;}.selectorClass{color:red;}.objectBox-element{font-family:Monaco,monospace;color:#000088;}.nodeChildren{padding-left:26px;}.nodeTag{color:blue;cursor:pointer;}.nodeValue{color:#FF0000;font-weight:normal;}.nodeText,.nodeComment{margin:0 2px;vertical-align:top;}.nodeText{color:#333333;font-family:Monaco,monospace;}.nodeComment{color:DarkGreen;}.nodeHidden,.nodeHidden *{color:#888888;}.nodeHidden .nodeTag{color:#5F82D9;}.nodeHidden .nodeValue{color:#D86060;}.selectedElement .nodeHidden,.selectedElement .nodeHidden *{color:SkyBlue !important;}.log-object{}.property{position:relative;clear:both;height:15px;}.propertyNameCell{vertical-align:top;float:left;width:28%;position:absolute;left:0;z-index:0;}.propertyValueCell{float:right;width:68%;background:#fff;position:absolute;padding-left:5px;display:table-cell;right:0;z-index:1;}.propertyName{font-weight:bold;}.FirebugPopup{height:100% !important;}.FirebugPopup #fbWindowButtons{display:none !important;}.FirebugPopup #fbHSplitter{display:none !important;}',HTML:'<table id="fbChrome" cellpadding="0" cellspacing="0" border="0"><tbody><tr><td id="fbTop" colspan="2"><div id="fbWindowButtons"><a id="fbWindow_btDeactivate" class="fbSmallButton fbHover" title="Deactivate Firebug for this web page"> </a><a id="fbWindow_btDetach" class="fbSmallButton fbHover" title="Open Firebug in popup window"> </a><a id="fbWindow_btClose" class="fbSmallButton fbHover" title="Minimize Firebug"> </a></div><div id="fbToolbar"><div id="fbToolbarContent"><span id="fbToolbarIcon"><a id="fbFirebugButton" class="fbIconButton" class="fbHover" target="_blank"> </a></span><span id="fbToolbarButtons"><span id="fbFixedButtons"><a id="fbChrome_btInspect" class="fbButton fbHover" title="Click an element in the page to inspect">Inspect</a></span><span id="fbConsoleButtons" class="fbToolbarButtons"><a id="fbConsole_btClear" class="fbButton fbHover" title="Clear the console">Clear</a></span></span><span id="fbStatusBarBox"><span class="fbToolbarSeparator"></span></span></div></div><div id="fbPanelBarBox"><div id="fbPanelBar1" class="fbPanelBar"><a id="fbConsoleTab" class="fbTab fbHover"><span class="fbTabL"></span><span class="fbTabText">Console</span><span class="fbTabMenuTarget"></span><span class="fbTabR"></span></a><a id="fbHTMLTab" class="fbTab fbHover"><span class="fbTabL"></span><span class="fbTabText">HTML</span><span class="fbTabR"></span></a><a class="fbTab fbHover"><span class="fbTabL"></span><span class="fbTabText">CSS</span><span class="fbTabR"></span></a><a class="fbTab fbHover"><span class="fbTabL"></span><span class="fbTabText">Script</span><span class="fbTabR"></span></a><a class="fbTab fbHover"><span class="fbTabL"></span><span class="fbTabText">DOM</span><span class="fbTabR"></span></a></div><div id="fbPanelBar2Box" class="hide"><div id="fbPanelBar2" class="fbPanelBar"></div></div></div><div id="fbHSplitter"> </div></td></tr><tr id="fbContent"><td id="fbPanelBox1"><div id="fbPanel1" class="fbFitHeight"><div id="fbConsole" class="fbPanel"></div><div id="fbHTML" class="fbPanel"></div></div></td><td id="fbPanelBox2" class="hide"><div id="fbVSplitter" class="fbVSplitter"> </div><div id="fbPanel2" class="fbFitHeight"><div id="fbHTML_Style" class="fbPanel"></div><div id="fbHTML_Layout" class="fbPanel"></div><div id="fbHTML_DOM" class="fbPanel"></div></div><textarea id="fbLargeCommandLine" class="fbFitHeight"></textarea><div id="fbLargeCommandButtons"><a id="fbCommand_btRun" class="fbButton fbHover">Run</a><a id="fbCommand_btClear" class="fbButton fbHover">Clear</a><a id="fbSmallCommandLineIcon" class="fbSmallButton fbHover"></a></div></td></tr><tr id="fbBottom" class="hide"><td id="fbCommand" colspan="2"><div id="fbCommandBox"><div id="fbCommandIcon">>>></div><input id="fbCommandLine" name="fbCommandLine" type="text"/><a id="fbLargeCommandLineIcon" class="fbSmallButton fbHover"></a></div></td></tr></tbody></table><span id="fbMiniChrome"><span id="fbMiniContent"><span id="fbMiniIcon" title="Open Firebug Lite"></span><span id="fbMiniErrors" class="fbErrors">2 errors</span></span></span>'}
}});
FBL.initialize()
})(); | zz-ms | trunk/zz-ms-v2.0/src/main/webapp/js/FusionCharts/firebug-lite.js | JavaScript | asf20 | 452,207 |
/*
* Document : mask 1.1
* Created on : 2011-12-11, 14:37:38
* Author : GodSon
* Email : wmails@126.com
* Link : www.btboys.com
*
*/
(function($){
function init(target,options){
var wrap = $(target);
if($("div.mask",wrap).length) wrap.mask("hide");
wrap.attr("position",wrap.css("position"));
wrap.attr("overflow",wrap.css("overflow"));
wrap.css("position", "relative");
wrap.css("overflow", "hidden");
var maskCss = {
position:"absolute",
left:0,
top:0,
cursor: "wait",
background:"#ccc",
opacity:options.opacity,
filter:"alpha(opacity="+options.opacity*100+")",
display:"none"
};
var maskMsgCss = {
position:"absolute",
width:"auto",
padding:"10px 20px",
border:"2px solid #ccc",
color:"white",
cursor: "wait",
display:"none",
borderRadius:5,
background:"black",
opacity:0.6,
filter:"alpha(opacity=60)"
};
var width,height,left,top;
if(target == 'body'){
width = Math.max(document.documentElement.clientWidth, document.body.clientWidth);
height = Math.max(document.documentElement.clientHeight, document.body.clientHeight);
}else{
width = wrap.outerWidth() || "100%";
height = wrap.outerHeight() || "100%";
}
$('<div class="mask"></div>').css($.extend({},maskCss,{
display : 'block',
width : width,
height : height,
zIndex:options.zIndex
})).appendTo(wrap);
var maskm= $('<div class="mask-msg"></div>').html(options.maskMsg).appendTo(wrap).css(maskMsgCss);
if(target == 'body'){
left = (Math.max(document.documentElement.clientWidth,document.body.clientWidth) - $('div.mask-msg', wrap).outerWidth())/ 2;
if(document.documentElement.clientHeight > document.body.clientHeight){
top = (Math.max(document.documentElement.clientHeight,document.body.clientHeight) - $('div.mask-msg', wrap).outerHeight())/ 2;
}else{
top = (Math.min(document.documentElement.clientHeight,document.body.clientHeight) - $('div.mask-msg', wrap).outerHeight())/ 2;
}
}else{
left = (wrap.width() - $('div.mask-msg', wrap).outerWidth())/ 2;
top = (wrap.height() - $('div.mask-msg', wrap).outerHeight())/ 2;
}
maskm.css({
display : 'block',
zIndex:options.zIndex+1,
left : left,
top : top
});
setTimeout(function(){
wrap.mask("hide");
}, options.timeout);
return wrap;
}
$.fn.mask = function(options){
if (typeof options == 'string'){
return $.fn.mask.methods[options](this);
}
options = $.extend({}, $.fn.mask.defaults,options);
return init(this,options);
};
$.mask = function(options){
if (typeof options == 'string'){
return $.fn.mask.methods[options]("body");
}
options = $.extend({}, $.fn.mask.defaults,options);
return init("body",options);
};
$.mask.hide = function(){
$("body").mask("hide");
};
$.fn.mask.methods = {
hide : function(jq) {
return jq.each(function() {
var wrap = $(this);
$("div.mask",wrap).fadeOut(function(){
$(this).remove();
});
$("div.mask-msg",wrap).fadeOut(function(){
$(this).remove();
wrap.css("position", wrap.attr("position"));
wrap.css("overflow", wrap.attr("overflow"));
});
});
}
};
$.fn.mask.defaults = {
maskMsg:'\u52a0\u8f7d……',
zIndex:100000,
timeout:30000,
opacity:0.6
};
})(jQuery); | zz-ms | trunk/zz-ms-v2.0/src/main/webapp/js/mask.js | JavaScript | asf20 | 4,082 |
$(function() {
var browser = {
device : function() {
var u = navigator.userAgent;
return {
trident : u.indexOf('Trident') > -1,
presto : u.indexOf('Presto') > -1, // opera内核
webKit : u.indexOf('AppleWebKit') > -1, // 苹果、谷歌内核
gecko : u.indexOf('Gecko') > -1 && u.indexOf('KHTML') == -1, // 火狐内核
deskWebkit : (u.indexOf("Android") == -1 && u.indexOf("Mobile") == -1),
mobileWebKit : !!u.match(/AppleWebKit.*Mobile.*/) || !!u.match(/AppleWebKit/) || !!u.match(/.*Mobile.*/), // 是否为移动终端
ios : !!u.match(/(i[^;]+\;(U;)? CPU.+Mac OS X)/), // ios终端
android : u.indexOf('Android') > -1 || u.indexOf('Linux') > -1, // android终端
iPhone : u.indexOf('iPhone') > -1 && u.indexOf('Mac') > -1, // 是否为iPhoneD
iPad : u.indexOf('iPad') > -1, // 是否iPad
webApp : u.indexOf('Safari') == -1
// 是否为App应用程序,没有头部与底部
};
}(),
language : (navigator.browserLanguage || navigator.language).toLowerCase(),
version : $.browser.version
};
//$("#baseMsg").html('<em>您的设备基础信息:</em>' + navigator.userAgent);
var chromeUrl = '<div>推荐使用<strong><a href="https://www.google.com/intl/zh-CN/chrome/browser/" target="_blank">谷歌浏览器</a></strong>来获得更快的页面相应效果。</div>';
/* 判断webkit内核下的版本 */
if (browser.device.webKit) {
if (browser.device.deskWebkit) {
return;
} else if (browser.device.mobileWebKit) {
if (browser.device.ios) {
if (browser.device.iPhone) {
$("#deviceInfoBox").html("当前使用的浏览器是: <span>iOS系统iPhone版Safari</span>" + " " + ",内核版本号为:" + " <span>" + browser.version + "</span>").parent().slideDown(600);
} else if (browser.device.iPad) {
$("#deviceInfoBox").html("当前使用的浏览器是: <span>iOS系统iPad版Safari</span>" + " " + ",内核版本号为:" + " <span>" + browser.version + "</span>").parent().slideDown(600);
}
} else if (browser.device.android) {
$("#deviceInfoBox").html("当前使用的浏览器是: <span>android系统Webkit</span>" + " " + ",内核版本号为:" + " <span>" + browser.version + "</span>").parent().slideDown(600);
}
}
}/* 判断IE浏览器 */
else if (browser.device.trident) {
getDeviceInfo("IE浏览器");
}
/* 判断FireFox浏览器 */
else if (browser.device.gecko) {
getDeviceInfo("火狐浏览器");
}
/* 判断Opera浏览器 */
else if (browser.device.presto) {
getDeviceInfo("欧朋浏览器");
}
/*其他浏览器*/
else{
$("#deviceInfoBox").html("当前使用的浏览器是: <strong>欧朋浏览器</strong>" + " " + ",内核版本号为:" + " <strong>" + browser.version + "</strong>").parent().slideDown(600);
$("#deviceInfoBox").append(chromeUrl);
$(".unsupported-browser").slideDown("1000");
}
function getDeviceInfo(browserMsg){
$("#deviceInfoBox").html("当前使用的浏览器是: <strong>"+browserMsg+"</strong>" + " " + ",内核版本号为:" + " <strong>" + browser.version + "</strong>").parent().slideDown(600);
$("#deviceInfoBox").append(chromeUrl);
$(".unsupported-browser").slideDown("1000");
}
}); | zz-ms | trunk/zz-ms-v2.0/src/main/webapp/js/extBrowser.js | JavaScript | asf20 | 3,256 |
if ($.fn.pagination){
$.fn.pagination.defaults.beforePageText = '第';
$.fn.pagination.defaults.afterPageText = '页 - 共 {pages} 页';
$.fn.pagination.defaults.displayMsg = '当前显示 {from} - {to} 条记录 共 {total} 条记录';
}
if ($.fn.datagrid){
$.fn.datagrid.defaults.loadMsg = '正在处理,请稍待。。。';
}
if ($.fn.treegrid && $.fn.datagrid){
$.fn.treegrid.defaults.loadMsg = $.fn.datagrid.defaults.loadMsg;
}
if ($.messager){
$.messager.defaults.ok = '确定';
$.messager.defaults.cancel = '取消';
}
if ($.fn.validatebox){
$.fn.validatebox.defaults.missingMessage = '该输入项为必输项';
$.fn.validatebox.defaults.rules.email.message = '请输入有效的电子邮件地址';
$.fn.validatebox.defaults.rules.url.message = '请输入有效的URL地址';
$.fn.validatebox.defaults.rules.length.message = '输入内容长度必须介于{0}和{1}之间';
$.fn.validatebox.defaults.rules.remote.message = '请修正该字段';
}
if ($.fn.numberbox){
$.fn.numberbox.defaults.missingMessage = '该输入项为必输项';
}
if ($.fn.combobox){
$.fn.combobox.defaults.missingMessage = '该输入项为必输项';
}
if ($.fn.combotree){
$.fn.combotree.defaults.missingMessage = '该输入项为必输项';
}
if ($.fn.combogrid){
$.fn.combogrid.defaults.missingMessage = '该输入项为必输项';
}
if ($.fn.calendar){
$.fn.calendar.defaults.weeks = ['日','一','二','三','四','五','六'];
$.fn.calendar.defaults.months = ['一月','二月','三月','四月','五月','六月','七月','八月','九月','十月','十一月','十二月'];
}
if ($.fn.datebox){
$.fn.datebox.defaults.currentText = '今天';
$.fn.datebox.defaults.closeText = '关闭';
$.fn.datebox.defaults.okText = '确定';
$.fn.datebox.defaults.missingMessage = '该输入项为必输项';
$.fn.datebox.defaults.formatter = function(date){
var y = date.getFullYear();
var m = date.getMonth()+1;
var d = date.getDate();
return y+'-'+(m<10?('0'+m):m)+'-'+(d<10?('0'+d):d);
};
$.fn.datebox.defaults.parser = function(s){
if (!s) return new Date();
var ss = s.split('-');
var y = parseInt(ss[0],10);
var m = parseInt(ss[1],10);
var d = parseInt(ss[2],10);
if (!isNaN(y) && !isNaN(m) && !isNaN(d)){
return new Date(y,m-1,d);
} else {
return new Date();
}
};
}
if ($.fn.datetimebox && $.fn.datebox){
$.extend($.fn.datetimebox.defaults,{
currentText: $.fn.datebox.defaults.currentText,
closeText: $.fn.datebox.defaults.closeText,
okText: $.fn.datebox.defaults.okText,
missingMessage: $.fn.datebox.defaults.missingMessage
});
}
| zz-ms | trunk/zz-ms-v2.0/src/main/webapp/js/easyui-lang-zh_CN.js | JavaScript | asf20 | 2,658 |
/*
http://www.JSON.org/json2.js
2010-11-17
Public Domain.
NO WARRANTY EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK.
See http://www.JSON.org/js.html
This code should be minified before deployment.
See http://javascript.crockford.com/jsmin.html
USE YOUR OWN COPY. IT IS EXTREMELY UNWISE TO LOAD CODE FROM SERVERS YOU DO
NOT CONTROL.
This file creates a global JSON object containing two methods: stringify
and parse.
JSON.stringify(value, replacer, space)
value any JavaScript value, usually an object or array.
replacer an optional parameter that determines how object
values are stringified for objects. It can be a
function or an array of strings.
space an optional parameter that specifies the indentation
of nested structures. If it is omitted, the text will
be packed without extra whitespace. If it is a number,
it will specify the number of spaces to indent at each
level. If it is a string (such as '\t' or ' '),
it contains the characters used to indent at each level.
This method produces a JSON text from a JavaScript value.
When an object value is found, if the object contains a toJSON
method, its toJSON method will be called and the result will be
stringified. A toJSON method does not serialize: it returns the
value represented by the name/value pair that should be serialized,
or undefined if nothing should be serialized. The toJSON method
will be passed the key associated with the value, and this will be
bound to the value
For example, this would serialize Dates as ISO strings.
Date.prototype.toJSON = function (key) {
function f(n) {
// Format integers to have at least two digits.
return n < 10 ? '0' + n : n;
}
return this.getUTCFullYear() + '-' +
f(this.getUTCMonth() + 1) + '-' +
f(this.getUTCDate()) + 'T' +
f(this.getUTCHours()) + ':' +
f(this.getUTCMinutes()) + ':' +
f(this.getUTCSeconds()) + 'Z';
};
You can provide an optional replacer method. It will be passed the
key and value of each member, with this bound to the containing
object. The value that is returned from your method will be
serialized. If your method returns undefined, then the member will
be excluded from the serialization.
If the replacer parameter is an array of strings, then it will be
used to select the members to be serialized. It filters the results
such that only members with keys listed in the replacer array are
stringified.
Values that do not have JSON representations, such as undefined or
functions, will not be serialized. Such values in objects will be
dropped; in arrays they will be replaced with null. You can use
a replacer function to replace those with JSON values.
JSON.stringify(undefined) returns undefined.
The optional space parameter produces a stringification of the
value that is filled with line breaks and indentation to make it
easier to read.
If the space parameter is a non-empty string, then that string will
be used for indentation. If the space parameter is a number, then
the indentation will be that many spaces.
Example:
text = JSON.stringify(['e', {pluribus: 'unum'}]);
// text is '["e",{"pluribus":"unum"}]'
text = JSON.stringify(['e', {pluribus: 'unum'}], null, '\t');
// text is '[\n\t"e",\n\t{\n\t\t"pluribus": "unum"\n\t}\n]'
text = JSON.stringify([new Date()], function (key, value) {
return this[key] instanceof Date ?
'Date(' + this[key] + ')' : value;
});
// text is '["Date(---current time---)"]'
JSON.parse(text, reviver)
This method parses a JSON text to produce an object or array.
It can throw a SyntaxError exception.
The optional reviver parameter is a function that can filter and
transform the results. It receives each of the keys and values,
and its return value is used instead of the original value.
If it returns what it received, then the structure is not modified.
If it returns undefined then the member is deleted.
Example:
// Parse the text. Values that look like ISO date strings will
// be converted to Date objects.
myData = JSON.parse(text, function (key, value) {
var a;
if (typeof value === 'string') {
a =
/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2}(?:\.\d*)?)Z$/.exec(value);
if (a) {
return new Date(Date.UTC(+a[1], +a[2] - 1, +a[3], +a[4],
+a[5], +a[6]));
}
}
return value;
});
myData = JSON.parse('["Date(09/09/2001)"]', function (key, value) {
var d;
if (typeof value === 'string' &&
value.slice(0, 5) === 'Date(' &&
value.slice(-1) === ')') {
d = new Date(value.slice(5, -1));
if (d) {
return d;
}
}
return value;
});
This is a reference implementation. You are free to copy, modify, or
redistribute.
*/
/*jslint evil: true, strict: false, regexp: false */
/*members "", "\b", "\t", "\n", "\f", "\r", "\"", JSON, "\\", apply,
call, charCodeAt, getUTCDate, getUTCFullYear, getUTCHours,
getUTCMinutes, getUTCMonth, getUTCSeconds, hasOwnProperty, join,
lastIndex, length, parse, prototype, push, replace, slice, stringify,
test, toJSON, toString, valueOf
*/
// Create a JSON object only if one does not already exist. We create the
// methods in a closure to avoid creating global variables.
if (!this.JSON2)
{
this.JSON2 = {};
}
(function () {
"use strict";
function f(n) {
// Format integers to have at least two digits.
return n < 10 ? '0' + n : n;
}
if (typeof Date.prototype.toJSON !== 'function') {
Date.prototype.toJSON = function (key) {
return isFinite(this.valueOf()) ?
this.getUTCFullYear() + '-' +
f(this.getUTCMonth() + 1) + '-' +
f(this.getUTCDate()) + 'T' +
f(this.getUTCHours()) + ':' +
f(this.getUTCMinutes()) + ':' +
f(this.getUTCSeconds()) + 'Z' : null;
};
String.prototype.toJSON =
Number.prototype.toJSON =
Boolean.prototype.toJSON = function (key) {
return this.valueOf();
};
}
var cx = /[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,
escapable = /[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,
gap,
indent,
meta = { // table of character substitutions
'\b': '\\b',
'\t': '\\t',
'\n': '\\n',
'\f': '\\f',
'\r': '\\r',
'"' : '\\"',
'\\': '\\\\'
},
rep;
function quote(string) {
escapable.lastIndex = 0;
return escapable.test(string) ?
'"' + string.replace(escapable, function (a) {
var c = meta[a];
return typeof c === 'string' ? c :
'\\u' + ('0000' + a.charCodeAt(0).toString(16)).slice(-4);
}) + '"' :
'"' + string + '"';
}
function str(key, holder) {
var i, // The loop counter.
k, // The member key.
v, // The member value.
length,
mind = gap,
partial,
value = holder[key];
if (value && typeof value === 'object' &&
typeof value.toJSON === 'function') {
value = value.toJSON(key);
}
if (typeof rep === 'function') {
value = rep.call(holder, key, value);
}
switch (typeof value) {
case 'string':
return quote(value);
case 'number':
return isFinite(value) ? String(value) : 'null';
case 'boolean':
case 'null':
return String(value);
case 'object':
if (!value) {
return 'null';
}
gap += indent;
partial = [];
if (Object.prototype.toString.apply(value) === '[object Array]') {
length = value.length;
for (i = 0; i < length; i += 1) {
partial[i] = str(i, value) || 'null';
}
v = partial.length === 0 ? '[]' :
gap ? '[\n' + gap +
partial.join(',\n' + gap) + '\n' +
mind + ']' :
'[' + partial.join(',') + ']';
gap = mind;
return v;
}
if (rep && typeof rep === 'object') {
length = rep.length;
for (i = 0; i < length; i += 1) {
k = rep[i];
if (typeof k === 'string') {
v = str(k, value);
if (v) {
partial.push(quote(k) + (gap ? ': ' : ':') + v);
}
}
}
} else {
for (k in value) {
if (Object.hasOwnProperty.call(value, k)) {
v = str(k, value);
if (v) {
partial.push(quote(k) + (gap ? ': ' : ':') + v);
}
}
}
}
v = partial.length === 0 ? '{}' :
gap ? '{\n' + gap + partial.join(',\n' + gap) + '\n' +
mind + '}' : '{' + partial.join(',') + '}';
gap = mind;
return v;
}
}
if (typeof JSON2.stringify !== 'function') {
JSON2.stringify = function (value, replacer, space) {
var i;
gap = '';
indent = '';
if (typeof space === 'number') {
for (i = 0; i < space; i += 1) {
indent += ' ';
}
} else if (typeof space === 'string') {
indent = space;
}
rep = replacer;
if (replacer && typeof replacer !== 'function' &&
(typeof replacer !== 'object' ||
typeof replacer.length !== 'number')) {
throw new Error('JSON2.stringify');
}
return str('', {'': value});
};
}
if (typeof JSON2.parse !== 'function') {
JSON2.parse = function (text, reviver) {
var j;
function walk(holder, key) {
var k, v, value = holder[key];
if (value && typeof value === 'object') {
for (k in value) {
if (Object.hasOwnProperty.call(value, k)) {
v = walk(value, k);
if (v !== undefined) {
value[k] = v;
} else {
delete value[k];
}
}
}
}
return reviver.call(holder, key, value);
}
text = String(text);
cx.lastIndex = 0;
if (cx.test(text)) {
text = text.replace(cx, function (a) {
return '\\u' +
('0000' + a.charCodeAt(0).toString(16)).slice(-4);
});
}
if (/^[\],:{}\s]*$/
.test(text.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g, '@')
.replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, ']')
.replace(/(?:^|:|,)(?:\s*\[)+/g, ''))) {
j = eval('(' + text + ')');
return typeof reviver === 'function' ?
walk({'': j}, '') : j;
}
throw new SyntaxError('JSON2.parse');
};
}
}());
| zz-ms | trunk/zz-ms-v2.0/src/main/webapp/js/json2.js | JavaScript | asf20 | 13,537 |
/**
* jQuery EasyUI 1.3.2
*
* Copyright (c) 2009-2013 www.jeasyui.com. All rights reserved.
*
* Licensed under the GPL or commercial licenses
* To use it on other terms please contact us: jeasyui@gmail.com
* http://www.gnu.org/licenses/gpl.txt
* http://www.jeasyui.com/license_commercial.php
*
*/
(function(){
var _1={draggable:{js:"jquery.draggable.js"},droppable:{js:"jquery.droppable.js"},resizable:{js:"jquery.resizable.js"},linkbutton:{js:"jquery.linkbutton.js",css:"linkbutton.css"},progressbar:{js:"jquery.progressbar.js",css:"progressbar.css"},pagination:{js:"jquery.pagination.js",css:"pagination.css",dependencies:["linkbutton"]},datagrid:{js:"jquery.datagrid.js",css:"datagrid.css",dependencies:["panel","resizable","linkbutton","pagination"]},treegrid:{js:"jquery.treegrid.js",css:"tree.css",dependencies:["datagrid"]},propertygrid:{js:"jquery.propertygrid.js",css:"propertygrid.css",dependencies:["datagrid"]},panel:{js:"jquery.panel.js",css:"panel.css"},window:{js:"jquery.window.js",css:"window.css",dependencies:["resizable","draggable","panel"]},dialog:{js:"jquery.dialog.js",css:"dialog.css",dependencies:["linkbutton","window"]},messager:{js:"jquery.messager.js",css:"messager.css",dependencies:["linkbutton","window","progressbar"]},layout:{js:"jquery.layout.js",css:"layout.css",dependencies:["resizable","panel"]},form:{js:"jquery.form.js"},menu:{js:"jquery.menu.js",css:"menu.css"},tabs:{js:"jquery.tabs.js",css:"tabs.css",dependencies:["panel","linkbutton"]},splitbutton:{js:"jquery.splitbutton.js",css:"splitbutton.css",dependencies:["linkbutton","menu"]},menubutton:{js:"jquery.menubutton.js",css:"menubutton.css",dependencies:["linkbutton","menu"]},accordion:{js:"jquery.accordion.js",css:"accordion.css",dependencies:["panel"]},calendar:{js:"jquery.calendar.js",css:"calendar.css"},combo:{js:"jquery.combo.js",css:"combo.css",dependencies:["panel","validatebox"]},combobox:{js:"jquery.combobox.js",css:"combobox.css",dependencies:["combo"]},combotree:{js:"jquery.combotree.js",dependencies:["combo","tree"]},combogrid:{js:"jquery.combogrid.js",dependencies:["combo","datagrid"]},validatebox:{js:"jquery.validatebox.js",css:"validatebox.css"},numberbox:{js:"jquery.numberbox.js",dependencies:["validatebox"]},searchbox:{js:"jquery.searchbox.js",css:"searchbox.css",dependencies:["menubutton"]},spinner:{js:"jquery.spinner.js",css:"spinner.css",dependencies:["validatebox"]},numberspinner:{js:"jquery.numberspinner.js",dependencies:["spinner","numberbox"]},timespinner:{js:"jquery.timespinner.js",dependencies:["spinner"]},tree:{js:"jquery.tree.js",css:"tree.css",dependencies:["draggable","droppable"]},datebox:{js:"jquery.datebox.js",css:"datebox.css",dependencies:["calendar","combo"]},datetimebox:{js:"jquery.datetimebox.js",dependencies:["datebox","timespinner"]},slider:{js:"jquery.slider.js",dependencies:["draggable"]},parser:{js:"jquery.parser.js"}};
var _2={"af":"easyui-lang-af.js","bg":"easyui-lang-bg.js","ca":"easyui-lang-ca.js","cs":"easyui-lang-cs.js","cz":"easyui-lang-cz.js","da":"easyui-lang-da.js","de":"easyui-lang-de.js","en":"easyui-lang-en.js","es":"easyui-lang-es.js","fr":"easyui-lang-fr.js","it":"easyui-lang-it.js","nl":"easyui-lang-nl.js","pt_BR":"easyui-lang-pt_BR.js","ru":"easyui-lang-ru.js","tr":"easyui-lang-tr.js","zh_CN":"easyui-lang-zh_CN.js","zh_TW":"easyui-lang-zh_TW.js"};
var _3={};
function _4(_5,_6){
var _7=false;
var _8=document.createElement("script");
_8.type="text/javascript";
_8.language="javascript";
_8.src=_5;
_8.onload=_8.onreadystatechange=function(){
if(!_7&&(!_8.readyState||_8.readyState=="loaded"||_8.readyState=="complete")){
_7=true;
_8.onload=_8.onreadystatechange=null;
if(_6){
_6.call(_8);
}
}
};
document.getElementsByTagName("head")[0].appendChild(_8);
};
function _9(_a,_b){
_4(_a,function(){
document.getElementsByTagName("head")[0].removeChild(this);
if(_b){
_b();
}
});
};
function _c(_d,_e){
var _f=document.createElement("link");
_f.rel="stylesheet";
_f.type="text/css";
_f.media="screen";
_f.href=_d;
document.getElementsByTagName("head")[0].appendChild(_f);
if(_e){
_e.call(_f);
}
};
function _10(_11,_12){
_3[_11]="loading";
var _13=_1[_11];
var _14="loading";
var _15=(easyloader.css&&_13["css"])?"loading":"loaded";
if(easyloader.css&&_13["css"]){
if(/^http/i.test(_13["css"])){
var url=_13["css"];
}else{
var url=easyloader.base+"themes/"+easyloader.theme+"/"+_13["css"];
}
_c(url,function(){
_15="loaded";
if(_14=="loaded"&&_15=="loaded"){
_16();
}
});
}
if(/^http/i.test(_13["js"])){
var url=_13["js"];
}else{
var url=easyloader.base+"plugins/"+_13["js"];
}
_4(url,function(){
_14="loaded";
if(_14=="loaded"&&_15=="loaded"){
_16();
}
});
function _16(){
_3[_11]="loaded";
easyloader.onProgress(_11);
if(_12){
_12();
}
};
};
function _17(_18,_19){
var mm=[];
var _1a=false;
if(typeof _18=="string"){
add(_18);
}else{
for(var i=0;i<_18.length;i++){
add(_18[i]);
}
}
function add(_1b){
if(!_1[_1b]){
return;
}
var d=_1[_1b]["dependencies"];
if(d){
for(var i=0;i<d.length;i++){
add(d[i]);
}
}
mm.push(_1b);
};
function _1c(){
if(_19){
_19();
}
easyloader.onLoad(_18);
};
var _1d=0;
function _1e(){
if(mm.length){
var m=mm[0];
if(!_3[m]){
_1a=true;
_10(m,function(){
mm.shift();
_1e();
});
}else{
if(_3[m]=="loaded"){
mm.shift();
_1e();
}else{
if(_1d<easyloader.timeout){
_1d+=10;
setTimeout(arguments.callee,10);
}
}
}
}else{
if(easyloader.locale&&_1a==true&&_2[easyloader.locale]){
var url=easyloader.base+"locale/"+_2[easyloader.locale];
_9(url,function(){
_1c();
});
}else{
_1c();
}
}
};
_1e();
};
easyloader={modules:_1,locales:_2,base:".",theme:"default",css:true,locale:null,timeout:2000,load:function(_1f,_20){
if(/\.css$/i.test(_1f)){
if(/^http/i.test(_1f)){
_c(_1f,_20);
}else{
_c(easyloader.base+_1f,_20);
}
}else{
if(/\.js$/i.test(_1f)){
if(/^http/i.test(_1f)){
_4(_1f,_20);
}else{
_4(easyloader.base+_1f,_20);
}
}else{
_17(_1f,_20);
}
}
},onProgress:function(_21){
},onLoad:function(_22){
}};
var _23=document.getElementsByTagName("script");
for(var i=0;i<_23.length;i++){
var src=_23[i].src;
if(!src){
continue;
}
var m=src.match(/easyloader\.js(\W|$)/i);
if(m){
easyloader.base=src.substring(0,m.index);
}
}
window.using=easyloader.load;
if(window.jQuery){
jQuery(function(){
easyloader.load("parser",function(){
jQuery.parser.parse();
});
});
}
})();
| zz-ms | trunk/zz-ms-v2.0/src/main/webapp/js/easyloader.js | JavaScript | asf20 | 6,295 |
(function() {
var iOSCheckbox;
var __slice = Array.prototype.slice;
iOSCheckbox = (function() {
function iOSCheckbox(elem, options) {
var key, opts, value;
this.elem = $(elem);
opts = $.extend({}, iOSCheckbox.defaults, options);
for (key in opts) {
value = opts[key];
this[key] = value;
}
this.elem.data(this.dataName, this);
this.wrapCheckboxWithDivs();
this.attachEvents();
this.disableTextSelection();
if (this.resizeHandle) {
this.optionallyResize('handle');
}
if (this.resizeContainer) {
this.optionallyResize('container');
}
this.initialPosition();
}
iOSCheckbox.prototype.isDisabled = function() {
return this.elem.is(':disabled');
};
iOSCheckbox.prototype.wrapCheckboxWithDivs = function() {
this.elem.wrap("<div class='" + this.containerClass + "' />");
this.container = this.elem.parent();
this.offLabel = $("<label class='" + this.labelOffClass + "' style='width:" + this.labelWidth + "'>\n <span>" + this.uncheckedLabel + "</span>\n</label>").appendTo(this.container);
this.offSpan = this.offLabel.children('span');
this.onLabel = $("<label class='" + this.labelOnClass + "' style='width:" + this.labelWidth + "'>\n <span>" + this.checkedLabel + "</span>\n</label>").appendTo(this.container);
this.onSpan = this.onLabel.children('span');
return this.handle = $("<div class='" + this.handleClass + "'>\n <div class='" + this.handleRightClass + "'>\n <div class='" + this.handleCenterClass + "' />\n </div>\n</div>").appendTo(this.container);
};
iOSCheckbox.prototype.disableTextSelection = function() {
if ($.browser.msie) {
return $([ this.handle, this.offLabel, this.onLabel, this.container
]).attr("unselectable", "on");
}
};
iOSCheckbox.prototype._getDimension = function(elem, dimension) {
if ($.fn.actual != null) {
return elem.actual(dimension);
} else {
return elem[dimension]();
}
};
iOSCheckbox.prototype.optionallyResize = function(mode) {
var newWidth, offLabelWidth, onLabelWidth;
onLabelWidth = this._getDimension(this.onLabel, "width");
offLabelWidth = this._getDimension(this.offLabel, "width");
if (mode === "container") {
newWidth = onLabelWidth > offLabelWidth ? onLabelWidth : offLabelWidth;
newWidth += this._getDimension(this.handle, "width") + this.handleMargin;
return this.container.css({
width : newWidth
});
} else {
newWidth = onLabelWidth > offLabelWidth ? onLabelWidth : offLabelWidth;
return this.handle.css({
width : newWidth
});
}
};
iOSCheckbox.prototype.onMouseDown = function(event) {
var x;
event.preventDefault();
if (this.isDisabled()) {
return;
}
x = event.pageX || event.originalEvent.changedTouches[0].pageX;
iOSCheckbox.currentlyClicking = this.handle;
iOSCheckbox.dragStartPosition = x;
return iOSCheckbox.handleLeftOffset = parseInt(this.handle.css('left'), 10) || 0;
};
iOSCheckbox.prototype.onDragMove = function(event, x) {
var newWidth, p;
if (iOSCheckbox.currentlyClicking !== this.handle) {
return;
}
p = (x + iOSCheckbox.handleLeftOffset - iOSCheckbox.dragStartPosition) / this.rightSide;
if (p < 0) {
p = 0;
}
if (p > 1) {
p = 1;
}
newWidth = p * this.rightSide;
this.handle.css({
left : newWidth
});
this.onLabel.css({
width : newWidth + this.handleRadius
});
this.offSpan.css({
marginRight : -newWidth
});
return this.onSpan.css({
marginLeft : -(1 - p) * this.rightSide
});
};
iOSCheckbox.prototype.onDragEnd = function(event, x) {
var p;
if (iOSCheckbox.currentlyClicking !== this.handle) {
return;
}
if (this.isDisabled()) {
return;
}
if (iOSCheckbox.dragging) {
p = (x - iOSCheckbox.dragStartPosition) / this.rightSide;
this.elem.prop('checked', p >= 0.5);
} else {
this.elem.prop('checked', !this.elem.prop('checked'));
}
iOSCheckbox.currentlyClicking = null;
iOSCheckbox.dragging = null;
return this.didChange();
};
iOSCheckbox.prototype.refresh = function() {
return this.didChange();
};
iOSCheckbox.prototype.didChange = function() {
var new_left;
if (typeof this.onChange === "function") {
this.onChange(this.elem, this.elem.prop('checked'));
}
if (this.isDisabled()) {
this.container.addClass(this.disabledClass);
return false;
} else {
this.container.removeClass(this.disabledClass);
}
new_left = this.elem.prop('checked') ? this.rightSide : 0;
this.handle.animate({
left : new_left
}, this.duration);
this.onLabel.animate({
width : new_left + this.handleRadius
}, this.duration);
this.offSpan.animate({
marginRight : -new_left
}, this.duration);
return this.onSpan.animate({
marginLeft : new_left - this.rightSide
}, this.duration);
};
iOSCheckbox.prototype.attachEvents = function() {
var localMouseMove, localMouseUp, self;
self = this;
localMouseMove = function(event) {
return self.onGlobalMove.apply(self, arguments);
};
localMouseUp = function(event) {
self.onGlobalUp.apply(self, arguments);
$(document).unbind('mousemove touchmove', localMouseMove);
return $(document).unbind('mouseup touchend', localMouseUp);
};
return this.container.bind('mousedown touchstart', function(event) {
self.onMouseDown.apply(self, arguments);
$(document).bind('mousemove touchmove', localMouseMove);
return $(document).bind('mouseup touchend', localMouseUp);
});
};
iOSCheckbox.prototype.initialPosition = function() {
var containerWidth, offset;
containerWidth = this._getDimension(this.container, "width");
this.offLabel.css({
width : containerWidth - this.containerRadius
});
offset = this.containerRadius + 1;
if ($.browser.msie && $.browser.version < 7) {
offset -= 3;
}
this.rightSide = containerWidth - this._getDimension(this.handle, "width") - offset;
if (this.elem.is(':checked')) {
this.handle.css({
left : this.rightSide
});
this.onLabel.css({
width : this.rightSide + this.handleRadius
});
this.offSpan.css({
marginRight : -this.rightSide
});
} else {
this.onLabel.css({
width : 0
});
this.onSpan.css({
marginLeft : -this.rightSide
});
}
if (this.isDisabled()) {
return this.container.addClass(this.disabledClass);
}
};
iOSCheckbox.prototype.onGlobalMove = function(event) {
var x;
if (!(!this.isDisabled() && iOSCheckbox.currentlyClicking)) {
return;
}
event.preventDefault();
x = event.pageX || event.originalEvent.changedTouches[0].pageX;
if (!iOSCheckbox.dragging && (Math.abs(iOSCheckbox.dragStartPosition - x) > this.dragThreshold)) {
iOSCheckbox.dragging = true;
}
return this.onDragMove(event, x);
};
iOSCheckbox.prototype.onGlobalUp = function(event) {
var x;
if (!iOSCheckbox.currentlyClicking) {
return;
}
event.preventDefault();
x = event.pageX || event.originalEvent.changedTouches[0].pageX;
this.onDragEnd(event, x);
return false;
};
iOSCheckbox.defaults = {
duration : 150,
checkedLabel : '是',
uncheckedLabel : '否',
resizeHandle : true,
resizeContainer : true,
disabledClass : 'iPhoneCheckDisabled',
containerClass : 'iPhoneCheckContainer',
labelOnClass : 'iPhoneCheckLabelOn',
labelOffClass : 'iPhoneCheckLabelOff',
handleClass : 'iPhoneCheckHandle',
handleCenterClass : 'iPhoneCheckHandleCenter',
handleRightClass : 'iPhoneCheckHandleRight',
dragThreshold : 5,
handleMargin : 15,
handleRadius : 4,
containerRadius : 5,
dataName : "iphoneStyle",
labelWidth : '30px',
onChange : function() {
if (this.elem.is(':checked')) {
$('#on_off').val("1");
}else{
$('#on_off').val("0");
}
}
};
return iOSCheckbox;
})();
$.iphoneStyle = this.iOSCheckbox = iOSCheckbox;
$.fn.iphoneStyle = function() {
var args, checkbox, dataName, existingControl, method, params, _i, _len, _ref, _ref2, _ref3, _ref4;
args = 1 <= arguments.length ? __slice.call(arguments, 0) : [];
dataName = (_ref = (_ref2 = args[0]) != null ? _ref2.dataName : void 0) != null ? _ref : iOSCheckbox.defaults.dataName;
_ref3 = this.filter(':checkbox');
for (_i = 0, _len = _ref3.length; _i < _len; _i++) {
checkbox = _ref3[_i];
existingControl = $(checkbox).data(dataName);
if (existingControl != null) {
method = args[0], params = 2 <= args.length ? __slice.call(args, 1) : [];
if ((_ref4 = existingControl[method]) != null) {
_ref4.apply(existingControl, params);
}
} else {
new iOSCheckbox(checkbox, args[0]);
}
}
return this;
};
$.fn.iOSCheckbox = function(options) {
var opts;
if (options == null) {
options = {};
}
opts = $.extend({}, options, {
resizeHandle : false,
disabledClass : 'iOSCheckDisabled',
containerClass : 'iOSCheckContainer',
labelOnClass : 'iOSCheckLabelOn',
labelOffClass : 'iOSCheckLabelOff',
handleClass : 'iOSCheckHandle',
handleCenterClass : 'iOSCheckHandleCenter',
handleRightClass : 'iOSCheckHandleRight',
dataName : 'iOSCheckbox'
});
return this.iphoneStyle(opts);
};
}).call(this);
| zz-ms | trunk/zz-ms-v2.0/src/main/webapp/js/iphone.check.js | JavaScript | asf20 | 9,551 |
$(document).ready(function() {
getCookie();
onfocus();
$(".on_off_checkbox").iphoneStyle();
$('.tip a ').tipsy({
gravity : 'sw'
});
$('#login').show().animate({
opacity : 1
}, 2000);
$('.logo').show().animate({
opacity : 1,
top : '32%'
}, 800, function() {
$('.logo').show().delay(1200).animate({
opacity : 1,
top : '1%'
}, 300, function() {
$('.formLogin').animate({
opacity : 1,
left : '0'
}, 300);
$('.userbox').animate({
opacity : 0
}, 200).hide();
});
});
$('.userload').click(function(e) {
$('.formLogin').animate({
opacity : 1,
left : '0'
}, 300);
$('.userbox').animate({
opacity : 0
}, 200, function() {
$('.userbox').hide();
});
});
// 重置
$('#forgetpass').click(function(e) {
$(":input").each(function() {
$('#'+this.name).val("");
});
});
// 点击登录
$('#but_login').click(function(e) {
submit();
});
//回车登录
$(document).keydown(function(e){
if(e.keyCode == 13) {
submit();
}
});
$('#Kaptcha').click(
function() {
$(this).hide().attr('src',rootPath + '/kaptcha.jpg?' + Math.floor(Math.random() * 100)).fadeIn();
});
});
//表单提交
function submit()
{
var submit = true;
$("input[nullmsg]").each(function() {
if ($("#" + this.name).val() == "") {
showError($("#" + this.name).attr("nullmsg"), 500);
jrumble();
setTimeout('hideTop()', 1000);
submit = false;
return false;
}
});
if (submit) {
hideTop();
loading('登陆中..', 1);
setTimeout("unloading()", 1000);
setTimeout("Login()", 1000);
}
}
//登录处理函数
function Login() {
setCookie();
var actionurl=$('form').attr('action');//提交路径
//var checkurl=$('form').attr('check');
var formData = new Object();
var data=$(":input").each(function() {
formData[this.name] =$("#"+this.name ).val();
});
$.ajax({
async : false,
cache : false,
type : 'POST',
url : actionurl,// 请求的action路径
data : formData,
error : function() {// 请求失败处理函数
alert("登陆异常,请稍候再试");
},
success : function(data) {
if (data.status) {
loginsuccess();
setTimeout("window.location.href=rootPath + '/index.html'", 1000);
}
else {
showError(data.message);
}
}
});
}
//设置cookie
function setCookie()
{
if ($('#on_off').val() == '1') {
$("input[iscookie='true']").each(function() {
$.cookie(this.name, $("#"+this.name).val(), "/",24);
$.cookie("COOKIE_NAME","true", "/",24);
});
} else {
$("input[iscookie='true']").each(function() {
$.cookie(this.name,null);
$.cookie("COOKIE_NAME",null);
});
}
}
//读取cookie
function getCookie()
{
var COOKIE_NAME=$.cookie("COOKIE_NAME");
if (COOKIE_NAME !=null) {
$("input[iscookie='true']").each(function() {
$($("#"+this.name).val( $.cookie(this.name)));
});
$("#on_off").attr("checked", true);
$("#on_off").val("1");
}
else
{
$("#on_off").attr("checked", false);
$("#on_off").val("0");
}
}
//点击消息关闭提示
$('#alertMessage').click(function() {
hideTop();
});
//显示错误提示
function showError(str) {
$('#alertMessage').addClass('error').html(str).stop(true, true).show().animate({
opacity : 1,
right : '0'
}, 500);
}
//验证通过加载动画
function loginsuccess()
{
$("#login").animate({
opacity : 1,
top : '40%'
}, 200, function() {
$('.userbox').show().animate({
opacity : 1
}, 500);
$("#login").animate({
opacity : 0,
top : '60%'
}, 500, function() {
$(this).fadeOut(200, function() {
$(".text_success").slideDown();
$("#successLogin").animate({
opacity : 1,
height : "200px"
}, 1000);
});
});
});
}
function showSuccess(str) {
$('#alertMessage').removeClass('error').html(str).stop(true, true).show().animate({
opacity : 1,
right : '0'
}, 500);
}
function onfocus() {
if ($(window).width() > 480) {
$('.tip input').tipsy({
trigger : 'focus',
gravity : 'w',
live : true
});
} else {
$('.tip input').tipsy("hide");
}
}
function hideTop() {
$('#alertMessage').animate({
opacity : 0,
right : '-20'
}, 500, function() {
$(this).hide();
});
}
//加载信息
function loading(name, overlay) {
$('body').append('<div id="overlay"></div><div id="preloader">' + name + '..</div>');
if (overlay == 1) {
$('#overlay').css('opacity', 0.1).fadeIn(function() {
$('#preloader').fadeIn();
});
return false;
}
$('#preloader').fadeIn();
}
function unloading() {
$('#preloader').fadeOut('fast', function() {
$('#overlay').fadeOut();
});
}
// 表单晃动
function jrumble() {
$('.inner').jrumble({
x : 4,
y : 0,
rotation : 0
});
$('.inner').trigger('startRumble');
setTimeout('$(".inner").trigger("stopRumble")', 500);
} | zz-ms | trunk/zz-ms-v2.0/src/main/webapp/js/login.js | JavaScript | asf20 | 4,977 |
// tipsy, facebook style tooltips for jquery
// version 1.0.0a
// (c) 2008-2010 jason frame [jason@onehackoranother.com]
// released under the MIT license
(function($) {
function maybeCall(thing, ctx) {
return (typeof thing == 'function') ? (thing.call(ctx)) : thing;
};
function Tipsy(element, options) {
this.$element = $(element);
this.options = options;
this.enabled = true;
this.fixTitle();
};
Tipsy.prototype = {
show: function() {
var title = this.getTitle();
if (title && this.enabled) {
var $tip = this.tip();
$tip.find('.tipsy-inner')[this.options.html ? 'html' : 'text'](title);
$tip[0].className = 'tipsy'; // reset classname in case of dynamic gravity
$tip.remove().css({top: 0, left: 0, visibility: 'hidden', display: 'block'}).prependTo(document.body);
var pos = $.extend({}, this.$element.offset(), {
width: this.$element[0].offsetWidth,
height: this.$element[0].offsetHeight
});
var actualWidth = $tip[0].offsetWidth,
actualHeight = $tip[0].offsetHeight,
gravity = maybeCall(this.options.gravity, this.$element[0]);
var tp;
switch (gravity.charAt(0)) {
case 'n':
tp = {top: pos.top + pos.height + this.options.offset, left: pos.left + pos.width / 2 - actualWidth / 2};
break;
case 's':
tp = {top: pos.top - actualHeight - this.options.offset, left: pos.left + pos.width / 2 - actualWidth / 2};
break;
case 'e':
tp = {top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left - actualWidth - this.options.offset};
break;
case 'w':
tp = {top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left + pos.width + this.options.offset};
break;
}
if (gravity.length == 2) {
if (gravity.charAt(1) == 'w') {
tp.left = pos.left + pos.width / 2 - 15;
} else {
tp.left = pos.left + pos.width / 2 - actualWidth + 15;
}
}
$tip.css(tp).addClass('tipsy-' + gravity);
$tip.find('.tipsy-arrow')[0].className = 'tipsy-arrow tipsy-arrow-' + gravity.charAt(0);
if (this.options.className) {
$tip.addClass(maybeCall(this.options.className, this.$element[0]));
}
if (this.options.fade) {
$tip.stop().css({opacity: 0, display: 'block', visibility: 'visible'}).animate({opacity: this.options.opacity});
} else {
$tip.css({visibility: 'visible', opacity: this.options.opacity});
}
}
},
hide: function() {
if (this.options.fade) {
this.tip().stop().fadeOut(function() { $(this).remove(); });
} else {
this.tip().remove();
}
},
fixTitle: function() {
var $e = this.$element;
if ($e.attr('title') || typeof($e.attr('original-title')) != 'string') {
$e.attr('original-title', $e.attr('title') || '').removeAttr('title');
}
},
getTitle: function() {
var title, $e = this.$element, o = this.options;
this.fixTitle();
var title, o = this.options;
if (typeof o.title == 'string') {
title = $e.attr(o.title == 'title' ? 'original-title' : o.title);
} else if (typeof o.title == 'function') {
title = o.title.call($e[0]);
}
title = ('' + title).replace(/(^\s*|\s*$)/, "");
return title || o.fallback;
},
tip: function() {
if (!this.$tip) {
this.$tip = $('<div class="tipsy"></div>').html('<div class="tipsy-arrow"></div><div class="tipsy-inner"></div>');
}
return this.$tip;
},
validate: function() {
if (!this.$element[0].parentNode) {
this.hide();
this.$element = null;
this.options = null;
}
},
enable: function() { this.enabled = true; },
disable: function() { this.enabled = false; },
toggleEnabled: function() { this.enabled = !this.enabled; }
};
$.fn.tipsy = function(options) {
if (options === true) {
return this.data('tipsy');
} else if (typeof options == 'string') {
var tipsy = this.data('tipsy');
if (tipsy) tipsy[options]();
return this;
}
options = $.extend({}, $.fn.tipsy.defaults, options);
function get(ele) {
var tipsy = $.data(ele, 'tipsy');
if (!tipsy) {
tipsy = new Tipsy(ele, $.fn.tipsy.elementOptions(ele, options));
$.data(ele, 'tipsy', tipsy);
}
return tipsy;
}
function enter() {
var tipsy = get(this);
tipsy.hoverState = 'in';
if (options.delayIn == 0) {
tipsy.show();
} else {
tipsy.fixTitle();
setTimeout(function() { if (tipsy.hoverState == 'in') tipsy.show(); }, options.delayIn);
}
};
function leave() {
var tipsy = get(this);
tipsy.hoverState = 'out';
if (options.delayOut == 0) {
tipsy.hide();
} else {
setTimeout(function() { if (tipsy.hoverState == 'out') tipsy.hide(); }, options.delayOut);
}
};
if (!options.live) this.each(function() { get(this); });
if (options.trigger != 'manual') {
var binder = options.live ? 'live' : 'bind',
eventIn = options.trigger == 'hover' ? 'mouseenter' : 'focus',
eventOut = options.trigger == 'hover' ? 'mouseleave' : 'blur';
this[binder](eventIn, enter)[binder](eventOut, leave);
}
return this;
};
$.fn.tipsy.defaults = {
className: null,
delayIn: 0,
delayOut: 0,
fade: false,
fallback: '',
gravity: 'n',
html: false,
live: false,
offset: 0,
opacity: 1,
title: 'title',
trigger: 'hover'
};
// Overwrite this method to provide options on a per-element basis.
// For example, you could store the gravity in a 'tipsy-gravity' attribute:
// return $.extend({}, options, {gravity: $(ele).attr('tipsy-gravity') || 'n' });
// (remember - do not modify 'options' in place!)
$.fn.tipsy.elementOptions = function(ele, options) {
return $.metadata ? $.extend({}, options, $(ele).metadata()) : options;
};
$.fn.tipsy.autoNS = function() {
return $(this).offset().top > ($(document).scrollTop() + $(window).height() / 2) ? 's' : 'n';
};
$.fn.tipsy.autoWE = function() {
return $(this).offset().left > ($(document).scrollLeft() + $(window).width()/ 2 ) ? 'e' : 'w';
};
/**
* yields a closure of the supplied parameters, producing a function that takes
* no arguments and is suitable for use as an autogravity function like so:
*
* @param margin (int) - distance from the viewable region edge that an
* element should be before setting its tooltip's gravity to be away
* from that edge.
* @param prefer (string, e.g. 'n', 'sw', 'w') - the direction to prefer
* if there are no viewable region edges effecting the tooltip's
* gravity. It will try to vary from this minimally, for example,
* if 'sw' is preferred and an element is near the right viewable
* region edge, but not the top edge, it will set the gravity for
* that element's tooltip to be 'se', preserving the southern
* component.
*/
$.fn.tipsy.autoBounds = function(margin, prefer) {
return function() {
var dir = {ns: prefer[0], ew: (prefer.length > 1 ? prefer[1] : false)},
boundTop = $(document).scrollTop() + margin,
boundLeft = $(document).scrollLeft() + margin,
$this = $(this);
if ($this.offset().top < boundTop) dir.ns = 'n';
if ($this.offset().left < boundLeft) dir.ew = 'w';
if ($(window).width() + $(document).scrollLeft() - $this.offset().left < margin) dir.ew = 'e';
if ($(window).height() + $(document).scrollTop() - $this.offset().top < margin) dir.ns = 's';
return dir.ns + (dir.ew ? dir.ew : '');
}
};
$.fn.tipsy.autoHide = function() {
return $(this).tip().stop().fadeOut(function() { $(this).remove(); });
};
})(jQuery); | zz-ms | trunk/zz-ms-v2.0/src/main/webapp/js/jquery.tipsy.js | JavaScript | asf20 | 9,450 |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>xhEditor初始化代码生成向导 for xhEditor v1.1.14</title>
<script type="text/javascript" src="jquery/jquery-1.4.4.min.js"></script>
<script type="text/javascript" src="xheditor-1.1.14-zh-cn.min.js"></script>
<script type="text/javascript">
$(pageInit);
function pageInit()
{
$('#editorMode').change(updateAll);
$('#update').click(updateAll);
$('#varSetup').find('input,select').focus(function(){$(this).select();}).keypress(function(ev){if(ev.which==13)updateAll();});
$('#source').focus(function(){$(this).select();});
$('#frmSetup').submit(function(){return false;}).bind('reset',function(){setTimeout(updateAll,10);});
updateAll();
}
function toggleDisplay(id){$('#'+id).toggle(100);}
function updateAll()
{
var arrVar=[],sVar,sJSInit,sInit,textareaID=$('input[name=id]').val();
$('#varSetup fieldset').find('input,select').each(function(){
var name=this.name,elem=$(this),value=elem.val();
if(name!='id'&&value!=''&&!elem.find('option:selected').text().match(/(default)/i))
{
if(elem.attr('class')=='text')value="'"+value+"'";
arrVar.push(name+':'+value);
}
});
sVar=arrVar.join(',');
var editor=$('textarea[name=preview]')[0].editor;
if(editor)editor.getSource();
$('textarea[name=preview]').attr('id',textareaID).xheditor(false);
sJSInit="$('#"+textareaID+"').xheditor("+(sVar?'{'+sVar+'}':'')+');';
if($('#editorMode').val()==1)
{
sInit=' class="xheditor'+(sVar?' {'+sVar+'}':'')+'"';
sInit=sInit.replace(/(.+?xheditor)(.+?)tools:'(simple|mini)',?(.+?)/i,'$1-$3$2$4');
}
else sInit=sJSInit;
$('link[id^=xheCSS]').remove();
try{eval(sJSInit);}catch(e){}
$('#source').val(sInit);
}
</script>
<style type="text/css">
body{
font-size:12px;
margin:0;padding:0 20px;
}
.top{border:1px solid #ccc;padding:10px;}
.section{padding:5px 30px;}
#varSetup fieldset{border:0 none;border-top:2px solid #999999;padding:5px;}
#varSetup fieldset legend{padding:0 5px;font-size:13px;}
#varSetup fieldset p{margin:5px;}
#varSetup fieldset label{display:inline-block;width:120px;}
#varSetup fieldset input,#varSetup fieldset select{width:300px;border-width:1px;border:1px #ABADB3 solid;padding:2px;}
#varSetup span{color:#666;}
#varSetup input[type=button],#varSetup input[type=reset]{border-width:1px;padding:3px 8px;}
#source{border-width:1px;border:1px #ABADB3 solid;padding:2px;}
#note{margin:20px 0;border:1px solid #ccc;padding:10px;color:#666;}
</style>
</head>
<body>
<h1 class="top">xhEditor初始化代码生成向导 for xhEditor v1.1.14</h1>
<h2>1: 选择编辑器初始化模式</h2>
<div class="section"><select id="editorMode"><option value="1" selected="selected">Class初始化</option><option value="2">Javascript初始化</option></select></div>
<h2>2: 更改初始化参数</h2>
<div id="varSetup" class="section">
<form id="frmSetup">
<fieldset>
<legend><a href="javascript:toggleDisplay('group1')">基本参数</a></legend>
<div id="group1">
<p><label><acronym title="需要初始化的textarea ID">textareaID</acronym></label><input type="text" class="text" value="elem1" name="id"> <span>需要初始化为编辑器的textarea的id值</span></p>
<p><label><acronym title="按钮自定义选择,留空默认full按钮组">tools</acronym></label><input type="text" class="text" value="" name="tools"> <span>工具栏组:full,mfull,simple,mini,或者自定义每个按钮,<a href="http://xheditor.com/manual/2#chapter2" target="_blank">点击查看完整按钮表</a></span></p>
<p><label><acronym title="皮肤风格选择">skin</acronym></label><select name="skin" class="text"><option value="default" selected="selected">默认 (default)</option><option value="o2007blue">Office 2007 蓝色</option><option value="o2007silver">Office 2007 银色</option><option value="vista">Vista</option><option value="nostyle">NoStyle</option></select> <span>皮肤选择,留空默认default皮肤</span></p>
<p><label><acronym title="编辑器宽度,留空默认读取textarea的宽度">width</acronym></label><input type="text" class="text" value="" name="width"> <span>编辑器宽度,留空读取textarea宽度</span></p>
<p><label><acronym title="编辑器高度,留空默认读取textarea的高度">height</acronym></label><input type="text" class="text" value="" name="height"> <span>编辑器高度,留空读取textarea高度</span></p>
<p><label><acronym title="悬停自动执行延迟的时间">hoverExecDelay</acronym></label><input type="text" value="" name="hoverExecDelay"> <span>悬停自动执行延迟的时间,数值(单位毫秒),默认为100,设置为-1关闭此功能</span></p>
<p><label><acronym title="阴影的深度(按钮面板和模式窗口的背景阴影)">layerShadow</acronym></label><input type="text" value="" name="layerShadow"> <span>按钮面板和模式窗口的背景阴影,参数:0(不显示),大于0(显示阴影并设置阴影深度)</span></p>
<p><label><acronym title="点击任意位置取消按钮面板功能">clickCancelDialog</acronym></label><select name="clickCancelDialog"><option value="" selected="selected">开启 (default)</option><option value="false">关闭</option></select> <span>点击任意位置取消按钮面板功能</span></p>
<p><label><acronym title="强制P标签">forcePtag</acronym></label><select name="forcePtag"><option value="" selected="selected">强制P标签 (default)</option><option value="false">使用BR标签</option></select> <span>强制P标签</span></p>
<p><label><acronym title="禁用编辑区的右键菜单">disableContextmenu</acronym></label><select name="disableContextmenu"><option value="true">禁用</option><option value="false" selected="selected">不禁用 (default)</option></select> <span>禁用编辑区的右键菜单</span></p>
<p><label><acronym title="编辑器背景">background</acronym></label><input type="text" class="text" value="" name="background"> <span>设置编辑器背景,格式同CSS同名参数一致。建议直接设置textarea的css背景</span></p>
<p><label><acronym title="编辑器JS所在的根路径">editorRoot</acronym></label><input type="text" class="text" value="" name="editorRoot"> <span>编辑器JS文件所在的根路径,用在某些特殊情况下定位编辑器的根路径</span></p>
<p><label><acronym title="是否清理粘贴内容">cleanPaste</acronym></label><select name="cleanPaste"><option value="0">不清理</option><option value="1">简单清理Word</option><option value="2" selected="selected">深入清理Word (default)</option><option value="3">强制转文本</option></select> <span>是否清理粘贴HTML代码,清理Word或强制转文本</span></p>
<p><label><acronym title="提交按钮的ID">submitID</acronym></label><input type="text" class="text" value="" name="submitID"> <span>非标准submit提交时指定提交按钮的ID值,以触发编辑值同步</span></p>
</div>
</fieldset>
<fieldset>
<legend><a href="javascript:toggleDisplay('group2')">初始状态参数</a></legend>
<div id="group2" style="display: none;">
<p><label><acronym title="初始为源代码模式">sourceMode</acronym></label><select name="sourceMode"><option value="" selected="selected">标准 (default)</option><option value="true">源代码模式</option></select> <span>初始化时直接设置为源代码模式</span></p>
<p><label><acronym title="初始为全屏模式">fullscreen</acronym></label><select name="fullscreen"><option value="" selected="selected">标准 (default)</option><option>全屏模式</option></select> <span>初始化时直接设置为全屏状态</span></p>
</div>
</fieldset>
<fieldset>
<legend><a href="javascript:toggleDisplay('group3')">HTML代码控制参数</a></legend>
<div id="group3" style="display: none;">
<p><label><acronym title="是否禁用内部样式 <style></style>">internalStyle</acronym></label><select name="internalStyle"><option value="true" selected="selected">允许 (default)</option><option value="false">禁止</option></select> <span>是否禁用内部样式 <style></style></span></p>
<p><label><acronym title="是否禁用内联样式 style="" class=""">inlineStyle</acronym></label><select name="inlineStyle"><option value="true" selected="selected">允许 (default)</option><option value="false">禁止</option></select> <span>是否禁用内联样式 style="" class=""</span></p>
<p><label><acronym title="是否禁用内部脚本 <script></script>">internalScript</acronym></label><select name="internalScript"><option value="true">允许</option><option value="false" selected="selected">禁止 (default)</option></select> <span>是否禁用内部脚本 <script></script></span></p>
<p><label><acronym title="是否禁用内联脚本 onclick=""">inlineScript</acronym></label><select name="inlineScript"><option value="true">允许</option><option value="false" selected="selected">禁止 (default)</option></select> <span>是否禁用内联脚本 onclick=""</span></p>
<p><label><acronym title="是否禁用link标签 <link rel="stylesheet" type="text/css" href="" />">linkTag</acronym></label><select name="linkTag"><option value="true">允许</option><option value="false" selected="selected">禁止 (default)</option></select> <span>是否禁用link标签 <link rel="stylesheet" type="text/css" href="" /></span></p>
<p><label><acronym title="本地URL的根路径">urlBase</acronym></label><input type="text" class="text" value="" name="urlBase"> <span>设置本地URL的根路径,用在前后台相对根路径不同的情况</span></p>
<p><label><acronym title="本地URL转换方案">urlType</acronym></label><select name="urlType" class="text"><option value="" selected="selected">不处理 (default)</option><option value="abs">abs (转绝对路径)</option><option value="root">root (转根路径)</option><option value="rel">rel (转相对路径)</option></select> <span>本地URL的转换方案选择</span></p>
<p><label><acronym title="是否显示块标记">showBlocktag</acronym></label><select name="showBlocktag"><option value="true">显示</option><option value="" selected="selected">不显示 (default)</option></select> <span>是否显示块标记</span></p>
<p><label><acronym title="加载外部CSS">loadCSS</acronym></label><input type="text" class="text" value="" name="loadCSS"> <span>加载外部CSS文件到iframe编辑区域中</span></p>
</div>
</fieldset>
<fieldset>
<legend><a href="javascript:toggleDisplay('group4')">上传相关参数</a></legend>
<div id="group4" style="display: none;">
<p><label><acronym title="上传按钮的文字">upBtnText</acronym></label><input type="text" class="text" value="" name="upBtnText"> <span>上传按钮的文本,可以定义为任意文字,默认:“上传”</span></p>
<p><label><acronym title="是否开启HTML5上传支持">html5Upload</acronym></label><select name="html5Upload"><option value="" selected="selected">开启 (default)</option><option value="false">关闭</option></select> <span>是否开启HTML5上传支持,默认:允许,此选项需要浏览器支持HTML5上传功能</span></p>
<p><label><acronym title="允许一次上传多少个文件">upMultiple</acronym></label><input type="text" value="" name="upMultiple"> <span>允许一次上传多少文件,默认:99,设置为1关闭,需支持HTML5上传</span></p>
<p><label><acronym title="超链接文件上传接收URL">upLinkUrl</acronym></label><input type="text" class="text" value="" name="upLinkUrl"> <span>超链接文件上传接收URL,例:upload.php,可使用内置变量{editorRoot}</span></p>
<p><label><acronym title="超链接上传前限制本地文件扩展名">upLinkExt</acronym></label><input type="text" class="text" value="" name="upLinkExt"> <span>超链接上传前限制本地文件扩展名,默认:zip,rar,txt</span></p>
<p><label><acronym title="图片文件上传接收URL">upImgUrl</acronym></label><input type="text" class="text" value="" name="upImgUrl"> <span>图片文件上传接收URL,例:upload.php,可使用内置变量{editorRoot}</span></p>
<p><label><acronym title="图片上传前限制本地文件扩展名">upImgExt</acronym></label><input type="text" class="text" value="" name="upImgExt"> <span>图片上传前限制本地文件扩展名,默认:jpg,jpeg,gif,png</span></p>
<p><label><acronym title="FLASH动画上传接收URL">upFlashUrl</acronym></label><input type="text" class="text" value="" name="upFlashUrl"> <span>FLASH动画文件上传接收URL,例:upload.php,可使用内置变量{editorRoot}</span></p>
<p><label><acronym title="FLASH动画上传前限制本地文件扩展名">upFlashExt</acronym></label><input type="text" class="text" value="" name="upFlashExt"> <span>FLASH动画上传前限制本地文件扩展名,默认:swf</span></p>
<p><label><acronym title="多媒体文件上传接收URL">upMediaUrl</acronym></label><input type="text" class="text" value="" name="upMediaUrl"> <span>多媒体文件上传接收URL,例:upload.php,可使用内置变量{editorRoot}</span></p>
<p><label><acronym title="多媒体上传前限制本地文件扩展名">upMediaExt</acronym></label><input type="text" class="text" value="" name="upMediaExt"> <span>多媒体上传前限制本地文件扩展名,默认:wmv,avi,wma,mp3,mid</span></p>
</div>
</fieldset>
<fieldset>
<legend><a href="javascript:toggleDisplay('group5')">其它参数</a></legend>
<div id="group5" style="display: none;">
<p><label><acronym title="超链接的默认文字">defLinkText</acronym></label><input type="text" class="text" value="" name="defLinkText"> <span>超链接的默认文字,默认值:点击打开链接</span></p>
<p><label><acronym title="自定义表情根路径">emotPath</acronym></label><input type="text" class="text" value="" name="emotPath"> <span>自定义表情图片的根路径</span></p>
<p><label><acronym title="添加自定义表情">emots</acronym></label><input type="text" value="" name="emots"> <span>自定义表情,可以是一定格式的JSON格式,<a href="http://xheditor.com/manual/2#chapter2" target="_blank">点击查看表情数据定义格式</a></span></p>
<p><label><acronym title="是否在表情img标签上标注emot属性">emotMark</acronym></label><select name="emotMark"><option value="" selected="selected">不标注 (default)</option><option value="true">标注</option></select> <span>是否在表情img标签上标注emot属性</span></p>
<p><label><acronym title="showModal弹出窗口的默认宽度">modalWidth</acronym></label><input type="text" class="text" value="" name="modalWidth"> <span>showModal弹出窗口的默认宽度,例如:600</span></p>
<p><label><acronym title="showModal弹出窗口的默认高度">modalHeight</acronym></label><input type="text" class="text" value="" name="modalHeight"> <span>showModal弹出窗口的默认高度,例如:400</span></p>
<p><label><acronym title="showModal弹出窗口是否显示上方的标题栏">modalTitle</acronym></label><select name="modalTitle"><option value="" selected="selected">显示 (default)</option><option value="false">不显示</option></select> <span>showModal弹出窗口是否显示上方的标题栏</span></p>
<p><label><acronym title="无障碍读屏提示">readTip</acronym></label><input type="text" class="text" value="" name="readTip"> <span>无障碍读屏软件提示文字,可用来为残疾人士提示快捷键等信息</span></p>
</div>
</fieldset>
<br /><input type="button" id="update" value="更新预览和源代码"> <input type="reset" value="重置所有参数" />
</form>
</div>
<h2>3: 预览编辑器</h2>
<div class="section"><textarea id="preview" name="preview" rows="8" cols="120"></textarea></div>
<h2>4: 复制源代码</h2>
<div class="section"><textarea id="source" name="source" rows="4" cols="80"></textarea></div>
<div id="note">备注:本向导不包括plugins、onUpload、onPaste和shortcuts几个参数,请自行添加。更多参数说明和API指南,请访问<a href="http://xheditor.com/manual/2" target="_blank">xhEditor进阶使用</a></div>
</body>
</html> | zz-ms | trunk/zz-ms-v2.0/src/main/webapp/js/xheditor/wizard.html | HTML | asf20 | 16,896 |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
<meta name="robots" content="noindex, nofollow" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>MultiUpload Demo</title>
<link href="multiupload.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="../../jquery/jquery-1.4.4.min.js"></script>
<script type="text/javascript" src="swfupload/swfupload.js"></script>
<script type="text/javascript" src="multiupload.js"></script>
<script type="text/javascript">
$(window).load(pageInit);
function pageInit()
{
var uploadurl='../upload.php',ext='所有文件 (*.*)',size='2 MB',count=5,useget=0,params={}//默认值
uploadurl=getQuery('uploadurl')||uploadurl;ext=getQuery('ext')||ext;size=getQuery('size')||size;count=getQuery('count')||count;useget=getQuery('useget')||useget;
var tmpParams=getQuery('params');
if(tmpParams)
{
try{eval("tmpParams=" + tmpParams);}catch(ex){};
params=$.extend({},params,tmpParams);
}
ext=ext.match(/([^\(]+?)\s*\(\s*([^\)]+?)\s*\)/i);
setTimeout(fixHeight,10);
swfu = new SWFUpload({
// Flash组件
flash_url : "swfupload/swfupload.swf",
prevent_swf_caching : false,//是否缓存SWF文件
// 服务器端
upload_url: uploadurl,
file_post_name : "filedata",
post_params: params,//随文件上传一同向上传接收程序提交的Post数据
use_query_string : useget=='1'?true:false,//是否用GET方式发送参数
// 文件设置
file_types : ext[2],//文件格式限制
file_types_description : ext[1],//文件格式描述
file_size_limit : size, // 文件大小限制
file_upload_limit : count,//上传文件总数
file_queue_limit:0,//上传队列总数
custom_settings : {
test : "aaa"
},
// 事件处理
file_queued_handler : fileQueued,//添加成功
file_queue_error_handler : fileQueueError,//添加失败
upload_start_handler : uploadStart,//上传开始
upload_progress_handler : uploadProgress,//上传进度
upload_error_handler : uploadError,//上传失败
upload_success_handler : uploadSuccess,//上传成功
upload_complete_handler : uploadComplete,//上传结束
// 按钮设置
button_placeholder_id : "divAddFiles",
button_width: 69,
button_height: 17,
button_window_mode: SWFUpload.WINDOW_MODE.TRANSPARENT,
button_cursor: SWFUpload.CURSOR.HAND,
button_image_url : "img/add.gif",
button_text: '<span class="theFont">添加文件</span>',
button_text_style: ".theFont { font-size: 12px; }",
button_text_left_padding: 20,
button_text_top_padding: 0,
// 调试设置
debug: false
});
}
function fixHeight(){$('#listArea').css('height',(document.body.clientHeight-56)+'px');}
function getQuery(item){var svalue = location.search.match(new RegExp('[\?\&]' + item + '=([^\&]*)(\&?)','i'));return svalue?decodeURIComponent(svalue[1]):'';}
//----------------跨域支持代码开始(非跨域环境请删除这段代码)----------------
var JSON = JSON || {};
JSON.stringify = JSON.stringify || function (obj) {
var t = typeof (obj);
if (t != "object" || obj === null) {
if (t == "string")obj = '"'+obj+'"';
return String(obj);
}
else {
var n, v, json = [], arr = (obj && obj.constructor == Array);
for (n in obj) {
v = obj[n]; t = typeof(v);
if (t == "string") v = '"'+v+'"';
else if (t == "object" && v !== null) v = JSON.stringify(v);
json.push((arr ? "" : '"' + n + '":') + String(v));
}
return (arr ? "[" : "{") + String(json) + (arr ? "]" : "}");
}
};
var callback= callback || function(v){
v=JSON.stringify(v);
window.name=escape(v);
window.location='http://'+location.search.match(/[\?&]parenthost=(.*)(&|$)/i)[1]+'/xheditorproxy.html';//这个文件最好是一个0字节文件,如果无此文件也会正常工作
}
//----------------跨域支持代码结束----------------
</script>
</head>
<body>
<div id="upload">
<div id="buttonArea">
<div id="controlBtns" style="display:none;"><a href="javascript:void(0);" id="btnClear" onclick="removeFile();" class="btn" style="display:none;"><span><img src="img/clear.gif" /> 删除文件</span></a> <a href="javascript:void(0);" id="btnStart" onclick="startUploadFiles();" class="btn"><span><img src="img/start.gif" /> 开始上传</span></a></div>
<a href="javascript:void(0);" id="addFiles" class="btn"><span><div id="divAddFiles">添加文件</div></span></a>
</div>
<div id="listArea">
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<thead id="listTitle"><tr><td width="53%">文件名</td><td width="25%">大小</td><td width="22%">状态</td></tr></thead>
<tbody id="listBody">
</tbody>
</table>
</div>
<div id="progressArea">
<div id="progressBar"><span>0%</span><div id="progress" style="width:1px;"></div></div>
</div>
</div>
</body>
</html> | zz-ms | trunk/zz-ms-v2.0/src/main/webapp/js/xheditor/xheditor_plugins/multiupload/multiupload.html | HTML | asf20 | 5,042 |