blob_id
stringlengths 40
40
| directory_id
stringlengths 40
40
| path
stringlengths 3
264
| content_id
stringlengths 40
40
| detected_licenses
sequencelengths 0
85
| license_type
stringclasses 2
values | repo_name
stringlengths 5
140
| snapshot_id
stringlengths 40
40
| revision_id
stringlengths 40
40
| branch_name
stringclasses 905
values | visit_date
timestamp[us]date 2015-08-09 11:21:18
2023-09-06 10:45:07
| revision_date
timestamp[us]date 1997-09-14 05:04:47
2023-09-17 19:19:19
| committer_date
timestamp[us]date 1997-09-14 05:04:47
2023-09-06 06:22:19
| github_id
int64 3.89k
681M
⌀ | star_events_count
int64 0
209k
| fork_events_count
int64 0
110k
| gha_license_id
stringclasses 22
values | gha_event_created_at
timestamp[us]date 2012-06-07 00:51:45
2023-09-14 21:58:39
⌀ | gha_created_at
timestamp[us]date 2008-03-27 23:40:48
2023-08-21 23:17:38
⌀ | gha_language
stringclasses 141
values | src_encoding
stringclasses 34
values | language
stringclasses 1
value | is_vendor
bool 1
class | is_generated
bool 2
classes | length_bytes
int64 3
10.4M
| extension
stringclasses 115
values | content
stringlengths 3
10.4M
| authors
sequencelengths 1
1
| author_id
stringlengths 0
158
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
9aa4f6c69d0f77ee3aa735b931a5a7c5d3503f0a | 4bea57e631734f8cb1c230f521fd523a63c1ff23 | /projects/openfoam/programming/AutoCase/cases/cavity/test/case/0/dsmcSigmaTcRMax | 2660010326c7aa19bddcab433144277087c7aedd | [] | no_license | andytorrestb/cfal | 76217f77dd43474f6b0a7eb430887e8775b78d7f | 730fb66a3070ccb3e0c52c03417e3b09140f3605 | refs/heads/master | 2023-07-04T01:22:01.990628 | 2021-08-01T15:36:17 | 2021-08-01T15:36:17 | 294,183,829 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,207 | /*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: v2012 |
| \\ / A nd | Website: www.openfoam.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volScalarField;
location "0";
object dsmcSigmaTcRMax;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 3 -1 0 0 0 0];
internalField uniform 2.30575378384293e-16;
boundaryField
{
inlet
{
type zeroGradient;
}
outlet
{
type zeroGradient;
}
wall
{
type zeroGradient;
}
frontAndBack
{
type empty;
}
}
// ************************************************************************* //
| [
"[email protected]"
] | ||
ca1b0ead0b3558c8f4ed9b1551942cf7256f4d96 | 742f7e938f7d464b9479dc8a9b8f7b03c1135311 | /downloadmanager.cpp | 2b67f06583668f915791e60501cf0badbc688bb2 | [] | no_license | KennethCheng/qt_browser | 7730739402465d1ff5c1e11d264a28d8bfa0a947 | bff21ef1dad9c57480c93e62c46e0f642af684d9 | refs/heads/master | 2020-04-18T23:27:58.808261 | 2011-01-27T09:54:55 | 2011-01-27T09:54:55 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 19,242 | cpp | /****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
** Contact: Nokia Corporation ([email protected])
**
** This file is part of the demonstration applications of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial Usage
** Licensees holding valid Qt Commercial licenses may use this file in
** accordance with the Qt Commercial License Agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Nokia.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain
** additional rights. These rights are described in the Nokia Qt LGPL
** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
** package.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3.0 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU General Public License version 3.0 requirements will be
** met: http://www.gnu.org/copyleft/gpl.html.
**
** If you are unsure which license is appropriate for your use, please
** contact the sales department at http://www.qtsoftware.com/contact.
** $QT_END_LICENSE$
**
****************************************************************************/
#include "downloadmanager.h"
#include "autosaver.h"
#include "browserapplication.h"
#include "networkaccessmanager.h"
#include <math.h>
#include <QtCore/QMetaEnum>
#include <QtCore/QSettings>
#include <QtGui/QDesktopServices>
#include <QtGui/QFileDialog>
#include <QtGui/QHeaderView>
#include <QtGui/QFileIconProvider>
#include <QtCore/QDebug>
#include <QtWebKit/QWebSettings>
/*!
DownloadItem is a widget that is displayed in the download manager list.
It moves the data from the QNetworkReply into the QFile as well
as update the information/progressbar and report errors.
*/
DownloadItem::DownloadItem(QNetworkReply *reply, bool requestFileName, QWidget *parent)
: QWidget(parent)
, m_reply(reply)
, m_requestFileName(requestFileName)
, m_bytesReceived(0)
{
setupUi(this);
QPalette p = downloadInfoLabel->palette();
p.setColor(QPalette::Text, Qt::darkGray);
downloadInfoLabel->setPalette(p);
progressBar->setMaximum(0);
tryAgainButton->hide();
connect(stopButton, SIGNAL(clicked()), this, SLOT(stop()));
connect(openButton, SIGNAL(clicked()), this, SLOT(open()));
connect(tryAgainButton, SIGNAL(clicked()), this, SLOT(tryAgain()));
init();
}
void DownloadItem::init()
{
if (!m_reply)
return;
// attach to the m_reply
m_url = m_reply->url();
m_reply->setParent(this);
connect(m_reply, SIGNAL(readyRead()), this, SLOT(downloadReadyRead()));
connect(m_reply, SIGNAL(error(QNetworkReply::NetworkError)),
this, SLOT(error(QNetworkReply::NetworkError)));
connect(m_reply, SIGNAL(downloadProgress(qint64, qint64)),
this, SLOT(downloadProgress(qint64, qint64)));
connect(m_reply, SIGNAL(metaDataChanged()),
this, SLOT(metaDataChanged()));
connect(m_reply, SIGNAL(finished()),
this, SLOT(finished()));
// reset info
downloadInfoLabel->clear();
progressBar->setValue(0);
getFileName();
// start timer for the download estimation
m_downloadTime.start();
if (m_reply->error() != QNetworkReply::NoError) {
error(m_reply->error());
finished();
}
}
void DownloadItem::getFileName()
{
QSettings settings;
settings.beginGroup(QLatin1String("downloadmanager"));
QString defaultLocation = QDesktopServices::storageLocation(QDesktopServices::DesktopLocation);
QString downloadDirectory = settings.value(QLatin1String("downloadDirectory"), defaultLocation).toString();
if (!downloadDirectory.isEmpty())
downloadDirectory += QLatin1Char('/');
QString defaultFileName = saveFileName(downloadDirectory);
QString fileName = defaultFileName;
if (m_requestFileName) {
fileName = QFileDialog::getSaveFileName(this, tr("Save File"), defaultFileName);
if (fileName.isEmpty()) {
m_reply->close();
fileNameLabel->setText(tr("Download canceled: %1").arg(QFileInfo(defaultFileName).fileName()));
return;
}
}
m_output.setFileName(fileName);
fileNameLabel->setText(QFileInfo(m_output.fileName()).fileName());
if (m_requestFileName)
downloadReadyRead();
}
QString DownloadItem::saveFileName(const QString &directory) const
{
// Move this function into QNetworkReply to also get file name sent from the server
QString path = m_url.path();
QFileInfo info(path);
QString baseName = info.completeBaseName();
QString endName = info.suffix();
if (baseName.isEmpty()) {
baseName = QLatin1String("unnamed_download");
qDebug() << "DownloadManager:: downloading unknown file:" << m_url;
}
QString name = directory + baseName + QLatin1Char('.') + endName;
if (QFile::exists(name)) {
// already exists, don't overwrite
int i = 1;
do {
name = directory + baseName + QLatin1Char('-') + QString::number(i++) + QLatin1Char('.') + endName;
} while (QFile::exists(name));
}
return name;
}
void DownloadItem::stop()
{
setUpdatesEnabled(false);
stopButton->setEnabled(false);
stopButton->hide();
tryAgainButton->setEnabled(true);
tryAgainButton->show();
setUpdatesEnabled(true);
m_reply->abort();
}
void DownloadItem::open()
{
QFileInfo info(m_output);
QUrl url = QUrl::fromLocalFile(info.absolutePath());
QDesktopServices::openUrl(url);
}
void DownloadItem::tryAgain()
{
if (!tryAgainButton->isEnabled())
return;
tryAgainButton->setEnabled(false);
tryAgainButton->setVisible(false);
stopButton->setEnabled(true);
stopButton->setVisible(true);
progressBar->setVisible(true);
QNetworkReply *r = BrowserApplication::networkAccessManager()->get(QNetworkRequest(m_url));
if (m_reply)
m_reply->deleteLater();
if (m_output.exists())
m_output.remove();
m_reply = r;
init();
emit statusChanged();
}
void DownloadItem::downloadReadyRead()
{
if (m_requestFileName && m_output.fileName().isEmpty())
return;
if (!m_output.isOpen()) {
// in case someone else has already put a file there
if (!m_requestFileName)
getFileName();
if (!m_output.open(QIODevice::WriteOnly)) {
downloadInfoLabel->setText(tr("Error opening save file: %1")
.arg(m_output.errorString()));
stopButton->click();
emit statusChanged();
return;
}
emit statusChanged();
}
if (-1 == m_output.write(m_reply->readAll())) {
downloadInfoLabel->setText(tr("Error saving: %1")
.arg(m_output.errorString()));
stopButton->click();
}
}
void DownloadItem::error(QNetworkReply::NetworkError)
{
qDebug() << "DownloadItem::error" << m_reply->errorString() << m_url;
downloadInfoLabel->setText(tr("Network Error: %1").arg(m_reply->errorString()));
tryAgainButton->setEnabled(true);
tryAgainButton->setVisible(true);
}
void DownloadItem::metaDataChanged()
{
qDebug() << "DownloadItem::metaDataChanged: not handled.";
}
void DownloadItem::downloadProgress(qint64 bytesReceived, qint64 bytesTotal)
{
m_bytesReceived = bytesReceived;
if (bytesTotal == -1) {
progressBar->setValue(0);
progressBar->setMaximum(0);
} else {
progressBar->setValue(bytesReceived);
progressBar->setMaximum(bytesTotal);
}
updateInfoLabel();
}
void DownloadItem::updateInfoLabel()
{
if (m_reply->error() == QNetworkReply::NoError)
return;
qint64 bytesTotal = progressBar->maximum();
bool running = !downloadedSuccessfully();
// update info label
double speed = m_bytesReceived * 1000.0 / m_downloadTime.elapsed();
double timeRemaining = ((double)(bytesTotal - m_bytesReceived)) / speed;
QString timeRemainingString = tr("seconds");
if (timeRemaining > 60) {
timeRemaining = timeRemaining / 60;
timeRemainingString = tr("minutes");
}
timeRemaining = floor(timeRemaining);
// When downloading the eta should never be 0
if (timeRemaining == 0)
timeRemaining = 1;
QString info;
if (running) {
QString remaining;
if (bytesTotal != 0)
remaining = tr("- %4 %5 remaining")
.arg(timeRemaining)
.arg(timeRemainingString);
info = QString(tr("%1 of %2 (%3/sec) %4"))
.arg(dataString(m_bytesReceived))
.arg(bytesTotal == 0 ? tr("?") : dataString(bytesTotal))
.arg(dataString((int)speed))
.arg(remaining);
} else {
if (m_bytesReceived == bytesTotal)
info = dataString(m_output.size());
else
info = tr("%1 of %2 - Stopped")
.arg(dataString(m_bytesReceived))
.arg(dataString(bytesTotal));
}
downloadInfoLabel->setText(info);
}
QString DownloadItem::dataString(int size) const
{
QString unit;
if (size < 1024) {
unit = tr("bytes");
} else if (size < 1024*1024) {
size /= 1024;
unit = tr("kB");
} else {
size /= 1024*1024;
unit = tr("MB");
}
return QString(QLatin1String("%1 %2")).arg(size).arg(unit);
}
bool DownloadItem::downloading() const
{
return (progressBar->isVisible());
}
bool DownloadItem::downloadedSuccessfully() const
{
return (stopButton->isHidden() && tryAgainButton->isHidden());
}
void DownloadItem::finished()
{
progressBar->hide();
stopButton->setEnabled(false);
stopButton->hide();
m_output.close();
updateInfoLabel();
emit statusChanged();
}
/*!
DownloadManager is a Dialog that contains a list of DownloadItems
It is a basic download manager. It only downloads the file, doesn't do BitTorrent,
extract zipped files or anything fancy.
*/
DownloadManager::DownloadManager(QWidget *parent)
: QDialog(parent)
, m_autoSaver(new AutoSaver(this))
, m_manager(BrowserApplication::networkAccessManager())
, m_iconProvider(0)
, m_removePolicy(Never)
{
setupUi(this);
downloadsView->setShowGrid(false);
downloadsView->verticalHeader()->hide();
downloadsView->horizontalHeader()->hide();
downloadsView->setAlternatingRowColors(true);
downloadsView->horizontalHeader()->setStretchLastSection(true);
m_model = new DownloadModel(this);
downloadsView->setModel(m_model);
connect(cleanupButton, SIGNAL(clicked()), this, SLOT(cleanup()));
load();
}
DownloadManager::~DownloadManager()
{
m_autoSaver->changeOccurred();
m_autoSaver->saveIfNeccessary();
if (m_iconProvider)
delete m_iconProvider;
}
int DownloadManager::activeDownloads() const
{
int count = 0;
for (int i = 0; i < m_downloads.count(); ++i) {
if (m_downloads.at(i)->stopButton->isEnabled())
++count;
}
return count;
}
void DownloadManager::download(const QNetworkRequest &request, bool requestFileName)
{
if (request.url().isEmpty())
return;
handleUnsupportedContent(m_manager->get(request), requestFileName);
}
void DownloadManager::handleUnsupportedContent(QNetworkReply *reply, bool requestFileName)
{
if (!reply || reply->url().isEmpty())
return;
QVariant header = reply->header(QNetworkRequest::ContentLengthHeader);
bool ok;
int size = header.toInt(&ok);
if (ok && size == 0)
return;
qDebug() << "DownloadManager::handleUnsupportedContent" << reply->url() << "requestFileName" << requestFileName;
DownloadItem *item = new DownloadItem(reply, requestFileName, this);
addItem(item);
}
void DownloadManager::addItem(DownloadItem *item)
{
connect(item, SIGNAL(statusChanged()), this, SLOT(updateRow()));
int row = m_downloads.count();
m_model->beginInsertRows(QModelIndex(), row, row);
m_downloads.append(item);
m_model->endInsertRows();
updateItemCount();
if (row == 0)
show();
downloadsView->setIndexWidget(m_model->index(row, 0), item);
QIcon icon = style()->standardIcon(QStyle::SP_FileIcon);
item->fileIcon->setPixmap(icon.pixmap(48, 48));
downloadsView->setRowHeight(row, item->sizeHint().height());
}
void DownloadManager::updateRow()
{
DownloadItem *item = qobject_cast<DownloadItem*>(sender());
int row = m_downloads.indexOf(item);
if (-1 == row)
return;
if (!m_iconProvider)
m_iconProvider = new QFileIconProvider();
QIcon icon = m_iconProvider->icon(item->m_output.fileName());
if (icon.isNull())
icon = style()->standardIcon(QStyle::SP_FileIcon);
item->fileIcon->setPixmap(icon.pixmap(48, 48));
downloadsView->setRowHeight(row, item->minimumSizeHint().height());
bool remove = false;
QWebSettings *globalSettings = QWebSettings::globalSettings();
if (!item->downloading()
&& globalSettings->testAttribute(QWebSettings::PrivateBrowsingEnabled))
remove = true;
if (item->downloadedSuccessfully()
&& removePolicy() == DownloadManager::SuccessFullDownload) {
remove = true;
}
if (remove)
m_model->removeRow(row);
cleanupButton->setEnabled(m_downloads.count() - activeDownloads() > 0);
}
DownloadManager::RemovePolicy DownloadManager::removePolicy() const
{
return m_removePolicy;
}
void DownloadManager::setRemovePolicy(RemovePolicy policy)
{
if (policy == m_removePolicy)
return;
m_removePolicy = policy;
m_autoSaver->changeOccurred();
}
void DownloadManager::save() const
{
QSettings settings;
settings.beginGroup(QLatin1String("downloadmanager"));
QMetaEnum removePolicyEnum = staticMetaObject.enumerator(staticMetaObject.indexOfEnumerator("RemovePolicy"));
settings.setValue(QLatin1String("removeDownloadsPolicy"), QLatin1String(removePolicyEnum.valueToKey(m_removePolicy)));
settings.setValue(QLatin1String("size"), size());
if (m_removePolicy == Exit)
return;
for (int i = 0; i < m_downloads.count(); ++i) {
QString key = QString(QLatin1String("download_%1_")).arg(i);
settings.setValue(key + QLatin1String("url"), m_downloads[i]->m_url);
settings.setValue(key + QLatin1String("location"), QFileInfo(m_downloads[i]->m_output).filePath());
settings.setValue(key + QLatin1String("done"), m_downloads[i]->downloadedSuccessfully());
}
int i = m_downloads.count();
QString key = QString(QLatin1String("download_%1_")).arg(i);
while (settings.contains(key + QLatin1String("url"))) {
settings.remove(key + QLatin1String("url"));
settings.remove(key + QLatin1String("location"));
settings.remove(key + QLatin1String("done"));
key = QString(QLatin1String("download_%1_")).arg(++i);
}
}
void DownloadManager::load()
{
QSettings settings;
settings.beginGroup(QLatin1String("downloadmanager"));
QSize size = settings.value(QLatin1String("size")).toSize();
if (size.isValid())
resize(size);
QByteArray value = settings.value(QLatin1String("removeDownloadsPolicy"), QLatin1String("Never")).toByteArray();
QMetaEnum removePolicyEnum = staticMetaObject.enumerator(staticMetaObject.indexOfEnumerator("RemovePolicy"));
m_removePolicy = removePolicyEnum.keyToValue(value) == -1 ?
Never :
static_cast<RemovePolicy>(removePolicyEnum.keyToValue(value));
int i = 0;
QString key = QString(QLatin1String("download_%1_")).arg(i);
while (settings.contains(key + QLatin1String("url"))) {
QUrl url = settings.value(key + QLatin1String("url")).toUrl();
QString fileName = settings.value(key + QLatin1String("location")).toString();
bool done = settings.value(key + QLatin1String("done"), true).toBool();
if (!url.isEmpty() && !fileName.isEmpty()) {
DownloadItem *item = new DownloadItem(0, this);
item->m_output.setFileName(fileName);
item->fileNameLabel->setText(QFileInfo(item->m_output.fileName()).fileName());
item->m_url = url;
item->stopButton->setVisible(false);
item->stopButton->setEnabled(false);
item->tryAgainButton->setVisible(!done);
item->tryAgainButton->setEnabled(!done);
item->progressBar->setVisible(!done);
addItem(item);
}
key = QString(QLatin1String("download_%1_")).arg(++i);
}
cleanupButton->setEnabled(m_downloads.count() - activeDownloads() > 0);
}
void DownloadManager::cleanup()
{
if (m_downloads.isEmpty())
return;
m_model->removeRows(0, m_downloads.count());
updateItemCount();
if (m_downloads.isEmpty() && m_iconProvider) {
delete m_iconProvider;
m_iconProvider = 0;
}
m_autoSaver->changeOccurred();
}
void DownloadManager::updateItemCount()
{
int count = m_downloads.count();
itemCount->setText(count == 1 ? tr("1 Download") : tr("%1 Downloads").arg(count));
}
DownloadModel::DownloadModel(DownloadManager *downloadManager, QObject *parent)
: QAbstractListModel(parent)
, m_downloadManager(downloadManager)
{
}
QVariant DownloadModel::data(const QModelIndex &index, int role) const
{
if (index.row() < 0 || index.row() >= rowCount(index.parent()))
return QVariant();
if (role == Qt::ToolTipRole)
if (!m_downloadManager->m_downloads.at(index.row())->downloadedSuccessfully())
return m_downloadManager->m_downloads.at(index.row())->downloadInfoLabel->text();
return QVariant();
}
int DownloadModel::rowCount(const QModelIndex &parent) const
{
return (parent.isValid()) ? 0 : m_downloadManager->m_downloads.count();
}
bool DownloadModel::removeRows(int row, int count, const QModelIndex &parent)
{
if (parent.isValid())
return false;
int lastRow = row + count - 1;
for (int i = lastRow; i >= row; --i) {
if (m_downloadManager->m_downloads.at(i)->downloadedSuccessfully()
|| m_downloadManager->m_downloads.at(i)->tryAgainButton->isEnabled()) {
beginRemoveRows(parent, i, i);
m_downloadManager->m_downloads.takeAt(i)->deleteLater();
endRemoveRows();
}
}
m_downloadManager->m_autoSaver->changeOccurred();
return true;
}
| [
"root@ubuntu.(none)"
] | root@ubuntu.(none) |
177c9bee3466ffc37abfda78b3085e33724d0919 | 336b38ce17fee2ce179edba0a7e1c80cdade021e | /src/input.h | 949bc6fcd187ddc54040944bbdcf9b1a165b1f7c | [
"MIT"
] | permissive | milesdave/skiopen | 0805120212807256bb490dd096c38e9b118cfba6 | 7550104c2f52aeb0e030a6df6b11219d60bba49e | refs/heads/master | 2020-12-03T02:01:44.622495 | 2017-07-23T10:34:50 | 2017-07-23T10:34:50 | 95,895,603 | 2 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,159 | h | #ifndef INPUT_H_
#define INPUT_H_
#include <SDL.h>
#include "structures/queue.h"
#include "types.h"
class Input
{
public:
~Input();
// Possible controller inputs.
enum In
{
// Digital inputs.
A = SDL_CONTROLLER_BUTTON_A,
B = SDL_CONTROLLER_BUTTON_B,
X = SDL_CONTROLLER_BUTTON_X,
Y = SDL_CONTROLLER_BUTTON_Y,
Select = SDL_CONTROLLER_BUTTON_BACK,
Home = SDL_CONTROLLER_BUTTON_GUIDE,
Start = SDL_CONTROLLER_BUTTON_START,
L3 = SDL_CONTROLLER_BUTTON_LEFTSTICK,
R3 = SDL_CONTROLLER_BUTTON_RIGHTSTICK,
L1 = SDL_CONTROLLER_BUTTON_LEFTSHOULDER,
R1 = SDL_CONTROLLER_BUTTON_RIGHTSHOULDER,
Up = SDL_CONTROLLER_BUTTON_DPAD_UP,
Down = SDL_CONTROLLER_BUTTON_DPAD_DOWN,
Left = SDL_CONTROLLER_BUTTON_DPAD_LEFT,
Right = SDL_CONTROLLER_BUTTON_DPAD_RIGHT,
// Analogue inputs.
LeftStickX = (Right + 1) + SDL_CONTROLLER_AXIS_LEFTX,
LeftStickY = (Right + 1) + SDL_CONTROLLER_AXIS_LEFTY,
RightStickX = (Right + 1) + SDL_CONTROLLER_AXIS_RIGHTX,
RightStickY = (Right + 1) + SDL_CONTROLLER_AXIS_RIGHTY,
L2 = (Right + 1) + SDL_CONTROLLER_AXIS_TRIGGERLEFT,
R2 = (Right + 1) + SDL_CONTROLLER_AXIS_TRIGGERRIGHT
};
// Eveything about a single input event.
struct InputEvent
{
In input;
Sint16 state;
};
// Returns a pointer to this singleton instance.
static Input* instance();
// Opens a controller if one is dectected.
void initController();
// Closes a controller if one is open.
void closeController();
// Returns the state of the specified input right now.
Sint16 getInput(In input) const;
// Returns a constant reference to the input event queue, allowing it
// to be copied.
inline const Queue<InputEvent>& events() const { return _events; }
// Converst an SDL_Event and adds it to the Queue. Should only be used
// by the Game class.
void offerEvent(const SDL_Event& e);
// Clears the event queue. Should only be used by the Game class.
inline void clearEvents() { _events.clear(); }
private:
Input();
// The connected controller.
SDL_GameController* _controller = nullptr;
// The event queue.
Queue<InputEvent> _events;
// This singleton instance.
static Input* _instance;
};
#endif
| [
"[email protected]"
] | |
ab482049ac26297e1c8275a5e1849136e7268dec | af21605135880c64243458beea3def0e01789427 | /light_clap/light_clap/adc_funcs.ino | 325fc469c1c5d2412677b81c4b8780e5ef17eb94 | [] | no_license | YuriiMytiai/arduino | 193b5c891a1d85288857aa8aff9a8b1f8292c601 | cf303c130ad7a07f13634e3d0429107fb274b5be | refs/heads/master | 2021-04-05T16:41:27.555709 | 2018-03-18T08:16:59 | 2018-03-18T08:16:59 | 125,252,850 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 591 | ino | double calc_RMS(int len) {
// len max value - 1024
double sqr_sum = 0;
double U_ref = 0.707;
double U_value;
for (int i = 0 ; i < len ; i++) { // save some samples
while(!(ADCSRA & 0x10)); // wait for adc to be ready
ADCSRA = 0xf5; // restart adc
byte low = ADCL; // fetch adc data (low byte)
byte high = ADCH; // fetch adc data (high byte)
int value = (high << 8) | low; // combine the two bytes
U_value = (double) value / 1024 * 5;
sqr_sum += U_value * U_value;
}
double sqr_mean = sqr_sum / len;
double sqrt_val = sqrt(sqr_mean);
return 10 * log10(sqrt_val / U_ref);
}
| [
"[email protected]"
] | |
1ebdacbbc0938820f6317cde1638966e378809fe | d8b79e34892ec47f9874eb7eaaa9ce7a2fa835df | /4.16派生类多继承/main.cpp | 006c98e6cfc1c41c0539c1ccae5c77daf892c393 | [] | no_license | hjq562004191/Cpp-Demo | 368ec9aa55e63bd65e47b98595c6f11003736665 | 0792c3becdd8ea9f81fa40d17bc360b22294a099 | refs/heads/master | 2020-05-01T16:52:23.495206 | 2019-07-01T09:22:43 | 2019-07-01T09:22:43 | 177,584,431 | 0 | 0 | null | null | null | null | GB18030 | C++ | false | false | 2,786 | cpp | #include <iostream>
#include <string.h>
using namespace std;
class employee {
protected:
string name;
int individualEmpNo;
int grade;
float accumPay;
int employeeNo;
public:
employee(string s,int i,int g,float a , int e){
name = s;
individualEmpNo = i;
grade = g;
accumPay = a;
employeeNo = e;
}
employee(){}
void show(){
cout<<"name:"<<name<<"\nindividualEmpNo:"<<individualEmpNo<<endl;
cout<<"grade:"<<grade<<"\naccumPay:"<<accumPay<<"\nemployeeNo:"<<employeeNo<<endl;
}
};
class technician:public employee{
protected:
float hourlyRate;
int workHours;
public:
technician(string s,int i,int g,float a , int e,float h,int w):employee(s,i,g,a,e){
name = s;
individualEmpNo = i;
accumPay = a + w*h;
employeeNo = e;
hourlyRate = h;
workHours = w;
grade = g;
}
void pay(){
cout<<"technician工资:"<<workHours*hourlyRate<<endl;
}
void displayStatus(){
cout<<"technician状态:\n";
show();
}
};
class manager:public employee{
protected:
float monthlyPay;
public:
manager( string s,int i,int g,float a , int e,float m):employee(s,i,g,a,e){
monthlyPay = m;
}
manager(float m){
monthlyPay = m;
}
void pay(){
cout<<"manager工资:"<<monthlyPay <<endl;
}
void displayStatus(){
cout<<"manager状态:\n";
show();
}
};
class salesman:public employee{
protected:
float CommRate;
float sales;
public:
salesman(string s,int i,int g,float a , int e,float comm,float sale):employee(s,i,g,a,e){
CommRate = comm;
sales = sale;
}
salesman(float comm,float sale){
CommRate = comm;
sales = sale;
}
void pay(){
cout<<"salesman工资:"<<CommRate * sales<<endl;
}
void displayStatus(){
cout<<"salesman状态:\n";
show();
}
};
class salesmanager:public manager,salesman,employee{
public:
salesmanager(string s,int i,int g,float a , int e,float comm,float sale,float m):manager(m),salesman(comm,sale),employee(s,i,g,a,e){
}
void pay(){
cout<<"salesmanager工资:"<<manager::monthlyPay + salesman::sales * salesman::CommRate<<endl;
}
void displayStatus(){
cout<<"salesmanager状态:\n";
manager::show();
}
};
int main(){
technician t("销售员",1001,10,2000,1,10,5);
t.pay();
t.displayStatus();
cout<<endl;
manager m("经理",1002,5,5000,2,10000);
m.pay();
m.displayStatus();
cout<<endl;
salesman s("销售员",1003,20,3000,3,20,16);
s.pay();
s.displayStatus();
cout<<endl;
salesmanager sm("销售经理",1004,30,6000,4,30,20,10000);
sm.pay();
sm.displayStatus();
return 0;
}
| [
"[email protected]"
] | |
ecfdeb0fd1b628e3486f7745319db3a98084724b | 6a070489af967c0434589854621316e0615b7f84 | /360/2lab360/reference/threadp.cpp | 97b23becc09c76201cd1a253fb1d55367558e1b5 | [] | no_license | jbelyeu/old_class_code | 5fbfcfc0687bb8a9e16234eace72db61b31e3287 | 6a3afb5d795b7d6aca5e6885394f84f0a5a141ee | refs/heads/master | 2021-01-10T08:55:34.728873 | 2016-03-30T23:25:19 | 2016-03-30T23:25:19 | 54,907,018 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,631 | cpp | #include <stdio.h>
#include <iostream>
#include <unistd.h>
#include <queue>
#include <pthread.h>
#include <semaphore.h>
using namespace std;
struct threadInfo
{
int threadID;
int stuff;
double dubStuff;
};
const int THREADS = 20;
sem_t mutex; //mutual exclusion
sem_t space_on_q;
sem_t num_of_tasks;
queue<int > tasks;
void* serve(void* pointer)
{
// for the consumer threads to do
struct threadInfo* myInfo = (struct threadInfo* ) pointer;
while ( 1 )
{
sem_wait(&num_of_tasks); //while there are no tasks, wait
//wait for queue to be available
sem_wait(&mutex);
cout << "I am thread: " << myInfo->threadID << endl;
int thing = tasks.front();
tasks.pop();
cout << "things to do : " << thing << endl;
sem_post(&mutex); //let go of queue
sem_post(&space_on_q);
//read request
//parse headers
//get file
//write response to client
//close() socket
}
}
int main(int argc, char* argv[])
{
cout << "main" << endl;
struct threadInfo* myThreads[THREADS];
pthread_t threads [THREADS];
sem_init(&space_on_q, 0, 100);
sem_init(&num_of_tasks, 0, 0);
sem_init(&mutex, 0, 1);
for (int i = 0; i < THREADS; ++i)
{
sem_wait(&mutex);
cout << "creating thread " << i << endl;
myThreads[i]->threadID = i;
pthread_create(&threads[i], NULL, serve, &myThreads);
sem_post(&mutex);
}
int counter = 0;
while(1)
{
sem_wait(&space_on_q); //limits the number of requests allowed, down to queue size
//this is where the producer works
sem_wait(&mutex);
tasks.push(counter);
sem_post(&mutex);
sem_post(&num_of_tasks); //there is a task now
counter++;
}
}
| [
"[email protected]"
] | |
01d8fa011ed036e6ba4d7bca2a13a25e457336e7 | 31ac07ecd9225639bee0d08d00f037bd511e9552 | /externals/OCCTLib/inc/TColStd_HSetOfInteger.hxx | 167cb7a8103a14679ea6644f73d34226bbec15e0 | [] | no_license | litao1009/SimpleRoom | 4520e0034e4f90b81b922657b27f201842e68e8e | 287de738c10b86ff8f61b15e3b8afdfedbcb2211 | refs/heads/master | 2021-01-20T19:56:39.507899 | 2016-07-29T08:01:57 | 2016-07-29T08:01:57 | 64,462,604 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,943 | hxx | // This file is generated by WOK (CPPExt).
// Please do not edit this file; modify original file instead.
// The copyright and license terms as defined for the original file apply to
// this header file considered to be the "object code" form of the original source.
#ifndef _TColStd_HSetOfInteger_HeaderFile
#define _TColStd_HSetOfInteger_HeaderFile
#ifndef _Standard_HeaderFile
#include <Standard.hxx>
#endif
#ifndef _Standard_DefineHandle_HeaderFile
#include <Standard_DefineHandle.hxx>
#endif
#ifndef _Handle_TColStd_HSetOfInteger_HeaderFile
#include <Handle_TColStd_HSetOfInteger.hxx>
#endif
#ifndef _TColStd_SetOfInteger_HeaderFile
#include <TColStd_SetOfInteger.hxx>
#endif
#ifndef _MMgt_TShared_HeaderFile
#include <MMgt_TShared.hxx>
#endif
#ifndef _Standard_Integer_HeaderFile
#include <Standard_Integer.hxx>
#endif
#ifndef _Standard_Boolean_HeaderFile
#include <Standard_Boolean.hxx>
#endif
class TColStd_SetOfInteger;
class TColStd_HSetOfInteger : public MMgt_TShared {
public:
Standard_EXPORT TColStd_HSetOfInteger();
Standard_Integer Extent() const;
Standard_Boolean IsEmpty() const;
void Clear() ;
Standard_Boolean Add(const Standard_Integer& T) ;
Standard_Boolean Remove(const Standard_Integer& T) ;
Standard_EXPORT Handle_TColStd_HSetOfInteger Union(const Handle(TColStd_HSetOfInteger)& B) const;
Standard_EXPORT Handle_TColStd_HSetOfInteger Intersection(const Handle(TColStd_HSetOfInteger)& B) const;
Standard_EXPORT Handle_TColStd_HSetOfInteger Difference(const Handle(TColStd_HSetOfInteger)& B) const;
Standard_Boolean Contains(const Standard_Integer& T) const;
Standard_Boolean IsASubset(const Handle(TColStd_HSetOfInteger)& S) const;
Standard_Boolean IsAProperSubset(const Handle(TColStd_HSetOfInteger)& S) const;
Standard_EXPORT Handle_TColStd_HSetOfInteger ShallowCopy() const;
const TColStd_SetOfInteger& Set() const;
TColStd_SetOfInteger& ChangeSet() ;
DEFINE_STANDARD_RTTI(TColStd_HSetOfInteger)
protected:
private:
TColStd_SetOfInteger mySet;
};
#define Item Standard_Integer
#define Item_hxx <Standard_Integer.hxx>
#define TheSet TColStd_SetOfInteger
#define TheSet_hxx <TColStd_SetOfInteger.hxx>
#define TCollection_HSet TColStd_HSetOfInteger
#define TCollection_HSet_hxx <TColStd_HSetOfInteger.hxx>
#define Handle_TCollection_HSet Handle_TColStd_HSetOfInteger
#define TCollection_HSet_Type_() TColStd_HSetOfInteger_Type_()
#include <TCollection_HSet.lxx>
#undef Item
#undef Item_hxx
#undef TheSet
#undef TheSet_hxx
#undef TCollection_HSet
#undef TCollection_HSet_hxx
#undef Handle_TCollection_HSet
#undef TCollection_HSet_Type_
// other Inline functions and methods (like "C++: function call" methods)
inline Handle_TColStd_HSetOfInteger ShallowCopy(const Handle_TColStd_HSetOfInteger& me) {
return me->ShallowCopy();
}
#endif
| [
"[email protected]"
] | |
e760ccf03e140751e3552000ca2ab9674eb6eba5 | cf018101493315ac53e3e6f6ebb446e63373e921 | /GameDev/Animation.h | 0292d9d1230380f19a51c7177f1e48b87e1872e7 | [] | no_license | RavinSG/GameDev | cedbd8dd8ea93fed35149716a936a1a7eec38404 | cdcd12d5c1ced9450a2ea4ceabb21766c25fa69c | refs/heads/master | 2023-02-20T10:27:35.114697 | 2021-01-25T07:43:45 | 2021-01-25T07:43:45 | 330,348,843 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 668 | h | #pragma once
#include <vector>
struct FrameData
{
int id;
int x;
int y;
int width;
int height;
float displayTimeSeconds;
};
enum class FacingDirection
{
None,
Left,
Right
};
class Animation
{
public:
Animation(FacingDirection direction);
void AddFrame(int textureID, int x, int y, int width, int height, float frameTIme);
const FrameData* GetCurrentFrame() const;
bool UpdateFrame(float deltaTime);
void Reset();
void SetDirection(FacingDirection direction);
FacingDirection GetDirection() const;
private:
void IncrmentFrame();
std::vector<FrameData> frames;
int CurrentFrameIndex;
float CurrentFrameTime;
FacingDirection direction;
};
| [
"[email protected]"
] | |
f0291994a9eda62a5a45cbc5988f311fccbfe645 | 6b40e9dccf2edc767c44df3acd9b626fcd586b4d | /NT/shell/ext/dsui/dsquery/frame.cpp | cf9d2c9699a264ecd018ea472581e47af1b3af7a | [] | no_license | jjzhang166/WinNT5_src_20201004 | 712894fcf94fb82c49e5cd09d719da00740e0436 | b2db264153b80fbb91ef5fc9f57b387e223dbfc2 | refs/heads/Win2K3 | 2023-08-12T01:31:59.670176 | 2021-10-14T15:14:37 | 2021-10-14T15:14:37 | 586,134,273 | 1 | 0 | null | 2023-01-07T03:47:45 | 2023-01-07T03:47:44 | null | UTF-8 | C++ | false | false | 142,455 | cpp | #include "pch.h"
#include "uxtheme.h"
#pragma hdrstop
/*-----------------------------------------------------------------------------
/ Private data and helper functions
/----------------------------------------------------------------------------*/
//
// ICommonQuery stuff
//
class CCommonQuery : public ICommonQuery, IObjectWithSite
{
private:
LONG _cRef;
IUnknown* _punkSite;
public:
CCommonQuery();
~CCommonQuery();
// IUnknown
STDMETHOD(QueryInterface)(REFIID riid, LPVOID* ppvObject);
STDMETHOD_(ULONG, AddRef)();
STDMETHOD_(ULONG, Release)();
// ICommonQuery
STDMETHOD(OpenQueryWindow)(THIS_ HWND hwndParent, LPOPENQUERYWINDOW pOpenQueryWnd, IDataObject** ppDataObject);
// IObjectWithSite
STDMETHODIMP SetSite(IUnknown* punk);
STDMETHODIMP GetSite(REFIID riid, void **ppv);
};
//
// View layout constants used by our dialogs
//
#define VIEWER_DEFAULT_CY 200
#define COMBOEX_IMAGE_CX 16
#define COMBOEX_IMAGE_CY 16
typedef struct
{
HDSA hdsaPages; // DSA containing page entries
DWORD dwFlags; // flags
CLSID clsidForm; // CLSID identifier for this form
LPTSTR pTitle; // title used for drop down / title bar
HICON hIcon; // hIcon passed by caller
INT iImage; // image list index of icon
INT iForm; // visible index of form in control
INT iPage; // currently selected page on form
} QUERYFORM, * LPQUERYFORM;
typedef struct
{
CLSID clsidForm; // CLSID to associate this form with
LPCQPAGE pPage; // CQPAGE structures
LPCQPAGEPROC pPageProc; // PageProc's used by thunking layer
LPARAM lParam; // PAGEPROC lParam
HWND hwndPage; // hWnd of page dialog // = NULL if none
} QUERYFORMPAGE, * LPQUERYFORMPAGE;
typedef struct
{
LPCQSCOPE pScope;
INT iImage;
} QUERYSCOPE, * LPQUERYSCOPE;
class CQueryFrame : public IQueryFrame
{
friend INT QueryWnd_MessageProc(HWND hwnd, LPMSG pMsg);
friend INT_PTR CALLBACK QueryWnd_DlgProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
public:
CQueryFrame(IUnknown* punkSite, LPOPENQUERYWINDOW pOpenQueryWindow, IDataObject** ppDataObject);
~CQueryFrame();
// IUnknown
STDMETHOD(QueryInterface)(REFIID riid, LPVOID* ppvObject);
STDMETHOD_(ULONG, AddRef)();
STDMETHOD_(ULONG, Release)();
// Internal helper functions
STDMETHOD(DoModal)(HWND hwndParent);
// IQueryFrame
STDMETHOD(AddScope)(THIS_ LPCQSCOPE pScope, INT i, BOOL fSelect);
STDMETHOD(GetWindow)(THIS_ HWND* phWnd);
STDMETHOD(InsertMenus)(THIS_ HMENU hmenuShared, LPOLEMENUGROUPWIDTHS lpMenuWidth);
STDMETHOD(RemoveMenus)(THIS_ HMENU hmenuShared);
STDMETHOD(SetMenu)(THIS_ HMENU hmenuShared, HOLEMENU holereservedMenu);
STDMETHOD(SetStatusText)(THIS_ LPCTSTR pszStatusText);
STDMETHOD(StartQuery)(THIS_ BOOL fStarting);
STDMETHOD(LoadQuery)(THIS_ IPersistQuery* pPersistQuery);
STDMETHOD(SaveQuery)(THIS_ IPersistQuery* pPersistQuery);
STDMETHOD(CallForm)(THIS_ LPCLSID pclsidForm, UINT uMsg, WPARAM wParam, LPARAM lParam);
STDMETHOD(GetScope)(THIS_ LPCQSCOPE* ppScope);
STDMETHOD(GetHandler)(THIS_ REFIID riid, void **ppv);
protected:
// Helper functions
VOID CloseQueryFrame(HRESULT hres);
INT FrameMessageBox(LPCTSTR pPrompt, UINT uType);
// Message handlers
HRESULT OnInitDialog(HWND hwnd);
VOID DoEnableControls(VOID);
LRESULT OnNotify(INT idCtrl, LPNMHDR pNotify);
VOID OnSize(INT cx, INT cy);
VOID OnGetMinMaxInfo(LPMINMAXINFO lpmmi);
VOID OnCommand(WPARAM wParam, LPARAM lParam);
VOID OnInitMenu(HMENU hMenu);
VOID OnEnterMenuLoop(BOOL fEntering);
VOID OnMenuSelect(HMENU hMenu, UINT uID);
HRESULT OnFindNow(VOID);
BOOL OnNewQuery(BOOL fAlwaysPrompt);
HRESULT OnBrowse(VOID);
HRESULT OnHelp(LPHELPINFO pHelpInfo);
// Form/Scope helper fucntions
HRESULT InsertScopeIntoList(LPCQSCOPE pScope, INT i, BOOL fAddToControl);
HRESULT AddScopeToControl(LPQUERYSCOPE pQueryScope, INT i);
HRESULT PopulateScopeControl(VOID);
HRESULT GetSelectedScope(LPQUERYSCOPE* ppQueryScope);
HRESULT AddFromIQueryForm(IQueryForm* pQueryForm, HKEY hkeyForm);
HRESULT GatherForms(VOID);
HRESULT GetForms(HKEY hKeyForms, LPTSTR pName);
HRESULT PopulateFormControl(BOOL fIncludeHidden);
HRESULT SelectForm(REFCLSID clsidForm);
VOID SelectFormPage(LPQUERYFORM pQueryForm, INT iPage);
HRESULT CallFormPages(LPQUERYFORM pQueryForm, UINT uMsg, WPARAM wParam, LPARAM lParam);
LPQUERYFORM FindQueryForm(REFCLSID clsidForm);
private:
LONG _cRef; // reference count for the object
IUnknown* _punkSite; // site object we need to pass through
IQueryHandler* _pQueryHandler; // IQueryHandler object we need to interact with
LPOPENQUERYWINDOW _pOpenQueryWnd; // copy of initial parameters provided by caller
IDataObject** _ppDataObject; // receives the resulting data object from handler
DWORD _dwHandlerViewFlags; // flags from the handler
BOOL _fQueryRunning:1; // = 1 => query has been started, via IQueryFrame::StartQuery(TRUE)
BOOL _fExitModalLoop:1; // = 1 => must leave modal loop
BOOL _fScopesPopulated:1; // = 1 => scope control has been populated
BOOL _fTrackingMenuBar:1; // = 1 => then we are tracking the menu bar, therefore send activates etc
BOOL _fAddScopesNYI:1; // = 1 => did AddScopes return E_NOTIMPL
BOOL _fScopesAddedAsync:1; // = 1 => scopes added async by the handler
BOOL _fScopeImageListSet:1; // = 1 => scope image list has been set
BOOL _fFormFirstEnable:1; // = 1 => enabling controls for first item, so ensure we set focus
HRESULT _hResult; // result value stored by CloseQueryFrame
HKEY _hkHandler; // registry key for the handler
HWND _hwnd; // main window handle
HWND _hwndResults; // result viewer
HWND _hwndStatus; // status bar
HWND _hwndFrame; // Query Pages tab control
HWND _hwndLookForLabel; // "Find:"
HWND _hwndLookFor; // Form combo
HWND _hwndLookInLabel; // "In:"
HWND _hwndLookIn; // Scope combo
HWND _hwndBrowse; // "Browse"
HWND _hwndFindNow; // "Find now"
HWND _hwndStop; // "Stop"
HWND _hwndNewQuery; // "New Query"
HWND _hwndOK; // "OK"
HWND _hwndCancel; // "Cancel"
HWND _hwndFindAnimation; // Query issued animation
HICON _hiconSmall; // large/small app icons
HICON _hiconLarge;
HMENU _hmenuFile; // handle of the frames menu bar
HIMAGELIST _himlForms; // image list for query form objects
SIZE _szMinTrack; // minimum track size of the window
INT _dxFormAreaLeft; // offset to left edge of form area (from window left)
INT _dxFormAreaRight; // offset to right edge of form area (from window right)
INT _dxButtonsLeft; // offset to left edge of buttons (from window right)
INT _dxAnimationLeft; // offset to left edge of aniimation (from window right)
INT _dyResultsTop; // offset to top of results (from top of window)
INT _dyOKTop; // offset to top of "OK" buttom (from results top)
INT _dxGap; // gap between OK + Cancel / LookIn + Browse
INT _dyGap; // gap between bottom of OK,Cancel and the frame.
INT _cyStatus; // height of the status bar
HDSA _hdsaForms; // forms DSA
HDSA _hdsaPages; // pages DSA
SIZE _szForm; // size of the (current form we are displaying)
HDSA _hdsaScopes; // scopes DSA
INT _iDefaultScope; // index of the defualt scope to select (into DSA)
LPQUERYFORM _pCurrentForm; // == NULL if none / else -> form structure
LPQUERYFORMPAGE _pCurrentFormPage; // == NULL if none / else -> page structure
};
//
// Helper functions
//
INT_PTR CALLBACK QueryWnd_DlgProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
INT QueryWnd_MessageProc(HWND hwnd, LPMSG pMsg);
HRESULT _CallScopeProc(LPQUERYSCOPE pQueryScope, UINT uMsg, LPVOID pVoid);
INT _FreeScope(LPQUERYSCOPE pQueryScope);
INT _FreeScopeCB(LPVOID pItem, LPVOID pData);
HRESULT _CallPageProc(LPQUERYFORMPAGE pQueryFormPage, UINT uMsg, WPARAM wParam, LPARAM lParam);
INT _FreeQueryFormCB(LPVOID pItem, LPVOID pData);
INT _FreeQueryForm(LPQUERYFORM pQueryForm);
INT _FreeQueryFormPageCB(LPVOID pItem, LPVOID pData);
INT _FreeQueryFormPage(LPQUERYFORMPAGE pQueryFormPage);
HRESULT _AddFormsProc(LPARAM lParam, LPCQFORM pForm);
HRESULT _AddPagesProc(LPARAM lParam, REFCLSID clsidForm, LPCQPAGE pPage);
//
// Help stuff
//
#define HELP_FILE (NULL)
static DWORD const aHelpIDs[] =
{
0, 0
};
//
// constant strings
//
TCHAR const c_szCLSID[] = TEXT("CLSID");
TCHAR const c_szForms[] = TEXT("Forms");
TCHAR const c_szFlags[] = TEXT("Flags");
TCHAR const c_szCommonQuery[] = TEXT("CommonQuery");
TCHAR const c_szHandlerIs[] = TEXT("Handler");
TCHAR const c_szFormIs[] = TEXT("Form");
TCHAR const c_szSearchPaneHidden[] = TEXT("SearchPaneHidden");
/*-----------------------------------------------------------------------------
/ CCommonQuery
/----------------------------------------------------------------------------*/
CCommonQuery::CCommonQuery() :
_punkSite(NULL), _cRef(1)
{
DllAddRef();
}
CCommonQuery::~CCommonQuery()
{
DoRelease(_punkSite);
DllRelease();
}
// QI handling
ULONG CCommonQuery::AddRef()
{
return InterlockedIncrement(&_cRef);
}
ULONG CCommonQuery::Release()
{
TraceAssert( 0 != _cRef );
ULONG cRef = InterlockedDecrement(&_cRef);
if ( 0 == cRef )
{
delete this;
}
return cRef;
}
HRESULT CCommonQuery::QueryInterface(REFIID riid, void **ppv)
{
static const QITAB qit[] =
{
QITABENT(CCommonQuery, ICommonQuery), // IID_ICommonQuery
QITABENT(CCommonQuery, IObjectWithSite), // IID_IObjectWithSite
{0, 0 },
};
return QISearch(this, qit, riid, ppv);
}
STDAPI CCommonQuery_CreateInstance(IUnknown* punkOuter, IUnknown** ppunk, LPCOBJECTINFO poi)
{
CCommonQuery *pcq = new CCommonQuery;
if (!pcq)
return E_OUTOFMEMORY;
HRESULT hres = pcq->QueryInterface(IID_IUnknown, (void **)ppunk);
pcq->Release();
return hres;
}
// ICommonQuery methods
STDMETHODIMP CCommonQuery::OpenQueryWindow(THIS_ HWND hwndParent, LPOPENQUERYWINDOW pOpenQueryWnd, IDataObject** ppDataObject)
{
HRESULT hres;
CQueryFrame* pQueryFrame = NULL;
TraceEnter(TRACE_QUERY, "CCommonQuery::OpenQueryWindow");
if (!pOpenQueryWnd || (hwndParent && !IsWindow(hwndParent)))
ExitGracefully(hres, E_INVALIDARG, "Bad parameters");
if (ppDataObject)
*(ppDataObject) = NULL;
pQueryFrame = new CQueryFrame(_punkSite, pOpenQueryWnd, ppDataObject);
TraceAssert(pQueryFrame);
if (!pQueryFrame)
ExitGracefully(hres, E_OUTOFMEMORY, "Failed to construct the query window object");
hres = pQueryFrame->DoModal(hwndParent); // don't bother fail gracefully etc
FailGracefully(hres, "Failed on calling DoModal");
exit_gracefully:
DoRelease(pQueryFrame);
TraceLeaveResult(hres);
}
// IObjectWithSite
STDMETHODIMP CCommonQuery::SetSite(IUnknown* punk)
{
HRESULT hres = S_OK;
TraceEnter(TRACE_QUERY, "CCommonQuery::SetSite");
DoRelease(_punkSite);
if (punk)
{
TraceMsg("QIing for IUnknown from the site object");
hres = punk->QueryInterface(IID_IUnknown, (void **)&_punkSite);
FailGracefully(hres, "Failed to get IUnknown from the site object");
}
exit_gracefully:
TraceLeaveResult(hres);
}
STDMETHODIMP CCommonQuery::GetSite(REFIID riid, void **ppv)
{
HRESULT hres;
TraceEnter(TRACE_QUERY, "CCommonQuery::GetSite");
if (!_punkSite)
ExitGracefully(hres, E_NOINTERFACE, "No site to QI from");
hres = _punkSite->QueryInterface(riid, ppv);
FailGracefully(hres, "QI failed on the site unknown object");
exit_gracefully:
TraceLeaveResult(hres);
}
// IQueryFrame stuff
CQueryFrame::CQueryFrame(IUnknown *punkSite, LPOPENQUERYWINDOW pOpenQueryWindow, IDataObject** ppDataObject) :
_cRef(1), _punkSite(punkSite), _pOpenQueryWnd(pOpenQueryWindow),
_ppDataObject(ppDataObject), _hiconLarge(NULL), _hiconSmall(NULL)
{
if (_punkSite)
_punkSite->AddRef();
DllAddRef();
}
CQueryFrame::~CQueryFrame()
{
DoRelease(_punkSite);
if (_hiconLarge)
DestroyIcon(_hiconLarge);
if (_hiconSmall)
DestroyIcon(_hiconSmall);
if (_hkHandler)
RegCloseKey(_hkHandler);
if (_hmenuFile)
DestroyMenu(_hmenuFile);
if (_himlForms)
ImageList_Destroy(_himlForms);
if (_hdsaForms)
{
Trace(TEXT("Destroying QUERYFORM DSA (%d)"), DSA_GetItemCount(_hdsaForms));
DSA_DestroyCallback(_hdsaForms, _FreeQueryFormCB, NULL);
_hdsaForms = NULL;
}
if (_hdsaPages)
{
Trace(TEXT("Destroying QUERYFORMPAGE DSA (%d)"), DSA_GetItemCount(_hdsaPages));
DSA_DestroyCallback(_hdsaPages, _FreeQueryFormPageCB, NULL);
_hdsaPages = NULL;
}
if (_hdsaScopes)
{
Trace(TEXT("Destroying QUERYSCOPE DSA (%d)"), DSA_GetItemCount(_hdsaScopes));
DSA_DestroyCallback(_hdsaScopes, _FreeScopeCB, NULL);
_hdsaScopes = NULL;
}
_pCurrentForm = NULL;
_pCurrentFormPage = NULL;
// Now discard the handler and its window (if we have one), if
// we don't do this they will never kill their objects
if (_hwndResults)
{
DestroyWindow(_hwndResults);
_hwndResults = NULL;
}
DllRelease();
}
// QI handling
ULONG CQueryFrame::AddRef()
{
return InterlockedIncrement(&_cRef);
}
ULONG CQueryFrame::Release()
{
TraceAssert( 0 != _cRef );
ULONG cRef = InterlockedDecrement(&_cRef);
if ( 0 == cRef )
{
delete this;
}
return cRef;
}
HRESULT CQueryFrame::QueryInterface(REFIID riid, void **ppv)
{
static const QITAB qit[] =
{
QITABENT(CQueryFrame, IQueryFrame), // IID_IQueryFrame
{0, 0 },
};
return QISearch(this, qit, riid, ppv);
}
/*-----------------------------------------------------------------------------
/ IQueryFrame
/----------------------------------------------------------------------------*/
STDMETHODIMP CQueryFrame::DoModal(HWND hwndParent)
{
HRESULT hres;
HWND hwndFrame = NULL;
HWND hwndFocus = NULL;
HWND hwndTopOwner = hwndParent;
MSG msg;
INITCOMMONCONTROLSEX iccex;
TraceEnter(TRACE_FRAME, "CQueryFrame::DoModal");
// initialize with the query handler we need
//REVIEWED-2002-02-25-lucios.
hres = CoCreateInstance(_pOpenQueryWnd->clsidHandler, NULL, CLSCTX_INPROC_SERVER, IID_IQueryHandler, (LPVOID*)&_pQueryHandler);
FailGracefully(hres, "Failed to get IQueryHandler for the given CLSID");
hres = _pQueryHandler->Initialize(this, _pOpenQueryWnd->dwFlags, _pOpenQueryWnd->pHandlerParameters);
FailGracefully(hres, "Failed to initialize the handler");
// mimic the behaviour of DialogBox by working out which control previously
// had focus, which window to disable and then running a message
// pump for our dialog. Having done this we can then restore the state
// back to something sensible.
_fExitModalLoop = FALSE; // can be changed from hear down
iccex.dwSize = SIZEOF(iccex);
iccex.dwICC = ICC_USEREX_CLASSES;
InitCommonControlsEx(&iccex);
if (_pOpenQueryWnd->dwFlags & OQWF_HIDESEARCHUI)
{
hwndFrame = CreateDialogParam(GLOBAL_HINSTANCE, MAKEINTRESOURCE(IDD_FILTER),
hwndParent,
QueryWnd_DlgProc, (LPARAM)this);
}
else
{
hwndFrame = CreateDialogParam(GLOBAL_HINSTANCE, MAKEINTRESOURCE(IDD_FIND),
hwndParent,
QueryWnd_DlgProc, (LPARAM)this);
}
if (!hwndFrame)
ExitGracefully(hres, E_FAIL, "Failed to create the dialog");
hwndFocus = GetFocus();
if (hwndTopOwner)
{
// walk up the window stack looking for the window to be disabled, this must
// be the top-most non-child window. If the resulting window is either
// the desktop or is already disabled then don't bother.
while (GetWindowLong(hwndTopOwner, GWL_STYLE) & WS_CHILD)
hwndTopOwner = GetParent(hwndTopOwner);
TraceAssert(hwndTopOwner);
if ((hwndTopOwner == GetDesktopWindow())
|| EnableWindow(hwndTopOwner, FALSE))
{
TraceMsg("Parent is disabled or the desktop window, therefore setting to NULL");
hwndTopOwner = NULL;
}
}
ShowWindow(hwndFrame, SW_SHOW); // show the query window
while (!_fExitModalLoop && GetMessage(&msg, NULL, 0, 0) > 0)
{
if (!QueryWnd_MessageProc(hwndFrame, &msg) && !IsDialogMessage(hwndFrame, &msg))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
}
// Now tidy up, make the parent the active window, enable the top most
// window if there is one and restore focus as required.
if (hwndTopOwner)
EnableWindow(hwndTopOwner, TRUE);
if (hwndParent && (GetActiveWindow() == hwndFrame))
{
TraceMsg("Passing activation to parent");
SetActiveWindow(hwndParent);
}
if (IsWindow(hwndFocus))
SetFocus(hwndFocus);
DestroyWindow(hwndFrame); // discard the current frame window
exit_gracefully:
DoRelease(_pQueryHandler);
TraceLeaveResult(_hResult);
}
/*---------------------------------------------------------------------------*/
STDMETHODIMP CQueryFrame::AddScope(THIS_ LPCQSCOPE pScope, INT i, BOOL fSelect)
{
HRESULT hres;
TraceEnter(TRACE_FRAME, "CQueryFrame::AddScope");
if (!pScope)
ExitGracefully(hres, E_INVALIDARG, "No scope to add to the list");
// Add the scope to the control and then ensure that we either have
// its index stored (for default selection) or we select the
// item.
if (!_hdsaScopes || !DSA_GetItemCount(_hdsaScopes))
{
TraceMsg("First scope being added, thefore selecting");
fSelect = TRUE;
}
hres = InsertScopeIntoList(pScope, i, _fScopesPopulated);
FailGracefully(hres, "Failed to add scope to control");
if (fSelect)
{
if (!_fScopesPopulated)
{
Trace(TEXT("Storing default scope index %d"), ShortFromResult(hres));
_iDefaultScope = ShortFromResult(hres);
}
else
{
Trace(TEXT("Selecting scope index %d"), ShortFromResult(hres));
ComboBox_SetCurSel(_hwndLookIn, ShortFromResult(hres));
}
}
// hres = S_OK;
exit_gracefully:
TraceLeaveResult(hres);
}
/*---------------------------------------------------------------------------*/
STDMETHODIMP CQueryFrame::GetWindow(THIS_ HWND* phWnd)
{
TraceEnter(TRACE_FRAME, "CQueryFrame::GetWindow");
TraceAssert(phWnd);
*phWnd = _hwnd;
TraceLeaveResult(S_OK);
}
/*---------------------------------------------------------------------------*/
// Add a menu group to the given menu bar, updating the width index accordingly
// so that other people can merge in accordingly
VOID _DoInsertMenu(HMENU hMenu, INT iIndexTo, HMENU hMenuToInsert, INT iIndexFrom)
{
TCHAR szBuffer[MAX_PATH];
HMENU hPopupMenu = NULL;
TraceEnter(TRACE_FRAME, "_DoInsertMenu");
hPopupMenu = CreatePopupMenu();
if (hPopupMenu)
{
Shell_MergeMenus(hPopupMenu, GetSubMenu(hMenuToInsert, iIndexFrom), 0x0, 0x0, 0x7fff, 0);
//REVIEWED-2002-02-25-lucios.
GetMenuString(hMenuToInsert, iIndexFrom, szBuffer, ARRAYSIZE(szBuffer), MF_BYPOSITION);
InsertMenu(hMenu, iIndexTo, MF_BYPOSITION|MF_POPUP, (UINT_PTR)hPopupMenu, szBuffer);
}
TraceLeave();
}
VOID _AddMenuGroup(HMENU hMenuShared, HMENU hMenuGroup, LONG iInsertAt, LPLONG pWidth)
{
HRESULT hres;
TCHAR szBuffer[MAX_PATH];
HMENU hMenu;
INT i;
TraceEnter(TRACE_FRAME, "_AddMenuGroup");
TraceAssert(hMenuShared);
TraceAssert(hMenuGroup);
TraceAssert(pWidth);
for (i = 0 ; i < GetMenuItemCount(hMenuGroup) ; i++)
{
_DoInsertMenu(hMenuShared, iInsertAt+i, hMenuGroup, i);
*pWidth += 1;
}
TraceLeave();
}
STDMETHODIMP CQueryFrame::InsertMenus(THIS_ HMENU hmenuShared, LPOLEMENUGROUPWIDTHS lpMenuWidth)
{
HRESULT hres;
TraceEnter(TRACE_FRAME, "CQueryFrame::InsertMenus");
if (!hmenuShared || !lpMenuWidth)
ExitGracefully(hres, E_INVALIDARG, "Unable to insert menus");
// if we don't have the menu bar already loaded then lets load it,
// having done that we can then add our menu to the bar (we only
// provide entries for the file menu).
if (!_hmenuFile)
{
_hmenuFile = LoadMenu(GLOBAL_HINSTANCE, MAKEINTRESOURCE(IDR_FILEMENUGROUP));
if (!_hmenuFile)
ExitGracefully(hres, E_FAIL, "Failed to load base menu defn");
}
_AddMenuGroup(hmenuShared, _hmenuFile, 0, &lpMenuWidth->width[0]);
hres = S_OK; // success
exit_gracefully:
TraceLeaveResult(hres);
}
/*---------------------------------------------------------------------------*/
STDMETHODIMP CQueryFrame::RemoveMenus(THIS_ HMENU hmenuShared)
{
TraceEnter(TRACE_FRAME, "CQueryFrame::RemoveMenus");
// We don't need to implement this as we copy or menus into the
// menu that the handler supplies - fix DSQUERY if this ever
// changes.
TraceLeaveResult(S_OK);
}
/*---------------------------------------------------------------------------*/
STDMETHODIMP CQueryFrame::SetMenu(THIS_ HMENU hmenuShared, HOLEMENU holereservedMenu)
{
TraceEnter(TRACE_FRAME, "CQueryFrame::SetMenu");
if (!(_pOpenQueryWnd->dwFlags & OQWF_HIDEMENUS))
{
HMENU hmenuOld = ::GetMenu(_hwnd);
if (!hmenuShared)
hmenuShared = _hmenuFile;
::SetMenu(_hwnd, hmenuShared);
DoEnableControls(); // ensure the menu state is valid
::DrawMenuBar(_hwnd);
if (hmenuOld && (hmenuOld != _hmenuFile) && (hmenuOld != hmenuShared))
{
TraceMsg("Destroying old menu");
DestroyMenu(hmenuOld);
}
}
TraceLeaveResult(S_OK);
}
/*---------------------------------------------------------------------------*/
STDMETHODIMP CQueryFrame::SetStatusText(THIS_ LPCTSTR pszStatusText)
{
TraceEnter(TRACE_FRAME, "CQueryFrame::SetStatusText");
Trace(TEXT("Setting status text to: %s"), pszStatusText);
if (_hwndStatus)
SendMessage(_hwndStatus, SB_SETTEXT, 0, (LPARAM)pszStatusText);
TraceLeaveResult(S_OK);
}
/*---------------------------------------------------------------------------*/
STDMETHODIMP CQueryFrame::StartQuery(THIS_ BOOL fStarting)
{
TraceEnter(TRACE_FRAME, "CQueryFrame::StartQuery");
if (fStarting)
{
Animate_Play(_hwndFindAnimation, 0, -1, -1);
}
else
{
Animate_Stop(_hwndFindAnimation);
Animate_Seek(_hwndFindAnimation, 0); // go to start
}
if (_pQueryHandler)
_pQueryHandler->ActivateView(CQRVA_STARTQUERY, (WPARAM)fStarting, 0);
// now set the controls into a sensble state
_fQueryRunning = fStarting;
DoEnableControls();
TraceLeaveResult(S_OK);
}
/*---------------------------------------------------------------------------*/
STDMETHODIMP CQueryFrame::LoadQuery(THIS_ IPersistQuery* pPersistQuery)
{
HRESULT hres;
TCHAR szGUID[GUIDSTR_MAX+1];
LPQUERYFORM pQueryForm = NULL;
GUID guid;
TraceEnter(TRACE_FRAME, "CQueryFrame::LoadQuery");
_pQueryHandler->StopQuery(); // ensure that the handler stops its processing
// Attempt to read the handler GUID from the query stream, first try reading it as
// as string then parsing it into something that we can use, if that fails then
// try again, but this time read it as a structure.
//
// having aquired the GUID for the handler make sure that we have the correct handler
// selected.
if (FAILED(pPersistQuery->ReadString(c_szCommonQuery, c_szHandlerIs, szGUID, ARRAYSIZE(szGUID))) ||
!GetGUIDFromString(szGUID, &guid))
{
TraceMsg("Trying new style handler GUID as struct");
hres = pPersistQuery->ReadStruct(c_szCommonQuery, c_szHandlerIs, &guid, SIZEOF(guid));
FailGracefully(hres, "Failed to read handler GUID as struct");
}
if (guid != _pOpenQueryWnd->clsidHandler)
ExitGracefully(hres, E_FAIL, "Persisted handler GUID and specified handler GUID don't match");
hres = _pQueryHandler->LoadQuery(pPersistQuery);
FailGracefully(hres, "Handler failed to load its query data");
// Get the form ID, then look up the form to see if we have one that matches,
// if not then we cannot load any thing else. If we do haved that form then
// ensure that we clear it and then load away.
if (FAILED(pPersistQuery->ReadString(c_szCommonQuery, c_szFormIs, szGUID, ARRAYSIZE(szGUID))) ||
!GetGUIDFromString(szGUID, &guid))
{
TraceMsg("Trying new style form GUID as struct");
hres = pPersistQuery->ReadStruct(c_szCommonQuery, c_szFormIs, &guid, SIZEOF(guid));
FailGracefully(hres, "Failed to read handler GUID as struct");
}
hres = SelectForm(guid);
FailGracefully(hres, "Failed to select the query form");
if (hres == S_FALSE)
ExitGracefully(hres, E_FAIL, "Failed to select the query form to read the query info");
hres = CallFormPages(_pCurrentForm, CQPM_CLEARFORM, 0, 0);
FailGracefully(hres, "Failed to clear form before loading");
// Load the persisted query from the stream, coping correctly with the
// UNICODE / ANSI issue. We will be passed an IPersistQuery object which
// we must then thunk accordingly if we are UNICODE for the pages we
// are going to talk to.
hres = CallFormPages(_pCurrentForm, CQPM_PERSIST, TRUE, (LPARAM)pPersistQuery);
FailGracefully(hres, "Failed to load page data (UNICODE)");
hres = S_OK; // success
exit_gracefully:
if (SUCCEEDED(hres))
{
TraceMsg("Query loaded successfully, select form query");
SelectForm(guid);
}
TraceLeaveResult(hres);
}
/*---------------------------------------------------------------------------*/
STDMETHODIMP CQueryFrame::SaveQuery(THIS_ IPersistQuery* pPersistQuery)
{
HRESULT hres;
LPQUERYSCOPE pQueryScope;
TCHAR szBuffer[MAX_PATH];
TraceEnter(TRACE_FRAME, "CQueryFrame::SaveQuery");
if (!pPersistQuery)
ExitGracefully(hres, E_INVALIDARG, "No pPersistQuery object to write into");
pPersistQuery->Clear(); // flush the contents
hres = pPersistQuery->WriteStruct(c_szCommonQuery, c_szHandlerIs,
&_pOpenQueryWnd->clsidHandler,
SIZEOF(_pOpenQueryWnd->clsidHandler));
FailGracefully(hres, "Failed to write handler GUID");
hres = pPersistQuery->WriteStruct(c_szCommonQuery, c_szFormIs,
&_pCurrentForm->clsidForm,
SIZEOF(_pCurrentForm->clsidForm));
FailGracefully(hres, "Failed to write form GUID");
// Allow the handler to persist itself into the the stream, this includes
// giving it the current scope to store.
hres = GetSelectedScope(&pQueryScope);
FailGracefully(hres, "Failed to get the scope from the LookIn control");
hres = _pQueryHandler->SaveQuery(pPersistQuery, pQueryScope->pScope);
FailGracefully(hres, "Failed when calling handler to persist itself");
// Save the query into the stream, coping correctly with the
// UNICODE / ANSI issue. We will be passed an IPersistQuery object which
// we must then thunk accordingly if we are UNICODE for the pages we
// are going to talk to.
hres = CallFormPages(_pCurrentForm, CQPM_PERSIST, FALSE, (LPARAM)pPersistQuery);
FailGracefully(hres, "Failed to load page data (UNICODE)");
hres = S_OK;
exit_gracefully:
TraceLeaveResult(hres);
}
/*---------------------------------------------------------------------------*/
STDMETHODIMP CQueryFrame::CallForm(THIS_ LPCLSID pclsidForm, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
HRESULT hres;
LPQUERYFORM pQueryForm = _pCurrentForm;
TraceEnter(TRACE_FRAME, "CQueryFrame::CallForm");
if (pclsidForm)
{
pQueryForm = FindQueryForm(*pclsidForm);
TraceAssert(pQueryForm);
}
if (!pQueryForm)
ExitGracefully(hres, E_FAIL, "Failed to find query form for given CLSID");
hres = CallFormPages(pQueryForm, uMsg, wParam, lParam);
FailGracefully(hres, "Failed when calling CallFormPages");
// hres = S_OK;
exit_gracefully:
TraceLeaveResult(hres);
}
/*---------------------------------------------------------------------------*/
STDMETHODIMP CQueryFrame::GetScope(THIS_ LPCQSCOPE* ppScope)
{
HRESULT hres;
LPQUERYSCOPE pQueryScope;
TraceEnter(TRACE_FRAME, "CQueryFrame::GetScope");
if (!ppScope)
ExitGracefully(hres, E_INVALIDARG, "ppScope == NULL, thats bad");
hres = GetSelectedScope(&pQueryScope);
FailGracefully(hres, "Failed to get the current scope");
*ppScope = (LPCQSCOPE)CoTaskMemAlloc(pQueryScope->pScope->cbStruct);
TraceAssert(*ppScope);
if (!*ppScope)
ExitGracefully(hres, E_OUTOFMEMORY, "Failed to allocate the scope block");
//REVIEWED-2002-02-25-lucios.
memcpy(*ppScope, pQueryScope->pScope, pQueryScope->pScope->cbStruct);
hres = S_OK;
exit_gracefully:
TraceLeaveResult(hres);
}
/*---------------------------------------------------------------------------*/
STDMETHODIMP CQueryFrame::GetHandler(THIS_ REFIID riid, void **ppv)
{
HRESULT hres;
TraceEnter(TRACE_FRAME, "CQueryFrame::GetHandler");
if (!_pQueryHandler)
ExitGracefully(hres, E_UNEXPECTED, "_pQueryHandler is NULL");
hres = _pQueryHandler->QueryInterface(riid, ppv);
exit_gracefully:
TraceLeaveResult(hres);
}
/*-----------------------------------------------------------------------------
/ Dialog box handler functions (core guts)
/----------------------------------------------------------------------------*/
#define REAL_WINDOW(hwnd) \
(hwnd && \
IsWindowVisible(hwnd) && \
IsWindowEnabled(hwnd) && \
(GetWindowLong(hwnd, GWL_STYLE) & WS_TABSTOP))
HWND _NextTabStop(HWND hwndSearch, BOOL fShift)
{
HWND hwnd;
Trace(TEXT("hwndSearch %08x, fShift %d"), hwndSearch, fShift);
// do we have a window to search into?
while (hwndSearch)
{
// if we have a window then lets check to see if it has any children?
hwnd = GetWindow(hwndSearch, GW_CHILD);
Trace(TEXT("Child of %08x is %08x"), hwndSearch, hwnd);
if (hwnd)
{
// it has a child therefore lets to go its first/last
// and continue the search there for a window that
// matches the criteria we are looking for.
hwnd = GetWindow(hwnd, fShift ? GW_HWNDLAST:GW_HWNDFIRST);
if (!REAL_WINDOW(hwnd))
{
Trace(TEXT("Trying to recurse into %08x"), hwnd);
hwnd = _NextTabStop(hwnd, fShift);
}
Trace(TEXT("Tabstop child of %08x is %08x"), hwndSearch, hwnd);
}
// after all that is hwnd a valid window? if so then pass
// that back out to the caller.
if (REAL_WINDOW(hwnd))
{
Trace(TEXT("Child tab stop was %08x"), hwnd);
return hwnd;
}
// do we have a sibling? if so then lets return that otherwise
// lets just continue to search until we either run out of windows
// or hit something interesting
hwndSearch = GetWindow(hwndSearch, fShift ? GW_HWNDPREV:GW_HWNDNEXT);
if (REAL_WINDOW(hwndSearch))
{
Trace(TEXT("Next tab stop was %08x"), hwndSearch);
return hwndSearch;
}
}
return hwndSearch;
}
INT QueryWnd_MessageProc(HWND hwnd, LPMSG pMsg)
{
LRESULT lResult = 0;
CQueryFrame* pQueryFrame = NULL;
NMHDR nmhdr;
pQueryFrame = (CQueryFrame*)GetWindowLongPtr(hwnd, DWLP_USER);
if (!pQueryFrame)
return 0;
if ((pMsg->message == WM_KEYDOWN) && (pMsg->wParam == VK_TAB))
{
BOOL fCtrl = GetAsyncKeyState(VK_CONTROL) < 0;
BOOL fShift = GetAsyncKeyState(VK_SHIFT) < 0;
// ensure that the focus rectangles are shown
#if (_WIN32_WINNT >= 0x0500)
SendMessage(hwnd, WM_CHANGEUISTATE, MAKEWPARAM(UIS_CLEAR, UISF_HIDEFOCUS), 0);
#endif
if (fCtrl)
{
// if this is a key press within the parent then lets ensure that we
// allow the tab control to change the page correctly. otherwise lets
// just hack around the problem of the result view not handling tabs
// properly.
INT iCur = TabCtrl_GetCurSel(pQueryFrame->_hwndFrame);
INT nPages = TabCtrl_GetItemCount(pQueryFrame->_hwndFrame);
if (fShift)
iCur += (nPages-1);
else
iCur++;
pQueryFrame->SelectFormPage(pQueryFrame->_pCurrentForm, iCur % nPages);
return 1; // we processed it
}
else
{
// is the window that has the focus a child of the result view, if
// so then we must attempt to pass focus to its 1st child and hope
// that is can do the rest.
HWND hwndNext, hwndFocus = GetFocus();
Trace(TEXT("Current focus window %08x"), hwndFocus);
while (hwndFocus && GetWindowLong(hwndFocus, GWL_STYLE) & WS_CHILD)
{
hwndNext = _NextTabStop(hwndFocus, fShift);
Trace(TEXT("_NextTabStop yeilds %08x from %08x"), hwndNext, hwndFocus);
if (hwndNext)
{
Trace(TEXT("SetFocus on child %08x"), hwndNext);
SendMessage(GetParent(hwndNext),WM_NEXTDLGCTL,(WPARAM)hwndNext,TRUE);
SetFocus(hwndNext);
return 1;
}
while (TRUE)
{
// look up the parent list trying to find a window that we can
// tab back into. We must watch that when we walk out of the
// child list we loop correctly at the top of the list.
hwndNext = GetParent(hwndFocus);
Trace(TEXT("Parent hwnd %08x"), hwndNext);
if (GetWindowLong(hwndNext, GWL_STYLE) & WS_CHILD)
{
// the parent window is a child, therefore we can check
// to see if has any siblings.
Trace(TEXT("hwndNext is a child, therefore hwndNext of it is %08x"),
GetWindow(hwndNext, fShift ? GW_HWNDPREV:GW_HWNDNEXT));
if (GetWindow(hwndNext, fShift ? GW_HWNDPREV:GW_HWNDNEXT))
{
hwndFocus = GetWindow(hwndNext, fShift ? GW_HWNDPREV:GW_HWNDNEXT);
Trace(TEXT("Silbing window found %08x"), hwndFocus);
break;
}
else
{
TraceMsg("There was no sibling, therefore continuing parent loop");
hwndFocus = hwndNext;
}
}
else
{
// we have hit the parent window of it all (the overlapped one)
// therefore we must attempt to go to its first child. Walk forward
// in the stack looking for a window that matches the
// "REAL_WINDOW" conditions.
hwndFocus = GetWindow(hwndFocus, fShift ? GW_HWNDLAST:GW_HWNDFIRST);
Trace(TEXT("First child is %08x"), hwndFocus);
break; // continue the sibling search etc
}
}
if (REAL_WINDOW(hwndFocus))
{
SendMessage(GetParent(hwndFocus),WM_NEXTDLGCTL,(WPARAM)hwndFocus,TRUE);
SetFocus(hwndFocus);
return 1;
}
}
}
}
return 0;
}
//
// Main DLGPROC
//
INT_PTR CALLBACK QueryWnd_DlgProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
CQueryFrame* pQueryFrame;
if (uMsg == WM_INITDIALOG)
{
HRESULT hres;
pQueryFrame = (CQueryFrame*)lParam;
SetWindowLongPtr(hwnd, DWLP_USER, (LRESULT)pQueryFrame);
hres = pQueryFrame->OnInitDialog(hwnd);
Trace(TEXT("OnInitDialog returns %08x"), hres);
if (FAILED(hres))
{
TraceMsg("Failed to initialize the dialog, Destroying the window");
pQueryFrame->CloseQueryFrame(hres);
DestroyWindow(hwnd);
}
}
else
{
pQueryFrame = (CQueryFrame*)GetWindowLongPtr(hwnd, DWLP_USER);
if (!pQueryFrame)
goto exit_gracefully;
switch (uMsg)
{
case WM_ERASEBKGND:
{
HDC hdc = (HDC)wParam;
RECT rc;
// if we have a DC then lets fill it, and if we have a
// query form then lets paint the divider between the menu bar and
// this area.
if (hdc)
{
GetClientRect(hwnd, &rc);
FillRect(hdc, &rc, (HBRUSH)(COLOR_3DFACE+1));
if (!(pQueryFrame->_pOpenQueryWnd->dwFlags & OQWF_HIDEMENUS))
DrawEdge(hdc, &rc, EDGE_ETCHED, BF_TOP);
SetWindowLongPtr(hwnd, DWLP_MSGRESULT, 1L);
}
return 1;
}
case WM_NOTIFY:
return pQueryFrame->OnNotify((int)wParam, (LPNMHDR)lParam);
case WM_SIZE:
pQueryFrame->OnSize(LOWORD(lParam), HIWORD(lParam));
return(1);
case WM_GETMINMAXINFO:
pQueryFrame->OnGetMinMaxInfo((LPMINMAXINFO)lParam);
return(1);
case WM_COMMAND:
pQueryFrame->OnCommand(wParam, lParam);
return(1);
case WM_ACTIVATE:
pQueryFrame->_pQueryHandler->ActivateView(wParam ? CQRVA_ACTIVATE : CQRVA_DEACTIVATE, 0, 0);
// NTRAID#NTBUG9-411693-2001/10/24-lucios
// We return 0 so that we don't call DefWndProc and therefore the
// focus is not set to the first child control
return(0);
case WM_INITMENU:
pQueryFrame->OnInitMenu((HMENU)wParam);
return(1);
case WM_SETCURSOR:
{
// do we have any scopes? if not then let us display the wait
// cursor for the user. if we have a query running then lets
// display the app start cursor.
if (!pQueryFrame->_fAddScopesNYI &&
!ComboBox_GetCount(pQueryFrame->_hwndLookIn))
{
if (LOWORD(lParam) == HTCLIENT)
{
SetCursor(LoadCursor(NULL, MAKEINTRESOURCE(IDC_WAIT)));
SetWindowLongPtr(hwnd, DWLP_MSGRESULT, 1L);
return 1;
}
}
break;
}
case WM_INITMENUPOPUP:
{
// only send sub-menu activates if the menu bar is being tracked, this is
// handled within OnInitMenu, if we are not tracking the menu then we
// assume that the client has already primed the menu and that they are
// using some kind of popup menu.
if (pQueryFrame->_fTrackingMenuBar)
pQueryFrame->_pQueryHandler->ActivateView(CQRVA_INITMENUBARPOPUP, wParam, lParam);
return(1);
}
case WM_ENTERMENULOOP:
pQueryFrame->OnEnterMenuLoop(TRUE);
return(1);
case WM_EXITMENULOOP:
pQueryFrame->OnEnterMenuLoop(FALSE);
return(1);
case WM_MENUSELECT:
{
UINT uID = LOWORD(wParam);
UINT uFlags = HIWORD(wParam);
HMENU hMenu = (HMENU)lParam;
// the command opens a popup menu the the uID is actually
// the index into the menu, so lets ensure that we pick
// up the correct ID by calling GetMenuItemInfo, note that
// GetMenuItemID returns -1 in this case which is totally
// useless.
if (uFlags & MF_POPUP)
{
MENUITEMINFO mii;
ZeroMemory(&mii, SIZEOF(mii));
mii.cbSize = SIZEOF(mii);
mii.fMask = MIIM_ID;
if (GetMenuItemInfo(hMenu, uID, TRUE, &mii))
uID = mii.wID;
}
pQueryFrame->OnMenuSelect(hMenu, uID);
return(1);
}
case WM_SYSCOMMAND:
if (wParam == SC_CLOSE)
{
pQueryFrame->CloseQueryFrame(S_FALSE);
return(1);
}
break;
case WM_CONTEXTMENU:
{
// there are a couple of controls we don't care about for the
// frame, so lets ignore those when passing the CQRVA_CONTEXTMENU
// through to the handler.
POINT pt = { GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam) };
ScreenToClient((HWND)wParam, &pt);
switch (GetDlgCtrlID(ChildWindowFromPoint((HWND)wParam, pt)))
{
case IDC_FORMAREA:
case IDC_FINDANIMATION:
case IDC_STATUS:
return TRUE; // handled
default:
pQueryFrame->_pQueryHandler->ActivateView(CQRVA_CONTEXTMENU, wParam, lParam);
return TRUE;
}
return FALSE;
}
case WM_HELP:
{
LPHELPINFO phi = (LPHELPINFO)lParam;
// filter out those controls we are not interested in (they make no sense)
// to bother the user with
switch (GetDlgCtrlID((HWND)phi->hItemHandle))
{
case IDC_FORMAREA:
case IDC_FINDANIMATION:
case IDC_STATUS:
return TRUE;
default:
pQueryFrame->OnHelp(phi);
return TRUE;
}
return FALSE;
}
case CQFWM_ADDSCOPE:
{
LPCQSCOPE pScope = (LPCQSCOPE)wParam;
BOOL fSelect = LOWORD(lParam);
INT iIndex = HIWORD(lParam);
if (SUCCEEDED(pQueryFrame->AddScope(pScope, iIndex, fSelect)))
SetWindowLongPtr(hwnd, DWLP_MSGRESULT, 1L);
return 1;
}
case CQFWM_GETFRAME:
{
IQueryFrame** ppQueryFrame = (IQueryFrame**)lParam;
if (ppQueryFrame)
{
pQueryFrame->AddRef();
*ppQueryFrame = pQueryFrame;
SetWindowLongPtr(hwnd, DWLP_MSGRESULT, 1L);
}
return 1;
}
case CQFWM_ALLSCOPESADDED:
{
// there is an async scope collector, it has added all the scopes
// so we must now attempt to issue the query if the we are in the
// holding pattern waiting for the scopes to be collected.
pQueryFrame->_fScopesAddedAsync = FALSE; // all scopes have been added
if (pQueryFrame->_pOpenQueryWnd->dwFlags & OQWF_ISSUEONOPEN)
PostMessage(pQueryFrame->_hwnd, CQFWM_STARTQUERY, 0, 0);
return 1;
}
case CQFWM_STARTQUERY:
pQueryFrame->OnFindNow();
return 1;
case CQFWM_SETDEFAULTFOCUS:
{
HWND hwndNextTab = _NextTabStop(pQueryFrame->_pCurrentFormPage->hwndPage, FALSE);
SendMessage(pQueryFrame->_pCurrentFormPage->hwndPage, WM_NEXTDLGCTL, (WPARAM)hwndNextTab, 1);
break;
}
default:
break;
}
}
exit_gracefully:
return(0);
}
/*-----------------------------------------------------------------------------
/ CQueryFrame::CloseQueryFrame
/ ----------------------------
/ Close the query window passing back the data object if required, and ensuring
/ that our result code indicates what is going on.
/
/ In:
/ hResult = result code to pass to the caller
/
/ Out:
/ -
/----------------------------------------------------------------------------*/
VOID CQueryFrame::CloseQueryFrame(HRESULT hres)
{
TraceEnter(TRACE_FRAME, "CQueryFrame::CloseQueryFrame");
Trace(TEXT("hResult %08x"), hres);
// If we succeeded then attempt to collect the IDataObject and pass it
// back to the caller.
if (hres == S_OK)
{
if (_ppDataObject)
{
hres = _pQueryHandler->GetViewObject(CQRVS_SELECTION, IID_IDataObject, (LPVOID*)_ppDataObject);
FailGracefully(hres, "Failed when collecting the data object");
}
if ((_pOpenQueryWnd->dwFlags & OQWF_SAVEQUERYONOK) && _pOpenQueryWnd->pPersistQuery)
{
hres = SaveQuery(_pOpenQueryWnd->pPersistQuery);
FailGracefully(hres, "Failed when persisting query to IPersistQuery blob");
}
hres = S_OK; // success
}
exit_gracefully:
_hResult = hres;
_fExitModalLoop = TRUE; // bomb out of the modal loop
TraceLeave();
}
/*-----------------------------------------------------------------------------
/ CQueryFrame::FrameMessageBox
/ ----------------------------
/ Our message box for putting up prompts that relate to the current
/ query. We handle getting the view information and displaying
/ the prompt, returning the result from MessageBox.
/
/ In:
/ pPrompt = text displayed as a prompt
/ uType = message box type
/
/ Out:
/ INT
/----------------------------------------------------------------------------*/
INT CQueryFrame::FrameMessageBox(LPCTSTR pPrompt, UINT uType)
{
TCHAR szTitle[MAX_PATH];
CQVIEWINFO vi;
TraceEnter(TRACE_FRAME, "CQueryFrame::FrameMessageBox");
ZeroMemory(&vi, SIZEOF(vi));
//vi. dwFlags = 0; // display attributes
if (SUCCEEDED(_pQueryHandler->GetViewInfo(&vi)) && vi.hInstance && vi.idTitle)
LoadString(vi.hInstance, vi.idTitle, szTitle, ARRAYSIZE(szTitle));
else
GetWindowText(_hwnd, szTitle, ARRAYSIZE(szTitle));
TraceLeaveValue(MessageBox(_hwnd, pPrompt, szTitle, uType));
}
/*-----------------------------------------------------------------------------
/ CQueryFrame::OnInitDlg
/ ----------------------
/ Handle a WM_INITDAILOG message, this is sent as the first thing the
/ dialog receives, therefore we must handle our initialization that
/ was not handled in the constructor.
/
/ In:
/ hwnd = handle of dialog we are initializing
/
/ Out:
/ HRESULT
/----------------------------------------------------------------------------*/
HRESULT CQueryFrame::OnInitDialog(HWND hwnd)
{
HRESULT hres;
HICON hIcon = NULL;
TCHAR szGUID[GUIDSTR_MAX+1];
TCHAR szBuffer[MAX_PATH];
CQVIEWINFO vi;
INT dyControls = 0;
RECT rect, rect2;
SIZE size;
TraceEnter(TRACE_FRAMEDLG, "CQueryFrame::OnInitDialog");
// get the HKEY for the handler we are using
hres = GetKeyForCLSID(_pOpenQueryWnd->clsidHandler, NULL, &_hkHandler);
FailGracefully(hres, "Failed to open handlers HKEY");
// pick up the control handles and store them, saves picking them up later
_hwnd = hwnd;
_hwndFrame = GetDlgItem(hwnd, IDC_FORMAREA);
_hwndLookForLabel = GetDlgItem(hwnd, CQID_LOOKFORLABEL);
_hwndLookFor = GetDlgItem(hwnd, CQID_LOOKFOR);
_hwndLookInLabel = GetDlgItem(hwnd, CQID_LOOKINLABEL);
_hwndLookIn = GetDlgItem(hwnd, CQID_LOOKIN);
_hwndBrowse = GetDlgItem(hwnd, CQID_BROWSE);
_hwndFindNow = GetDlgItem(hwnd, CQID_FINDNOW);
_hwndStop = GetDlgItem(hwnd, CQID_STOP);
_hwndNewQuery = GetDlgItem(hwnd, CQID_CLEARALL);
_hwndFindAnimation = GetDlgItem(hwnd, IDC_FINDANIMATION);
_hwndOK = GetDlgItem(hwnd, IDOK);
_hwndCancel = GetDlgItem(hwnd, IDCANCEL);
// when enable is called this will be the first
_fFormFirstEnable = TRUE;
// call the IQueryHandler interface and get its display attributes,
// then reflect these into the dialog we are about to display to the
// outside world.
vi.dwFlags = 0;
vi.hInstance = NULL;
vi.idLargeIcon = 0;
vi.idSmallIcon = 0;
vi.idTitle = 0;
vi.idAnimation = 0;
hres = _pQueryHandler->GetViewInfo(&vi);
FailGracefully(hres, "Failed when getting the view info from the handler");
_dwHandlerViewFlags = vi.dwFlags;
if (vi.hInstance)
{
HICON hiTemp = NULL;
if (vi.idLargeIcon)
{
_hiconLarge = (HICON)LoadImage(vi.hInstance,
MAKEINTRESOURCE(vi.idLargeIcon),
IMAGE_ICON,
0, 0,
LR_DEFAULTCOLOR|LR_DEFAULTSIZE);
if (_hiconLarge)
SendMessage(hwnd, WM_SETICON, ICON_BIG, (LPARAM)_hiconLarge);
}
if (vi.idSmallIcon)
{
_hiconSmall = (HICON)LoadImage(vi.hInstance,
MAKEINTRESOURCE(vi.idLargeIcon),
IMAGE_ICON,
GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON),
LR_DEFAULTCOLOR);
if (_hiconSmall)
SendMessage(hwnd, WM_SETICON, ICON_SMALL, (LPARAM)_hiconSmall);
}
if (vi.idTitle)
{
LoadString(vi.hInstance, vi.idTitle, szBuffer, ARRAYSIZE(szBuffer));
SetWindowText(hwnd, szBuffer);
}
}
if (vi.hInstance && vi.idAnimation)
{
SetWindowLongPtr(_hwndFindAnimation, GWLP_HINSTANCE, (LRESULT)vi.hInstance);
Animate_Open(_hwndFindAnimation, MAKEINTRESOURCE(vi.idAnimation));
}
else
{
Animate_Open(_hwndFindAnimation, MAKEINTRESOURCE(IDR_FINDANIMATION));
}
// now adjust the positions and hide the controls we are not interested in
if (_pOpenQueryWnd->dwFlags & OQWF_REMOVEFORMS)
{
// NTRAID#NTBUG9-619016-2002/05/21-lucios
EnableWindow(_hwndLookForLabel,FALSE);
ShowWindow(_hwndLookForLabel, SW_HIDE);
ShowWindow(_hwndLookFor, SW_HIDE);
}
if (_pOpenQueryWnd->dwFlags & OQWF_REMOVESCOPES)
{
// NTRAID#NTBUG9-619016-2002/05/21-lucios
EnableWindow(_hwndLookInLabel,FALSE);
ShowWindow(_hwndLookInLabel, SW_HIDE);
ShowWindow(_hwndLookIn, SW_HIDE);
ShowWindow(_hwndBrowse, SW_HIDE);
}
// hiding both the scopes and the forms control causes us to
// move all the controls up by so many units.
if ((_pOpenQueryWnd->dwFlags & (OQWF_REMOVEFORMS|OQWF_REMOVESCOPES))
== (OQWF_REMOVEFORMS|OQWF_REMOVESCOPES))
{
GetRealWindowInfo(_hwndLookForLabel, &rect, NULL);
GetRealWindowInfo(_hwndFrame, &rect2, NULL);
dyControls += rect2.top - rect.top;
Trace(TEXT("Moving all controls up by %d units"), dyControls);
OffsetWindow(_hwndFrame, 0, -dyControls);
OffsetWindow(_hwndFindNow, 0, -dyControls);
OffsetWindow(_hwndStop, 0, -dyControls);
OffsetWindow(_hwndNewQuery, 0, -dyControls);
OffsetWindow(_hwndFindAnimation, 0, -dyControls);
OffsetWindow(_hwndOK, 0, -dyControls);
if (_hwndCancel)
OffsetWindow(_hwndCancel, 0, -dyControls);
}
// hiding OK/Cancel so lets adjust the size here to include the
// OK/Cancel buttons disappearing, note that we update dyControls
// to include this delta
if (!(_pOpenQueryWnd->dwFlags & OQWF_OKCANCEL))
{
ShowWindow(_hwndOK, SW_HIDE);
if (_hwndCancel)
ShowWindow(_hwndCancel, SW_HIDE);
// if this is the filter dialog then lets ensure that
// we trim the OK/Cancel buttons from the size by adjusting the
// dyControls further.
GetRealWindowInfo(_hwndOK, &rect, NULL);
GetRealWindowInfo(_hwndFrame, &rect2, NULL);
dyControls += rect.bottom - rect2.bottom;
}
// having performed that extra bit of initialization lets cache the
// positions of the various controls, to make sizing more fun...
GetClientRect(hwnd, &rect2);
rect2.bottom -= dyControls;
_dyResultsTop = rect2.bottom;
GetRealWindowInfo(hwnd, NULL, &size);
GetRealWindowInfo(_hwndFrame, &rect, &_szForm);
Trace(TEXT("dyControls %d"), dyControls);
size.cy -= dyControls;
_dxFormAreaLeft = rect.left;
_dxFormAreaRight = rect2.right - rect.right;
_szMinTrack.cx = size.cx - _szForm.cx;
_szMinTrack.cy = size.cy - _szForm.cy;
if (!(_pOpenQueryWnd->dwFlags & OQWF_HIDEMENUS))
{
TraceMsg("Adjusting _szMinTrack.cy to account for menu bar");
_szMinTrack.cy += GetSystemMetrics(SM_CYMENU);
}
GetRealWindowInfo(_hwndBrowse, &rect, NULL);
_dxButtonsLeft = rect2.right - rect.left;
GetRealWindowInfo(_hwndLookIn, &rect, NULL);
_dxGap = (rect2.right - rect.right) - _dxButtonsLeft;
GetRealWindowInfo(_hwndFindAnimation, &rect, NULL);
_dxAnimationLeft = rect2.right - rect.left;
GetRealWindowInfo(_hwndOK, &rect, NULL);
_dyOKTop = rect2.bottom - rect.top;
_dyGap = size.cy - rect.bottom;
// Now collect the forms and pages, then walk them building the size
// information that we need.
hres = GatherForms();
FailGracefully(hres, "Failed to init form list");
_szMinTrack.cx += _szForm.cx;
_szMinTrack.cy += _szForm.cy;
// Populate the scope control by querying the handler for them,
// if there are none then we display a suitable message box and
// let the user know that something went wrong.
hres = PopulateScopeControl();
FailGracefully(hres, "Failed to init scope list");
_fScopesPopulated = TRUE; // scope control now populated
// perform final fix up of the window, ensure that we size it so that
// the entire form and buttons are visible. Then set ourselves into the
// no query state and reset the animation.
SetWindowPos(hwnd,
NULL,
0, 0,
_szMinTrack.cx, _szMinTrack.cy,
SWP_NOMOVE|SWP_NOZORDER);
if (_pOpenQueryWnd->dwFlags & OQWF_HIDEMENUS)
::SetMenu(hwnd, NULL);
hres = PopulateFormControl(_pOpenQueryWnd->dwFlags & OQWF_SHOWOPTIONAL);
FailGracefully(hres, "Failed to populate form control");
// Now load the query which inturn selects the form that we should be using,
// if there is no query to load then either use the default form or
// the first in the list.
if ((_pOpenQueryWnd->dwFlags & OQWF_LOADQUERY) && _pOpenQueryWnd->pPersistQuery)
{
// NTRAID#NTBUG9-627056-2002/06/11-artm
// If unable to load query, still show the window but w/out values filled in.
HRESULT hResLoad = LoadQuery(_pOpenQueryWnd->pPersistQuery);
if (FAILED(hResLoad))
{
Trace(TEXT("Failed when trying to load query from supplied IPersistQuery with error %x"), hResLoad);
}
}
else
{
if (_pOpenQueryWnd->dwFlags & OQWF_DEFAULTFORM)
{
SelectForm(_pOpenQueryWnd->clsidDefaultForm);
if (!_pCurrentForm)
ExitGracefully(hres, E_FAIL, "Failed to select the query form");
}
else
{
INT iForm = (int)ComboBox_GetItemData(_hwndLookFor, 0);
LPQUERYFORM pQueryForm = (LPQUERYFORM)DSA_GetItemPtr(_hdsaForms, iForm);
TraceAssert(pQueryForm);
SelectForm(pQueryForm->clsidForm);
}
}
StartQuery(FALSE);
// issue on open, therefore lets get the query going, if there is async
// scope collection then the query will be issued by the bg thread.
if (_pOpenQueryWnd->dwFlags & OQWF_ISSUEONOPEN)
PostMessage(_hwnd, CQFWM_STARTQUERY, 0, 0);
SetForegroundWindow(hwnd);
hres = S_OK; // success
exit_gracefully:
TraceLeaveResult(hres);
}
/*-----------------------------------------------------------------------------
/ CQueryFrame::EnableControls
/ ---------------------------
/ Set the controls into their enabled/disabled state based on the
/ state of the dialog.
/
/ In:
/ -
/
/ Out:
/ HRESULT
/----------------------------------------------------------------------------*/
VOID CQueryFrame::DoEnableControls(VOID)
{
BOOL fScopes = (_fAddScopesNYI || ComboBox_GetCount(_hwndLookIn));
BOOL fEnable = fScopes;
UINT uEnable = fScopes ? MF_ENABLED:MF_GRAYED;
HMENU hMenu = GetMenu(_hwnd);
INT i;
TraceEnter(TRACE_FRAMEDLG, "CQueryFrame::DoEnableControls");
EnableWindow(_hwndFindNow, !_fQueryRunning && fEnable);
EnableWindow(_hwndStop, _fQueryRunning && fEnable);
EnableWindow(_hwndNewQuery, fEnable);
EnableWindow(_hwndLookFor, !_fQueryRunning && fEnable);
EnableWindow(_hwndLookIn, !_fQueryRunning && fEnable);
EnableWindow(_hwndBrowse, !_fQueryRunning && fEnable);
if (_pCurrentForm)
{
CallFormPages(_pCurrentForm, CQPM_ENABLE, (BOOL)(!_fQueryRunning && fEnable), 0);
if (_fFormFirstEnable)
{
PostMessage(_hwnd, CQFWM_SETDEFAULTFOCUS, 0, 0);
_fFormFirstEnable = FALSE;
}
}
if (_hwndOK)
EnableWindow(_hwndOK, !_fQueryRunning && fEnable);
if (_hwndCancel)
EnableWindow(_hwndCancel, !_fQueryRunning && fEnable);
for (i = 0 ; i < GetMenuItemCount(hMenu) ; i++)
EnableMenuItem(hMenu, i, MF_BYPOSITION|uEnable);
DrawMenuBar(_hwnd);
TraceLeave();
}
/*-----------------------------------------------------------------------------
/ CQueryFrame::OnNotify
/ ---------------------
/ Notify event received, decode it and handle accordingly
/
/ In:
/ idCtrl = ID of control issuing notify
/ pNotify -> LPNMHDR structure
/
/ Out:
/ LRESULT
/----------------------------------------------------------------------------*/
LRESULT CQueryFrame::OnNotify(INT idCtrl, LPNMHDR pNotify)
{
LRESULT lr = 0;
TraceEnter(TRACE_FRAMEDLG, "CQueryFrame::OnNotify");
// TCN_SELCHANGE used to indicate that the currently active
// tab has been changed
if (pNotify->code == TCN_SELCHANGE)
{
INT iPage = TabCtrl_GetCurSel(_hwndFrame);
TraceAssert(iPage >= 0);
if (iPage >= 0)
{
SelectFormPage(_pCurrentForm, iPage);
lr = 0;
}
}
TraceLeaveResult((HRESULT)lr);
}
/*-----------------------------------------------------------------------------
/ CQueryFrame::OnSize
/ -------------------
/ The window is being sized and we received a WM_SIZE, therefore move
/ the content of the window about.
/
/ In:
/ cx = new width
/ cy = new height
/
/ Out:
/ -
/----------------------------------------------------------------------------*/
VOID CQueryFrame::OnSize(INT cx, INT cy)
{
HDWP hdwp;
RECT rect, rect2;
SIZE sz, sz2;
INT x, cxForm, cyForm;
INT dyResultsTop = 0;
INT frameBottom = 0;
TraceEnter(TRACE_FRAMEDLG, "CQueryFrame::OnSize");
// do as much as we can within a DefWindowPos to aVOID too
// much flicker.
hdwp = BeginDeferWindowPos(16);
if (hdwp)
{
{
// adjust the look for controls, if there is no scope then
// stretch the look for control over the entire client area
// of the window.
if (!(_pOpenQueryWnd->dwFlags & OQWF_REMOVEFORMS))
{
if (_pOpenQueryWnd->dwFlags & OQWF_REMOVESCOPES)
{
GetRealWindowInfo(_hwndLookFor, &rect, &sz);
if (hdwp)
{
hdwp = DeferWindowPos(hdwp, _hwndLookFor, NULL,
0, 0,
(cx - _dxFormAreaRight) - rect.left, sz.cy,
SWP_NOZORDER|SWP_NOMOVE);
}
}
}
// adjust the "look in" controls, if there is a form control
// then stretch across the remaining space, otherwise move the
// label and stretch the scope over the remaining space.
if (!(_pOpenQueryWnd->dwFlags & OQWF_REMOVESCOPES))
{
INT xScopeRight;
GetRealWindowInfo(_hwndLookIn, &rect, &sz);
xScopeRight = cx - _dxFormAreaRight - _dxGap;
if (_pOpenQueryWnd->dwFlags & OQWF_HIDESEARCHUI)
{
//
// when hiding the search UI, then adjust the button position to account for the
// right edge of the dialog not having buttons.
//
xScopeRight -= (_dxButtonsLeft - _dxFormAreaRight) + _dxGap;
}
if (_pOpenQueryWnd->dwFlags & OQWF_REMOVEFORMS)
{
GetRealWindowInfo(_hwndLookInLabel, &rect2, &sz2);
if (hdwp)
{
hdwp = DeferWindowPos(hdwp, _hwndLookInLabel, NULL,
_dxFormAreaLeft, rect2.top,
0, 0,
SWP_NOSIZE|SWP_NOZORDER);
}
if(hdwp)
{
hdwp = DeferWindowPos(hdwp, _hwndLookIn, NULL,
_dxFormAreaLeft+sz2.cx, rect.top,
xScopeRight - (_dxFormAreaLeft + sz2.cx), sz.cy,
SWP_NOZORDER);
}
}
else
{
if(hdwp)
{
hdwp = DeferWindowPos(hdwp, _hwndLookIn, NULL,
0, 0,
xScopeRight - rect.left, sz.cy,
SWP_NOZORDER|SWP_NOMOVE);
}
}
// browse control is displayed always if we are showing the
// scopes.
GetRealWindowInfo(_hwndBrowse, &rect, NULL);
if(hdwp)
{
hdwp = DeferWindowPos(hdwp, _hwndBrowse, NULL,
xScopeRight+_dxGap, rect.top,
0, 0,
SWP_NOZORDER|SWP_NOSIZE);
}
}
// all the buttons have a fixed offset from the right edege
// of the dialog, so just handle that as we can.
if (!(_pOpenQueryWnd->dwFlags & OQWF_HIDESEARCHUI))
{
GetRealWindowInfo(_hwndFindNow, &rect, NULL);
if(hdwp)
{
hdwp = DeferWindowPos(hdwp, _hwndFindNow, NULL,
(cx - _dxButtonsLeft), rect.top,
0, 0,
SWP_NOZORDER|SWP_NOSIZE);
}
GetRealWindowInfo(_hwndStop, &rect, &sz);
if(hdwp)
{
hdwp = DeferWindowPos(hdwp, _hwndStop, NULL,
(cx - _dxButtonsLeft), rect.top,
0, 0,
SWP_NOZORDER|SWP_NOSIZE);
}
GetRealWindowInfo(_hwndNewQuery, &rect, NULL);
if(hdwp)
{
hdwp = DeferWindowPos(hdwp, _hwndNewQuery, NULL,
(cx - _dxButtonsLeft), rect.top,
0, 0,
SWP_NOZORDER|SWP_NOSIZE);
}
GetRealWindowInfo(_hwndFindAnimation, &rect2, &sz2);
if(hdwp)
{
hdwp = DeferWindowPos(hdwp, _hwndFindAnimation, NULL,
(cx - _dxAnimationLeft), rect2.top,
0, 0,
SWP_NOZORDER|SWP_NOSIZE);
}
}
// position the form "frame" control
GetRealWindowInfo(_hwndFrame, &rect, &sz);
cxForm = (cx - _dxFormAreaRight) - rect.left;
if(hdwp)
{
hdwp = DeferWindowPos(hdwp, _hwndFrame, NULL,
0, 0,
cxForm, _szForm.cy,
SWP_NOZORDER|SWP_NOMOVE);
}
dyResultsTop = _dyResultsTop;
// NOTICE-NTRAID#NTBUG9-577850-2002/05/21-artm
// Layout did not give enough vertical room to the result label.
// In FE localized builds it was clipped when the window was
// repainted. _dyResultsTop does not take into account space
// needed between frame bottom and the top of the result label.
// Store the bottom of the frame for later calculation.
frameBottom = rect.bottom;
// when we have a cancel button then ensure that it is to the right
// of the OK button.
if (_hwndCancel)
{
GetRealWindowInfo(_hwndCancel, &rect, &sz);
if(hdwp)
{
hdwp = DeferWindowPos(hdwp, _hwndCancel, NULL,
(cx - _dxButtonsLeft), dyResultsTop - _dyOKTop,
0, 0,
SWP_NOZORDER|SWP_NOSIZE);
}
GetRealWindowInfo(_hwndOK, &rect, &sz);
if(hdwp)
{
hdwp = DeferWindowPos(hdwp, _hwndOK, NULL,
(cx - _dxButtonsLeft - _dxGap - sz.cx), dyResultsTop - _dyOKTop,
0, 0,
SWP_NOZORDER|SWP_NOSIZE);
}
}
else
{
GetRealWindowInfo(_hwndOK, &rect, &sz);
if(hdwp)
{
hdwp = DeferWindowPos(hdwp, _hwndOK, NULL,
(cx - _dxButtonsLeft), dyResultsTop - _dyOKTop,
0, 0,
SWP_NOZORDER|SWP_NOSIZE);
}
}
}
// move the results and status bar as required
if (_hwndResults)
{
if(hdwp)
{
hdwp = DeferWindowPos(hdwp, _hwndStatus, NULL,
0, cy - _cyStatus,
cx, _cyStatus,
SWP_SHOWWINDOW|SWP_NOZORDER);
}
// NTRAID#NTBUG9-406927-2001/10/24-lucios
HWND resultsLabel=GetDlgItem(_hwnd,CQID_RESULTSLABEL);
if(resultsLabel)
{
// NOTICE-NTRAID#NTBUG9-577850-2002/05/15-artm Label showing on FE builds.
// Make sure that the label is enabled now that we want to show it.
EnableWindow(resultsLabel, TRUE);
RECT rec;
GetClientRect(resultsLabel,&rec);
INT height=rect.bottom-rect.top;
// Include blank space above label proportional to height of label.
dyResultsTop = frameBottom + (height / 4);
if(hdwp)
{
hdwp = DeferWindowPos(hdwp, resultsLabel, NULL,
0, dyResultsTop,
cx, height,
SWP_SHOWWINDOW|SWP_NOZORDER);
}
dyResultsTop+=height;
}
if(hdwp)
{
hdwp = DeferWindowPos(hdwp, _hwndResults, NULL,
0, dyResultsTop,
cx, max(0, cy - (dyResultsTop + _cyStatus)),
SWP_SHOWWINDOW|SWP_NOZORDER);
}
}
// NTRAID#NTBUG9-670595-2002/08/08-artm
// Need to call EndDeferWindowPos() whether or not results and status bar moved.
if(hdwp)
{
EndDeferWindowPos(hdwp);
}
// here is the strange bit, by this point we have moved & sized all the
// controls on the dialog except the current page, as this is a child window
// and not a control which in turn has controls doing this would break
// the DefWindowPos path, therefore having updated everybody, lets update
// the page.
if (_pCurrentFormPage && _pCurrentFormPage->hwndPage)
{
GetRealWindowInfo(_hwndFrame, &rect, NULL);
TabCtrl_AdjustRect(_hwndFrame, FALSE, &rect);
cxForm = rect.right - rect.left;
cyForm = rect.bottom - rect.top;
SetWindowPos(_pCurrentFormPage->hwndPage, NULL,
rect.left, rect.top, cxForm, cyForm,
SWP_NOZORDER);
}
}
TraceLeave();
}
/*-----------------------------------------------------------------------------
/ CQueryFrame::OnGetMinMaxInfo
/ ----------------------------
/ The window is being sized and we received a WM_SIZE, therefore move
/ the content of the window about.
/
/ In:
/ lpmmin -> MINMAXINFO structure
/
/ Out:
/ -
/----------------------------------------------------------------------------*/
VOID CQueryFrame::OnGetMinMaxInfo(LPMINMAXINFO lpmmi)
{
RECT rect = {0, 0, 0, 0};
TraceEnter(TRACE_FRAMEDLG, "CQueryFrame::OnGetMinMaxInfo");
#if 0
if (!_fHideSearchPane)
#endif
{
lpmmi->ptMinTrackSize.x = _szMinTrack.cx;
lpmmi->ptMinTrackSize.y = _szMinTrack.cy;
if (!_hwndResults)
{
lpmmi->ptMaxSize.y = lpmmi->ptMinTrackSize.y;
lpmmi->ptMaxTrackSize.y = lpmmi->ptMinTrackSize.y;
}
}
#if 0
else
{
AdjustWindowRect(&rect, GetWindowLong(_hwnd, GWL_STYLE), (NULL != GetMenu(_hwnd)));
lpmmi->ptMinTrackSize.y = rect.bottom - rect.top;
}
#endif
if (_hwndResults && _hwndStatus)
lpmmi->ptMinTrackSize.y += _cyStatus;
TraceLeave();
}
/*-----------------------------------------------------------------------------
/ CQueryFrame::OnCommand
/ ----------------------
/ We have recieved a WM_COMMAND so process it accordingly.
/
/ In:
/ wParam, lParam = parameters from the message
/
/ Out:
/ -
/----------------------------------------------------------------------------*/
VOID CQueryFrame::OnCommand(WPARAM wParam, LPARAM lParam)
{
HRESULT hres;
UINT uID = LOWORD(wParam);
UINT uNotify = HIWORD(wParam);
HWND hwndControl = (HWND)lParam;
INT i;
TraceEnter(TRACE_FRAMEDLG, "CQueryFrame::OnCommand");
Trace(TEXT("uID %08x, uNotify %d, hwndControl %08x"), uID, uNotify, hwndControl);
switch (uID)
{
case IDOK:
TraceMsg("IDOK received");
CloseQueryFrame(S_OK);
break;
case IDCANCEL:
TraceMsg("IDCANCEL received");
CloseQueryFrame(S_FALSE);
break;
case CQID_LOOKFOR:
{
if (uNotify == CBN_SELCHANGE)
{
INT iSel = ComboBox_GetCurSel(_hwndLookFor);
INT iForm = (int)ComboBox_GetItemData(_hwndLookFor, iSel);
LPQUERYFORM pQueryForm = (LPQUERYFORM)DSA_GetItemPtr(_hdsaForms, iForm);
TraceAssert(pQueryForm);
if (S_FALSE == SelectForm(pQueryForm->clsidForm))
{
TraceMsg("SelectForm return S_FALSE, so the user doesn't want the new form");
PostMessage(_hwndLookFor, CB_SETCURSEL, (WPARAM)_pCurrentForm->iForm, 0);
}
}
break;
}
case CQID_BROWSE:
OnBrowse();
break;
case CQID_FINDNOW:
OnFindNow();
break;
case CQID_STOP:
{
LONG style;
_pQueryHandler->StopQuery();
// For some reason, the standard method of getting the old
// def button used in SetDefButton() below isn't working,
// so we have to forcibly remove the BS_DEFPUSHBUTTON style
// from the CQID_STOP button.
style = GetWindowLong(_hwndStop, GWL_STYLE) & ~BS_DEFPUSHBUTTON;
SendMessage(_hwndStop,
BM_SETSTYLE,
MAKEWPARAM(style, 0),
MAKELPARAM(TRUE, 0));
SetDefButton(_hwnd, CQID_FINDNOW);
SendMessage(GetParent(_hwndFindNow),WM_NEXTDLGCTL,(WPARAM)_hwndFindNow,TRUE);
SetFocus(_hwndFindNow);
break;
}
case CQID_CLEARALL:
OnNewQuery(TRUE); // discard the current query
break;
case CQID_FILE_CLOSE:
TraceMsg("CQID_FILE_CLOSE received");
CloseQueryFrame(S_FALSE);
break;
default:
_pQueryHandler->InvokeCommand(_hwnd, uID);
break;
}
TraceLeave();
}
/*-----------------------------------------------------------------------------
/ CQueryFrame::OnInitMenu
/ -----------------------
/ Handle telling the handler that the menu is being initialised, however
/ this should only happen if the menu being activated is the
/ menu bar, otherwise we assume that the caller is tracking a popup
/ menu and has performed the required initalization.
/
/ In:
/ wParam, lParam = parameters from the WM_INITMENU
/
/ Out:
/ -
/----------------------------------------------------------------------------*/
VOID CQueryFrame::OnInitMenu(HMENU hMenu)
{
TraceEnter(TRACE_FRAMEDLG, "CQueryFrame::OnInitMenu");
_fTrackingMenuBar = (GetMenu(_hwnd) == hMenu);
if (_fTrackingMenuBar)
{
TraceMsg("Tracking the menu bar, sending activate");
_pQueryHandler->ActivateView(CQRVA_INITMENUBAR, (WPARAM)hMenu, 0L);
// NTRAID#NTBUG9-630248-2002/06/12-artm
// Only enable View menu if the results list box is displayed.
EnableMenuItem(
hMenu,
CQID_VIEW_SEARCHPANE,
MF_BYCOMMAND| ((_hwndResults != NULL) ? MF_ENABLED:MF_GRAYED) );
}
TraceLeave();
}
/*-----------------------------------------------------------------------------
/ CQueryFrame::OnEnterMenuLoop
/ ----------------------------
/ When the user displays a menu we must reflect this into the status bar
/ so that we can give the user help text relating to the commands they
/ select.
/
/ In:
/ fEntering = entering the menu loop, or leaving.
/
/ Out:
/ -
/----------------------------------------------------------------------------*/
VOID CQueryFrame::OnEnterMenuLoop(BOOL fEntering)
{
TraceEnter(TRACE_FRAMEDLG, "CQueryFrame::OnEnterMenuLoop");
if (_hwndStatus)
{
if (fEntering)
{
SendMessage(_hwndStatus, SB_SIMPLE, (WPARAM)TRUE, 0L);
SendMessage(_hwndStatus, SB_SETTEXT, (WPARAM)SBT_NOBORDERS|255, 0L);
}
else
{
SendMessage(_hwndStatus, SB_SIMPLE, (WPARAM)FALSE, 0L);
}
}
TraceLeave();
}
/*-----------------------------------------------------------------------------
/ CQueryFrame::OnMenuSelect
/ -------------------------
/ Get the status text for this menu item and display it to the user,
/ if this doesn't map to any particular command then NULL out
/ the string. At this point we also trap our commands.
/
/ In:
/ hMenu = menu the user is on
/ uID = command ID for that item
/
/ Out:
/ -
/----------------------------------------------------------------------------*/
VOID CQueryFrame::OnMenuSelect(HMENU hMenu, UINT uID)
{
TCHAR szBuffer[MAX_PATH] = { TEXT('\0') };
TraceEnter(TRACE_FRAMEDLG, "CQueryFrame::OnMenuSelect");
Trace(TEXT("hMenu %08x, uID %08x"), hMenu, uID);
if (_hwndStatus)
{
switch (uID)
{
case CQID_FILE_CLOSE:
case CQID_VIEW_SEARCHPANE:
LoadString(GLOBAL_HINSTANCE, uID, szBuffer, ARRAYSIZE(szBuffer));
break;
default:
_pQueryHandler->GetCommandString(uID, 0x0, szBuffer, ARRAYSIZE(szBuffer));
break;
}
Trace(TEXT("Setting status bar to: %s"), szBuffer);
SendMessage(_hwndStatus, SB_SETTEXT, (WPARAM)SBT_NOBORDERS|255, (LPARAM)szBuffer);
}
TraceLeave();
}
/*-----------------------------------------------------------------------------
/ CQueryFrame::OnFindNow
/ ----------------------
// Issue the query, resulting in a view window being created and then issuing
// the parameter block to the query client.
/
/ In:
/ Out:
/ HRESULT
/----------------------------------------------------------------------------*/
HRESULT CQueryFrame::OnFindNow(VOID)
{
HRESULT hres;
CQPARAMS qp = { 0 };
LPQUERYSCOPE pQueryScope = NULL;
TCHAR szBuffer[MAX_PATH];
BOOL fFixSize = TRUE;
RECT rc;
DECLAREWAITCURSOR;
BOOL fSetCursor = FALSE;
TraceEnter(TRACE_FRAMEDLG, "CQueryFrame::OnFindNow");
TraceAssert(_pCurrentForm != NULL);
if (_fQueryRunning)
ExitGracefully(hres, E_FAIL, "Quyery is already running");
SetWaitCursor();
fSetCursor = TRUE;
// If we have not created the viewer before now lets do so, also at the
// same time we attempt to fix the window size to ensure that enough
// of the view is visible.
if (!_hwndResults)
{
if (!_hwndStatus)
{
_hwndStatus = CreateStatusWindow(WS_CHILD, NULL, _hwnd, IDC_STATUS);
GetClientRect(_hwndStatus, &rc);
_cyStatus = rc.bottom - rc.top;
}
// Now construct the result viewer for us to use
hres = _pQueryHandler->CreateResultView(_hwnd, &_hwndResults);
FailGracefully(hres, "Failed when creating the view object");
GetWindowRect(_hwnd, &rc);
SetWindowPos(_hwnd, NULL,
0, 0,
rc.right - rc.left,
_szMinTrack.cy + VIEWER_DEFAULT_CY,
SWP_NOZORDER|SWP_NOMOVE);
}
// are we still collecting the scopes async? If so then lets wait until
// they have all arrived before we set the UI running.
if (_hdsaScopes && DSA_GetItemCount(_hdsaScopes))
{
// Collect the parameters ready for starting the query, if this fails then
// there is no point us continuing.
ZeroMemory(&qp, SIZEOF(qp));
qp.cbStruct = SIZEOF(qp);
//qp.dwFlags = 0x0;
qp.clsidForm = _pCurrentForm->clsidForm; // new NT5 beta 2
hres = GetSelectedScope(&pQueryScope);
FailGracefully(hres, "Failed to get the scope from the LookIn control");
if (pQueryScope)
{
Trace(TEXT("pQueryScope %08x"), pQueryScope);
qp.pQueryScope = pQueryScope->pScope;
}
hres = CallFormPages(_pCurrentForm, CQPM_GETPARAMETERS, 0, (LPARAM)&qp.pQueryParameters);
FailGracefully(hres, "Failed when collecting parameters from form");
if (!qp.pQueryParameters)
{
LoadString(GLOBAL_HINSTANCE, IDS_ERR_NOPARAMS, szBuffer, ARRAYSIZE(szBuffer));
FrameMessageBox(szBuffer, MB_ICONERROR|MB_OK);
ExitGracefully(hres, E_FAIL, "Failed to issue the query, no parameters");
}
// We either already had a view, or have just created one. Either way
// we must now prepare the query for sending.
Trace(TEXT("qp.cbStruct %08x"), qp.cbStruct);
Trace(TEXT("qp.dwFlags %08x"), qp.dwFlags);
Trace(TEXT("qp.pQueryScope %08x"), qp.pQueryScope);
Trace(TEXT("qp.pQueryParameters %08x"), qp.pQueryParameters);
TraceGUID("qp.clsidForm: ", qp.clsidForm);
hres = _pQueryHandler->IssueQuery(&qp);
FailGracefully(hres, "Failed in IssueQuery");
}
else
{
// set the status text to reflect that we are initializng, otherwise it is
// left empty and looks like we have crashed.
if (LoadString(GLOBAL_HINSTANCE, IDS_INITIALIZING, szBuffer, ARRAYSIZE(szBuffer)))
{
SetStatusText(szBuffer);
}
}
hres = S_OK; // success
exit_gracefully:
if (qp.pQueryParameters)
CoTaskMemFree(qp.pQueryParameters);
if (fSetCursor)
ResetWaitCursor();
TraceLeaveResult(hres);
}
/*-----------------------------------------------------------------------------
/ CQueryFrame::OnNewQuery
/ -----------------------
/ Discard the current query, prompting the user as requierd.
/
/ In:
/ fAlwaysPrompt = TRUE if we force prompting of the user
/
/ Out:
/ BOOL
/----------------------------------------------------------------------------*/
BOOL CQueryFrame::OnNewQuery(BOOL fAlwaysPrompt)
{
BOOL fQueryCleared = TRUE;
TCHAR szBuffer[MAX_PATH];
RECT rc;
TraceEnter(TRACE_FRAMEDLG, "CQueryFrame::OnNewQuery");
if (_hwndResults || fAlwaysPrompt)
{
LoadString(GLOBAL_HINSTANCE, IDS_CLEARCURRENT, szBuffer, ARRAYSIZE(szBuffer));
if (IDOK != FrameMessageBox(szBuffer, MB_ICONINFORMATION|MB_OKCANCEL))
ExitGracefully(fQueryCleared, FALSE, "Used cancled new query");
if (_pQueryHandler)
_pQueryHandler->StopQuery();
CallFormPages(_pCurrentForm, CQPM_CLEARFORM, 0, 0);
if (_hwndResults)
{
DestroyWindow(_hwndResults); // no result view now
_hwndResults = NULL;
// NOTICE-NTRAID#NTBUG9-577850-2002/05/15-artm Label showing in FE builds.
// Hide the label so there is no chance of seeing it when result view not
// visible.
HWND resultsLabel = GetDlgItem(_hwnd, CQID_RESULTSLABEL);
if (resultsLabel)
{
EnableWindow(resultsLabel, FALSE);
ShowWindow(resultsLabel, SW_HIDE);
}
DestroyWindow(_hwndStatus); // no status bar
_hwndStatus = NULL;
GetWindowRect(_hwnd, &rc); // shrink the window
SetWindowPos(_hwnd, NULL,
0, 0, rc.right - rc.left, _szMinTrack.cy,
SWP_NOZORDER|SWP_NOMOVE);
}
}
exit_gracefully:
TraceLeaveValue(fQueryCleared);
}
/*-----------------------------------------------------------------------------
/ CQueryFrame::OnBrowse
/ ---------------------
/ Browse for a new scope, adding it to the list if not already present,
/ or selecting the previous scope.
/
/ In:
/ Out:
/ HRESULT
/----------------------------------------------------------------------------*/
HRESULT CQueryFrame::OnBrowse(VOID)
{
HRESULT hres;
LPQUERYSCOPE pQueryScope = NULL;
LPCQSCOPE pScope = NULL;
TraceEnter(TRACE_FRAMEDLG, "CQueryFrame::OnBrowse");
// Call the handler and get a scope allocation back, then add it to the list
// of scopes to be displayed.
hres = GetSelectedScope(&pQueryScope);
FailGracefully(hres, "Failed to get the scope from the LookIn control");
Trace(TEXT("Calling BrowseForScope _hwnd %08x, pQueryScope %08x (%08x)"),
_hwnd, pQueryScope, pQueryScope->pScope);
hres = _pQueryHandler->BrowseForScope(_hwnd, pQueryScope ? pQueryScope->pScope:NULL, &pScope);
FailGracefully(hres, "Failed when calling BrowseForScope");
if ((hres != S_FALSE) && pScope)
{
hres = InsertScopeIntoList(pScope, DA_LAST, TRUE);
FailGracefully(hres, "Failed when adding the scope to the control");
ComboBox_SetCurSel(_hwndLookIn, ShortFromResult(hres));
}
hres = S_OK;
exit_gracefully:
if (pScope)
CoTaskMemFree(pScope);
TraceLeaveResult(hres);
}
/*-----------------------------------------------------------------------------
/ CQueryFrame::OnHelp
/ -------------------
/ Invoke the context sensitive help for the window, catch the
/ handler specific and page specific stuff and pass those help
/ requests down to the relevant objects.
/
/ In:
/ pHelpInfo -> help info structure
/
/ Out:
/ HRESULT
/----------------------------------------------------------------------------*/
HRESULT CQueryFrame::OnHelp(LPHELPINFO pHelpInfo)
{
HRESULT hres;
RECT rc;
HWND hwnd = (HWND)pHelpInfo->hItemHandle;
TraceEnter(TRACE_FRAME, "CQueryFrame::OnHelp");
// We are invoking help, theroefore we need ot check to see where element
// of the window we are being invoked for. If it is the
// result view then route the message to that, if its the form then
// likewise.
//
// If we don't hit any of the extension controls then lets pass the
// help onto WinHelp and get it to display the topics we have.
if (pHelpInfo->iContextType != HELPINFO_WINDOW)
ExitGracefully(hres, E_FAIL, "WM_HELP handler only copes with WINDOW objects");
if (_pCurrentFormPage->hwndPage && IsChild(_pCurrentFormPage->hwndPage, hwnd))
{
// it was on the query form page, therefore let it go there, that way
// they can provide topics specific to them
TraceMsg("Invoking help on the form pane");
hres = _CallPageProc(_pCurrentFormPage, CQPM_HELP, 0, (LPARAM)pHelpInfo);
FailGracefully(hres, "Failed when calling page proc to get help");
}
else
{
// pass the help information through to the handler as an activation,
// this should really just be a new method, but this works.
TraceMsg("Invoking help on the results pane");
TraceAssert(_pQueryHandler);
hres = _pQueryHandler->ActivateView(CQRVA_HELP, 0, (LPARAM)pHelpInfo);
FailGracefully(hres, "Handler WndProc returned FALSE");
}
hres = S_OK;
exit_gracefully:
TraceLeaveResult(hres);
}
/*-----------------------------------------------------------------------------
/ Scope helper functions
/----------------------------------------------------------------------------*/
/*-----------------------------------------------------------------------------
/ _CallScopeProc
/ --------------
/ Releae the given scope object, freeing the object that is referenced
/ and passing a CQSM_RELEASE message to it.
/
/ In:
/ pQueryScope -> scope object to be called
/ uMsg, pVoid -> parameters for the scope
/
/ Out:
/ HRESULT
/----------------------------------------------------------------------------*/
HRESULT _CallScopeProc(LPQUERYSCOPE pQueryScope, UINT uMsg, LPVOID pVoid)
{
HRESULT hres;
TraceEnter(TRACE_SCOPES, "_CallScopeProc");
Trace(TEXT("pQueryScope %08x, uMsg %d, pVoid %08x"), pQueryScope, uMsg, pVoid);
Trace(TEXT("(cbStruct %d, pScopeProc %08x, lParam %08x)"),
pQueryScope->pScope->cbStruct,
pQueryScope->pScope->pScopeProc,
pQueryScope->pScope->lParam);
if (!pQueryScope)
ExitGracefully(hres, S_OK, "pQueryScope == NULL");
hres = (pQueryScope->pScope->pScopeProc)(pQueryScope->pScope, uMsg, pVoid);
FailGracefully(hres, "Failed calling ScopeProc");
exit_gracefully:
TraceLeaveResult(hres);
}
/*-----------------------------------------------------------------------------
/ _FreeScope
/ ----------
/ Releae the given scope object, freeing the object that is referenced
/ and passing a CQSM_RELEASE message to it.
/
/ In:
/ pQueryScope -> scope object to be released
/
/ Out:
/ INT == 1 always
/----------------------------------------------------------------------------*/
INT _FreeScopeCB(LPVOID pItem, LPVOID pData)
{
return _FreeScope((LPQUERYSCOPE)pItem);
}
INT _FreeScope(LPQUERYSCOPE pQueryScope)
{
TraceEnter(TRACE_SCOPES, "_FreeScope");
Trace(TEXT("pQueryScope %08x, pQueryScope->pScope %08x"), pQueryScope, pQueryScope->pScope);
if (pQueryScope)
{
_CallScopeProc(pQueryScope, CQSM_RELEASE, NULL);
if (pQueryScope->pScope)
{
LocalFree((HLOCAL)pQueryScope->pScope);
pQueryScope->pScope = NULL;
}
}
TraceLeaveValue(TRUE);
}
/*-----------------------------------------------------------------------------
/ CQueryFrame::InsertScopeIntoList
/ --------------------------------
/ Adds the given scope to the scope picker.
/
/ In:
/ pQueryScope -> zcope object to be added to the view
/ i = index to insert the scope at
/ fAddToControl = add the scope the picker control
/ ppQueryScope -> recieves the new query scope object / = NULL
/
/ Out:
/ HRESULT
/----------------------------------------------------------------------------*/
HRESULT CQueryFrame::InsertScopeIntoList(LPCQSCOPE pScope, INT i, BOOL fAddToControl)
{
HRESULT hres;
QUERYSCOPE qs;
INT iScope;
TraceEnter(TRACE_SCOPES, "CQueryFrame::InsertScopeIntoList");
Trace(TEXT("pScope %08x, i %d, fAddToControl %d"), pScope, i, fAddToControl);
if (!pScope)
ExitGracefully(hres, E_INVALIDARG, "pScope == NULL, not allowed");
// if we don't have any scopes then allocate the DSA
if (!_hdsaScopes)
{
_hdsaScopes = DSA_Create(SIZEOF(QUERYSCOPE), 4);
TraceAssert(_hdsaScopes);
if (!_hdsaScopes)
ExitGracefully(hres, E_OUTOFMEMORY, "Failed to allocate the scope DPA");
}
// Walk the list of scopes checking to see if this one is already in
// there, if not then we can add it.
for (iScope = 0 ; iScope < DSA_GetItemCount(_hdsaScopes) ; iScope++)
{
LPQUERYSCOPE pQueryScope = (LPQUERYSCOPE)DSA_GetItemPtr(_hdsaScopes, iScope);
TraceAssert(pQueryScope);
if (S_OK == _CallScopeProc(pQueryScope, CQSM_SCOPEEQUAL, pScope))
{
hres = ResultFromShort(iScope);
goto exit_gracefully;
}
}
// Take a copy of the scope blob passed by the caller. We copy the entire
// structure who's size is defined by cbStruct into a LocalAlloc block,
// once we have this we can then build the QUERYSCOPE structure that references
// it.
Trace(TEXT("pScope->cbStruct == %d"), pScope->cbStruct);
qs.pScope = (LPCQSCOPE)LocalAlloc(LPTR, pScope->cbStruct);
if (!qs.pScope)
ExitGracefully(hres, E_OUTOFMEMORY, "Failed to allocate query scope");
Trace(TEXT("Copying structure qs.pScope %08x, pScope %08x"), qs.pScope, pScope);
//REVIEWED-2002-02-25-lucios.
CopyMemory(qs.pScope, pScope, pScope->cbStruct);
//qs.pScope = NULL;
qs.iImage = -1; // no image
// We have a QUERYSCOPE, so initialize it, if that works then append it to the
// DSA before either setting the return value or appending it to the control.
_CallScopeProc(&qs, CQSM_INITIALIZE, NULL);
iScope = DSA_InsertItem(_hdsaScopes, i, &qs);
Trace(TEXT("iScope = %d"), iScope);
if (iScope == -1)
{
_FreeScope(&qs);
ExitGracefully(hres, E_OUTOFMEMORY, "Failed to add scope to DSA");
}
if (fAddToControl)
{
LPQUERYSCOPE pQueryScope = (LPQUERYSCOPE)DSA_GetItemPtr(_hdsaScopes, iScope);
TraceAssert(pQueryScope);
Trace(TEXT("Calling AddScopeToControl with %08x (%d)"), pQueryScope, iScope);
hres = AddScopeToControl(pQueryScope, iScope);
}
else
{
hres = ResultFromShort(iScope);
}
exit_gracefully:
TraceLeaveResult(hres);
}
/*-----------------------------------------------------------------------------
/ CQueryFrame::AddScopeToControl
/ ------------------------------
/ Adds the given scope to the scope picker.
/
/ In:
/ pQueryScope -> zcope object to be added to the view
/ i = index into view where to insert the scope
/
/ Out:
/ HRESULT (== index of item added)
/----------------------------------------------------------------------------*/
HRESULT CQueryFrame::AddScopeToControl(LPQUERYSCOPE pQueryScope, INT i)
{
HRESULT hres;
CQSCOPEDISPLAYINFO cqsdi;
COMBOBOXEXITEM cbi;
TCHAR szBuffer[MAX_PATH];
TCHAR szIconLocation[MAX_PATH] = { 0 };
INT item;
TraceEnter(TRACE_SCOPES, "CQueryFrame::AddScopeToControl");
if (!pQueryScope)
ExitGracefully(hres, E_INVALIDARG, "No scope specified");
// Call the scope to get the display information about this
// scope before we attempt to add it.
cqsdi.cbStruct = SIZEOF(cqsdi);
cqsdi.dwFlags = 0;
cqsdi.pDisplayName = szBuffer;
cqsdi.cchDisplayName = ARRAYSIZE(szBuffer);
cqsdi.pIconLocation = szIconLocation;
cqsdi.cchIconLocation = ARRAYSIZE(szIconLocation);
cqsdi.iIconResID = 0;
cqsdi.iIndent = 0;
hres = _CallScopeProc(pQueryScope, CQSM_GETDISPLAYINFO, &cqsdi);
FailGracefully(hres, "Failed to get display info for the scope");
// Now add the item to the control, if they gave as an image then
// add that to the image list (and tweak the INSERTITEM structure
// accordingly).
cbi.mask = CBEIF_TEXT|CBEIF_INDENT;
cbi.iItem = i;
cbi.pszText = cqsdi.pDisplayName;
cbi.iIndent = cqsdi.iIndent;
Trace(TEXT("Indent is %d"), cqsdi.iIndent);
if (szIconLocation[0] && cqsdi.iIconResID)
{
INT iImage;
if (!_fScopeImageListSet)
{
HIMAGELIST himlSmall;
Shell_GetImageLists(NULL, &himlSmall);
SendMessage(_hwndLookIn, CBEM_SETIMAGELIST, 0, (LPARAM)himlSmall);
_fScopeImageListSet = TRUE;
}
cbi.mask |= CBEIF_IMAGE|CBEIF_SELECTEDIMAGE;
cbi.iImage = Shell_GetCachedImageIndex(szIconLocation, cqsdi.iIconResID, 0x0);;
cbi.iSelectedImage = cbi.iImage;
Trace(TEXT("Image index set to: %d"), cbi.iImage);
}
item = (INT)SendMessage(_hwndLookIn, CBEM_INSERTITEM, 0, (LPARAM)&cbi);
if (item == -1)
ExitGracefully(hres, E_FAIL, "Failed when inserting the scope to the list");
DoEnableControls(); // reflect button changes into UI
hres = ResultFromShort(item);
exit_gracefully:
TraceLeaveResult(hres);
}
/*-----------------------------------------------------------------------------
/ CQueryFrame::PopulateScopeControl
/ ---------------------------------
/ Collect the scopes that we want to display in the scope control and
/ then populate it. If the handler doesn't return any scopes then
/ we remove the control and assume that know what to do when they
/ don't receive a scope pointer.
/
/ In:
/ -
/
/ Out:
/ HRESULT
/----------------------------------------------------------------------------*/
HRESULT CQueryFrame::PopulateScopeControl(VOID)
{
HRESULT hres;
LPQUERYSCOPE pQueryScope;
INT i;
TraceEnter(TRACE_SCOPES, "CQueryFrame::PopulateScopeControl");
// Collect the scopes that we should be showing in the view, if we don't
// get any back then we disable the scope control, if we do get some then
// populate the scope control with them.
hres = _pQueryHandler->AddScopes();
_fAddScopesNYI = (hres == E_NOTIMPL);
if (hres != E_NOTIMPL)
FailGracefully(hres, "Failed when calling handler to add scopes");
if (_hdsaScopes)
{
// We have some scopes, so now we create the image list that we can use
// for icons with scopes. Then walk through the DPA getting the scope
// to give us some display information about itself that we can
// add to the combo box.
ComboBox_SetExtendedUI(_hwndLookIn, TRUE);
for (i = 0 ; i < DSA_GetItemCount(_hdsaScopes); i++)
{
pQueryScope = (LPQUERYSCOPE)DSA_GetItemPtr(_hdsaScopes, i);
TraceAssert(pQueryScope);
AddScopeToControl(pQueryScope, i);
}
}
else
{
// we don't have any scopes after calling AddScopes, this is either
// because the ::AddScopes method is not implemented, or the
// scopes are being added async. If IssueQuery returned a success
// we assume they are coming in async and flag as such in our
// state.
if (!_fAddScopesNYI)
{
TraceMsg("Handler adding scopes async, so marking so");
_fScopesAddedAsync = TRUE;
}
}
hres = S_OK; // success
exit_gracefully:
Trace(TEXT("Default scope is index %d"), _iDefaultScope);
ComboBox_SetCurSel(_hwndLookIn, _iDefaultScope);
TraceLeaveResult(hres);
}
/*-----------------------------------------------------------------------------
/ CQueryFrame::GetSelectedScope
/ -----------------------------
/ Get the selected from the the scope ComboBox, this is a reference into the
/ scope DSA.
/
/ In:
/ ppQueryScope = receives a pointer to the new scope
/
/ Out:
/ HRESULT
/----------------------------------------------------------------------------*/
HRESULT CQueryFrame::GetSelectedScope(LPQUERYSCOPE* ppQueryScope)
{
HRESULT hres;
COMBOBOXEXITEM cbi;
INT iScope;
TraceEnter(TRACE_SCOPES, "CQueryFrame::GetSelectedScope");
*ppQueryScope = NULL;
if (_hdsaScopes)
{
// Get the index for the current scope, if it doesn't give a real
// index to a item in our view then barf! Otherwise look up the
// associated scope.
iScope = ComboBox_GetCurSel(_hwndLookIn);
Trace(TEXT("iScope %d"), iScope);
if (iScope == -1)
ExitGracefully(hres, E_FAIL, "User entered scopes not supported yet");
*ppQueryScope = (LPQUERYSCOPE)DSA_GetItemPtr(_hdsaScopes, iScope);
TraceAssert(*ppQueryScope);
}
hres = *ppQueryScope ? S_OK : E_FAIL;
exit_gracefully:
Trace(TEXT("Returning LPQUERYSCOPE %08x"), *ppQueryScope);
TraceLeaveResult(hres);
}
/*-----------------------------------------------------------------------------
/ Form handling functions
/----------------------------------------------------------------------------*/
/*-----------------------------------------------------------------------------
/ _FreeQueryForm
/ ---------------
/ Destroy the QUERYFORM allocation being used to describe the form in
/ our DPA. We ensure that we issue a CQPM_RELEASE before doing anything
/
/ In:
/ pQueryForm -> query form to be destroyed
/
/ Out:
/ INT == 1 always
/----------------------------------------------------------------------------*/
INT _FreeQueryFormCB(LPVOID pItem, LPVOID pData)
{
return _FreeQueryForm((LPQUERYFORM)pItem);
}
INT _FreeQueryForm(LPQUERYFORM pQueryForm)
{
TraceEnter(TRACE_FORMS, "_FreeQueryForm");
if (pQueryForm)
{
if (pQueryForm->hdsaPages)
{
DSA_DestroyCallback(pQueryForm->hdsaPages, _FreeQueryFormPageCB, NULL);
pQueryForm->hdsaPages = NULL;
}
Str_SetPtr(&pQueryForm->pTitle, NULL);
if (pQueryForm->hIcon)
{
DestroyIcon(pQueryForm->hIcon);
}
}
TraceLeaveValue(TRUE);
}
/*-----------------------------------------------------------------------------
/ _FreeQueryFormPage
/ ------------------
/ Given a pointer to a query form page structure release the members that
// are of interest, including calling the PAGEPROC to releasee the underlying
/ object.
/
/ In:
/ pQueryFormPage -> page to be removed
/
/ Out:
/ INT == 1 always
/----------------------------------------------------------------------------*/
INT _FreeQueryFormPageCB(LPVOID pItem, LPVOID pData)
{
return _FreeQueryFormPage((LPQUERYFORMPAGE)pItem);
}
INT _FreeQueryFormPage(LPQUERYFORMPAGE pQueryFormPage)
{
TraceEnter(TRACE_FORMS, "_FreeQueryFormPage");
if (pQueryFormPage)
{
_CallPageProc(pQueryFormPage, CQPM_RELEASE, 0, 0); // NB: ignore return code
if (pQueryFormPage->hwndPage)
{
EnableThemeDialogTexture(pQueryFormPage->hwndPage, ETDT_DISABLE);
DestroyWindow(pQueryFormPage->hwndPage);
pQueryFormPage->hwndPage = NULL;
}
if (pQueryFormPage->pPage)
{
LocalFree(pQueryFormPage->pPage);
pQueryFormPage->pPage = NULL;
}
}
TraceLeaveValue(TRUE);
}
/*-----------------------------------------------------------------------------
/ _CallPageProc
/ -------------
/ Call the given page object thunking the arguments as required if the
/ page object is non-UNICODE (only if building UNICODE).
/
/ In:
/ pQueryFormPage -> page object to be called
/ uMsg, wParam, lParam = parameters for message
/
/ Out:
/ HRESULT
/----------------------------------------------------------------------------*/
HRESULT _CallPageProc(LPQUERYFORMPAGE pQueryFormPage, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
HRESULT hres;
TraceEnter(TRACE_FORMS, "_CallPageProc");
Trace(TEXT("pQueryFormPage %08x, pPage %08x, uMsg %d, wParam %08x, lParam %08x"),
pQueryFormPage, pQueryFormPage->pPage, uMsg, wParam, lParam);
if (!pQueryFormPage)
ExitGracefully(hres, S_OK, "pQueryFormPage == NULL");
hres = (pQueryFormPage->pPage->pPageProc)(pQueryFormPage->pPage, pQueryFormPage->hwndPage, uMsg, wParam, lParam);
FailGracefully(hres, "Failed calling PageProc");
// hres = S_OK;
exit_gracefully:
TraceLeaveResult(hres);
}
/*-----------------------------------------------------------------------------
/ Functions for adding query forms/pages
/----------------------------------------------------------------------------*/
// CB to add forms to the form DSA.
HRESULT _AddFormsProc(LPARAM lParam, LPCQFORM pForm)
{
HRESULT hres;
QUERYFORM qf = {0};
HDSA hdsaForms = (HDSA)lParam;
TraceEnter(TRACE_FORMS, "_AddFormsProc");
if (!pForm || !hdsaForms)
ExitGracefully(hres, E_INVALIDARG, "Failed to add page pForm == NULL");
// Allocate and thunk as required
qf.hdsaPages = NULL; // DSA of pages
qf.dwFlags = pForm->dwFlags; // flags
qf.clsidForm = pForm->clsid; // CLSID identifier for this form
qf.pTitle = NULL; // title used for drop down / title bar
qf.hIcon = pForm->hIcon; // hIcon passed by caller
qf.iImage = -1; // image list index of icon
qf.iForm = 0; // visible index of form in control
qf.iPage = 0; // currently selected page on form
if (!Str_SetPtr(&qf.pTitle, pForm->pszTitle))
ExitGracefully(hres, E_OUTOFMEMORY, "Failed to copy form title string");
// Allocate the DSA if one doesn't exist yet, then add in the form
// structure as required.
if (-1 == DSA_AppendItem(hdsaForms, &qf))
ExitGracefully(hres, E_FAIL, "Failed to add form to the form DSA");
hres = S_OK; // success
exit_gracefully:
if (FAILED(hres))
_FreeQueryForm(&qf);
TraceLeaveResult(hres);
}
// CB to add pages to the page DSA.
HRESULT _AddPagesProc(LPARAM lParam, REFCLSID clsidForm, LPCQPAGE pPage)
{
HRESULT hres;
QUERYFORMPAGE qfp = {0};
HDSA hdsaPages = (HDSA)lParam;
TraceEnter(TRACE_FORMS, "_AddPagesProc");
if (!pPage || !hdsaPages)
ExitGracefully(hres, E_INVALIDARG, "Failed to add page pPage == NULL");
// copy the pPage structure for us to pass to the PAGEPROC later, nb: we
// use the cbStruct field to indicate the size of blob we must copy.
Trace(TEXT("pPage->cbStruct == %d"), pPage->cbStruct);
qfp.pPage = (LPCQPAGE)LocalAlloc(LPTR, pPage->cbStruct);
if (!qfp.pPage)
ExitGracefully(hres, E_OUTOFMEMORY, "Failed to allocate copy of page structure");
Trace(TEXT("Copying structure qfp.pPage %08x, pPage %08x"), qfp.pPage, pPage);
//REVIEWED-2002-02-25-lucios.
CopyMemory(qfp.pPage, pPage, pPage->cbStruct); // copy the page structure
//qfp.pPage = NULL;
qfp.clsidForm = clsidForm;
qfp.pPageProc = pPage->pPageProc;
qfp.lParam = pPage->lParam;
qfp.hwndPage = NULL;
_CallPageProc(&qfp, CQPM_INITIALIZE, 0, 0);
if (-1 == DSA_AppendItem(hdsaPages, &qfp))
ExitGracefully(hres, E_FAIL, "Failed to add the form to the DSA");
hres = S_OK; // succcess
exit_gracefully:
if (FAILED(hres))
_FreeQueryFormPage(&qfp);
TraceLeaveResult(hres);
}
// Add forms/pages from a UNICODE IQueryForm iface
HRESULT CQueryFrame::AddFromIQueryForm(IQueryForm* pQueryForm, HKEY hKeyForm)
{
HRESULT hres;
TraceEnter(TRACE_FORMS, "CQueryFrame::AddFromIQueryForm");
if (!pQueryForm)
ExitGracefully(hres, E_FAIL, "pQueryForm == NULL, failing");
hres = pQueryForm->Initialize(hKeyForm);
FailGracefully(hres, "Failed in IQueryFormW::Initialize");
// Call the form object to add its form and then its pages
hres = pQueryForm->AddForms(_AddFormsProc, (LPARAM)_hdsaForms);
if (SUCCEEDED(hres) || (hres == E_NOTIMPL))
{
hres = pQueryForm->AddPages(_AddPagesProc, (LPARAM)_hdsaPages);
FailGracefully(hres, "Failed in IQueryForm::AddPages");
}
else
{
FailGracefully(hres, "Failed when calling IQueryForm::AddForms");
}
hres = S_OK; // success
exit_gracefully:
TraceLeaveResult(hres);
}
#ifdef UNICODE
#define ADD_FROM_IQUERYFORM AddFromIQueryFormW
#else
#define ADD_FROM_IQUERYFORM AddFromIQueryFormA
#endif
/*-----------------------------------------------------------------------------
/ CQueryFrame::GatherForms
/ ------------------------
/ Enumerate all the query forms for the given query handler and build
/ the DPA containing the list of them. Once we have done this we
/ can then populate the control at some more convientent moment.
/
/ When gathering we first hit the "handler", then the "Forms" sub-key
/ trying to load all the InProc servers that provide forms. We build
/ list of hidden, never shown etc.
/
/ In:
/ -
/ Out:
/ HRESULT
/----------------------------------------------------------------------------*/
HRESULT _AddPageToForm(LPQUERYFORM pQueryForm, LPQUERYFORMPAGE pQueryFormPage, BOOL fClone)
{
HRESULT hres;
QUERYFORMPAGE qfp;
TraceEnter(TRACE_FORMS, "_AddPageToForm");
TraceAssert(pQueryForm);
TraceAssert(pQueryFormPage);
// ensure that we have a page DSA for this form object
if (!pQueryForm->hdsaPages)
{
TraceMsg("Creating a new page DSA for form");
pQueryForm->hdsaPages = DSA_Create(SIZEOF(QUERYFORMPAGE), 4);
if (!pQueryForm->hdsaPages)
ExitGracefully(hres, E_OUTOFMEMORY, "*** No page DSA on form object ***");
}
if (!fClone)
{
// Moving this page structure to the one associated with the query form,
// therefore just ensure that the form has a DSA for pages and just
// insert an item at the header (yes, we add the pages in reverse).
Trace(TEXT("Adding page %08x to form %s"), pQueryFormPage, pQueryForm->pTitle);
if (-1 == DSA_InsertItem(pQueryForm->hdsaPages, 0, pQueryFormPage))
ExitGracefully(hres, E_FAIL, "Failed to copy page to form page DSA");
}
else
{
LPCQPAGE pPage = pQueryFormPage->pPage;
// Copying the page structure (it must be global), therefore clone
// the QUERYFORMPAGE strucutre and the CQPAGE into a new allocation
// and insert that into the page DSA.
Trace(TEXT("Cloning page %08x to form %s"), pQueryFormPage, pQueryForm->pTitle);
CopyMemory(&qfp, pQueryFormPage, SIZEOF(QUERYFORMPAGE));
qfp.pPage = (LPCQPAGE)LocalAlloc(LPTR, pPage->cbStruct);
if (!qfp.pPage)
ExitGracefully(hres, E_OUTOFMEMORY, "Failed to allocate copy of page structure");
Trace(TEXT("Copying structure qfp.pPage %08x, pPage %08x"), qfp.pPage, pPage);
//REVIEWED-2002-02-25-lucios.
CopyMemory(qfp.pPage, pPage, pPage->cbStruct); // copy the page structure
_CallPageProc(&qfp, CQPM_INITIALIZE, 0, 0);
if (-1 == DSA_AppendItem(pQueryForm->hdsaPages, &qfp))
{
_FreeQueryFormPage(&qfp);
ExitGracefully(hres, E_FAIL, "Failed to copy page to form DSA");
}
}
hres = S_OK; // success
exit_gracefully:
TraceLeaveResult(hres);
}
HRESULT CQueryFrame::GatherForms(VOID)
{
HRESULT hres;
IQueryForm* pQueryFormA = NULL;
HKEY hKeyForms = NULL;
TCHAR szBuffer[MAX_PATH];
INT i, iPage, iForm;
RECT rect;
TC_ITEM tci;
TraceEnter(TRACE_FORMS, "CQueryFrame::GatherForms");
// Construct DSA's so we can store the forms and pages as required.
_hdsaForms = DSA_Create(SIZEOF(QUERYFORM), 4);
_hdsaPages = DSA_Create(SIZEOF(QUERYFORMPAGE), 4);
if (!_hdsaForms || !_hdsaPages)
ExitGracefully(hres, E_OUTOFMEMORY, "Failed to create DSA's for storing pages/forms");
// First check the IQueryHandler to see if it supports IQueryForm, if it does
// then call it to add its objects. Note that we don't bother with ANSI/UNICODE
// at this point as the handler is assumed to be built the same the
// the query framework.
if (SUCCEEDED(_pQueryHandler->QueryInterface(IID_IQueryForm, (LPVOID*)&pQueryFormA)))
{
hres = AddFromIQueryForm(pQueryFormA, NULL);
FailGracefully(hres, "Failed when calling AddFromIQueryForm on handlers IQueryForm iface)");
}
// now attempt to build the list of forms and pages from the registered form
// extensions. These are declared under the handlers CLSID in the registry,
// under the sub-key "Forms".
if (ERROR_SUCCESS != RegOpenKeyEx(_hkHandler, c_szForms, NULL, KEY_READ, &hKeyForms))
{
TraceMsg("No 'Forms' sub-key found, therefore skipping");
}
else
{
// Enumerate all the keys in the "Forms" key, these are assumed to be a list of
// the form handlers.
for (i = 0 ; TRUE ; i++)
{
DWORD cchStruct = ARRAYSIZE(szBuffer);
if (ERROR_SUCCESS != RegEnumKeyEx(hKeyForms, i, szBuffer, &cchStruct, NULL, NULL, NULL, NULL))
{
TraceMsg("RegEnumKeyEx return's false, therefore stopping eunmeration");
break;
}
GetForms(hKeyForms, szBuffer);
}
}
// Now tally the form/page information together and remove duplicates and attach the pages
// to forms, take special note of the global pages. As all forms will now be in the
// DSA we can check for a zero count and we don't have to worry about the order
// in which the the forms and pages were added.
if (!DSA_GetItemCount(_hdsaForms) || !DSA_GetItemCount(_hdsaPages))
ExitGracefully(hres, E_FAIL, "Either the forms or pages DSA is empty");
for (iPage = DSA_GetItemCount(_hdsaPages) ; --iPage >= 0 ;)
{
LPQUERYFORMPAGE pQueryFormPage = (LPQUERYFORMPAGE)DSA_GetItemPtr(_hdsaPages, iPage);
TraceAssert(pQueryFormPage);
Trace(TEXT("iPage %d (of %d)"), iPage, DSA_GetItemCount(_hdsaPages));
if (!(pQueryFormPage->pPage->dwFlags & CQPF_ISGLOBAL))
{
LPQUERYFORM pQueryFormB = FindQueryForm(pQueryFormPage->clsidForm);
TraceAssert(pQueryFormB);
TraceGUID("Adding page to form:", pQueryFormPage->clsidForm);
if (pQueryFormB)
{
hres = _AddPageToForm(pQueryFormB, pQueryFormPage, FALSE);
FailGracefully(hres, "Failed when adding page to form");
if (!DSA_DeleteItem(_hdsaPages, iPage))
TraceMsg("**** Failed to remove page from global DSA ****");
}
}
}
for (iPage = DSA_GetItemCount(_hdsaPages) ; --iPage >= 0 ;)
{
LPQUERYFORMPAGE pQueryFormPage = (LPQUERYFORMPAGE)DSA_GetItemPtr(_hdsaPages, iPage);
TraceAssert(pQueryFormPage);
if ((pQueryFormPage->pPage->dwFlags & CQPF_ISGLOBAL))
{
Trace(TEXT("Adding global page to %d forms"), DSA_GetItemCount(_hdsaForms));
for (iForm = 0 ; iForm < DSA_GetItemCount(_hdsaForms); iForm++)
{
LPQUERYFORM pQueryFormC = (LPQUERYFORM)DSA_GetItemPtr(_hdsaForms, iForm);
TraceAssert(pQueryFormC);
if (!(pQueryFormC->dwFlags & CQFF_NOGLOBALPAGES))
{
hres = _AddPageToForm(pQueryFormC, pQueryFormPage, TRUE);
FailGracefully(hres, "Failed when adding global page to form");
}
}
_FreeQueryFormPage(pQueryFormPage);
if (!DSA_DeleteItem(_hdsaPages, iPage))
TraceMsg("**** Failed to remove page from global DSA ****");
}
}
// Walk the list of forms, rmeoving the ones which have no pages assocaited with
// them, we don't need these around confusing the world around us. Note that
// we walk backwards through the list removing.
//
// Also remove the optional forms we don't want to ehw orld to see
for (iForm = DSA_GetItemCount(_hdsaForms) ; --iForm >= 0 ;)
{
LPQUERYFORM pQueryFormD = (LPQUERYFORM)DSA_GetItemPtr(_hdsaForms, iForm);
TraceAssert(pQueryFormD);
Trace(TEXT("pQueryForm %08x (%s), pQueryFormD->hdsaPages %08x (%d)"),
pQueryFormD,
pQueryFormD->pTitle,
pQueryFormD->hdsaPages,
pQueryFormD->hdsaPages ? DSA_GetItemCount(pQueryFormD->hdsaPages):0);
if (!pQueryFormD->hdsaPages
|| !DSA_GetItemCount(pQueryFormD->hdsaPages)
|| ((pQueryFormD->dwFlags & CQFF_ISOPTIONAL) && !(_pOpenQueryWnd->dwFlags & OQWF_SHOWOPTIONAL)))
{
TraceGUID("Removing form: ", pQueryFormD->clsidForm);
_FreeQueryForm(pQueryFormD);
DSA_DeleteItem(_hdsaForms, iForm);
}
}
if (!DSA_GetItemCount(_hdsaForms))
ExitGracefully(hres, E_FAIL, "!!!!! No forms registered after page/form fix ups !!!!!");
// The pages have been attached to the forms so we can now attempt to create the
// form/page objects.
_szForm.cx = 0;
_szForm.cy = 0;
tci.mask = TCIF_TEXT;
tci.pszText = TEXT("");
tci.cchTextMax = 0;
TabCtrl_InsertItem(_hwndFrame, 0, &tci); // tabctrl needs at least one item so we can compute sizes
for (iForm = 0 ; iForm < DSA_GetItemCount(_hdsaForms); iForm++)
{
LPQUERYFORM pQueryFormE = (LPQUERYFORM)DSA_GetItemPtr(_hdsaForms, iForm);
TraceAssert(pQueryFormE);
// Create each of the modeless page dialoges that we show to allow the user
// to edit the search criteria. We also grab the size and modify the
// form informaiton we have so that the default size of the dialog can be
// correctly computed.
for (iPage = 0 ; iPage < DSA_GetItemCount(pQueryFormE->hdsaPages); iPage++)
{
LPQUERYFORMPAGE pQueryFormPage = (LPQUERYFORMPAGE)DSA_GetItemPtr(pQueryFormE->hdsaPages, iPage);
TraceAssert(pQueryFormPage);
pQueryFormPage->hwndPage = CreateDialogParam(pQueryFormPage->pPage->hInstance,
MAKEINTRESOURCE(pQueryFormPage->pPage->idPageTemplate),
_hwnd,
pQueryFormPage->pPage->pDlgProc,
(LPARAM)pQueryFormPage->pPage);
if (!pQueryFormPage->hwndPage)
ExitGracefully(hres, E_FAIL, "Failed to create query form page");
EnableThemeDialogTexture(pQueryFormPage->hwndPage, ETDT_ENABLETAB);
GetRealWindowInfo(pQueryFormPage->hwndPage, &rect, NULL);
TabCtrl_AdjustRect(_hwndFrame, TRUE, &rect);
_szForm.cx = max(rect.right-rect.left, _szForm.cx);
_szForm.cy = max(rect.bottom-rect.top, _szForm.cy);
// flush the form parameters
_CallPageProc(pQueryFormPage, CQPM_CLEARFORM, 0, 0);
// Call the page with CQPM_SETDEFAULTPARAMETERS with the
// OPENQUERYWINDOW structure. wParam is TRUE/FALSE indiciating if
// the form is the default one, and therefore if the pFormParam is
// valid.
_CallPageProc(pQueryFormPage, CQPM_SETDEFAULTPARAMETERS,
(WPARAM)((_pOpenQueryWnd->dwFlags & OQWF_DEFAULTFORM) &&
IsEqualCLSID(_pOpenQueryWnd->clsidDefaultForm, pQueryFormPage->clsidForm)),
(LPARAM)_pOpenQueryWnd);
}
// If the form has an hIcon then lets ensure that we add that to the form image
// list, any failure here is non-fatal, in that we will just skip that forms
// icon in the list (rather than barfing)
if (pQueryFormE->hIcon)
{
if (!_himlForms)
_himlForms = ImageList_Create(COMBOEX_IMAGE_CX, COMBOEX_IMAGE_CY, 0, 4, 1);
if (_himlForms)
{
pQueryFormE->iImage = ImageList_AddIcon(_himlForms, pQueryFormE->hIcon);
TraceAssert(pQueryFormE->iImage >= 0);
}
DestroyIcon(pQueryFormE->hIcon);
pQueryFormE->hIcon = NULL;
}
}
hres = S_OK; // success
exit_gracefully:
DoRelease(pQueryFormA);
if (hKeyForms)
RegCloseKey(hKeyForms);
TraceLeaveResult(hres);
}
/*-----------------------------------------------------------------------------
/ CQueryFrame::GetForms
/ ---------------------
/ Given a HKEY to the forms list and the value name for the form we want
/ to add, query for the form information add add the form objects
/ to the master list.
/
/ In:
/ hKeyForms = HKEY for the {CLSID provider}\Forms key
/ pName -> key value to query for
/
/ Out:
/ VOID
/----------------------------------------------------------------------------*/
HRESULT CQueryFrame::GetForms(HKEY hKeyForms, LPTSTR pName)
{
HRESULT hres;
HKEY hKeyForm = NULL;
TCHAR szQueryFormCLSID[GUIDSTR_MAX+1];
DWORD dwFlags;
DWORD dwSize;
IUnknown* pUnknown = NULL;
IQueryForm* pQueryForm = NULL;
CLSID clsidForm;
BOOL fIncludeForms = FALSE;
TraceEnter(TRACE_FORMS, "CQueryFrame::_GetForms");
Trace(TEXT("pName %s"), pName);
if (ERROR_SUCCESS != RegOpenKeyEx(hKeyForms, pName, NULL, KEY_READ, &hKeyForm))
ExitGracefully(hres, E_UNEXPECTED, "Failed to open the form key");
// Read the flags and try to determine if we should invoke this form object.
dwSize = SIZEOF(dwFlags);
if (ERROR_SUCCESS != RegQueryValueEx(hKeyForm, c_szFlags, NULL, NULL, (LPBYTE)&dwFlags, &dwSize))
{
TraceMsg("No flags, defaulting to something sensible");
dwFlags = QUERYFORM_CHANGESFORMLIST;
}
Trace(TEXT("Forms flag is %08x"), dwFlags);
// should be invoke this form object?
//
// - if dwFlags has QUERYFORM_CHANGESFORMSLIST, or
// - if dwFlags has QUERYFORM_CHANGESOPTFORMLIST and we are showing optional forms, or
// - neither set and the form object supports the requested form
if (!(dwFlags & QUERYFORM_CHANGESFORMLIST))
{
if ((dwFlags & QUERYFORM_CHANGESOPTFORMLIST) &&
(_pOpenQueryWnd->dwFlags & OQWF_SHOWOPTIONAL))
{
TraceMsg("Form is optional, are we are showing optional forms");
fIncludeForms = TRUE;
}
else
{
// OK, so it either didn't update the form list, or wasn't marked as optional,
// so lets check to see if it supports the form the user has requested, if not
// then don't bother loading this guy.
if (_pOpenQueryWnd->dwFlags & OQWF_DEFAULTFORM)
{
TCHAR szBuffer[GUIDSTR_MAX+32];
HKEY hkFormsSupported;
TraceMsg("Checking for supported form");
if (ERROR_SUCCESS == RegOpenKeyEx(hKeyForm, TEXT("Forms Supported"), NULL, KEY_READ, &hkFormsSupported))
{
TraceMsg("Form has a 'Supported Forms' sub-key");
GetStringFromGUID(_pOpenQueryWnd->clsidDefaultForm, szQueryFormCLSID, ARRAYSIZE(szQueryFormCLSID));
Trace(TEXT("Checking for: %s"), szQueryFormCLSID);
if (ERROR_SUCCESS == RegQueryValueEx(hkFormsSupported, szQueryFormCLSID, NULL, NULL, NULL, NULL))
{
TraceMsg("Query form is in supported list");
fIncludeForms = TRUE;
}
RegCloseKey(hkFormsSupported);
}
else
{
TraceMsg("No forms supported sub-key, so loading form object anyway");
fIncludeForms = TRUE;
}
}
}
}
else
{
TraceMsg("Form updates form list");
fIncludeForms = TRUE;
}
// if fIncludeForms is TRUE, then the checks above succeeded and we are including forms
// from this object (identified by pName), so we must now get the CLSID of the object
// we are invoking and use its IQueryForm interface to add the forms that we want.
if (fIncludeForms)
{
// get the form object CLSID, having parse it, then CoCreate it adding the forms.
dwSize = SIZEOF(szQueryFormCLSID);
if (ERROR_SUCCESS != RegQueryValueEx(hKeyForm, c_szCLSID, NULL, NULL, (LPBYTE)szQueryFormCLSID, &dwSize))
ExitGracefully(hres, E_UNEXPECTED, "Failed to read the CLSID of the form");
Trace(TEXT("szQueryFormCLSID: %s"), szQueryFormCLSID);
if (!GetGUIDFromString(szQueryFormCLSID, &clsidForm))
ExitGracefully(hres, E_UNEXPECTED, "Fialed to parse the string as a GUID");
// we now have the CLISD of the form object, so we must attempt to CoCreate it, we try for
// the current build type (eg UNICODE) and then fall back to ANSI if thats not supported,
// so we can support ANSI query form objects on a UNICODE platform.
hres = CoCreateInstance(clsidForm, NULL, CLSCTX_INPROC_SERVER, IID_IUnknown, (void**)&pUnknown);
FailGracefully(hres, "Failed to CoCreate the form object");
if (SUCCEEDED(pUnknown->QueryInterface(IID_IQueryForm, (LPVOID*)&pQueryForm)))
{
hres = AddFromIQueryForm(pQueryForm, hKeyForm);
FailGracefully(hres, "Failed when adding forms from specified IQueryForm iface");
}
else
{
ExitGracefully(hres, E_UNEXPECTED, "Form object doesn't support IQueryForm(A/W)");
}
}
hres = S_OK;
exit_gracefully:
if (hKeyForm)
RegCloseKey(hKeyForm);
DoRelease(pUnknown);
DoRelease(pQueryForm);
TraceLeaveResult(hres);
}
/*-----------------------------------------------------------------------------
/ CQueryFrame::PopulateFormControl
/ ---------------------------------
/ Enumerate all the query forms for the given query handler and build
/ the DPA containing the list of them. Once we have done this we
/ can then populate the control at some more convientent moment.
/
/ When gathering we first hit the "handler", then the "Forms" sub-key
/ trying to load all the InProc servers that provide forms. We build
/ list of hidden, never shown etc.
/
/ In:
/ fIncludeHidden = list forms marked as hidden in control
/
/ Out:
/ VOID
/----------------------------------------------------------------------------*/
HRESULT CQueryFrame::PopulateFormControl(BOOL fIncludeHidden)
{
HRESULT hres;
COMBOBOXEXITEM cbi;
INT i, iForm;
TraceEnter(TRACE_FORMS, "CQueryFrame::PopulateFormControl");
Trace(TEXT("fIncludeHidden: %d"), fIncludeHidden);
// list which forms within the control
if (!_hdsaForms)
ExitGracefully(hres, E_FAIL, "No forms to list");
ComboBox_ResetContent(_hwndLookFor); // remove all items from that control
for (i = 0, iForm = 0 ; iForm < DSA_GetItemCount(_hdsaForms); iForm++)
{
LPQUERYFORM pQueryForm = (LPQUERYFORM)DSA_GetItemPtr(_hdsaForms, iForm);
TraceAssert(pQueryForm);
// filter out those forms that are not of interest to this instance of the
// dialog.
if (((pQueryForm->dwFlags & CQFF_ISOPTIONAL) && !fIncludeHidden) ||
(pQueryForm->dwFlags & CQFF_ISNEVERLISTED))
{
Trace(TEXT("Hiding form: %s"), pQueryForm->pTitle);
continue;
}
// now add the form to the control, including the image if there is an image
// specified.
cbi.mask = CBEIF_TEXT|CBEIF_LPARAM;
cbi.iItem = i++;
cbi.pszText = pQueryForm->pTitle;
cbi.cchTextMax = lstrlen(pQueryForm->pTitle);
cbi.lParam = iForm;
if (pQueryForm->iImage >= 0)
{
Trace(TEXT("Form has an image %d"), pQueryForm->iImage);
cbi.mask |= CBEIF_IMAGE|CBEIF_SELECTEDIMAGE;
cbi.iImage = pQueryForm->iImage;
cbi.iSelectedImage = pQueryForm->iImage;
}
pQueryForm->iForm = (int)SendMessage(_hwndLookFor, CBEM_INSERTITEM, 0, (LPARAM)&cbi);
if (pQueryForm->iForm < 0)
{
Trace(TEXT("Form name: %s"), pQueryForm->pTitle);
ExitGracefully(hres, E_FAIL, "Failed to add the entry to the combo box");
}
}
hres = S_OK;
exit_gracefully:
TraceLeaveValue(hres);
}
/*-----------------------------------------------------------------------------
/ CQueryFrame::SelectForm
/ -----------------------
/ Changes the current form to the one specified as an into the DPA.
/
/ In:
/ iForm = form to be selected
/
/ Out:
/ -
/----------------------------------------------------------------------------*/
HRESULT CQueryFrame::SelectForm(REFCLSID clsidForm)
{
HRESULT hres;
LPQUERYFORM pQueryForm, pOldQueryForm;
LPQUERYFORMPAGE pQueryFormPage;
LPCQPAGE pPage;
INT nCmdShow = SW_SHOW;
TCHAR szBuffer[64], szTitle[MAX_PATH];;
TC_ITEM tci;
INT i;
TraceEnter(TRACE_FORMS, "CQueryFrame::SelectForm");
pQueryForm = FindQueryForm(clsidForm);
TraceAssert(pQueryForm);
if (!pQueryForm)
ExitGracefully(hres, S_FALSE, "Failed to find the requested form");
// Change the currently displayed form and change the displayed
// tabs to correctly indicate this
if ((pQueryForm != _pCurrentForm))
{
if (!OnNewQuery(FALSE)) // prompt the user
ExitGracefully(hres, S_FALSE, "Failed to select the new form");
TabCtrl_DeleteAllItems(_hwndFrame);
for (i = 0 ; i < DSA_GetItemCount(pQueryForm->hdsaPages) ; i++)
{
pQueryFormPage = (LPQUERYFORMPAGE)DSA_GetItemPtr(pQueryForm->hdsaPages, i);
pPage = pQueryFormPage->pPage;
tci.mask = TCIF_TEXT;
tci.pszText = pQueryForm->pTitle;
tci.cchTextMax = MAX_PATH;
if (pPage->idPageName &&
LoadString(pPage->hInstance, pPage->idPageName, szBuffer, ARRAYSIZE(szBuffer)))
{
Trace(TEXT("Loaded page title string %s"), szBuffer);
tci.pszText = szBuffer;
}
TabCtrl_InsertItem(_hwndFrame, i, &tci);
}
ComboBox_SetCurSel(_hwndLookFor, pQueryForm->iForm);
_pCurrentForm = pQueryForm;
SelectFormPage(pQueryForm, pQueryForm->iPage);
// Change the dialog title to reflect the new form
if (LoadString(GLOBAL_HINSTANCE, IDS_FRAMETITLE, szBuffer, ARRAYSIZE(szBuffer)))
{
// NTRAID#NTBUG9-554458-2002/02/20-lucios. Pending fix.
wsprintf(szTitle, szBuffer, pQueryForm->pTitle);
SetWindowText(_hwnd, szTitle);
}
// Tell the handler that we have changed the form, they can then use this
// new form name to modify their UI.
_pQueryHandler->ActivateView(CQRVA_FORMCHANGED, (WPARAM)lstrlen(pQueryForm->pTitle), (LPARAM)pQueryForm->pTitle);
}
hres = S_OK;
exit_gracefully:
TraceLeaveResult(hres);
}
/*-----------------------------------------------------------------------------
/ CQueryFrame::SelectFormPage
/ ---------------------------
/ Change the currently active page of a query form to the one specified
/ by the index.
/
/ In:
/ pQueryForm = query form to be changed
/ iForm = form to be selected
/
/ Out:
/ -
/----------------------------------------------------------------------------*/
VOID CQueryFrame::SelectFormPage(LPQUERYFORM pQueryForm, INT iPage)
{
LPQUERYFORMPAGE pQueryFormPage;
RECT rect;
TraceEnter(TRACE_FORMS, "CQueryFrame::SelectFormPage");
pQueryFormPage = (LPQUERYFORMPAGE)DSA_GetItemPtr(pQueryForm->hdsaPages, iPage);
// Have we changed the query form page? If so then display the now dialog
// hiding the previous one. We call the TabCtrl to find out where we should
// be placing this new control.
if (pQueryFormPage != _pCurrentFormPage)
{
// Reflect the change into the tab control
TabCtrl_SetCurSel(_hwndFrame, iPage);
pQueryForm->iPage = iPage;
// Fix the size and visability of the new form
if (_pCurrentFormPage)
ShowWindow(_pCurrentFormPage->hwndPage, SW_HIDE);
GetRealWindowInfo(_hwndFrame, &rect, NULL);
TabCtrl_AdjustRect(_hwndFrame, FALSE, &rect);
SetWindowPos(pQueryFormPage->hwndPage,
HWND_TOP,
rect.left, rect.top,
rect.right - rect.left,
rect.bottom - rect.top,
SWP_SHOWWINDOW);
_pCurrentFormPage = pQueryFormPage;
}
TraceLeave();
}
/*-----------------------------------------------------------------------------
/ CQueryFrame::CallFormPages
/ --------------------------
/ Given a query form traverse the array of pages calling each of them
/ with the given message information. If any of the pages return
/ an error code (other than E_NOTIMPL) we bail.
/
/ In:
/ pQueryForm = query form to call
/ uMsg, wParam, lParam = parameters for the page
/
/ Out:
/ HRESULT
/----------------------------------------------------------------------------*/
HRESULT CQueryFrame::CallFormPages(LPQUERYFORM pQueryForm, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
HRESULT hres = S_OK;
INT iPage;
TraceEnter(TRACE_FORMS, "CQueryFrame::CallFormPages");
if (!pQueryForm || !pQueryForm->hdsaPages)
ExitGracefully(hres, E_FAIL, "No pQueryForm || pQueryForm->hdsaPages == NULL");
Trace(TEXT("pQueryForm %08x"), pQueryForm);
Trace(TEXT("uMsg %08x, wParam %08x, lParam %08x"), uMsg, wParam, lParam);
Trace(TEXT("%d pages to call"), DSA_GetItemCount(pQueryForm->hdsaPages));
// Call each page in turn if it matches the filter we have been given for calling
// down. If a page returns S_FALSE or a FAILURE then we exit the loop. If the
// failure however is E_NOTIMPL then we ignore.
for (iPage = 0 ; iPage < DSA_GetItemCount(pQueryForm->hdsaPages); iPage++)
{
LPQUERYFORMPAGE pQueryFormPage = (LPQUERYFORMPAGE)DSA_GetItemPtr(pQueryForm->hdsaPages, iPage);
TraceAssert(pQueryFormPage);
hres = _CallPageProc(pQueryFormPage, uMsg, wParam, lParam);
if (FAILED(hres) && (hres != E_NOTIMPL))
{
TraceMsg("PageProc returned a FAILURE");
break;
}
else if (hres == S_FALSE)
{
TraceMsg("PageProc returned S_FALSE, exiting loop");
break;
}
}
exit_gracefully:
TraceLeaveResult(hres);
}
/*-----------------------------------------------------------------------------
/ CQueryFrame::FindQueryForm
/ --------------------------
/ Given the CLSID for the form return a pointer to its LPQUERYFORM structure,
/ or NULL if not found.
/
/ In:
/ clsidForm = ID of the form
/
/ Out:
/ LPQUERYFORM
/----------------------------------------------------------------------------*/
LPQUERYFORM CQueryFrame::FindQueryForm(REFCLSID clsidForm)
{
LPQUERYFORM pQueryForm = NULL;
INT i;
TraceEnter(TRACE_FORMS, "CQueryFrame::FindQueryForm");
TraceGUID("Form ID", clsidForm);
for (i = 0 ; _hdsaForms && (i < DSA_GetItemCount(_hdsaForms)) ; i++)
{
pQueryForm = (LPQUERYFORM)DSA_GetItemPtr(_hdsaForms, i);
TraceAssert(pQueryForm);
if (IsEqualCLSID(clsidForm, pQueryForm->clsidForm))
{
Trace(TEXT("Form is index %d (%08x)"), i, pQueryForm);
break;
}
}
if (!_hdsaForms || (i >= DSA_GetItemCount(_hdsaForms)))
pQueryForm = NULL;
TraceLeaveValue(pQueryForm);
}
| [
"[email protected]"
] | |
e7d2f771cfe2d34c1fda44b807f79f0c8cfd7946 | 5437dc6424b182adc0b655739ff7cd94f169feaf | /test/task.h | b4dc094bd66dc0b3cdff8e2dd212c4140a869b88 | [] | no_license | ziyuan520/test | 23fccbeeed4dee537765e064a71a48918fa010b6 | fec6fe66a0bb31b8d773daa93cc2fb75e144b631 | refs/heads/master | 2021-01-01T06:13:21.193428 | 2017-07-16T13:09:37 | 2017-07-16T13:09:37 | 97,383,485 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 705 | h | #ifndef TASK_H
#define TASK_H
#include <QWidget>
#include <QString>
#include "data.h"
//a
namespace Ui {
class task;
}
class task : public QWidget
{
Q_OBJECT
public:
explicit task(QWidget *parent = 0);
void setTitle(char*);
void setTime(QDate time,QDate end);
void setIndex(int i);
void setTitle(QString);
void setData(timedata Data);
~task();
private:
Ui::task *ui;
int index;
timedata data;
signals:
void done(int state,int index);
void editDone(int);
private slots:
void on_checkBox_stateChanged(int arg1);
void on_more_clicked();
void sentEditData(timedata editedData);
};
#endif // TASK_H
| [
"[email protected]"
] | |
8d4f4014a9de0b0d3691e57cc83ae233a727c5ee | b761757a02d38f4d0bf4f8879c4389041a530745 | /Tensorflow-micro/CIFAR-Models/build/CMakeFiles/CMakeTmp/CompilerFlagC.c | d025068d92ca2e35321ecf8d7cd15efbf8a29ca5 | [] | no_license | chrpro/TinyML-Evaluation | 14c771839d02938734c73bd13e3e07f15c2b4bfb | 4ca8b6582d38d84744e37cca93697ea388593278 | refs/heads/main | 2023-09-03T22:22:55.063375 | 2023-08-12T11:35:10 | 2023-08-12T11:35:10 | 350,752,223 | 6 | 3 | null | null | null | null | UTF-8 | C++ | false | false | 30 | c | int main (void)
{ return 0; }
| [
"[email protected]"
] | |
7ebe35ea4612ffe0b806784598f3fb8b7643ff63 | bcfc1d294607d448d59ad23d415338a16ab84f0c | /DataStructure/SeqQueue.cpp | 2ae88fda50f90772ac7f191ff9e0f431d6ed88d3 | [] | no_license | Yunnglin/DataStructure | 4fb4f32cdafa11ae45cbecbed3828373b6857e6d | 7df73538a0620016d67b35bfe3516bb78a045ec3 | refs/heads/master | 2020-03-28T08:58:29.390946 | 2018-11-06T12:03:47 | 2018-11-06T12:03:47 | 148,003,953 | 0 | 0 | null | null | null | null | GB18030 | C++ | false | false | 763 | cpp | #include "pch.h"
#include "SeqQueue.h"
#ifndef _SeqQueue_Cpp_
#define _SeqQueue_Cpp_
template<class T>
SeqQueue<T>::SeqQueue()
{
//顺序队的front和rear初始化为-1
this->front = -1;
this->rear = -1;
}
template<class T>
SeqQueue<T>::~SeqQueue()
{
}
template<class T>
void SeqQueue<T>::Destroy() {
delete this;
}
template<class T>
bool SeqQueue<T>::IsEmpty() {
return (this->front == this->rear);
}
template<class T>
bool SeqQueue<T>::enQueue(T e) {
if (this->rear == SQMaxSize - 1)
return false;
this->rear++;
this->data[this->rear] = e;
return true;
}
template<class T>
bool SeqQueue<T>::deQueue(T& e) {
if (this->front == this->rear)
return false;
this->front++;
e = this->data[this->front];
return true;
}
#endif // !_SeqQueue_Cpp_ | [
"[email protected]"
] | |
e5181bd3fef1845ca15a81d031820b647c14f918 | e05a2da817a8524e10b1c0c02490825f06dbc83e | /week-07/day-02/01.cpp | 49804261ed8268b485c24dcb2f8e03afacecd072 | [] | no_license | green-fox-academy/Gabor11 | ed54b7a167defa95934b784d92eb5a95a63576cf | 9a75874ae0fecea918f38c2858a46a5a71b4f5b7 | refs/heads/master | 2021-09-06T04:17:40.460148 | 2018-02-02T09:04:38 | 2018-02-02T09:04:38 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 536 | cpp | #include <iostream>
using namespace std;
// create a function that adds two integers.
// Create an other function of the same name that takes 3 integers and returns the result of adding these 3 integers.
// Write code that uses both after one an other and prints out the results in a new line each.
// For input use 1 and 2, then 1, 2 and 3.
int sum(int a, int b)
{
return a + b;
}
int sum(int a, int b, int c)
{
return a + b + c;
}
int main()
{
cout << sum(1, 2) << endl;
cout << sum(1, 2, 3) << endl;
return 0;
}
| [
"[email protected]"
] | |
f3ec87edfa4a626b1614360420481d59c7bf7081 | 2c0e6e0723895caee73f05445aac5f22d1e41f89 | /mainwindow.h | afe0040322182a2a5aa8a6e2153b024beb16f6a9 | [] | no_license | jerryjiahaha/reversi | 4db0ab431ec5c66e517fcfac4d63ba716dd3017a | 6dc04e16f3dbab1d9c147815474a84ce1f103b1c | refs/heads/master | 2021-01-01T04:18:38.093528 | 2016-05-27T13:24:15 | 2016-05-27T13:24:15 | 59,720,106 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,046 | h | #ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include <QMainWindow>
#include <QPainter>
#include <QWidget>
#include <QObject>
#include <QMessageBox>
//#include <QThread>
#include <QDesktopWidget>
#include <map>
#include "virtual_board.h"
#include "boardview.h"
#include "newgamedialog.h"
#include "ai/SmartGecko.h"
namespace Ui {
class MainWindow;
}
class MainWindow : public QMainWindow
{
Q_OBJECT
public:
explicit MainWindow(QWidget *parent = 0);
~MainWindow();
signals:
void nextPlayer();
void endOfGame();
private slots:
void on_actionNew_triggered();
void startGame(int ret);
void handleNextPos(int x, int y);
void handleNextPlayer();
void handleEndOfGame();
//void updateInfo();
private:
Ui::MainWindow *ui;
BoardWidget *board_view;
vBoard *board_model;
newGameDialog *newgame;
int imfirst;
std::map<int, int> playerList; // Ai:1, human:0
std::map<int, QString> playerNames;
SmartGecko *ai;
//int whiteisAi;
//int blackisAi;
};
#endif // MAINWINDOW_H
| [
"[email protected]"
] | |
08ef87f2a6e218df9b841d7d995fa37b6bea2420 | be0282afa8dd436619c71d6118c9db455eaf1a29 | /Intermediate/Build/Win64/Design3D/Inc/NavigationSystem/NavModifierVolume.gen.cpp | 6c908e88404eefe38da33fbeccc05f8472ce306d | [] | no_license | Quant2017/Design3D | 0f915580b222af40ab911021cceef5c26375d7f9 | 94a22386be4aa37aa0f546354cc62958820a4bf6 | refs/heads/master | 2022-04-23T10:44:12.398772 | 2020-04-22T01:02:39 | 2020-04-22T01:02:39 | 262,966,755 | 1 | 0 | null | 2020-05-11T07:12:37 | 2020-05-11T07:12:36 | null | UTF-8 | C++ | false | false | 8,800 | cpp | // Copyright 1998-2019 Epic Games, Inc. All Rights Reserved.
/*===========================================================================
Generated code exported from UnrealHeaderTool.
DO NOT modify this manually! Edit the corresponding .h files instead!
===========================================================================*/
#include "UObject/GeneratedCppIncludes.h"
#include "NavigationSystem/Public/NavModifierVolume.h"
#ifdef _MSC_VER
#pragma warning (push)
#pragma warning (disable : 4883)
#endif
PRAGMA_DISABLE_DEPRECATION_WARNINGS
void EmptyLinkFunctionForGeneratedCodeNavModifierVolume() {}
// Cross Module References
NAVIGATIONSYSTEM_API UClass* Z_Construct_UClass_ANavModifierVolume_NoRegister();
NAVIGATIONSYSTEM_API UClass* Z_Construct_UClass_ANavModifierVolume();
ENGINE_API UClass* Z_Construct_UClass_AVolume();
UPackage* Z_Construct_UPackage__Script_NavigationSystem();
NAVIGATIONSYSTEM_API UFunction* Z_Construct_UFunction_ANavModifierVolume_SetAreaClass();
COREUOBJECT_API UClass* Z_Construct_UClass_UClass();
NAVIGATIONSYSTEM_API UClass* Z_Construct_UClass_UNavArea_NoRegister();
ENGINE_API UClass* Z_Construct_UClass_UNavRelevantInterface_NoRegister();
// End Cross Module References
void ANavModifierVolume::StaticRegisterNativesANavModifierVolume()
{
UClass* Class = ANavModifierVolume::StaticClass();
static const FNameNativePtrPair Funcs[] = {
{ "SetAreaClass", &ANavModifierVolume::execSetAreaClass },
};
FNativeFunctionRegistrar::RegisterFunctions(Class, Funcs, ARRAY_COUNT(Funcs));
}
struct Z_Construct_UFunction_ANavModifierVolume_SetAreaClass_Statics
{
struct NavModifierVolume_eventSetAreaClass_Parms
{
TSubclassOf<UNavArea> NewAreaClass;
};
static const UE4CodeGen_Private::FClassPropertyParams NewProp_NewAreaClass;
static const UE4CodeGen_Private::FPropertyParamsBase* const PropPointers[];
#if WITH_METADATA
static const UE4CodeGen_Private::FMetaDataPairParam Function_MetaDataParams[];
#endif
static const UE4CodeGen_Private::FFunctionParams FuncParams;
};
const UE4CodeGen_Private::FClassPropertyParams Z_Construct_UFunction_ANavModifierVolume_SetAreaClass_Statics::NewProp_NewAreaClass = { "NewAreaClass", nullptr, (EPropertyFlags)0x0014000000000080, UE4CodeGen_Private::EPropertyGenFlags::Class, RF_Public|RF_Transient|RF_MarkAsNative, 1, STRUCT_OFFSET(NavModifierVolume_eventSetAreaClass_Parms, NewAreaClass), Z_Construct_UClass_UNavArea_NoRegister, Z_Construct_UClass_UClass, METADATA_PARAMS(nullptr, 0) };
const UE4CodeGen_Private::FPropertyParamsBase* const Z_Construct_UFunction_ANavModifierVolume_SetAreaClass_Statics::PropPointers[] = {
(const UE4CodeGen_Private::FPropertyParamsBase*)&Z_Construct_UFunction_ANavModifierVolume_SetAreaClass_Statics::NewProp_NewAreaClass,
};
#if WITH_METADATA
const UE4CodeGen_Private::FMetaDataPairParam Z_Construct_UFunction_ANavModifierVolume_SetAreaClass_Statics::Function_MetaDataParams[] = {
{ "Category", "AI|Navigation" },
{ "CPP_Default_NewAreaClass", "None" },
{ "ModuleRelativePath", "Public/NavModifierVolume.h" },
};
#endif
const UE4CodeGen_Private::FFunctionParams Z_Construct_UFunction_ANavModifierVolume_SetAreaClass_Statics::FuncParams = { (UObject*(*)())Z_Construct_UClass_ANavModifierVolume, nullptr, "SetAreaClass", sizeof(NavModifierVolume_eventSetAreaClass_Parms), Z_Construct_UFunction_ANavModifierVolume_SetAreaClass_Statics::PropPointers, ARRAY_COUNT(Z_Construct_UFunction_ANavModifierVolume_SetAreaClass_Statics::PropPointers), RF_Public|RF_Transient|RF_MarkAsNative, (EFunctionFlags)0x04020401, 0, 0, METADATA_PARAMS(Z_Construct_UFunction_ANavModifierVolume_SetAreaClass_Statics::Function_MetaDataParams, ARRAY_COUNT(Z_Construct_UFunction_ANavModifierVolume_SetAreaClass_Statics::Function_MetaDataParams)) };
UFunction* Z_Construct_UFunction_ANavModifierVolume_SetAreaClass()
{
static UFunction* ReturnFunction = nullptr;
if (!ReturnFunction)
{
UE4CodeGen_Private::ConstructUFunction(ReturnFunction, Z_Construct_UFunction_ANavModifierVolume_SetAreaClass_Statics::FuncParams);
}
return ReturnFunction;
}
UClass* Z_Construct_UClass_ANavModifierVolume_NoRegister()
{
return ANavModifierVolume::StaticClass();
}
struct Z_Construct_UClass_ANavModifierVolume_Statics
{
static UObject* (*const DependentSingletons[])();
static const FClassFunctionLinkInfo FuncInfo[];
#if WITH_METADATA
static const UE4CodeGen_Private::FMetaDataPairParam Class_MetaDataParams[];
#endif
#if WITH_METADATA
static const UE4CodeGen_Private::FMetaDataPairParam NewProp_AreaClass_MetaData[];
#endif
static const UE4CodeGen_Private::FClassPropertyParams NewProp_AreaClass;
static const UE4CodeGen_Private::FPropertyParamsBase* const PropPointers[];
static const UE4CodeGen_Private::FImplementedInterfaceParams InterfaceParams[];
static const FCppClassTypeInfoStatic StaticCppClassTypeInfo;
static const UE4CodeGen_Private::FClassParams ClassParams;
};
UObject* (*const Z_Construct_UClass_ANavModifierVolume_Statics::DependentSingletons[])() = {
(UObject* (*)())Z_Construct_UClass_AVolume,
(UObject* (*)())Z_Construct_UPackage__Script_NavigationSystem,
};
const FClassFunctionLinkInfo Z_Construct_UClass_ANavModifierVolume_Statics::FuncInfo[] = {
{ &Z_Construct_UFunction_ANavModifierVolume_SetAreaClass, "SetAreaClass" }, // 4229470781
};
#if WITH_METADATA
const UE4CodeGen_Private::FMetaDataPairParam Z_Construct_UClass_ANavModifierVolume_Statics::Class_MetaDataParams[] = {
{ "HideCategories", "Navigation Brush Physics Object Display Rendering Physics Input Blueprint" },
{ "IncludePath", "NavModifierVolume.h" },
{ "ModuleRelativePath", "Public/NavModifierVolume.h" },
{ "ObjectInitializerConstructorDeclared", "" },
{ "ShowCategories", "Input|MouseInput Input|TouchInput" },
{ "ToolTip", "Allows applying selected AreaClass to navmesh, using Volume's shape" },
};
#endif
#if WITH_METADATA
const UE4CodeGen_Private::FMetaDataPairParam Z_Construct_UClass_ANavModifierVolume_Statics::NewProp_AreaClass_MetaData[] = {
{ "Category", "Default" },
{ "ModuleRelativePath", "Public/NavModifierVolume.h" },
};
#endif
const UE4CodeGen_Private::FClassPropertyParams Z_Construct_UClass_ANavModifierVolume_Statics::NewProp_AreaClass = { "AreaClass", nullptr, (EPropertyFlags)0x0024080000000015, UE4CodeGen_Private::EPropertyGenFlags::Class, RF_Public|RF_Transient|RF_MarkAsNative, 1, STRUCT_OFFSET(ANavModifierVolume, AreaClass), Z_Construct_UClass_UNavArea_NoRegister, Z_Construct_UClass_UClass, METADATA_PARAMS(Z_Construct_UClass_ANavModifierVolume_Statics::NewProp_AreaClass_MetaData, ARRAY_COUNT(Z_Construct_UClass_ANavModifierVolume_Statics::NewProp_AreaClass_MetaData)) };
const UE4CodeGen_Private::FPropertyParamsBase* const Z_Construct_UClass_ANavModifierVolume_Statics::PropPointers[] = {
(const UE4CodeGen_Private::FPropertyParamsBase*)&Z_Construct_UClass_ANavModifierVolume_Statics::NewProp_AreaClass,
};
const UE4CodeGen_Private::FImplementedInterfaceParams Z_Construct_UClass_ANavModifierVolume_Statics::InterfaceParams[] = {
{ Z_Construct_UClass_UNavRelevantInterface_NoRegister, (int32)VTABLE_OFFSET(ANavModifierVolume, INavRelevantInterface), false },
};
const FCppClassTypeInfoStatic Z_Construct_UClass_ANavModifierVolume_Statics::StaticCppClassTypeInfo = {
TCppClassTypeTraits<ANavModifierVolume>::IsAbstract,
};
const UE4CodeGen_Private::FClassParams Z_Construct_UClass_ANavModifierVolume_Statics::ClassParams = {
&ANavModifierVolume::StaticClass,
nullptr,
&StaticCppClassTypeInfo,
DependentSingletons,
FuncInfo,
Z_Construct_UClass_ANavModifierVolume_Statics::PropPointers,
InterfaceParams,
ARRAY_COUNT(DependentSingletons),
ARRAY_COUNT(FuncInfo),
ARRAY_COUNT(Z_Construct_UClass_ANavModifierVolume_Statics::PropPointers),
ARRAY_COUNT(InterfaceParams),
0x009000A0u,
METADATA_PARAMS(Z_Construct_UClass_ANavModifierVolume_Statics::Class_MetaDataParams, ARRAY_COUNT(Z_Construct_UClass_ANavModifierVolume_Statics::Class_MetaDataParams))
};
UClass* Z_Construct_UClass_ANavModifierVolume()
{
static UClass* OuterClass = nullptr;
if (!OuterClass)
{
UE4CodeGen_Private::ConstructUClass(OuterClass, Z_Construct_UClass_ANavModifierVolume_Statics::ClassParams);
}
return OuterClass;
}
IMPLEMENT_CLASS(ANavModifierVolume, 230976370);
template<> NAVIGATIONSYSTEM_API UClass* StaticClass<ANavModifierVolume>()
{
return ANavModifierVolume::StaticClass();
}
static FCompiledInDefer Z_CompiledInDefer_UClass_ANavModifierVolume(Z_Construct_UClass_ANavModifierVolume, &ANavModifierVolume::StaticClass, TEXT("/Script/NavigationSystem"), TEXT("ANavModifierVolume"), false, nullptr, nullptr, nullptr);
DEFINE_VTABLE_PTR_HELPER_CTOR(ANavModifierVolume);
PRAGMA_ENABLE_DEPRECATION_WARNINGS
#ifdef _MSC_VER
#pragma warning (pop)
#endif
| [
"[email protected]"
] | |
04669c2dae169d1c298abbdfc8712aea782570c2 | 5252563bae16bc43fe455bd2d24416e8916d06d4 | /controller/autobot/autobot.h | b22661b816b0675b6fa8d6fd69613b05e8702f59 | [] | no_license | shantnu-agarwal/core | 03e72fd1ff696d0b7f25fba5cfadce5c343c995b | e835b6d9a19dedaa9e79ca912a5968924d25518c | refs/heads/master | 2020-04-01T10:27:11.597842 | 2018-07-17T05:46:23 | 2018-07-17T05:46:23 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 440 | h | #ifndef __AUTOBOT_H__
#define __AUTOBOT_H__
#include <iostream>
#include <cmath>
#include "../helper/helper.h"
#define ACCURACY 1.5
class Autobot{
private:
double latitude,longitude,difference,distance,bearing;
int Right = 16,Left = 64,Leftdrift = 192,Rightdrift = 144,fwd = 128,stop = 0;
int err = 5,dat = 0, isAuto = 0;
public:
double destlat,destlon;
Autobot();
int update(double heading,Helper H);
};
#endif
| [
"[email protected]"
] | |
4a80f607a33a8d32bacb667f0deacf0c63f9f805 | 98e45aa1ea2adbc961fe5ee0cf87ad71640c3193 | /67 Add Binary.cp | 5227f3d03513cae3b78621bc28e485e8cce70d67 | [] | no_license | Amin747/My-Codes | 991b680241d3de6d946c410e734dc9fd50e2a465 | 76fb69b6dc78f6ff8be4d0f5a34de05fd6e25525 | refs/heads/master | 2020-12-23T13:36:34.762890 | 2020-05-14T23:53:29 | 2020-05-14T23:53:29 | 237,169,337 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,178 | cp | #include <iostream>
#include <string>
#include <vector>
#include <cmath>
using namespace std;
//Given a non-empty array of digits representing a non-negative integer, plus one to the integer.
//
//The digits are stored such that the most significant digit is at the head of the list, and each element in the array contain a single digit.
//
//You may assume the integer does not contain any leading zero, except the number 0 itself.
//
//Example 1:
//
//Input: [1,2,3]
//Output: [1,2,4]
//Explanation: The array represents the integer 123.
//Example 2:
//
//Input: [4,3,2,1]
//Output: [4,3,2,2]
//Explanation: The array represents the integer 4321.
string addBinary(string a, string b){
int alen = a.length()-1;
int blen = b.length()-1;
int anslen =max(alen, blen);
string answer(anslen+1,' ');
int carry = 0;
if (alen > blen){
while (blen!=alen){
b = '0' + b;
blen++;
}
}
if (blen > alen){
while (alen!=blen){
a = '0' + a;
alen ++;
}
}
while (alen >=0 || blen>=0){
if (a[alen]-'0'+b[blen]-'0'+carry==2){
answer[anslen] = '0';
carry = 1;
alen--;
blen--;
anslen--;
continue;
}
if (a[alen]-'0'+b[blen]-'0'+carry==3){
answer[anslen] = '1';
carry = 1;
alen--;
blen--;
anslen--;
continue;
}
if (a[alen]-'0'+b[blen]-'0'+carry==1){
answer[anslen] = '1';
carry = 0;
alen--;
blen--;
anslen--;
continue;
}
if (a[alen]-'0'+b[blen]-'0'+carry==0){
answer[anslen] = '0';
carry = 0;
alen--;
blen--;
anslen--;
continue;
}
}
if (alen==-1 && blen==-1 && carry==1){
answer = '1'+answer;
}
return answer;
}
int main(){
string one = "1010";
string two = "1011";
string answer = addBinary(one, two);
for (int i=0; i<answer.length(); i++){
cout << answer[i] << " ";
}
}
| [
"[email protected]"
] | |
67a675b90bbd11e26da53dd0e76d48a64f1d9da8 | 20c9c11b8400c6605d869c84e69c41c5faa3f260 | /blmarket/2014/Codejam/R1A/D.cc | 06adc918dfa298f4a2812406728abac80e8589b0 | [] | no_license | blmarket/icpc | 312ea2c667ec08d16864c1faa6fe75d3864dedbe | febfc2b758b7a4a4d6e5a6f05d24e3a964a3213a | refs/heads/master | 2021-07-23T20:20:19.780664 | 2021-05-15T13:39:04 | 2021-05-15T13:39:04 | 4,029,598 | 3 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 1,716 | cc | #include <iostream>
#include <vector>
using namespace std;
double prob[2][1024][1024];
int main(void) {
for(int i=0;i<1000;i++) {
prob[0][i][i] = 1.0;
}
for(int i=0;i<1000;i++) {
int cur = (i%2);
int nex = (1-cur);
memset(prob[nex], 0, sizeof(prob[0]));
for(int j=0;j<1000;j++) prob[nex][i][j] = prob[cur][i][j];
for(int j=0;j<1000;j++) if(j != i) {
for(int k=0;k<1000;k++) {
prob[nex][j][k] += prob[cur][j][k] * 0.999 + prob[cur][i][k] * 0.001;
prob[nex][i][k] += prob[cur][j][k] * 0.001 - prob[cur][i][k] * 0.001;
}
}
// for(int j=0;j<1000;j++) for(int k=0;k<1000;k++) prob[nex][j][k] = prob[cur][j][k] * 0.999;
// for(int j=0;j<1000;j++) {
// for(int a=0;a<1000;a++) for(int b=0;b<1000;b++) {
// int na = a;
// if(a == i || a == j) {
// na = (i+j-a);
// }
// prob[nex][na][b] += 0.001 * prob[cur][a][b];
// }
// }
}
for(int i=0;i<1000;i++) {
for(int j=0;j<1000;j++) {
cout << prob[0][i][j] << " ";
}
cout << endl;
}
return 0;
int T;
scanf("%d", &T);
int bc = 0;
for(int i=0;i<T;i++) {
int n;
scanf("%d", &n);
double pp = 1;
for(int j=0;j<n;j++) {
int tmp;
scanf("%d", &tmp);
pp *= prob[0][j][tmp] * 1000;
}
printf("Case #%d: ", i+1);
if(pp > 5.0) {
printf("BAD\n");
bc++;
} else {
printf("GOOD\n");
}
}
cerr << bc << endl;
}
| [
"[email protected]"
] | |
6a97959d170efccf1f83d4d7a61bf39c12e87aa4 | e00fbab8a4edfc4cec3fbeb461bb33275be91c63 | /XMLnew/XmlDocument/XmlDocument.h | af96a089db553a3d75b16c2b3842ebbd8ffd5b31 | [] | no_license | Sushanthkengunte/Project-2 | 3dd368ee01fccc2e53dc243be6ef9901d470b5e0 | 36452da251cf2fabf95ce3dbc6151d3a697ce812 | refs/heads/master | 2021-01-23T01:51:39.348253 | 2017-05-31T02:32:16 | 2017-05-31T02:32:16 | 92,895,593 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 6,334 | h | #ifndef XMLDOCUMENT_H
#define XMLDOCUMENT_H
///////////////////////////////////////////////////////////////////
// XmlDocument.h - a container of XmlElement nodes //
// Ver 2.2 //
// Application: Help for CSE687 Pr#2, Spring 2015 //
// Platform: Dell XPS 2720, Win 8.1 Pro, Visual Studio 2013 //
// Author: Jim Fawcett, CST 4-187, 443-3948 //
// [email protected] //
///////////////////////////////////////////////////////////////////
/*
* Package Operations:
* -------------------
* This package is intended to help students in CSE687 - Object Oriented Design
* get started with Project #2 - XML Document Model. It uses C++11 constructs,
* most noteably std::shared_ptr. The XML Document Model is essentially
* a program-friendly wrapper around an Abstract Syntax Tree (AST) used to
* contain the results of parsing XML markup.
*
* Abstract Syntax Trees, defined in this package, are unordered trees with
* two types of nodes:
* Terminal nodes - nodes with no children
* Non-Terminal nodes - nodes which may have a finite number of children
* They are often used to contain the results of parsing some language.
*
* The elements defined in the companion package, XmlElement, will be used in
* the AST defined in this package. They are:
* AbstractXmlElement - base for all the XML Element types
* DocElement - XML element with children designed to hold prologue, Xml root, and epilogue
* TaggedElement - XML element with tag, attributes, child elements
* TextElement - XML element with only text, no markup
* CommentElement - XML element with comment markup and text
* ProcInstrElement - XML element with markup and attributes but no children
* XmlDeclarElement - XML declaration element with attributes but no children
*
* Required Files:
* ---------------
* - XmlDocument.h, XmlDocument.cpp,
* XmlElement.h, XmlElement.cpp
*
* Build Process:
* --------------
* devenv AST.sln /debug rebuild
*
* Maintenance History:
* --------------------
* ver 2.2 : 01 Jun 2015
* - added building document from XML file using XmlParser in constructor
* - added test to teststub
* ver 2.1 : 07 Mar 2015
* - added an XmlDocument method DFS(...) to implement Depth First Search.
* This isn't really needed, but was added to illustrate the answer to
* a Midterm question.
* ver 2.0 : 04 Mar 2015
* This version can programmatically create, edit, and save an XML document.
* It is not yet able to parse an XML string or file.
* - deleted copy constructor and assignment operator
* - defined move constructor and move assignment
* - defined search methods element, elements, descendents, select, find
* - defined access methods docElement() and xmlRoot()
* - defined toString()
* ver 1.2 : 21 Feb 2015
* - modified these comments
* ver 1.1 : 14 Feb 2015
* - minor changes to comments, method arguments
* Ver 1.0 : 11 Feb 2015
* - first release
*
* ToDo:
* -----
* This is the beginning of an XmlDocument class for Project #2.
* It lays out a suggested design, which you are not compelled to follow.
* If it helps then use it. If not you don't have to.
*
* Note that I've simply roughed in a design that is similar to that
* used in the .Net Framework XDocument class.
*/
#include <memory>
#include <string>
#include "../XmlElement/XmlElement.h"
namespace XmlProcessing
{
///////////////////////////////////////////////////////////////////////////
// XmlDocument class
class XmlDocument
{
public:
using sPtr = std::shared_ptr < AbstractXmlElement > ;
enum sourceType { file, str };
// construction and assignment
XmlDocument(sPtr pRoot = nullptr) : pDocElement_(pRoot) {}
XmlDocument(const std::string& src, sourceType srcType=str);
XmlDocument(const XmlDocument& doc) = delete;
XmlDocument(XmlDocument&& doc);
XmlDocument& operator=(const XmlDocument& doc) = delete;
XmlDocument& operator=(XmlDocument&& doc);
// access to docElement and XML root
std::shared_ptr<AbstractXmlElement>& docElement() { return pDocElement_; }
std::shared_ptr<AbstractXmlElement> xmlRoot();
bool xmlRoot(sPtr pRoot);
// queries return XmlDocument references so they can be chained, e.g., doc.element("foobar").descendents();
XmlDocument& element(const std::string& tag); // found_[0] contains first element (DFS order) with tag
XmlDocument& elements(const std::string& tag); // found_ contains all children of first element with tag
XmlDocument& descendents(const std::string& tag = ""); // found_ contains descendents of prior found_[0]
std::vector<sPtr> select(); // returns found_. Uses std::move(found_) to clear found_
bool find(const std::string& tag, sPtr pElem, bool findall = true);
size_t size();
std::string toString();
template<typename CallObj>
void DFS(sPtr pElem, CallObj& co);
private:
sPtr pDocElement_; // AST that holds procInstr, comments, XML root, and more comments
std::vector<sPtr> found_; // query results
};
//----< search subtree of XmlDocument >------------------------------------
template<typename CallObj>
void XmlDocument::DFS(sPtr pElem, CallObj& co)
{
co(*pElem);
for (auto pChild : pElem->children())
DFS(pChild, co);
}
///////////////////////////////////////////////////////////////////////////
// Global Functions for Depth First Search
//
// These functions take a callable object to define processing on each
// element encountered on search traversal. They may be functions,
// functors, or lambdas - see XmlDocument.cpp for examples.
//----< search subtree of XmlDocument >------------------------------------
template<typename CallObj>
void DFS(XmlDocument::sPtr pElem, CallObj& co)
{
using sPtr = XmlDocument::sPtr;
co(*pElem);
for (auto pChild : pElem->children())
DFS(pChild, co);
}
//----< search entire XmlDocument >----------------------------------------
template<typename CallObj>
void DFS(XmlDocument& doc, CallObj& co)
{
using sPtr = XmlDocument::sPtr;
sPtr pDocElem = doc.docElement();
DFS(pDocElem, co);
}
}
#endif
| [
"[email protected]"
] | |
f221cb1881e2f892a884b5019880ba4dd153784f | 4a49b92106830b269ab1331061611bdb6dfd5a0a | /src/series.h | 72974680f5e6df25ddce40003a00c8d6dbaa8e77 | [] | no_license | heavenchou/CBReader | 1e5a8a9f2e01b95da88f48cbe17b5a409b0cf097 | 590d73051ebd16cb9423c8b1bfd499f59beead47 | refs/heads/master | 2022-05-04T05:14:09.320858 | 2021-04-18T19:38:26 | 2021-04-18T19:38:26 | 83,400,590 | 2 | 1 | null | null | null | null | BIG5 | C++ | false | false | 2,474 | h | // ---------------------------------------------------------------------------
#ifndef SeriesH
#define SeriesH
#ifdef _Windows
#include <Xml.Win.msxmldom.hpp>
#else
#include <Xml.omnixmldom.hpp>
#endif
#include <Xml.XMLDoc.hpp>
#include <fmx.h>
#include "catalog.h"
#include "spine.h"
#include "bookdata.h"
#include "juanline.h"
#include <utility> // for std::pair
#include "../../Monster/src/monster.h"
// ---------------------------------------------------------------------------
class CSeries
{
private: // User declarations
public: // User declarations
String Dir; // 本書的目錄
String ID; // ID 代碼, CBETA 的指定為 CBEAT
String Title; // 標題
String Creator; // 作者
String PublishDate; // 出版日期
String NavFile; // 導覽文件
String Nav2File; // 導覽文件 (CBETA 特有的, 未來再考慮如何處理多目錄)
String Nav3File; // 導覽文件 (CBETA 特有的, 未來再考慮如何處理多目錄)
String CatalogFile; // 目錄文件
String SpineFile; // 遍歷文件
String BookDataFile; // BookData 文件
String JSFile; // CBReader 專用的 js 檔
String Version; // 版本
CCatalog * Catalog; // 目錄
CSpine * Spine; // 遍歷文件
CJuanLine * JuanLine; // 各卷與頁欄行的關係物件, CBETA 專用
CBookData * BookData; // 每本書的資訊, 例如 T , 大正藏, 2
TmyMonster * SearchEngine_orig; // 原書全文檢索引擎
TmyMonster * SearchEngine_CB; // CB 版全文檢索引擎
void __fastcall LoadMetaData(String sMeta); // 載入後設文件
// 由經卷去找經文, Vol 可以是空的, 但有跨冊的經文就要指定
String __fastcall CBGetFileNameBySutraNumJuan(String sBookID, String sVol, String sSutraNum, String sJuan = "", String sPage = "", String sField = "", String sLine = "");
// 由冊頁欄行找經文
String __fastcall CBGetFileNameByVolPageFieldLine(String sBook, String sVol = "", String sPage = "", String sField = "", String sLine = "");
// 由頁欄行取得標準 0001a01 格式的字串
String __fastcall CBGetPageLine(String sPage, String sField, String sLine);
// 載入全文檢索引擎
void __fastcall LoadSearchEngine();
// 釋放全文檢索引擎
void __fastcall FreeSearchEngine();
__fastcall CSeries(String sDir); // 傳入目錄, 進行初值化
__fastcall ~CSeries();
};
// ---------------------------------------------------------------------------
#endif
| [
"[email protected]"
] | |
6b255903573b568c6a2d48f1703d977e15c2e7ce | 5ca725fa93f69be671866e7b57f8be1df3eecf3a | /code/editor/qt/qgleswidget.h | 0da78e7383cec6351b66ad1135ca79fb674d44f3 | [
"MIT"
] | permissive | PureDu/potato | 9544577fcdb756f9c7516d4e776eb1c0b2305e5a | aa574be8262f98099b9b657e03f175bb98df78f2 | refs/heads/master | 2021-05-29T17:10:51.566955 | 2015-01-10T01:15:36 | 2015-01-10T01:15:36 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,965 | h | #pragma once
#include "input.h"
#include <QtOpenGL/QGLWidget>
#include <QtCore/QBasicTimer>
#if defined(CXX_GNU)
#include <EGL/egl.h>
#elif defined(CXX_MSVC)
#include <Windows.h>
#endif
namespace c4g {
namespace core {
class IRender;
}
namespace scene {
class ISceneImpl;
}
namespace qt {
class QGLESFormat : public QGLFormat
{
public:
static QGLESFormat instance;
private:
QGLESFormat();
virtual ~QGLESFormat();
public:
};
class QGLESWidget;
class QGLESContext : public QGLContext
{
public:
explicit QGLESContext(QGLESWidget* widget);
virtual ~QGLESContext();
public:
virtual bool create(const QGLContext* shareContext = 0);
protected:
virtual bool chooseContext(const QGLContext* shareContext = 0);
public:
virtual void makeCurrent();
virtual void doneCurrent();
virtual void swapBuffers() const;
private:
QGLESWidget* m_pWidget;
#if defined(CXX_GNU)
EGLConfig m_pGLConfig;
EGLDisplay m_pGLDisplay;
EGLContext m_pGLContext;
EGLSurface m_pGLSurface;
#elif defined(CXX_MSVC)
HGLRC m_pRC;
HDC m_pDC;
#endif
};
class QGLESWidget : public QGLWidget
{
Q_OBJECT
public:
QGLESWidget(QWidget* pParent = NULL);
virtual ~QGLESWidget();
public:
void Initialize(core::MString2Module& rmModule);
public Q_SLOTS:
void ToLoadScene(QString sScenePath);
Q_SIGNALS:
void DidLoadScene(c4g::scene::ISceneImpl*const pScene);
protected:
void mousePressEvent(QMouseEvent *e);
void mouseReleaseEvent(QMouseEvent *e);
void timerEvent(QTimerEvent *e);
protected:
void initializeGL();
void resizeGL(int w, int h);
void paintGL();
private:
c4g::core::IRender* m_pRender;
c4g::scene::ISceneImpl* m_pScene;
QBasicTimer timer;
float m_fWidth;
float m_fHeight;
display::CInput m_oInput;
#if defined(CXX_GNU)
timeval time;
#elif defined(CXX_MSVC)
SYSTEMTIME time;
#endif
double second;
double second_temp;
double second_delta;
double second_sleep;
double second_per_frame_min;
};
}
}
| [
"[email protected]"
] | |
675591a86efbf8394e529e2b2407f5b2f4334ed9 | 8ce4ed0f23fc861e024ed66a4cd3328d032df00f | /TanksTutorial/Source/TanksTutorial/Public/TankTracks.h | 282311e83f6680359e9f70ce40cc2395673895cf | [] | no_license | PlasmaSnake/TanksTutorial | d22aea5f5820c30b6cc5001a71bebc557932bf58 | 54dd0136bb7edb1418dfcbcb7a830b9ff3389db9 | refs/heads/master | 2021-09-16T12:32:11.095614 | 2018-06-20T16:30:09 | 2018-06-20T16:30:09 | 114,600,950 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 886 | h | // Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "CoreMinimal.h"
#include "Components/StaticMeshComponent.h"
#include "TankTracks.generated.h"
/**
*
*/
UCLASS(meta = (BluePrintSpawnableComponent))
class TANKSTUTORIAL_API UTankTracks : public UStaticMeshComponent
{
GENERATED_BODY()
public:
UFUNCTION(BlueprintCallable, Category = "Input")
void SetThrottle(float Throttle);
//Max Track Force in Newtons
UPROPERTY(EditDefaultsOnly)
float TrackMaxDrivingForce = 400000; // Assume 40 Ton Tank + 1g ton accel
private:
UTankTracks();
virtual void BeginPlay() override;
void ApplySidewaysForce();
UFUNCTION()
void OnHit(UPrimitiveComponent* HitComponent, AActor* OtherActor, UPrimitiveComponent* OtherComponent, FVector NormalImpulse, const FHitResult& Hit);
void DriveTracks();
float CurrentThrottle = 0;
};
| [
"[email protected]"
] | |
2f763ca1aa29b91cdf67e0c907fcf6af1f8d9da2 | d3e50a16ce55c6a322533d5f5e1b68f99d961d19 | /cpp/oo/3.4-Observer/Observer.h | 40d9f0aa91240a22676e160e95a95ad2512657bf | [] | no_license | monkeyde17/et-notes | 0f2e88fd18c50a770fef7c807f64caaddf329d7e | 8e9cfa016efa9f08a234e91c523aa498574e3fe5 | refs/heads/master | 2021-01-20T03:39:20.955149 | 2015-03-16T12:45:59 | 2015-03-16T12:45:59 | 20,673,513 | 1 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 750 | h | #ifndef _OBSERVER_H_
#define _OBSERVER_H_
#include "Subject.h"
#include <string>
using namespace std;
typedef string State;
class Observer
{
public:
virtual ~Observer();
virtual void Update(Subject *sub) = 0;
virtual void PrintInfo() = 0;
protected:
Observer();
State _st;
};
class ConcreteObserverA : public Observer
{
public:
virtual Subject* GetSubject();
ConcreteObserverA(Subject *sub);
virtual ~ConcreteObserverA();
void Update(Subject *sub);
void PrintInfo();
private:
Subject *_sub;
};
class ConcreteObserverB : public Observer
{
public:
virtual Subject* GetSubject();
ConcreteObserverB(Subject *sub);
virtual ~ConcreteObserverB();
void Update(Subject *sub);
void PrintInfo();
private:
Subject *_sub;
};
#endif
| [
"[email protected]"
] | |
83bb4efdcb27e64d45083aa20b1353fbf0f3525e | 603cb2bd2a1098ad60bf3b7f3ee1e81d7a7ffb58 | /src/Config.h | bf17cc08ba29fe80893c6508e8d313b4d339184e | [] | no_license | ajorians/nHitori | d564cd215dacd7428a53ef5747f568870286fe6f | 1de81e0bb32a3f2551ce156723e09d29dfaa96a2 | refs/heads/master | 2016-09-06T12:07:47.495363 | 2016-01-26T21:23:33 | 2016-01-26T21:23:33 | 22,314,044 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 524 | h | #ifndef CONFIG_H
#define CONFIG_H
extern "C"
{
#include <os.h>
#include "ArchiveLib/ArchiveLib.h"
}
class Config
{
public:
Config();
~Config();
bool GetSolutionHelper() const;
void SetSolutionHelper(bool bEnable);
bool GetSelectorMovementAnimate() const;
void SetSelectorMovementAnimate(bool bEnable);
bool BeatLevel(int nLevelNumber) const;
void SetBeatLevel(int nLevelNumber);
protected:
ArchiveLib m_Archive;
bool m_bSolutionHelper;
bool m_bSelectorMovementAnimate;
};
#endif
| [
"[email protected]"
] | |
5dfc8bad2bc9ae87c1dec8d27b296f25800c7978 | 81c959f7894efc60a2747bf5136429d914b92f96 | /ui/views/mus/views_mus_test_suite.cc | cf479177218cebe7e13b9d49b05600e5982d7ee6 | [
"BSD-3-Clause"
] | permissive | emilio/chromium | 89f175c679c63e9e2b11e23c0764b02851235cfe | ab3d36b33fb3412d562033d68c716ddae6e4c3bd | refs/heads/master | 2023-03-10T04:49:52.623535 | 2017-03-10T02:57:25 | 2017-03-10T02:57:25 | 84,578,466 | 2 | 0 | null | 2017-03-10T16:21:05 | 2017-03-10T16:21:05 | null | UTF-8 | C++ | false | false | 9,826 | cc | // Copyright 2016 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "ui/views/mus/views_mus_test_suite.h"
#include <memory>
#include <string>
#include "base/command_line.h"
#include "base/files/file_path.h"
#include "base/memory/ptr_util.h"
#include "base/run_loop.h"
#include "base/synchronization/waitable_event.h"
#include "base/threading/simple_thread.h"
#include "base/threading/thread.h"
#include "mojo/edk/embedder/embedder.h"
#include "mojo/edk/embedder/scoped_ipc_support.h"
#include "services/catalog/catalog.h"
#include "services/service_manager/background/background_service_manager.h"
#include "services/service_manager/public/cpp/connector.h"
#include "services/service_manager/public/cpp/service.h"
#include "services/service_manager/public/cpp/service_context.h"
#include "services/ui/common/switches.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "ui/aura/mus/window_tree_host_mus.h"
#include "ui/aura/test/env_test_helper.h"
#include "ui/aura/test/mus/input_method_mus_test_api.h"
#include "ui/aura/window.h"
#include "ui/gl/gl_switches.h"
#include "ui/views/mus/desktop_window_tree_host_mus.h"
#include "ui/views/mus/mus_client.h"
#include "ui/views/mus/test_utils.h"
#include "ui/views/test/platform_test_helper.h"
#include "ui/views/test/views_test_helper_aura.h"
#include "ui/views/views_delegate.h"
#include "ui/views/widget/desktop_aura/desktop_native_widget_aura.h"
namespace views {
namespace {
const base::FilePath::CharType kCatalogFilename[] =
FILE_PATH_LITERAL("views_mus_tests_catalog.json");
void EnsureCommandLineSwitch(const std::string& name) {
base::CommandLine* cmd_line = base::CommandLine::ForCurrentProcess();
if (!cmd_line->HasSwitch(name))
cmd_line->AppendSwitch(name);
}
class DefaultService : public service_manager::Service {
public:
DefaultService() {}
~DefaultService() override {}
// service_manager::Service:
bool OnConnect(const service_manager::ServiceInfo& remote_info,
service_manager::InterfaceRegistry* registry) override {
return false;
}
private:
DISALLOW_COPY_AND_ASSIGN(DefaultService);
};
class PlatformTestHelperMus : public PlatformTestHelper {
public:
PlatformTestHelperMus(service_manager::Connector* connector,
const service_manager::Identity& identity) {
aura::test::EnvTestHelper().SetWindowTreeClient(nullptr);
// It is necessary to recreate the MusClient for each test,
// since a new MessageLoop is created for each test.
mus_client_ = test::MusClientTestApi::Create(connector, identity);
ViewsDelegate::GetInstance()->set_native_widget_factory(base::Bind(
&PlatformTestHelperMus::CreateNativeWidget, base::Unretained(this)));
}
~PlatformTestHelperMus() override {
aura::test::EnvTestHelper().SetWindowTreeClient(nullptr);
}
// PlatformTestHelper:
void OnTestHelperCreated(ViewsTestHelper* helper) override {
static_cast<ViewsTestHelperAura*>(helper)->EnableMusWithWindowTreeClient(
mus_client_->window_tree_client());
}
void SimulateNativeDestroy(Widget* widget) override {
aura::WindowTreeHostMus* window_tree_host =
static_cast<aura::WindowTreeHostMus*>(
widget->GetNativeView()->GetHost());
static_cast<aura::WindowTreeClientDelegate*>(mus_client_.get())
->OnEmbedRootDestroyed(window_tree_host);
}
private:
NativeWidget* CreateNativeWidget(const Widget::InitParams& init_params,
internal::NativeWidgetDelegate* delegate) {
NativeWidget* native_widget =
mus_client_->CreateNativeWidget(init_params, delegate);
if (!native_widget)
return nullptr;
// Disable sending KeyEvents to IME as tests aren't set up to wait for an
// ack (and tests run concurrently).
aura::WindowTreeHostMus* window_tree_host_mus =
static_cast<aura::WindowTreeHostMus*>(
static_cast<DesktopNativeWidgetAura*>(native_widget)->host());
aura::InputMethodMusTestApi::Disable(window_tree_host_mus->input_method());
return native_widget;
}
std::unique_ptr<MusClient> mus_client_;
DISALLOW_COPY_AND_ASSIGN(PlatformTestHelperMus);
};
std::unique_ptr<PlatformTestHelper> CreatePlatformTestHelper(
const service_manager::Identity& identity,
const base::Callback<service_manager::Connector*(void)>& callback) {
return base::MakeUnique<PlatformTestHelperMus>(callback.Run(), identity);
}
} // namespace
class ServiceManagerConnection {
public:
ServiceManagerConnection()
: thread_("Persistent service_manager connections"),
ipc_thread_("IPC thread") {
catalog::Catalog::LoadDefaultCatalogManifest(
base::FilePath(kCatalogFilename));
mojo::edk::Init();
ipc_thread_.StartWithOptions(
base::Thread::Options(base::MessageLoop::TYPE_IO, 0));
ipc_support_ = base::MakeUnique<mojo::edk::ScopedIPCSupport>(
ipc_thread_.task_runner(),
mojo::edk::ScopedIPCSupport::ShutdownPolicy::CLEAN);
base::WaitableEvent wait(base::WaitableEvent::ResetPolicy::AUTOMATIC,
base::WaitableEvent::InitialState::NOT_SIGNALED);
base::Thread::Options options;
thread_.StartWithOptions(options);
thread_.task_runner()->PostTask(
FROM_HERE, base::Bind(&ServiceManagerConnection::SetUpConnections,
base::Unretained(this), &wait));
wait.Wait();
// WindowManagerConnection cannot be created from here yet, although the
// connector and identity are available at this point. This is because
// WindowManagerConnection needs a ViewsDelegate and a MessageLoop to have
// been installed first. So delay the creation until the necessary
// dependencies have been met.
PlatformTestHelper::set_factory(
base::Bind(&CreatePlatformTestHelper, service_manager_identity_,
base::Bind(&ServiceManagerConnection::GetConnector,
base::Unretained(this))));
}
~ServiceManagerConnection() {
base::WaitableEvent wait(base::WaitableEvent::ResetPolicy::AUTOMATIC,
base::WaitableEvent::InitialState::NOT_SIGNALED);
thread_.task_runner()->PostTask(
FROM_HERE, base::Bind(&ServiceManagerConnection::TearDownConnections,
base::Unretained(this), &wait));
wait.Wait();
}
private:
service_manager::Connector* GetConnector() {
service_manager_connector_.reset();
base::WaitableEvent wait(base::WaitableEvent::ResetPolicy::AUTOMATIC,
base::WaitableEvent::InitialState::NOT_SIGNALED);
thread_.task_runner()->PostTask(
FROM_HERE, base::Bind(&ServiceManagerConnection::CloneConnector,
base::Unretained(this), &wait));
wait.Wait();
DCHECK(service_manager_connector_);
return service_manager_connector_.get();
}
void CloneConnector(base::WaitableEvent* wait) {
service_manager_connector_ = context_->connector()->Clone();
wait->Signal();
}
void SetUpConnections(base::WaitableEvent* wait) {
background_service_manager_ =
base::MakeUnique<service_manager::BackgroundServiceManager>(
nullptr, nullptr);
service_manager::mojom::ServicePtr service;
context_ = base::MakeUnique<service_manager::ServiceContext>(
base::MakeUnique<DefaultService>(),
service_manager::mojom::ServiceRequest(&service));
background_service_manager_->RegisterService(
service_manager::Identity(
GetTestName(), service_manager::mojom::kRootUserID),
std::move(service), nullptr);
// ui/views/mus requires a WindowManager running, so launch test_wm.
service_manager::Connector* connector = context_->connector();
connector->Connect("test_wm");
service_manager_connector_ = connector->Clone();
service_manager_identity_ = context_->identity();
wait->Signal();
}
void TearDownConnections(base::WaitableEvent* wait) {
context_.reset();
wait->Signal();
}
// Returns the name of the test executable, e.g.
// "views_mus_unittests".
std::string GetTestName() {
base::FilePath executable = base::CommandLine::ForCurrentProcess()
->GetProgram()
.BaseName()
.RemoveExtension();
return std::string("") + executable.MaybeAsASCII();
}
base::Thread thread_;
base::Thread ipc_thread_;
std::unique_ptr<mojo::edk::ScopedIPCSupport> ipc_support_;
std::unique_ptr<service_manager::BackgroundServiceManager>
background_service_manager_;
std::unique_ptr<service_manager::ServiceContext> context_;
std::unique_ptr<service_manager::Connector> service_manager_connector_;
service_manager::Identity service_manager_identity_;
DISALLOW_COPY_AND_ASSIGN(ServiceManagerConnection);
};
ViewsMusTestSuite::ViewsMusTestSuite(int argc, char** argv)
: ViewsTestSuite(argc, argv) {}
ViewsMusTestSuite::~ViewsMusTestSuite() {}
void ViewsMusTestSuite::Initialize() {
PlatformTestHelper::SetIsMus();
// Let other services know that we're running in tests. Do this with a
// command line flag to avoid making blocking calls to other processes for
// setup for tests (e.g. to unlock the screen in the window manager).
EnsureCommandLineSwitch(ui::switches::kUseTestConfig);
EnsureCommandLineSwitch(switches::kOverrideUseSoftwareGLForTests);
ViewsTestSuite::Initialize();
service_manager_connections_ = base::MakeUnique<ServiceManagerConnection>();
}
void ViewsMusTestSuite::Shutdown() {
service_manager_connections_.reset();
ViewsTestSuite::Shutdown();
}
} // namespace views
| [
"[email protected]"
] | |
9505a5d810920755bd43e31eb61eb7918ecd7b51 | c3f715589f5d83e3ba92baaa309414eb253ca962 | /C++/round-5/0801-0900/0861-0880/0876.h | f454f30ea46b4c66f774c87d53130b4f3457f551 | [] | no_license | kophy/Leetcode | 4b22272de78c213c4ad42c488df6cffa3b8ba785 | 7763dc71fd2f34b28d5e006a1824ca7157cec224 | refs/heads/master | 2021-06-11T05:06:41.144210 | 2021-03-09T08:25:15 | 2021-03-09T08:25:15 | 62,117,739 | 13 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 407 | h | /**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* ListNode *next;
* ListNode(int x) : val(x), next(NULL) {}
* };
*/
class Solution {
public:
ListNode *middleNode(ListNode *head) {
ListNode *slow = head, *fast = head;
while (fast != nullptr && fast->next != nullptr) {
slow = slow->next;
fast = fast->next->next;
}
return slow;
}
};
| [
"[email protected]"
] | |
99e723cf7ca17804ec91d42cf6b889cee29ed78f | b3710dfdd0eeb3e28d3a4c666af5df6558a03553 | /cgodeps/godot_engine/core/math/math_funcs.cpp | 1585c96b3887bc3b905bf87ea83b1aadb02155f4 | [
"MIT",
"CC-BY-3.0",
"CC-BY-4.0",
"LicenseRef-scancode-free-unknown",
"OFL-1.1",
"BSD-3-Clause",
"Bitstream-Vera",
"FTL",
"MPL-2.0",
"Zlib",
"LicenseRef-scancode-nvidia-2002",
"BSL-1.0",
"Apache-2.0",
"LicenseRef-scancode-public-domain",
"BSD-2-Clause"
] | permissive | gabstv/godot-go | 5befd7539ef35a9e459046644dd4b246a0db1ad9 | e0e7f07e1e44716e18330f063c9b3fd3c2468d31 | refs/heads/master | 2021-05-21T23:48:25.434825 | 2020-08-27T16:52:18 | 2020-08-27T16:52:18 | 252,864,512 | 10 | 3 | MIT | 2020-08-27T16:52:20 | 2020-04-03T23:26:52 | C++ | UTF-8 | C++ | false | false | 5,028 | cpp | /*************************************************************************/
/* math_funcs.cpp */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
/* "Software"), to deal in the Software without restriction, including */
/* without limitation the rights to use, copy, modify, merge, publish, */
/* distribute, sublicense, and/or sell copies of the Software, and to */
/* permit persons to whom the Software is furnished to do so, subject to */
/* the following conditions: */
/* */
/* The above copyright notice and this permission notice shall be */
/* included in all copies or substantial portions of the Software. */
/* */
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#include "math_funcs.h"
#include "core/error_macros.h"
RandomPCG Math::default_rand(RandomPCG::DEFAULT_SEED, RandomPCG::DEFAULT_INC);
#define PHI 0x9e3779b9
uint32_t Math::rand_from_seed(uint64_t *seed) {
RandomPCG rng = RandomPCG(*seed, RandomPCG::DEFAULT_INC);
uint32_t r = rng.rand();
*seed = rng.get_seed();
return r;
}
void Math::seed(uint64_t x) {
default_rand.seed(x);
}
void Math::randomize() {
default_rand.randomize();
}
uint32_t Math::rand() {
return default_rand.rand();
}
int Math::step_decimals(double p_step) {
static const int maxn = 10;
static const double sd[maxn] = {
0.9999, // somehow compensate for floating point error
0.09999,
0.009999,
0.0009999,
0.00009999,
0.000009999,
0.0000009999,
0.00000009999,
0.000000009999,
0.0000000009999
};
double abs = Math::abs(p_step);
double decs = abs - (int)abs; // Strip away integer part
for (int i = 0; i < maxn; i++) {
if (decs >= sd[i]) {
return i;
}
}
return 0;
}
// Only meant for editor usage in float ranges, where a step of 0
// means that decimal digits should not be limited in String::num.
int Math::range_step_decimals(double p_step) {
if (p_step < 0.0000000000001) {
return 16; // Max value hardcoded in String::num
}
return step_decimals(p_step);
}
double Math::dectime(double p_value, double p_amount, double p_step) {
double sgn = p_value < 0 ? -1.0 : 1.0;
double val = Math::abs(p_value);
val -= p_amount * p_step;
if (val < 0.0) {
val = 0.0;
}
return val * sgn;
}
double Math::ease(double p_x, double p_c) {
if (p_x < 0) {
p_x = 0;
} else if (p_x > 1.0) {
p_x = 1.0;
}
if (p_c > 0) {
if (p_c < 1.0) {
return 1.0 - Math::pow(1.0 - p_x, 1.0 / p_c);
} else {
return Math::pow(p_x, p_c);
}
} else if (p_c < 0) {
//inout ease
if (p_x < 0.5) {
return Math::pow(p_x * 2.0, -p_c) * 0.5;
} else {
return (1.0 - Math::pow(1.0 - (p_x - 0.5) * 2.0, -p_c)) * 0.5 + 0.5;
}
} else {
return 0; // no ease (raw)
}
}
double Math::stepify(double p_value, double p_step) {
if (p_step != 0) {
p_value = Math::floor(p_value / p_step + 0.5) * p_step;
}
return p_value;
}
uint32_t Math::larger_prime(uint32_t p_val) {
static const uint32_t primes[] = {
5,
13,
23,
47,
97,
193,
389,
769,
1543,
3079,
6151,
12289,
24593,
49157,
98317,
196613,
393241,
786433,
1572869,
3145739,
6291469,
12582917,
25165843,
50331653,
100663319,
201326611,
402653189,
805306457,
1610612741,
0,
};
int idx = 0;
while (true) {
ERR_FAIL_COND_V(primes[idx] == 0, 0);
if (primes[idx] > p_val) {
return primes[idx];
}
idx++;
}
}
double Math::random(double from, double to) {
return default_rand.random(from, to);
}
float Math::random(float from, float to) {
return default_rand.random(from, to);
}
| [
"[email protected]"
] | |
b029d0540c5309446c2c38688cd6ac5710a0f1c9 | e68c1f9134b44ddea144f7efa7523076f3f12d3a | /FinalCode/Monk_Male_DW_SS_DebilitatingBlows_03_2.cpp | c26c1a13ac6e49fb6a87d5471ebf647ccae90297 | [] | no_license | iso5930/Direct-3D-Team-Portfolio | 4ac710ede0c9176702595cba5579af42887611cf | 84e64eb4e91c7e5b4aed77212cd08cfee038fcd3 | refs/heads/master | 2021-08-23T08:15:00.128591 | 2017-12-04T06:14:39 | 2017-12-04T06:14:39 | 112,998,717 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 707 | cpp | #include "StdAfx.h"
#include "Monk_Male_DW_SS_DebilitatingBlows_03_2.h"
CMonk_Male_DW_SS_DebilitatingBlows_03_2::CMonk_Male_DW_SS_DebilitatingBlows_03_2(void)
{
m_eStateType = STATE_TYPE_MONK_MALE_DW_SS_DEBILITATINGBLOWS_03_2;
}
CMonk_Male_DW_SS_DebilitatingBlows_03_2::~CMonk_Male_DW_SS_DebilitatingBlows_03_2(void)
{
}
void CMonk_Male_DW_SS_DebilitatingBlows_03_2::Initialize()
{
CPlayerState::Initialize();
// SetAnimation
m_pOwner->SetAnimation(67);
// Clear
m_pPathFindCom->Clear();
}
CPlayerState* CMonk_Male_DW_SS_DebilitatingBlows_03_2::Action()
{
if(m_pAnimController->m_dFrameTime - 0.25 <= m_pAnimController->GetTrackPos())
{
return new CMonk_Male_DW_SS_Idle;
}
return NULL;
}
| [
"[email protected]"
] | |
8f167fe7e7999a7b096e15e039138b574362ff4c | 17e06748f1ee759b619ceb2339ca34ac6a560f9e | /Src/DemoEngine/SoundServer.cpp | 9494090e40b3c61af4529fc7d5726bbd779530f9 | [] | no_license | Fincodr/SDL_Course | b5040cd94436f3fcfdb74f4c92ce0752a17c7fd7 | e9aa60d3c1213186da8ff3042d90b275ab06a97c | refs/heads/master | 2021-01-25T07:19:27.297184 | 2012-08-30T03:06:57 | 2012-08-30T03:06:57 | 5,597,035 | 2 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,368 | cpp | /*
* _/_/_/_/ _/ _/
* _/ _/_/_/ _/_/_/ _/_/ _/_/_/ _/ _/_/
* _/_/_/ _/ _/ _/ _/ _/ _/ _/ _/ _/_/
* _/ _/ _/ _/ _/ _/ _/ _/ _/ _/
* _/ _/ _/ _/ _/_/_/ _/_/ _/_/_/ _/
*
* Copyright (c) 2012 Mika Luoma-aho <[email protected]>
*
* This source code and software is provided 'as-is', without any express or implied warranty.
* In no event will the authors be held liable for any damages arising from the use of this source code or software.
*
* Permission is granted to anyone to use this software (and the source code when its released from the author)
* as a learning point to create games, including commercial applications.
*
* You are however subject to the following restrictions:
*
* 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software.
* If you use this software's source code in a product,
* an acknowledgment in the product documentation would be appreciated but is not required.
* 2. Altered versions must be plainly marked as such, and must not be misrepresented as being the original software.
* 3. This notice may not be removed or altered from any distribution.
*
*/
#include "SoundServer.hpp"
namespace DemoEngine {
}
| [
"[email protected]"
] | |
d3af8fc00e3a028544c0f7eb072adbbe2d467d78 | ef3c869fcf4aa1c89715660726bdfdabc828d36e | /dwooglib/OImageProcess.cpp | a26ce392ce11dc4ee1d88d73106fedbfac039a29 | [
"BSD-2-Clause"
] | permissive | T-Nosaka/DWOOSizer | 0dc6bfd7ab46be28f6e109f66dfd476107b4068b | 10b92d9db8e1f68ee20a98018e91919ea736732e | refs/heads/main | 2023-05-08T03:57:03.328454 | 2021-06-06T06:18:33 | 2021-06-06T06:18:33 | 374,280,322 | 0 | 0 | null | null | null | null | SHIFT_JIS | C++ | false | false | 9,421 | cpp | /*++
画像処理基底
--*/
#include <windows.h>
#include "OImageProcess.h"
OImageProcess::OImageProcess()
{
Init();
}
OImageProcess::~OImageProcess()
{
ListDelete();
}
OImageProcess::OImageProcess( const OImageProcess& target )
{
Init();
*this = target;
}
void OImageProcess::Init()
{
m_TopX = 0;
m_TopY = 0;
m_ulHorzRes = 0;
m_ulVertRes = 0;
}
void OImageProcess::ListDelete()
{
//画像プレーン削除
for( auto it = m_planelist.begin(); it!=m_planelist.end(); it++ )
{
if ( *it != NULL )
{
delete *it ;
*it = NULL;
}
}
m_planelist.clear();
}
void OImageProcess::ListCopy( PLANELIST& destList )
{
//画像プレーン複製
for( auto it = destList.begin(); it!=destList.end(); it++ )
{
if ( *it != NULL )
{
OPlaneLeaf* pInstance = (*it)->Instance();
*pInstance = *(*it);
m_planelist.push_back( pInstance );
}
}
}
OPlaneLeaf* OImageProcess::GetPlane( std::string name )
{
OPlaneLeaf* rtnObj = NULL;
//画像プレーン取得
for( auto it = m_planelist.begin(); it!=m_planelist.end(); it++ )
{
if ( *it != NULL )
{
if ( (*it)->LeafName() == name )
return *it ;
}
}
return NULL;
}
void OImageProcess::RemovePlane( std::string name, bool bDestroy )
{
//画像プレーン削除
do
{
auto bFind = false;
for (auto it = m_planelist.begin(); it != m_planelist.end() && m_planelist.size() > 0; it++)
{
if (*it != NULL)
{
if ((*it)->LeafName() == name)
{
if(bDestroy == true )
delete *it;
m_planelist.erase(it);
bFind = true;
break;
}
}
}
if (bFind == false)
break;
} while (true);
}
void OImageProcess::operator=( const OImageProcess& target )
{
m_TopX = target.m_TopX;
m_TopY = target.m_TopY;
m_ulHorzRes = target.m_ulHorzRes;
m_ulVertRes = target.m_ulVertRes;
//自身のプレーンを破棄
ListDelete();
//プレーンコピー
ListCopy( ((OImageProcess&)target).m_planelist );
}
OImageProcess* OImageProcess::operator +( const OImageProcess& target )
{
if ( m_planelist.size() )
{
//単純に追加の場合、高速な処理を行う
if ( GetWidth() == ((OImageProcess&)target).GetWidth() &&
m_TopY + GetHeight() == target.m_TopY )
{
return Append( target );
}
}
else
{
return Append( target );
}
OImageProcess& RetObj = *Instance();
RetObj.m_TopX = ( m_TopX < ((OImageProcess&)target).GetTopX() ) ? m_TopX:((OImageProcess&)target).GetTopX();
RetObj.m_TopY = ( m_TopY < ((OImageProcess&)target).GetTopY() ) ? m_TopY:((OImageProcess&)target).GetTopY();
//合体後の領域計算
DWORD dwWidth = ( ( m_TopX+GetWidth() > ((OImageProcess&)target).GetTopX()+((OImageProcess&)target).GetWidth() ) ?
m_TopX+GetWidth() : ((OImageProcess&)target).GetTopX()+((OImageProcess&)target).GetWidth()
) - RetObj.m_TopX ;
DWORD dwHeight = ( ( m_TopY+GetHeight() > ((OImageProcess&)target).GetTopY()+((OImageProcess&)target).GetHeight() ) ?
m_TopY+GetHeight() : ((OImageProcess&)target).GetTopY()+((OImageProcess&)target).GetHeight()
) - RetObj.m_TopY ;
RetObj.m_ulHorzRes = m_ulHorzRes;
RetObj.m_ulVertRes = m_ulVertRes;
//全てのプレーンを処理
for( auto it=m_planelist.begin(); it!=m_planelist.end(); it++ )
{
//新領域のプレーンを作成
OPlaneLeaf* pPlane = (*it)->Instance( dwWidth, dwHeight );
//まず、自身の画像をコピーする。
DWORD dwLine ;
for( dwLine=0; dwLine< (*it)->Height(); dwLine++ )
{
pPlane->CopyDot( pPlane->GetPoint( m_TopX - RetObj.m_TopX, m_TopY - RetObj.m_TopY + dwLine ),
(*it)->GetPointObj( 0, dwLine ),
(*it)->Width() );
}
//次に相手の画像をコピーする。
OPlaneLeaf* pDestPlane = ((OImageProcess&)target).GetPlane( (*it)->LeafName() );
if ( pDestPlane != NULL )
{
for( dwLine=0; dwLine< pDestPlane->Height(); dwLine++ )
{
pPlane->CopyDot( pPlane->GetPoint( target.m_TopX - RetObj.m_TopX, target.m_TopY - RetObj.m_TopY + dwLine ),
pDestPlane->GetPointObj( 0, dwLine ),
pDestPlane->Width() );
}
}
//完成したプレーンを追加
RetObj.m_planelist.push_back( pPlane );
}
return &RetObj;
}
OImageProcess* OImageProcess::GetLine( DWORD startLine , DWORD endLine )
{
if ( endLine < startLine )
{
DWORD tmp = endLine;
endLine = startLine;
startLine = tmp;
}
DWORD dwHeight = GetHeight();
if ( startLine >= dwHeight )
{
startLine = dwHeight;
}
if ( endLine >= dwHeight )
{
endLine = dwHeight;
}
OImageProcess* pRetObj = Instance();
pRetObj->m_TopX = m_TopX;
pRetObj->m_TopY = m_TopY + startLine;
pRetObj->m_ulHorzRes = m_ulHorzRes;
pRetObj->m_ulVertRes = m_ulVertRes;
DWORD dwPlaneWidth = GetWidth();
DWORD dwPlaneHeight = endLine - startLine ;
//全てのプレーンを処理
for( auto it=m_planelist.begin(); it!=m_planelist.end(); it++ )
{
//新領域のプレーンを作成
OPlaneLeaf* pPlane = (*it)->Instance( dwPlaneWidth, dwPlaneHeight );
//領域の画像をコピーする。
pPlane->CopyDot( pPlane->GetPoint( 0, 0 ),
(*it)->GetPointObj( 0, startLine ),
pPlane->Width() * pPlane->Height() );
//完成したプレーンを追加
pRetObj->m_planelist.push_back( pPlane );
}
return pRetObj;
}
OImageProcess* OImageProcess::GetPerpendicularArea( DWORD startPos , DWORD endPos )
{
if ( endPos < startPos )
{
DWORD tmp = endPos;
endPos = startPos;
startPos = tmp;
}
DWORD dwWidth = GetWidth();
if ( startPos >= dwWidth )
{
startPos = dwWidth;
}
if ( endPos >= dwWidth )
{
endPos = dwWidth;
}
OImageProcess* pRetObj = Instance();
pRetObj->m_TopX = m_TopX + startPos;
pRetObj->m_TopY = m_TopY ;
pRetObj->m_ulHorzRes = m_ulHorzRes;
pRetObj->m_ulVertRes = m_ulVertRes;
DWORD dwPlaneWidth = endPos - startPos;
DWORD dwPlaneHeight = GetHeight() ;
//全てのプレーンを処理
for( auto it=m_planelist.begin(); it!=m_planelist.end(); it++ )
{
//新領域のプレーンを作成
OPlaneLeaf* pPlane = (*it)->Instance( dwPlaneWidth, dwPlaneHeight );
DWORD row ;
for( row=0; row<(*it)->Height(); row++ )
{
pPlane->CopyDot( pPlane->GetPoint( 0, row ),
(*it)->GetPointObj( startPos, row ),
dwPlaneWidth );
}
//完成したプレーンを追加
pRetObj->m_planelist.push_back( pPlane );
}
return pRetObj;
}
DWORD OImageProcess::GetWidth()
{
DWORD dwWidth = 0;
//所有するプレーンの最大幅
for( auto it = m_planelist.begin(); it!=m_planelist.end(); it++ )
if ( *it != NULL )
dwWidth = ( (*it)->Width() > dwWidth ) ? (*it)->Width():dwWidth ;
return dwWidth;
}
DWORD OImageProcess::GetHeight()
{
DWORD dwHeight = 0;
//所有するプレーンの最大幅
for( auto it = m_planelist.begin(); it!=m_planelist.end(); it++ )
if ( *it != NULL )
dwHeight = ( (*it)->Height() > dwHeight ) ? (*it)->Height():dwHeight ;
return dwHeight;
}
OImageProcess* OImageProcess::Append( const OImageProcess& target )
{
OImageProcess* pRetObj = Instance();
DWORD dwWidth;
DWORD dwHeight;
if ( GetWidth() > 0 && GetHeight() > 0 )
{
pRetObj->m_TopX = m_TopX;
pRetObj->m_TopY = m_TopY;
dwWidth = GetWidth();
}
else
{
pRetObj->m_TopX = target.m_TopX;
pRetObj->m_TopY = target.m_TopY;
dwWidth = ((OImageProcess&)target).GetWidth();
}
dwHeight = GetHeight() + ((OImageProcess&)target).GetHeight();
pRetObj->m_ulHorzRes = ((OImageProcess&)target).m_ulHorzRes;
pRetObj->m_ulVertRes = ((OImageProcess&)target).m_ulVertRes;
//全てのプレーンを処理
for( auto it=m_planelist.begin(); it!=m_planelist.end(); it++ )
{
//新領域のプレーンを作成
OPlaneLeaf* pPlane = (*it)->Instance( dwWidth, dwHeight );
//まず、自身の画像をコピーする。
pPlane->CopyDot( pPlane->GetPoint( 0, 0 ),
(*it)->GetPointObj( 0, 0 ),
(*it)->Width() * (*it)->Height() );
//次に相手の画像をコピーする。
OPlaneLeaf* pDestPlane = ((OImageProcess&)target).GetPlane( (*it)->LeafName() );
if ( pDestPlane != NULL )
{
pPlane->CopyDot( pPlane->GetPoint( 0, (*it)->Height() ),
pDestPlane->GetPointObj( 0, 0 ),
pDestPlane->Width() * pDestPlane->Height() );
}
//完成したプレーンを追加
pRetObj->m_planelist.push_back( pPlane );
}
return pRetObj;
}
//同じ水平画素のデータを作成
OImageProcess* OImageProcess::MakeAreaBoxH( DWORD dwSize )
{
OImageProcess* pRetObj = Instance();
pRetObj->m_TopX = m_TopX ;
pRetObj->m_TopY = m_TopY ;
pRetObj->m_ulHorzRes = m_ulHorzRes ;
pRetObj->m_ulVertRes = m_ulVertRes ;
//全てのプレーンを処理
for( auto it=m_planelist.begin(); it!=m_planelist.end(); it++ )
{
//新領域のプレーンを作成
OPlaneLeaf* pPlane = (*it)->Instance( GetWidth(), dwSize );
//完成したプレーンを追加
pRetObj->m_planelist.push_back( pPlane );
}
return pRetObj;
}
//同じ垂直画素のデータを作成
OImageProcess* OImageProcess::MakeAreaBoxV( DWORD dwSize )
{
OImageProcess* pRetObj = Instance();
pRetObj->m_TopX = m_TopX ;
pRetObj->m_TopY = m_TopY ;
pRetObj->m_ulHorzRes = m_ulHorzRes ;
pRetObj->m_ulVertRes = m_ulVertRes ;
//全てのプレーンを処理
for( auto it=m_planelist.begin(); it!=m_planelist.end(); it++ )
{
//新領域のプレーンを作成
OPlaneLeaf* pPlane = (*it)->Instance( dwSize, GetHeight() );
//完成したプレーンを追加
pRetObj->m_planelist.push_back( pPlane );
}
return pRetObj;
}
| [
"[email protected]"
] | |
08634f581f8e5feb67182492a84b86f94f9f6566 | 7de52062ec797ce2f2e206672fbce6be4ff8341f | /2022.cpp | 2c82db24a7c327fddea8a14a3c9803fd953a8c66 | [] | no_license | joselynzhao/ALGORITHM_PROCTICE | 2278bca3d194e88ef60522d438de18659e69ad03 | a026c5e4046585d71d4068f694e24eded44eccef | refs/heads/master | 2020-04-16T07:26:55.082322 | 2019-05-02T02:39:40 | 2019-05-02T02:39:40 | 165,387,245 | 2 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 330 | cpp | #include <iostream>
using namespace std;
int main(){
int m,n;
while(scanf("%d%d",&m,&n)!=EOF){
int max=0,temp,x=1,y=1;
for(int i=0;i<m;i++){
for(int j=0;j<n;j++){
scanf("%d",&temp);
if((temp*temp)>(max*max)){
max=temp;
x=i+1;
y=j+1;
}
}
}
cout<<x<<" "<<y<<" "<<max<<endl;
}
return 0;
} | [
"[email protected]"
] | |
83e66ebfae7c487c782346107b51b62be9220887 | 23bc99fcf78c2c3f216e1ed3e7435579168094b1 | /棋牌/PlatForm/Client/MainFrame/RoomSetWnd.cpp | eaee978f2661eedaf79150691604ff64b4d168cd | [] | no_license | 15831944/liuwanbing | 0b080a7d074dba30f81c6c2fbac136fd724d6793 | 4c527deb62446b0d24b1c5e6b65bc95ce949d942 | refs/heads/master | 2021-06-01T13:21:52.320236 | 2016-07-26T13:18:26 | 2016-07-26T13:18:26 | null | 0 | 0 | null | null | null | null | GB18030 | C++ | false | false | 15,720 | cpp | #include "StdAfx.h"
#include "RoomSetWnd.h"
using namespace BzDui;
bool CRoomSetWnd::m_bPlayBkMusic = true;
CRoomSetWnd::CRoomSetWnd(void)
{
//是否允许设置桌面密码
m_bAllowSetDesk = true;
m_szPass[0]=0;
m_bCutPercent=10;
m_bPass=FALSE;
m_bSameIP=false;
m_bSameIPNumber=0;
m_bLimitCut=FALSE;
m_bLimitPoint=0x00;
m_bInvaliMode=INVALI_ALL;
m_dwLowPoint=-100000L;
m_dwHighPoint=100000L;
m_dwLowMoney=-100000L;
m_dwHighMoney=100000L;
m_bSaveTalk=TRUE;
m_bShowUser=TRUE;
m_bShowMessage=TRUE;
}
CRoomSetWnd::~CRoomSetWnd(void)
{
}
LPCTSTR CRoomSetWnd::GetWindowClassName() const
{
return _T("UIFrame");
};
UINT CRoomSetWnd::GetClassStyle() const
{
return UI_CLASSSTYLE_DIALOG;
};
void CRoomSetWnd::OnFinalMessage(HWND hWnd)
{
m_pm.RemovePreMessageFilter(this);
//delete this;
};
LRESULT CRoomSetWnd::OnCreate(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
{
LONG styleValue = ::GetWindowLong(*this, GWL_STYLE);
styleValue &= ~WS_CAPTION;
::SetWindowLong(*this, GWL_STYLE, styleValue | WS_CLIPSIBLINGS | WS_CLIPCHILDREN);
m_pm.Init(m_hWnd);
m_pm.AddPreMessageFilter(this);
CDialogBuilder builder;
CControlUI* pRoot = builder.Create(_T("room_mid\\RoomSet\\RoomSet.xml"), (UINT)0, NULL, &m_pm);
ASSERT(pRoot && "Failed to parse XML");
m_pm.AttachDialog(pRoot);
m_pm.AddNotifier(this);
::SetWindowPos(m_hWnd,CWnd::wndTopMost, 0, 0, 0, 0, SWP_NOSIZE|SWP_NOMOVE);
Init();
return 0;
}
LRESULT CRoomSetWnd::OnDestroy(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
{
bHandled = FALSE;
return 0;
}
LRESULT CRoomSetWnd::OnNcActivate(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
{
if( ::IsIconic(*this) ) bHandled = FALSE;
return (wParam == 0) ? TRUE : FALSE;
}
LRESULT CRoomSetWnd::OnNcCalcSize(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
{
return 0;
}
LRESULT CRoomSetWnd::OnNcPaint(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
{
return 0;
}
LRESULT CRoomSetWnd::OnNcHitTest(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
{
POINT pt; pt.x = GET_X_LPARAM(lParam); pt.y = GET_Y_LPARAM(lParam);
::ScreenToClient(*this, &pt);
RECT rcClient;
::GetClientRect(*this, &rcClient);
RECT rcCaption = m_pm.GetCaptionRect();
if( pt.x >= rcClient.left + rcCaption.left && pt.x < rcClient.right - rcCaption.right \
&& pt.y >= rcCaption.top && pt.y < rcCaption.bottom )
{
CControlUI* pControl = static_cast<CControlUI*>(m_pm.FindControl(pt));
if( pControl && _tcscmp(pControl->GetClass(), _T("ButtonUI")) != 0 )
return HTCAPTION;
}
return HTCLIENT;
}
LRESULT CRoomSetWnd::OnSize(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
{
return 0;
}
LRESULT CRoomSetWnd::HandleMessage(UINT uMsg, WPARAM wParam, LPARAM lParam)
{
LRESULT lRes = 0;
BOOL bHandled = TRUE;
switch(uMsg)
{
case WM_CREATE:
{
lRes = OnCreate(uMsg, wParam, lParam, bHandled);
}
break;
case WM_DESTROY:
{
lRes = OnDestroy(uMsg, wParam, lParam, bHandled);
}
break;
case WM_NCACTIVATE:
{
lRes = OnNcActivate(uMsg, wParam, lParam, bHandled);
}
break;
case WM_NCCALCSIZE:
{
lRes = OnNcCalcSize(uMsg, wParam, lParam, bHandled);
}
break;
case WM_NCPAINT:
{
lRes = OnNcPaint(uMsg, wParam, lParam, bHandled);
}
break;
case WM_NCHITTEST:
{
lRes = OnNcHitTest(uMsg, wParam, lParam, bHandled);
}
break;
case WM_SIZE:
{
lRes = OnSize(uMsg, wParam, lParam, bHandled);
}
break;
default:
bHandled = FALSE;
}
if(bHandled)
{
return lRes;
}
if(m_pm.MessageHandler(uMsg,wParam,lParam,lRes))
{
return lRes;
}
return CWindowWnd::HandleMessage(uMsg, wParam, lParam);
}
LRESULT CRoomSetWnd::MessageHandler(UINT uMsg, WPARAM wParam, LPARAM lParam, bool& bHandled)
{
if( uMsg == WM_KEYDOWN )
{
if( wParam == VK_RETURN )
{
OnOK();
return true;
}
else if( wParam == VK_ESCAPE )
{
m_nRetFlag = 0;
Close();
return true;
}
}
return false;
}
void CRoomSetWnd::OnOK()
{
m_bLimitPoint = 0x00;
COptionUI* pOptCtrl = NULL;
CComboUI* pCobCtrl = NULL;
CEditUI* pEdtCrl = NULL;
TCHAR sz[32];
pOptCtrl = static_cast<COptionUI*>(m_pm.FindControl("Opt_1"));
m_bSameIP = pOptCtrl->IsSelected();
pCobCtrl = static_cast<CComboUI*>(m_pm.FindControl("Cob_1"));
LPCTSTR lpSel = pCobCtrl->GetText().GetData();
pOptCtrl = static_cast<COptionUI*>(m_pm.FindControl("Opt_2"));
if (pOptCtrl->IsSelected())
{
::sscanf_s(lpSel,"%d",&m_bSameIPNumber);
}
else
{
m_bSameIPNumber = 0;
}
pOptCtrl = static_cast<COptionUI*>(m_pm.FindControl("Opt_3"));
m_bLimitCut = pOptCtrl->IsSelected();
pCobCtrl = static_cast<CComboUI*>(m_pm.FindControl("Cob_2"));
::sscanf_s(pCobCtrl->GetText().GetData(),"%d",&m_bCutPercent);
pOptCtrl = static_cast<COptionUI*>(m_pm.FindControl("Opt_4"));
if (pOptCtrl->IsSelected())
{
m_bLimitPoint |= 0x40;
}
pEdtCrl = static_cast<CEditUI*>(m_pm.FindControl("Edt_2"));
::sscanf_s(pEdtCrl->GetText().GetData(),"%d",&m_dwLowPoint);
pEdtCrl = static_cast<CEditUI*>(m_pm.FindControl("Edt_3"));
::sscanf_s(pEdtCrl->GetText().GetData(),"%d",&m_dwHighPoint);
pOptCtrl = static_cast<COptionUI*>(m_pm.FindControl("Opt_8"));
if (pOptCtrl->IsSelected())
{
m_bLimitPoint |= 0x80;
}
pEdtCrl = static_cast<CEditUI*>(m_pm.FindControl("Edt_5"));
::sscanf_s(pEdtCrl->GetText().GetData(),"%d",&m_dwLowMoney);
pEdtCrl = static_cast<CEditUI*>(m_pm.FindControl("Edt_6"));
::sscanf_s(pEdtCrl->GetText().GetData(),"%d",&m_dwHighMoney);
pOptCtrl = static_cast<COptionUI*>(m_pm.FindControl("Opt_5"));
m_bShowUser = pOptCtrl->IsSelected();
pOptCtrl = static_cast<COptionUI*>(m_pm.FindControl("Opt_6"));
m_bPass = pOptCtrl->IsSelected();
pEdtCrl = static_cast<CEditUI*>(m_pm.FindControl("Edt_4"));
strcpy(m_szPass,pEdtCrl->GetText());
pOptCtrl = static_cast<COptionUI*>(m_pm.FindControl("Opt_7"));
m_bPlayBkMusic = pOptCtrl->IsSelected();
m_nRetFlag = 1;
Close();
}
void CRoomSetWnd::Init()
{
LoadNormalCtrlSkin();
COptionUI* pOptCtrl = NULL;
CComboUI* pCobCtrl = NULL;
CEditUI* pEdtCtrl = NULL;
TCHAR sz[128];
pOptCtrl = static_cast<COptionUI*>(m_pm.FindControl("Opt_1"));
pOptCtrl->Selected(m_bSameIP);
if (!m_bAllowSetDesk)
{
pOptCtrl->SetEnabled(false);
pOptCtrl->SetVisible(false);
}
pOptCtrl = static_cast<COptionUI*>(m_pm.FindControl("Opt_2"));
if (!m_bAllowSetDesk)
{
pOptCtrl->SetEnabled(false);
pOptCtrl->SetVisible(false);
}
pCobCtrl = static_cast<CComboUI*>(m_pm.FindControl("Cob_1"));
LPCTSTR szItems1[2] = {_T("3"),_T("4")};
LoadComboItems(pCobCtrl,szItems1,2);
if (m_bSameIPNumber > 0)
{
::sprintf_s(sz,sizeof(sz),"%d",m_bSameIPNumber);
SelectComboItem(pCobCtrl,sz);
pOptCtrl->Selected(true);
pCobCtrl->SetEnabled(true);
}
else
{
SelectComboItem(pCobCtrl,szItems1[0]);
pOptCtrl->Selected(false);
pCobCtrl->SetEnabled(false);
}
pOptCtrl = static_cast<COptionUI*>(m_pm.FindControl("Opt_3"));
pOptCtrl->Selected(m_bLimitCut);
if (!m_bAllowSetDesk)
{
pOptCtrl->SetEnabled(false);
pOptCtrl->SetVisible(false);
}
pCobCtrl = static_cast<CComboUI*>(m_pm.FindControl("Cob_2"));
LPCTSTR szItems2[9] = {_T("10"),_T("20"),_T("30"),_T("40"),_T("50"),_T("60"),_T("70"),_T("80"),_T("90")};
LoadComboItems(pCobCtrl,szItems2,9);
::sprintf_s(sz,sizeof(sz),"%d",m_bCutPercent);
SelectComboItem(pCobCtrl,sz);
pCobCtrl->SetEnabled(m_bLimitCut);
pOptCtrl = static_cast<COptionUI*>(m_pm.FindControl("Opt_4"));
pOptCtrl->Selected(m_bLimitPoint & 0x40);
if (!m_bAllowSetDesk)
{
pOptCtrl->SetEnabled(false);
pOptCtrl->SetVisible(false);
}
pOptCtrl = static_cast<COptionUI*>(m_pm.FindControl("Opt_8"));
pOptCtrl->Selected(m_bLimitPoint & 0x80);
if (!m_bAllowSetDesk)
{
pOptCtrl->SetEnabled(false);
pOptCtrl->SetVisible(false);
}
pOptCtrl = static_cast<COptionUI*>(m_pm.FindControl("Opt_5"));
pOptCtrl->Selected(m_bShowUser);
pOptCtrl = static_cast<COptionUI*>(m_pm.FindControl("Opt_6"));
pOptCtrl->Selected(m_bPass);
if (!m_bAllowSetDesk)
{
pOptCtrl->SetEnabled(false);
pOptCtrl->SetVisible(false);
}
pEdtCtrl = static_cast<CEditUI*>(m_pm.FindControl("Edt_2"));
::sprintf_s(sz,sizeof(sz),"%d",m_dwLowPoint);
pEdtCtrl->SetText(sz);
pEdtCtrl->SetEnabled(m_bLimitPoint & 0x40);
pEdtCtrl = static_cast<CEditUI*>(m_pm.FindControl("Edt_3"));
::sprintf_s(sz,sizeof(sz),"%d",m_dwHighPoint);
pEdtCtrl->SetText(sz);
pEdtCtrl->SetEnabled(m_bLimitPoint & 0x40);
pEdtCtrl = static_cast<CEditUI*>(m_pm.FindControl("Edt_5"));
::sprintf_s(sz,sizeof(sz),"%d",m_dwLowMoney);
pEdtCtrl->SetText(sz);
pEdtCtrl->SetEnabled(m_bLimitPoint & 0x80);
pEdtCtrl = static_cast<CEditUI*>(m_pm.FindControl("Edt_6"));
::sprintf_s(sz,sizeof(sz),"%d",m_dwHighMoney);
pEdtCtrl->SetText(sz);
pEdtCtrl->SetEnabled(m_bLimitPoint & 0x80);
pEdtCtrl = static_cast<CEditUI*>(m_pm.FindControl("Edt_4"));
pEdtCtrl->SetText(m_szPass);
pEdtCtrl->SetEnabled(m_bPass);
if (!m_bAllowSetDesk)
{
pEdtCtrl->SetEnabled(false);
}
pOptCtrl = static_cast<COptionUI*>(m_pm.FindControl("Opt_7"));
pOptCtrl->Selected(m_bPlayBkMusic);
//限制IP
/*if(Glb().m_release)
{
m_bSameIP=true;
((CButton *)GetDlgItem(IDC_SAME_IP))->SetCheck(BST_CHECKED);
((CButton *)GetDlgItem(IDC_SAME_IP))->EnableWindow(0);
}*/
//设置邀请方式
// if (m_bInvaliMode==INVALI_ALL) ((CButton *)GetDlgItem(IDC_INVALI_ALL))->SetCheck(BST_CHECKED);
// else if (m_bInvaliMode==INVALI_ONLY_FRIEND) ((CButton *)GetDlgItem(IDC_FRIEND_INVALI))->SetCheck(BST_CHECKED);
// else ((CButton *)GetDlgItem(IDC_NO_INVALI))->SetCheck(BST_CHECKED);
//
// //设置输入
// if (m_bSaveTalk) ((CButton *)GetDlgItem(IDC_SAVE_TALK))->SetCheck(BST_CHECKED);
// if (m_bShowUser) ((CButton *)GetDlgItem(IDC_SHOW_USER))->SetCheck(BST_CHECKED);
// int r,g,b;
}
//加载Combol的列表项
void CRoomSetWnd::LoadComboItems(CComboUI* pCtrl,LPCTSTR items[],int nums,int nSelect/* = 0*/)
{
if (!pCtrl || nums <= 0)
{
return;
}
for (int i = 0; i < nums; ++i)
{
CListLabelElementUI* p = new CListLabelElementUI();
p->SetText(items[i]);
pCtrl->Add(p);
}
return;
}
//根据文本设置选择列表项
bool CRoomSetWnd::SelectComboItem(BzDui::CComboUI* pCtrl,LPCTSTR szText)
{
if (!pCtrl)
{
return false;
}
int itNums = pCtrl->GetCount();
if (itNums <= 0)
{
return false;
}
for (int i = 0; i < itNums; ++i)
{
if (strcmp(szText,pCtrl->GetItemAt(i)->GetText().GetData()) == 0)
{
pCtrl->SelectItem(i);
return true;
}
}
return false;
}
void CRoomSetWnd::Notify(TNotifyUI& msg)
{
if( msg.sType == _T("click"))
{
if( msg.pSender->GetName() == _T("Bnt_Close"))
{
m_nRetFlag = 0;
Close();
}
if( msg.pSender->GetName() == _T("Btn_OK"))
{
OnOK();
}
if( msg.pSender->GetName() == _T("Btn_Cancel"))
{
m_nRetFlag = 0;
Close();
}
}
else if(msg.sType == _T("selectchanged"))
{
if (msg.pSender->GetName() == _T("Opt_2"))
{
COptionUI* pOptCtrl = static_cast<COptionUI*>(m_pm.FindControl("Opt_2"));
CComboUI* pCobCtrl = NULL;
pCobCtrl = static_cast<CComboUI*>(m_pm.FindControl("Cob_1"));
pCobCtrl->SetEnabled(pOptCtrl->IsSelected());
}
else if (msg.pSender->GetName() == _T("Opt_3"))
{
COptionUI* pOptCtrl = static_cast<COptionUI*>(m_pm.FindControl("Opt_3"));
CComboUI* pCobCtrl = NULL;
pCobCtrl = static_cast<CComboUI*>(m_pm.FindControl("Cob_2"));
pCobCtrl->SetEnabled(pOptCtrl->IsSelected());
}
else if (msg.pSender->GetName() == _T("Opt_4"))
{
COptionUI* pOptCtrl = static_cast<COptionUI*>(m_pm.FindControl("Opt_4"));
CEditUI* pEdtCtrl = NULL;
pEdtCtrl = static_cast<CEditUI*>(m_pm.FindControl("Edt_2"));
pEdtCtrl->SetEnabled(pOptCtrl->IsSelected());
pEdtCtrl = static_cast<CEditUI*>(m_pm.FindControl("Edt_3"));
pEdtCtrl->SetEnabled(pOptCtrl->IsSelected());
}
else if (msg.pSender->GetName() == _T("Opt_6"))
{
COptionUI* pOptCtrl = static_cast<COptionUI*>(m_pm.FindControl("Opt_6"));
CEditUI* pEdtCtrl = NULL;
pEdtCtrl = static_cast<CEditUI*>(m_pm.FindControl("Edt_4"));
pEdtCtrl->SetEnabled(pOptCtrl->IsSelected());
}
else if (msg.pSender->GetName() == _T("Opt_8"))
{
COptionUI* pOptCtrl = static_cast<COptionUI*>(m_pm.FindControl("Opt_8"));
CEditUI* pEdtCtrl = NULL;
pEdtCtrl = static_cast<CEditUI*>(m_pm.FindControl("Edt_5"));
pEdtCtrl->SetEnabled(pOptCtrl->IsSelected());
pEdtCtrl = static_cast<CEditUI*>(m_pm.FindControl("Edt_6"));
pEdtCtrl->SetEnabled(pOptCtrl->IsSelected());
}
}
}
//加载常规控件皮肤
void CRoomSetWnd::LoadNormalCtrlSkin()
{
int idx = 0;
CStdPtrArray* pCtrls = NULL;
//加载所有文本编辑框的皮肤
pCtrls = m_pm.FindSubControlsByClass(m_pm.GetRoot(),_TEXT("EditUI"));
CEditUI* pEditUI = NULL;
do
{
pEditUI = static_cast<CEditUI*>(pCtrls->GetAt(idx++));
if (pEditUI)
{
if (pEditUI->GetName() == _T("Edt_ID"))
{
continue;
}
pEditUI->SetNormalImage("file='dialog\\edit.png' dest='0,0,500,22' source='0,0,500,22' corner='3,4,2,2'");
pEditUI->SetHotImage("file='dialog\\edit.png' dest='0,0,500,22' source='0,22,500,44' corner='3,4,2,2'");
pEditUI->SetFocusedImage("file='dialog\\edit.png' dest='0,0,500,22' source='0,44,500,66' corner='3,4,2,2'");
pEditUI->SetDisabledImage("file='dialog\\edit.png' dest='0,0,500,22' source='0,66,500,88' corner='3,4,2,2'");
}
} while (pEditUI);
//加载所有下拉列表框的皮肤
idx = 0;
pCtrls = m_pm.FindSubControlsByClass(m_pm.GetRoot(),_TEXT("ComboUI"));
CComboUI* pComboUI = NULL;
do
{
pComboUI = static_cast<CComboUI*>(pCtrls->GetAt(idx++));
if (pComboUI)
{
pComboUI->SetNormalImage("file='dialog\\combo.png' dest='0,0,500,22' source='0,0,500,22' corner='5,0,22,0'");
pComboUI->SetHotImage("file='dialog\\combo.png' dest='0,0,500,22' source='0,22,500,44' corner='5,0,22,0'");
pComboUI->SetPushedImage("file='dialog\\combo.png' dest='0,0,500,22' source='0,44,500,66' corner='5,0,22,0'");
pComboUI->SetDisabledImage("file='dialog\\combo.png' dest='0,0,500,22' source='0,66,500,88' corner='5,0,22,0'");
RECT rc = {6,0,0,0};
pComboUI->SetItemTextPadding(rc);
// CScrollBarUI* pVScroll = pComboUI->GetVerticalScrollBar();
// if (pVScroll)
// {
// pVScroll->SetBkNormalImage("file='dialog\\vscrollbar_back.png' dest='0,0,14,100' source='0,0,14,100' corner='0,0,0,0'");
// pVScroll->SetButton1NormalImage("file='dialog\\vscrollbar_up.png' dest='0,0,16,16' source='0,0,16,16' corner='0,0,0,0'");
// }
}
} while (pComboUI);
//加载所有多选框的皮肤
idx = 0;
pCtrls = m_pm.FindSubControlsByClass(m_pm.GetRoot(),_TEXT("OptionUI"));
COptionUI* pOptionUI = NULL;
do
{
pOptionUI = static_cast<COptionUI*>(pCtrls->GetAt(idx++));
if (pOptionUI)
{
pOptionUI->SetNormalImage("file='dialog\\check.png' dest='0,0,15,15' source='0,0,15,15' corner='0,0,0,0'");
pOptionUI->SetHotImage("file='dialog\\check.png' dest='0,0,15,15' source='15,0,30,15' corner='0,0,0,0'");
pOptionUI->SetSelectedImage("file='dialog\\check.png' dest='0,0,15,15' source='30,0,45,15' corner='0,0,0,0'");
}
} while (pOptionUI);
} | [
"[email protected]"
] | |
5cc333e002330336e8ffb63bc75c81fd27c5027c | ce989e9fb6a42fc1dd5c19d46bdad46e175797df | /src/gslstat/tbb_cilk/tbb.cpp | 734b76638c5fa3c68335a4510ee57f41850ccfb6 | [] | no_license | RanWangTilburg/BayesianOrdinal | 4b17f4b6e1f40db9c3149a92119ad769f5017a13 | a1b8df3660ed07a12a77292d43d174ef326aa536 | refs/heads/master | 2020-12-03T06:36:06.573063 | 2017-06-28T19:47:42 | 2017-06-28T19:47:42 | 95,705,714 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,084 | cpp | #include <gtest/gtest.h>
#include <tbb/tbb.h>
#include <cilk/cilk.h>
#include <cstdio>
#include <tbb/flow_graph.h>
#pragma warning(disable: 588)
static const int N = 10000;
using namespace tbb::flow;
class TBBTest : public ::testing::Test {
};
struct square {
int operator()(int v) { return v * v; }
};
struct cube {
int operator()(int v) { return v * v * v; }
};
class sum {
int &my_sum;
public:
sum(int &s) : my_sum(s) {}
int operator()(tuple<int, int> v) {
my_sum += get<0>(v) + get<1>(v);
return my_sum;
}
};
class SumFoo {
float *my_a;
public:
float my_sum;
void operator()(const tbb::blocked_range<size_t> &r) {
float *a = my_a;
float sum = my_sum;
size_t end = r.end();
for (size_t i = r.begin(); i != end; ++i)
sum += a[i];
my_sum = sum;
}
SumFoo(SumFoo &x, tbb::split) : my_a(x.my_a), my_sum(0) {}
void join(const SumFoo &y) { my_sum += y.my_sum; }
SumFoo(float a[]) :
my_a(a), my_sum(0) {}
};
__attribute__((vector(uniform(input)))) int add_one(int input) {
return input + 1;
}
void parallel_add_one(int *a) {
tbb::parallel_for(0, N, [=](int index) { a[index] = add_one(a[index]); });
}
TEST_F(TBBTest, TBBTestForSimpleLoop) {
int a[N];
a[:]=0;
parallel_add_one(a);
for (int i = 0; i < N; i++) {
EXPECT_EQ(a[i], 1);
}
}
TEST_F(TBBTest, TEST_FLOW_GRAPH) {
int result = 0;
graph g;
broadcast_node<int> input(g);
function_node<int, int> squarer(g, unlimited, square());
function_node<int, int> cuber(g, unlimited, cube());
join_node<tuple<int, int>, queueing> join(g);
function_node<tuple<int, int>, int>
summer(g, serial, sum(result));
make_edge(input, squarer);
make_edge(input, cuber);
make_edge(squarer, get<0>(join.input_ports()));
make_edge(cuber, get<1>(join.input_ports()));
make_edge(join, summer);
for (int i = 1; i <= 10; ++i)
input.try_put(i);
g.wait_for_all();
ASSERT_EQ(result, 3410);
}
| [
"[email protected]"
] | |
2f03a308ecd33e9865b2a1f42c52a52ebe146fbb | 7d23a85363397f527f3e36242e9af43a3fc81b47 | /openmp_bitminer/openmp_bitminer/main.cpp | 3317e501ba7eee3bab335fdedff81ca6e9806ba7 | [
"MIT"
] | permissive | fbasatemur/openmp_blockchain | 3642651dc18c431fee74c405f5373430297bb67b | 4d3032c86b21c6307fd26672392f84cc588df580 | refs/heads/main | 2023-06-18T07:04:14.046026 | 2021-07-13T23:17:52 | 2021-07-13T23:17:52 | 365,493,075 | 3 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 3,807 | cpp | #include <stdlib.h>
#include <iostream>
#include "Sha.h"
#include "BlockChain.h"
#include <omp.h>
#include <iomanip>
using namespace std;
int main()
{
string inputText = "Bize her yer Trabzon! Bolumun en yakisikli hocasi Ibrahim Hoca'dir"; // ascii text
string initializeHash = "0000000000000000000000000000000000000000000000000000000000000000";
size_t threadNums;
cout << "THREAD NUMS: ";
cin >> threadNums;
size_t nonce = 0;
bool flag = false;
size_t acceptNonce; // acceptNonce will be approved by other threads
size_t acceptCounter; // accepted threads numbers
WORD* sha256K = InitializeK();
BlockChain blockChain;
blockChain.AddBack(inputText, initializeHash);
cout << "\n# BLOCK: " << blockChain.current->blockNum << "\t tid: " << omp_get_thread_num() << endl;
cout << "Hash initialized: " << blockChain.current->initializeHash << "\t nonce: " << nonce << "\t \t tid: " << omp_get_thread_num() << endl;
size_t entryCounter;
omp_lock_t lock;
omp_init_lock(&lock);
double start = omp_get_wtime(), end;
double globalTime = start;
int sec, h, m;
#pragma omp parallel num_threads(threadNums)
{
string privateText, privateHash;
size_t privateNonce;
#pragma omp critical
{
privateNonce = nonce;
nonce++;
}
#pragma omp barrier
while (true)
{
privateText = blockChain.GetText(privateNonce); // text generate for SHA256
privateHash = Sha256(privateText, sha256K); // hash calculated
if (blockChain.Control(privateHash))
{
#pragma omp single nowait
{
acceptCounter = 0;
entryCounter = 0;
acceptNonce = privateNonce;
flag = true;
while (acceptCounter < threadNums / 2) {} // must accepted N/2 threads
while (entryCounter < threadNums - 1) {} // wait threadNums-1 threads
// privateNonce accepted for other threads, print block informations
end = omp_get_wtime();
cout << "Hash found: " << privateHash << "\t \t nonce: " << acceptNonce << "\t \t tid: " << omp_get_thread_num() << endl << "Text: " << privateText << endl << "Block Run-time(s): " << std::setprecision(3) << fixed << (end - start);
start = omp_get_wtime();
sec = int(end - globalTime);
h = int(sec / 3600);
m = int((sec - (3600 * h)) / 60);
cout << "\t Total Run-time: " << h << ":" << m << ":" << (sec - (3600 * h) - (m * 60)) << endl;
blockChain.AddBack(privateText, privateHash); // add next block
nonce = 0;
privateNonce = nonce;
nonce++;
cout << endl << endl << "# BLOCK: " << blockChain.blockCounter << "\t tid: " << omp_get_thread_num() << endl;
cout << "Hash initialized: " << blockChain.current->initializeHash << "\t nonce: " << privateNonce << "\t \t tid: " << omp_get_thread_num() << endl;
flag = false;
}
}
else {
// nonce couldnt found, nonce increment
omp_set_lock(&lock);
privateNonce = nonce;
nonce++;
omp_unset_lock(&lock);
}
if (flag)
{
privateText = blockChain.GetText(acceptNonce);
privateHash = Sha256(privateText, sha256K);
#pragma omp critical
{
if (acceptCounter < threadNums / 2) // must accepted N/2 threads => accepted total: N/2 + 1(main thread) threads
{
if (blockChain.Control(privateHash)) {
cout << "Hash accepted: " << privateHash << "\t \t nonce: " << acceptNonce << "\t \t tid: " << omp_get_thread_num() << endl;
++acceptCounter;
}
else cout << "Error tid: " << omp_get_thread_num() << endl;
}
++entryCounter;
}
while (flag) {}
omp_set_lock(&lock);
privateNonce = nonce;
nonce++;
omp_unset_lock(&lock);
}
}
}
omp_destroy_lock(&lock);
return 0;
}
| [
"[email protected]"
] | |
aa1291df5dd50623e8c06d5de110bac882c5d94f | 449c7e09d28e60eec7a9ff86702f5ad591230fb5 | /include/Globals.h | f9c77b2cf0f9c612651e6033c1014b7daa0f4b20 | [
"MIT"
] | permissive | PyrokinesisStudio/modioSDK | 2819bba56d184e24954b354b759f564c4bda6631 | 951de6d90806794b5f86f82a1bbfda3e0ba0b65f | refs/heads/master | 2020-03-31T00:34:03.247271 | 2018-09-17T17:16:07 | 2018-09-17T17:16:07 | 151,745,494 | 1 | 0 | MIT | 2018-10-05T15:58:40 | 2018-10-05T15:58:40 | null | UTF-8 | C++ | false | false | 916 | h | #ifndef MODIO_GLOBALS_H
#define MODIO_GLOBALS_H
#include <iostream>
#include "Utility.h"
namespace modio
{
extern std::string API_KEY;
extern std::string ACCESS_TOKEN;
extern u32 GAME_ID;
extern std::string ROOT_PATH;
extern u32 DEBUG_LEVEL;
extern std::string MODIO_URL;
extern std::string MODIO_VERSION_PATH;
extern u32 MAX_CALL_CACHE;
extern u32 MAX_CACHE_TIME;
extern u32 LAST_MOD_EVENT_POLL;
extern u32 LAST_USER_EVENT_POLL;
extern u32 EVENT_POLL_INTERVAL;
extern u32 AUTOMATIC_UPDATES;
extern u32 BACKGROUND_DOWNLOADS;
extern u32 RETRY_AFTER;
extern void (*callback)(ModioResponse response, ModioEvent* events_array, u32 events_array_size);
extern void (*download_callback)(u32 response_code, u32 mod_id);
extern void (*upload_callback)(u32 response_code, u32 mod_id);
std::vector<std::string> getHeaders();
std::vector<std::string> getUrlEncodedHeaders();
}
#endif
| [
"[email protected]"
] | |
38537541f6568bf42c63dc6ebc1a23eb6d4e10a7 | 7cc8624e51638a595811a0ad04731d2e9d3ce78e | /068_circle/point.cpp | 97a1575193a98c0e80d37ec64af3a6a83e503f78 | [] | no_license | isildur7/ECE-551 | d89ed74c2eaeeb03a6f7c37bb68e6f2a7467d608 | 08a69f6936d69cb66a5c46871528d56c870e8108 | refs/heads/master | 2020-04-13T03:56:25.738551 | 2018-12-24T03:55:38 | 2018-12-24T03:55:38 | 162,946,376 | 3 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 22 | cpp | ../067_point/point.cpp | [
"[email protected]"
] | |
4a01e742398c3f9f580a5fd9c4330a7a916ccc08 | 94987728d8a35fa16c8d42b699d17dc1a60b8fd4 | /ouzel/core/android/WindowAndroid.h | 98a116ab9ebd12ebf883607b148ba8356a06cc1f | [
"BSD-3-Clause",
"BSD-2-Clause"
] | permissive | wengxxaa/ouzel | 6db39de8e537e68d314a89f0373d5dd4443db58d | 82cfc918216d0810cb354d40c02770616d3623b7 | refs/heads/master | 2021-01-12T04:10:38.629037 | 2016-12-28T10:32:14 | 2016-12-28T10:32:14 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 399 | h | // Copyright (C) 2016 Elviss Strazdins
// This file is part of the Ouzel engine.
#pragma once
#include "core/Window.h"
namespace ouzel
{
class WindowAndroid: public Window
{
friend Engine;
public:
void handleResize(const Size2& newSize);
protected:
WindowAndroid(const Size2& aSize, bool aResizable, bool aFullscreen, const std::string& aTitle);
};
}
| [
"[email protected]"
] | |
93db2c0e94d5a63b27df6d04bb552e070309469d | 21ede326b6cfcf5347ca6772d392d3acca80cfa0 | /ash/wm/panels/panel_layout_manager.cc | f849908f7d434ed8ddfaa6950ccf0f68181bcb88 | [
"BSD-3-Clause"
] | permissive | csagan5/kiwi | 6eaab0ab4db60468358291956506ad6f889401f8 | eb2015c28925be91b4a3130b3c2bee2f5edc91de | refs/heads/master | 2020-04-04T17:06:54.003121 | 2018-10-24T08:20:01 | 2018-10-24T08:20:01 | 156,107,399 | 2 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 35,291 | cc | // Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "ash/wm/panels/panel_layout_manager.h"
#include <algorithm>
#include <map>
#include <utility>
#include "ash/public/cpp/shell_window_ids.h"
#include "ash/public/cpp/window_properties.h"
#include "ash/root_window_controller.h"
#include "ash/shelf/shelf.h"
#include "ash/shell.h"
#include "ash/wm/overview/window_selector_controller.h"
#include "ash/wm/window_animation_types.h"
#include "ash/wm/window_parenting_utils.h"
#include "ash/wm/window_properties.h"
#include "ash/wm/window_state.h"
#include "ash/wm/window_util.h"
#include "base/auto_reset.h"
#include "third_party/skia/include/core/SkColor.h"
#include "third_party/skia/include/core/SkPath.h"
#include "ui/aura/client/window_parenting_client.h"
#include "ui/aura/window_delegate.h"
#include "ui/compositor/scoped_layer_animation_settings.h"
#include "ui/gfx/canvas.h"
#include "ui/gfx/geometry/rect.h"
#include "ui/gfx/geometry/vector2d.h"
#include "ui/views/background.h"
#include "ui/views/widget/widget.h"
#include "ui/wm/core/coordinate_conversion.h"
#include "ui/wm/core/window_util.h"
#include "ui/wm/public/activation_client.h"
using aura::Window;
namespace ash {
namespace {
const int kPanelIdealSpacing = 4;
const float kMaxHeightFactor = .80f;
const float kMaxWidthFactor = .50f;
// Duration for panel animations.
const int kPanelSlideDurationMilliseconds = 50;
const int kCalloutFadeDurationMilliseconds = 50;
// Offset used when sliding panel in/out of the shelf. Used for minimizing,
// restoring and the initial showing of a panel.
const int kPanelSlideInOffset = 20;
// Callout arrow dimensions.
const int kArrowWidth = 18;
const int kArrowHeight = 9;
class CalloutWidgetBackground : public views::Background {
public:
CalloutWidgetBackground() : alignment_(SHELF_ALIGNMENT_BOTTOM) {}
void Paint(gfx::Canvas* canvas, views::View* view) const override {
SkPath path;
switch (alignment_) {
case SHELF_ALIGNMENT_BOTTOM:
case SHELF_ALIGNMENT_BOTTOM_LOCKED:
path.moveTo(SkIntToScalar(0), SkIntToScalar(0));
path.lineTo(SkIntToScalar(kArrowWidth / 2),
SkIntToScalar(kArrowHeight));
path.lineTo(SkIntToScalar(kArrowWidth), SkIntToScalar(0));
break;
case SHELF_ALIGNMENT_LEFT:
path.moveTo(SkIntToScalar(kArrowHeight), SkIntToScalar(kArrowWidth));
path.lineTo(SkIntToScalar(0), SkIntToScalar(kArrowWidth / 2));
path.lineTo(SkIntToScalar(kArrowHeight), SkIntToScalar(0));
break;
case SHELF_ALIGNMENT_RIGHT:
path.moveTo(SkIntToScalar(0), SkIntToScalar(0));
path.lineTo(SkIntToScalar(kArrowHeight),
SkIntToScalar(kArrowWidth / 2));
path.lineTo(SkIntToScalar(0), SkIntToScalar(kArrowWidth));
break;
}
// Hard code the arrow color for now.
cc::PaintFlags flags;
flags.setStyle(cc::PaintFlags::kFill_Style);
flags.setColor(SkColorSetARGB(0xff, 0xe5, 0xe5, 0xe5));
canvas->DrawPath(path, flags);
}
ShelfAlignment alignment() { return alignment_; }
void set_alignment(ShelfAlignment alignment) { alignment_ = alignment; }
private:
ShelfAlignment alignment_;
DISALLOW_COPY_AND_ASSIGN(CalloutWidgetBackground);
};
struct VisiblePanelPositionInfo {
VisiblePanelPositionInfo()
: min_major(0),
max_major(0),
major_pos(0),
major_length(0),
window(nullptr),
slide_in(false) {}
int min_major;
int max_major;
int major_pos;
int major_length;
Window* window;
bool slide_in;
};
bool CompareWindowMajor(const VisiblePanelPositionInfo& win1,
const VisiblePanelPositionInfo& win2) {
return win1.major_pos < win2.major_pos;
}
void FanOutPanels(std::vector<VisiblePanelPositionInfo>::iterator first,
std::vector<VisiblePanelPositionInfo>::iterator last) {
int num_panels = last - first;
if (num_panels == 1) {
(*first).major_pos = std::max(
(*first).min_major, std::min((*first).max_major, (*first).major_pos));
}
if (num_panels <= 1)
return;
if (num_panels == 2) {
// If there are two adjacent overlapping windows, separate them by the
// minimum major_length necessary.
std::vector<VisiblePanelPositionInfo>::iterator second = first + 1;
int separation = (*first).major_length / 2 + (*second).major_length / 2 +
kPanelIdealSpacing;
int overlap = (*first).major_pos + separation - (*second).major_pos;
(*first).major_pos =
std::max((*first).min_major, (*first).major_pos - overlap / 2);
(*second).major_pos =
std::min((*second).max_major, (*first).major_pos + separation);
// Recalculate the first panel position in case the second one was
// constrained on the right.
(*first).major_pos =
std::max((*first).min_major, (*second).major_pos - separation);
return;
}
// If there are more than two overlapping windows, fan them out from minimum
// position to maximum position equally spaced.
int delta = ((*(last - 1)).max_major - (*first).min_major) / (num_panels - 1);
int major_pos = (*first).min_major;
for (std::vector<VisiblePanelPositionInfo>::iterator iter = first;
iter != last; ++iter) {
(*iter).major_pos =
std::max((*iter).min_major, std::min((*iter).max_major, major_pos));
major_pos += delta;
}
}
bool BoundsAdjacent(const gfx::Rect& bounds1, const gfx::Rect& bounds2) {
return bounds1.x() == bounds2.right() || bounds1.y() == bounds2.bottom() ||
bounds1.right() == bounds2.x() || bounds1.bottom() == bounds2.y();
}
gfx::Vector2d GetSlideInAnimationOffset(ShelfAlignment alignment) {
gfx::Vector2d offset;
if (alignment == SHELF_ALIGNMENT_LEFT)
offset.set_x(-kPanelSlideInOffset);
else if (alignment == SHELF_ALIGNMENT_RIGHT)
offset.set_x(kPanelSlideInOffset);
else
offset.set_y(kPanelSlideInOffset);
return offset;
}
} // namespace
class PanelCalloutWidget : public views::Widget {
public:
explicit PanelCalloutWidget(Window* container) : background_(nullptr) {
InitWidget(container);
}
// Updates the bounds based on the shelf alignment.
void UpdateBounds(Shelf* shelf) {
Window* window = this->GetNativeWindow();
gfx::Rect callout_bounds = window->bounds();
if (shelf->IsHorizontalAlignment()) {
callout_bounds.set_width(kArrowWidth);
callout_bounds.set_height(kArrowHeight);
} else {
callout_bounds.set_width(kArrowHeight);
callout_bounds.set_height(kArrowWidth);
}
Window* parent = window->parent();
// It's important this go through Window and not Widget. Going through
// Widget means it may move do a different screen, we don't want that.
window->SetBounds(callout_bounds);
// Setting the bounds should not trigger changing the parent.
DCHECK_EQ(parent, window->parent());
if (background_->alignment() != shelf->alignment()) {
background_->set_alignment(shelf->alignment());
SchedulePaintInRect(gfx::Rect(callout_bounds.size()));
}
}
private:
void InitWidget(Window* parent) {
views::Widget::InitParams params;
params.type = views::Widget::InitParams::TYPE_POPUP;
params.opacity = views::Widget::InitParams::TRANSLUCENT_WINDOW;
params.keep_on_top = true;
params.ownership = views::Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET;
::wm::ConvertRectToScreen(parent, ¶ms.bounds);
params.bounds.set_width(kArrowWidth);
params.bounds.set_height(kArrowHeight);
params.accept_events = false;
params.parent = parent;
set_focus_on_creation(false);
Init(params);
Window* widget_window = this->GetNativeWindow();
DCHECK_EQ(widget_window->GetRootWindow(), parent->GetRootWindow());
views::View* content_view = new views::View;
background_ = new CalloutWidgetBackground;
content_view->SetBackground(
std::unique_ptr<views::Background>(background_));
SetContentsView(content_view);
widget_window->layer()->SetOpacity(0);
}
// Weak pointer owned by this widget's content view.
CalloutWidgetBackground* background_;
DISALLOW_COPY_AND_ASSIGN(PanelCalloutWidget);
};
views::Widget* PanelLayoutManager::PanelInfo::CalloutWidget() {
return callout_widget;
}
////////////////////////////////////////////////////////////////////////////////
// PanelLayoutManager public implementation:
PanelLayoutManager::PanelLayoutManager(Window* panel_container)
: panel_container_(panel_container),
root_window_controller_(RootWindowController::ForWindow(panel_container)),
in_add_window_(false),
in_layout_(false),
show_callout_widgets_(true),
dragged_panel_(nullptr),
shelf_(nullptr),
last_active_panel_(nullptr),
weak_factory_(this) {
DCHECK(panel_container);
Shell::Get()->activation_client()->AddObserver(this);
Shell::Get()->window_tree_host_manager()->AddObserver(this);
Shell::Get()->AddShellObserver(this);
}
PanelLayoutManager::~PanelLayoutManager() {
Shutdown();
}
// static
PanelLayoutManager* PanelLayoutManager::Get(Window* window) {
if (!window)
return nullptr;
return static_cast<PanelLayoutManager*>(
window->GetRootWindow()
->GetChildById(kShellWindowId_PanelContainer)
->layout_manager());
}
void PanelLayoutManager::Shutdown() {
if (shelf_) {
shelf_->RemoveObserver(this);
shelf_ = nullptr;
}
for (PanelList::iterator iter = panel_windows_.begin();
iter != panel_windows_.end(); ++iter) {
delete iter->callout_widget;
}
panel_windows_.clear();
Shell::Get()->activation_client()->RemoveObserver(this);
Shell::Get()->window_tree_host_manager()->RemoveObserver(this);
Shell::Get()->RemoveShellObserver(this);
}
void PanelLayoutManager::StartDragging(Window* panel) {
DCHECK(!dragged_panel_);
dragged_panel_ = panel;
Relayout();
}
void PanelLayoutManager::FinishDragging() {
dragged_panel_ = nullptr;
Relayout();
}
void PanelLayoutManager::SetShelf(Shelf* shelf) {
DCHECK(!shelf_);
shelf_ = shelf;
shelf_->AddObserver(this);
WillChangeVisibilityState(shelf_->GetVisibilityState());
}
void PanelLayoutManager::ToggleMinimize(Window* panel) {
DCHECK(panel->parent() == panel_container_);
wm::WindowState* window_state = wm::GetWindowState(panel);
if (window_state->IsMinimized())
window_state->Restore();
else
window_state->Minimize();
}
void PanelLayoutManager::SetShowCalloutWidgets(bool show) {
if (show_callout_widgets_ == show)
return;
show_callout_widgets_ = show;
UpdateCallouts();
}
views::Widget* PanelLayoutManager::GetCalloutWidgetForPanel(Window* panel) {
DCHECK(panel->parent() == panel_container_);
PanelList::iterator found =
std::find(panel_windows_.begin(), panel_windows_.end(), panel);
DCHECK(found != panel_windows_.end());
return found->callout_widget;
}
////////////////////////////////////////////////////////////////////////////////
// PanelLayoutManager, aura::LayoutManager implementation:
void PanelLayoutManager::OnWindowResized() {
Relayout();
}
void PanelLayoutManager::OnWindowAddedToLayout(Window* child) {
if (child->type() == aura::client::WINDOW_TYPE_POPUP)
return;
if (in_add_window_)
return;
base::AutoReset<bool> auto_reset_in_add_window(&in_add_window_, true);
if (!child->GetProperty(kPanelAttachedKey)) {
// This should only happen when a window is added to panel container as a
// result of bounds change from within the application during a drag.
// If so we have already stopped the drag and should reparent the panel
// back to appropriate container and ignore it.
// TODO(varkha): Updating bounds during a drag can cause problems and a more
// general solution is needed. See http://crbug.com/251813 .
Window* old_parent = child->parent();
aura::client::ParentWindowWithContext(
child, child, child->GetRootWindow()->GetBoundsInScreen());
wm::ReparentTransientChildrenOfChild(child, old_parent, child->parent());
DCHECK(child->parent()->id() != kShellWindowId_PanelContainer);
return;
}
PanelInfo panel_info;
panel_info.window = child;
panel_info.callout_widget = new PanelCalloutWidget(panel_container_);
panel_info.slide_in = child != dragged_panel_;
panel_windows_.push_back(panel_info);
child->AddObserver(this);
wm::GetWindowState(child)->AddObserver(this);
Relayout();
}
void PanelLayoutManager::OnWillRemoveWindowFromLayout(Window* child) {}
void PanelLayoutManager::OnWindowRemovedFromLayout(Window* child) {
if (child->type() == aura::client::WINDOW_TYPE_POPUP)
return;
PanelList::iterator found =
std::find(panel_windows_.begin(), panel_windows_.end(), child);
if (found != panel_windows_.end()) {
delete found->callout_widget;
panel_windows_.erase(found);
}
if (restore_windows_on_shelf_visible_)
restore_windows_on_shelf_visible_->Remove(child);
child->RemoveObserver(this);
wm::GetWindowState(child)->RemoveObserver(this);
if (dragged_panel_ == child)
dragged_panel_ = nullptr;
if (last_active_panel_ == child)
last_active_panel_ = nullptr;
Relayout();
}
void PanelLayoutManager::OnChildWindowVisibilityChanged(Window* child,
bool visible) {
if (visible)
wm::GetWindowState(child)->Restore();
Relayout();
}
void PanelLayoutManager::SetChildBounds(Window* child,
const gfx::Rect& requested_bounds) {
gfx::Rect bounds(requested_bounds);
const gfx::Rect& max_bounds = panel_container_->GetRootWindow()->bounds();
const int max_width = max_bounds.width() * kMaxWidthFactor;
const int max_height = max_bounds.height() * kMaxHeightFactor;
if (bounds.width() > max_width)
bounds.set_width(max_width);
if (bounds.height() > max_height)
bounds.set_height(max_height);
// Reposition dragged panel in the panel order.
if (dragged_panel_ == child) {
PanelList::iterator dragged_panel_iter =
std::find(panel_windows_.begin(), panel_windows_.end(), dragged_panel_);
DCHECK(dragged_panel_iter != panel_windows_.end());
PanelList::iterator new_position;
for (new_position = panel_windows_.begin();
new_position != panel_windows_.end(); ++new_position) {
const gfx::Rect& bounds = (*new_position).window->bounds();
if (bounds.x() + bounds.width() / 2 <= requested_bounds.x())
break;
}
if (new_position != dragged_panel_iter) {
PanelInfo dragged_panel_info = *dragged_panel_iter;
panel_windows_.erase(dragged_panel_iter);
panel_windows_.insert(new_position, dragged_panel_info);
}
}
// Respect the minimum size of the window.
if (child->delegate()) {
const gfx::Size min_size = child->delegate()->GetMinimumSize();
bounds.set_width(std::max(min_size.width(), bounds.width()));
bounds.set_height(std::max(min_size.height(), bounds.height()));
}
SetChildBoundsDirect(child, bounds);
wm::SnapWindowToPixelBoundary(child);
Relayout();
}
////////////////////////////////////////////////////////////////////////////////
// PanelLayoutManager, ShellObserver implementation:
void PanelLayoutManager::OnOverviewModeEnded() {
Relayout();
}
void PanelLayoutManager::OnShelfAlignmentChanged(aura::Window* root_window) {
if (root_window_controller_->GetRootWindow() == root_window)
Relayout();
}
/////////////////////////////////////////////////////////////////////////////
// PanelLayoutManager, WindowObserver implementation:
void PanelLayoutManager::OnWindowPropertyChanged(Window* window,
const void* key,
intptr_t old) {
// Trigger a relayout to position the panels whenever the panel icon is set
// or changes.
if (key == kShelfIDKey)
Relayout();
}
/////////////////////////////////////////////////////////////////////////////
// PanelLayoutManager, WindowStateObserver implementation:
void PanelLayoutManager::OnPostWindowStateTypeChange(
wm::WindowState* window_state,
mojom::WindowStateType old_type) {
// If the shelf is currently hidden then windows will not actually be shown
// but the set to restore when the shelf becomes visible is updated.
if (restore_windows_on_shelf_visible_) {
if (window_state->IsMinimized()) {
MinimizePanel(window_state->window());
restore_windows_on_shelf_visible_->Remove(window_state->window());
} else {
restore_windows_on_shelf_visible_->Add(window_state->window());
}
return;
}
if (window_state->IsMinimized())
MinimizePanel(window_state->window());
else
RestorePanel(window_state->window());
}
////////////////////////////////////////////////////////////////////////////////
// PanelLayoutManager, wm::ActivationChangeObserver implementation:
void PanelLayoutManager::OnWindowActivated(ActivationReason reason,
Window* gained_active,
Window* lost_active) {
// Ignore if the panel that is not managed by this was activated.
if (gained_active &&
gained_active->type() == aura::client::WINDOW_TYPE_PANEL &&
gained_active->parent() == panel_container_) {
UpdateStacking(gained_active);
UpdateCallouts();
}
}
////////////////////////////////////////////////////////////////////////////////
// PanelLayoutManager, WindowTreeHostManager::Observer implementation:
void PanelLayoutManager::OnDisplayConfigurationChanged() {
Relayout();
}
////////////////////////////////////////////////////////////////////////////////
// PanelLayoutManager, ShelfLayoutManagerObserver implementation:
void PanelLayoutManager::WillChangeVisibilityState(
ShelfVisibilityState new_state) {
// On entering / leaving full screen mode the shelf visibility state is
// changed to / from SHELF_HIDDEN. In this state, panel windows should hide
// to allow the full-screen application to use the full screen.
bool shelf_hidden = new_state == ash::SHELF_HIDDEN;
if (!shelf_hidden) {
if (restore_windows_on_shelf_visible_) {
std::unique_ptr<aura::WindowTracker> restore_windows(
std::move(restore_windows_on_shelf_visible_));
for (Window* window : restore_windows->windows())
RestorePanel(window);
}
return;
}
if (restore_windows_on_shelf_visible_)
return;
std::unique_ptr<aura::WindowTracker> minimized_windows(
new aura::WindowTracker);
for (PanelList::iterator iter = panel_windows_.begin();
iter != panel_windows_.end();) {
Window* window = iter->window;
// Minimizing a panel window may remove it from the panel_windows_ list.
// Advance the iterator before minimizing it: http://crbug.com/393047.
++iter;
if (window != dragged_panel_ && window->IsVisible()) {
minimized_windows->Add(window);
wm::GetWindowState(window)->Minimize();
}
}
restore_windows_on_shelf_visible_ = std::move(minimized_windows);
}
void PanelLayoutManager::OnShelfIconPositionsChanged() {
// TODO: As this is called for every animation step now. Relayout needs to be
// updated to use current icon position instead of use the ideal bounds so
// that the panels slide with their icons instead of jumping.
Relayout();
}
////////////////////////////////////////////////////////////////////////////////
// PanelLayoutManager private implementation:
void PanelLayoutManager::MinimizePanel(Window* panel) {
// Clusterfuzz can trigger panel accelerators before the shelf is created.
// TODO(jamescook): Revert this after http://crbug.com/648964 is fixed.
if (!shelf_)
return;
::wm::SetWindowVisibilityAnimationType(
panel, wm::WINDOW_VISIBILITY_ANIMATION_TYPE_MINIMIZE);
ui::Layer* layer = panel->layer();
ui::ScopedLayerAnimationSettings panel_slide_settings(layer->GetAnimator());
panel_slide_settings.SetPreemptionStrategy(
ui::LayerAnimator::IMMEDIATELY_ANIMATE_TO_NEW_TARGET);
panel_slide_settings.SetTransitionDuration(
base::TimeDelta::FromMilliseconds(kPanelSlideDurationMilliseconds));
gfx::Rect bounds(panel->bounds());
bounds.Offset(GetSlideInAnimationOffset(shelf_->alignment()));
SetChildBoundsDirect(panel, bounds);
panel->Hide();
layer->SetOpacity(0);
if (::wm::IsActiveWindow(panel))
::wm::DeactivateWindow(panel);
Relayout();
}
void PanelLayoutManager::RestorePanel(Window* panel) {
PanelList::iterator found =
std::find(panel_windows_.begin(), panel_windows_.end(), panel);
DCHECK(found != panel_windows_.end());
found->slide_in = true;
Relayout();
}
void PanelLayoutManager::Relayout() {
if (!shelf_ || !shelf_->GetWindow())
return;
// Suppress layouts during overview mode because changing window bounds
// interfered with overview mode animations. However, layouts need to be done
// when the WindowSelectorController is restoring minimized windows so that
// they actually become visible.
WindowSelectorController* window_selector_controller =
Shell::Get()->window_selector_controller();
if (in_layout_ ||
(window_selector_controller->IsSelecting() &&
!window_selector_controller->IsRestoringMinimizedWindows())) {
return;
}
base::AutoReset<bool> auto_reset_in_layout(&in_layout_, true);
const bool horizontal = shelf_->IsHorizontalAlignment();
gfx::Rect shelf_bounds = shelf_->GetWindow()->GetBoundsInScreen();
::wm::ConvertRectFromScreen(panel_container_, &shelf_bounds);
int panel_start_bounds = kPanelIdealSpacing;
int panel_end_bounds =
horizontal ? panel_container_->bounds().width() - kPanelIdealSpacing
: panel_container_->bounds().height() - kPanelIdealSpacing;
Window* active_panel = nullptr;
std::vector<VisiblePanelPositionInfo> visible_panels;
for (PanelList::iterator iter = panel_windows_.begin();
iter != panel_windows_.end(); ++iter) {
Window* panel = iter->window;
iter->callout_widget->UpdateBounds(shelf_);
// Consider the dragged panel as part of the layout as long as it is
// touching the shelf.
if ((!panel->IsVisible() && !iter->slide_in) ||
(panel == dragged_panel_ &&
!BoundsAdjacent(panel->bounds(), shelf_bounds))) {
continue;
}
// If the shelf is currently hidden (full-screen mode), minimize panel until
// full-screen mode is exited. When a panel is dragged from another display
// the shelf state does not update before the panel is added so we exclude
// the dragged panel.
if (panel != dragged_panel_ && restore_windows_on_shelf_visible_) {
wm::GetWindowState(panel)->Minimize();
restore_windows_on_shelf_visible_->Add(panel);
continue;
}
gfx::Rect icon_bounds = shelf_->GetScreenBoundsOfItemIconForWindow(panel);
// If both the icon width and height are 0 then there is no icon in the
// shelf. If the shelf is hidden, one of the height or width will be
// 0 but the position in the shelf and major dimension is still reported
// correctly and the panel can be aligned above where the hidden icon is.
if (icon_bounds.width() == 0 && icon_bounds.height() == 0)
continue;
if (panel->HasFocus() || panel->Contains(wm::GetFocusedWindow())) {
DCHECK(!active_panel);
active_panel = panel;
}
::wm::ConvertRectFromScreen(panel_container_, &icon_bounds);
gfx::Point icon_origin = icon_bounds.origin();
VisiblePanelPositionInfo position_info;
int icon_start = horizontal ? icon_origin.x() : icon_origin.y();
int icon_end =
icon_start + (horizontal ? icon_bounds.width() : icon_bounds.height());
position_info.major_length =
horizontal ? panel->bounds().width() : panel->bounds().height();
position_info.min_major =
std::max(panel_start_bounds + position_info.major_length / 2,
icon_end - position_info.major_length / 2);
position_info.max_major =
std::min(icon_start + position_info.major_length / 2,
panel_end_bounds - position_info.major_length / 2);
position_info.major_pos = (icon_start + icon_end) / 2;
position_info.window = panel;
position_info.slide_in = iter->slide_in;
iter->slide_in = false;
visible_panels.push_back(position_info);
}
// Sort panels by their X positions and fan out groups of overlapping panels.
// The fan out method may result in new overlapping panels however given that
// the panels start at least a full panel width apart this overlap will
// never completely obscure a panel.
// TODO(flackr): Rearrange panels if new overlaps are introduced.
std::sort(visible_panels.begin(), visible_panels.end(), CompareWindowMajor);
size_t first_overlapping_panel = 0;
for (size_t i = 1; i < visible_panels.size(); ++i) {
if (visible_panels[i - 1].major_pos +
visible_panels[i - 1].major_length / 2 <
visible_panels[i].major_pos - visible_panels[i].major_length / 2) {
FanOutPanels(visible_panels.begin() + first_overlapping_panel,
visible_panels.begin() + i);
first_overlapping_panel = i;
}
}
FanOutPanels(visible_panels.begin() + first_overlapping_panel,
visible_panels.end());
for (size_t i = 0; i < visible_panels.size(); ++i) {
if (visible_panels[i].window == dragged_panel_)
continue;
bool slide_in = visible_panels[i].slide_in;
gfx::Rect bounds = visible_panels[i].window->GetTargetBounds();
if (shelf_->alignment() == SHELF_ALIGNMENT_LEFT)
bounds.set_x(shelf_bounds.right());
else if (shelf_->alignment() == SHELF_ALIGNMENT_RIGHT)
bounds.set_x(shelf_bounds.x() - bounds.width());
else
bounds.set_y(shelf_bounds.y() - bounds.height());
bool on_shelf = visible_panels[i].window->GetTargetBounds() == bounds;
if (horizontal) {
bounds.set_x(visible_panels[i].major_pos -
visible_panels[i].major_length / 2);
} else {
bounds.set_y(visible_panels[i].major_pos -
visible_panels[i].major_length / 2);
}
ui::Layer* layer = visible_panels[i].window->layer();
if (slide_in) {
// New windows shift up from the shelf into position and fade in.
layer->SetOpacity(0);
gfx::Rect initial_bounds(bounds);
initial_bounds.Offset(GetSlideInAnimationOffset(shelf_->alignment()));
SetChildBoundsDirect(visible_panels[i].window, initial_bounds);
// Set on shelf so that the panel animates into its target position.
on_shelf = true;
}
if (on_shelf) {
ui::ScopedLayerAnimationSettings panel_slide_settings(
layer->GetAnimator());
panel_slide_settings.SetPreemptionStrategy(
ui::LayerAnimator::IMMEDIATELY_ANIMATE_TO_NEW_TARGET);
panel_slide_settings.SetTransitionDuration(
base::TimeDelta::FromMilliseconds(kPanelSlideDurationMilliseconds));
SetChildBoundsDirect(visible_panels[i].window, bounds);
if (slide_in) {
layer->SetOpacity(1);
visible_panels[i].window->Show();
}
} else {
// If the shelf moved don't animate, move immediately to the new
// target location.
SetChildBoundsDirect(visible_panels[i].window, bounds);
}
}
UpdateStacking(active_panel);
UpdateCallouts();
}
void PanelLayoutManager::UpdateStacking(Window* active_panel) {
// Clusterfuzz can trigger panel accelerators before the shelf is created.
// TODO(jamescook): Revert this after http://crbug.com/648964 is fixed.
if (!shelf_)
return;
if (!active_panel) {
if (!last_active_panel_)
return;
active_panel = last_active_panel_;
}
// We want to to stack the panels like a deck of cards:
// ,--,--,--,-------.--.--.
// | | | | | | |
// | | | | | | |
//
// We use the middle of each panel to figure out how to stack the panels. This
// allows us to update the stacking when a panel is being dragged around by
// the titlebar--even though it doesn't update the shelf icon positions, we
// still want the visual effect.
std::map<int, Window*> window_ordering;
const bool horizontal = shelf_->IsHorizontalAlignment();
for (PanelList::const_iterator it = panel_windows_.begin();
it != panel_windows_.end(); ++it) {
const gfx::Rect& bounds = it->window->bounds();
window_ordering.insert(
std::make_pair(horizontal ? bounds.x() + bounds.width() / 2
: bounds.y() + bounds.height() / 2,
it->window));
}
Window* previous_panel = nullptr;
for (std::map<int, Window*>::const_iterator it = window_ordering.begin();
it != window_ordering.end() && it->second != active_panel; ++it) {
if (previous_panel)
panel_container_->StackChildAbove(it->second, previous_panel);
previous_panel = it->second;
}
previous_panel = nullptr;
for (std::map<int, Window*>::const_reverse_iterator it =
window_ordering.rbegin();
it != window_ordering.rend() && it->second != active_panel; ++it) {
if (previous_panel)
panel_container_->StackChildAbove(it->second, previous_panel);
previous_panel = it->second;
}
panel_container_->StackChildAtTop(active_panel);
if (dragged_panel_ && dragged_panel_->parent() == panel_container_)
panel_container_->StackChildAtTop(dragged_panel_);
last_active_panel_ = active_panel;
}
void PanelLayoutManager::UpdateCallouts() {
// Clusterfuzz can trigger panel accelerators before the shelf is created.
// TODO(jamescook): Revert this after http://crbug.com/648964 is fixed.
if (!shelf_)
return;
const bool horizontal = shelf_->IsHorizontalAlignment();
for (PanelList::iterator iter = panel_windows_.begin();
iter != panel_windows_.end(); ++iter) {
Window* panel = iter->window;
views::Widget* callout_widget = iter->callout_widget;
Window* callout_widget_window = callout_widget->GetNativeWindow();
gfx::Rect current_bounds = panel->GetBoundsInScreen();
gfx::Rect bounds = panel->GetTargetBounds();
::wm::ConvertRectToScreen(panel->parent(), &bounds);
gfx::Rect icon_bounds = shelf_->GetScreenBoundsOfItemIconForWindow(panel);
if (icon_bounds.IsEmpty() || !panel->layer()->GetTargetVisibility() ||
panel == dragged_panel_ || !show_callout_widgets_) {
callout_widget->Hide();
callout_widget_window->layer()->SetOpacity(0);
continue;
}
gfx::Rect callout_bounds = callout_widget->GetWindowBoundsInScreen();
gfx::Vector2d slide_vector = bounds.origin() - current_bounds.origin();
int slide_distance = horizontal ? slide_vector.x() : slide_vector.y();
int distance_until_over_panel = 0;
if (horizontal) {
callout_bounds.set_x(icon_bounds.x() +
(icon_bounds.width() - callout_bounds.width()) / 2);
distance_until_over_panel =
std::max(current_bounds.x() - callout_bounds.x(),
callout_bounds.right() - current_bounds.right());
} else {
callout_bounds.set_y(icon_bounds.y() +
(icon_bounds.height() - callout_bounds.height()) /
2);
distance_until_over_panel =
std::max(current_bounds.y() - callout_bounds.y(),
callout_bounds.bottom() - current_bounds.bottom());
}
if (shelf_->alignment() == SHELF_ALIGNMENT_LEFT)
callout_bounds.set_x(bounds.x() - callout_bounds.width());
else if (shelf_->alignment() == SHELF_ALIGNMENT_RIGHT)
callout_bounds.set_x(bounds.right());
else
callout_bounds.set_y(bounds.bottom());
::wm::ConvertRectFromScreen(callout_widget_window->parent(),
&callout_bounds);
SetChildBoundsDirect(callout_widget_window, callout_bounds);
DCHECK_EQ(panel_container_, callout_widget_window->parent());
DCHECK_EQ(panel_container_, panel->parent());
panel_container_->StackChildAbove(callout_widget_window, panel);
ui::Layer* layer = callout_widget_window->layer();
// If the panel is not over the callout position or has just become visible
// then fade in the callout.
if ((distance_until_over_panel > 0 || layer->GetTargetOpacity() < 1)) {
if (distance_until_over_panel > 0 &&
slide_distance >= distance_until_over_panel) {
// If the panel is not yet over the callout, then delay fading in
// the callout until after the panel should be over it.
int delay = kPanelSlideDurationMilliseconds *
distance_until_over_panel / slide_distance;
layer->SetOpacity(0);
layer->GetAnimator()->StopAnimating();
layer->GetAnimator()->SchedulePauseForProperties(
base::TimeDelta::FromMilliseconds(delay),
ui::LayerAnimationElement::OPACITY);
}
ui::ScopedLayerAnimationSettings callout_settings(layer->GetAnimator());
callout_settings.SetPreemptionStrategy(
ui::LayerAnimator::REPLACE_QUEUED_ANIMATIONS);
callout_settings.SetTransitionDuration(
base::TimeDelta::FromMilliseconds(kCalloutFadeDurationMilliseconds));
layer->SetOpacity(1);
}
// Show after changing the opacity animation. This way we don't have a
// state where the widget is visible but the opacity is 0.
callout_widget->Show();
}
}
////////////////////////////////////////////////////////////////////////////////
// keyboard::KeyboardControllerObserver implementation:
void PanelLayoutManager::OnKeyboardWorkspaceOccludedBoundsChanged(
const gfx::Rect& keyboard_bounds) {
const gfx::Rect& parent_bounds = panel_container_->bounds();
int available_space = parent_bounds.height() - keyboard_bounds.height();
for (PanelList::iterator iter = panel_windows_.begin();
iter != panel_windows_.end(); ++iter) {
Window* panel = iter->window;
wm::WindowState* panel_state = wm::GetWindowState(panel);
if (keyboard_bounds.height() > 0) {
// Save existing bounds, so that we can restore them when the keyboard
// hides.
panel_state->SaveCurrentBoundsForRestore();
gfx::Rect panel_bounds = panel->GetTargetBounds();
::wm::ConvertRectToScreen(panel->parent(), &panel_bounds);
int delta = panel_bounds.height() - available_space;
// Ensure panels are not pushed above the parent boundaries, shrink any
// panels that violate this constraint.
if (delta > 0) {
SetChildBoundsDirect(
panel,
gfx::Rect(panel_bounds.x(), panel_bounds.y() + delta,
panel_bounds.width(), panel_bounds.height() - delta));
}
} else if (panel_state->HasRestoreBounds()) {
// Keyboard hidden, restore original bounds if they exist.
SetChildBoundsDirect(panel, panel_state->GetRestoreBoundsInScreen());
}
}
// This bounds change will have caused a change to the Shelf which does not
// propagate automatically to this class, so manually recalculate bounds.
OnWindowResized();
}
} // namespace ash
| [
"[email protected]"
] | |
4ae6e855642eef27c507ec0041fcde04c7de0a04 | fc846546fc2da267589a09b82a97d6989986db72 | /INEM.cpp | 8654820602cf65c799d29fbea614e93f14a933a7 | [] | no_license | lborges123/Aeda_Proj1 | 5ebdfdfda1ddba1620b90c108f1ae4b9e631c9a9 | 7f74e0ef393719229c7a86740575d2b7372d850a | refs/heads/master | 2020-03-10T13:57:00.106099 | 2017-11-24T01:05:48 | 2017-11-24T01:05:48 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 930 | cpp | #pragma once
#include "PostosDeSocorro.h"
<<<<<<< HEAD
Inem::Inem(int numSocorristas, int numVeiculos, string local, int x, int y, int numAmbulancias, int numCarros, int numMotos) : PostoDeSocorro(numSocorristas, numVeiculos, local, x, y) {
=======
INEM::INEM(){ }
INEM::INEM(int numSocorristas, int numVeiculos, string local, double x, double y, int numAmbulancias, int numCarros, int numMotos) : PostoDeSocorro(numSocorristas, numVeiculos, local, x, y) {
>>>>>>> 439719ca816171d244ce83c6accb3c13c745512d
setNumVeiculos(numCarros + numMotos + numAmbulancias);
this->numMoto = numMotos;
this->numCarro = numCarros;
this->numAmbulancias = numAmbulancias;
}
double INEM::getProximidade(double x, double y) {
double distancia;
double x1 = coord.first;
double y1 = coord.second;
distancia = sqrt(((double)x - (double)x1)*((double)x - (double)x1) + ((double)y - (double)y1)*((double)y - (double)y1));
return distancia;
}
| [
"[email protected]"
] | |
f7e504627d6b7c74c49cce35ad760eba2e9ab545 | 5d83739af703fb400857cecc69aadaf02e07f8d1 | /Archive/9dcd29d55c6876efff4f18838f664706/main.cpp | d257fd8f38e5497f79b59bdd72f7a112117302d4 | [] | no_license | WhiZTiM/coliru | 3a6c4c0bdac566d1aa1c21818118ba70479b0f40 | 2c72c048846c082f943e6c7f9fa8d94aee76979f | refs/heads/master | 2021-01-01T05:10:33.812560 | 2015-08-24T19:09:22 | 2015-08-24T19:09:22 | 56,789,706 | 3 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 419 | cpp | #include <iostream>
constexpr int something_expensive(int x) { return x; }
int process(int x)
{
switch (x)
{
// hard-coded for common cases
case 0: return something_expensive(0);
case 1: return something_expensive(2);
case 2: return something_expensive(2);
// default is non-optimized
default: return something_expensive(x);
};
}
int main()
{
} | [
"francis.rammeloo@36614edc-3e3a-acb8-9062-c8ae0e4185df"
] | francis.rammeloo@36614edc-3e3a-acb8-9062-c8ae0e4185df |
3fea8e6bad03d17a482e9d2db5bf7f25846f5c67 | e38f9db8141282bca7b460892921556dabfbc19c | /qt/tutorial/008/abc.cpp | debfaec6fbfc8f5ead7b0f57b901d39397dd9999 | [] | no_license | ddddfang/my-exercise | 29866672788f7ea695e482eb8c052ee4a9953bed | 0a47d14547d50b6f1c4def78ebe82f2a0a3d3b74 | refs/heads/master | 2021-06-18T05:42:45.636838 | 2021-03-14T09:45:29 | 2021-03-14T09:45:29 | 187,171,975 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 660 | cpp | //#include <QApplication>
//#include <QWidget>
//#include <QIcon>
//#include <QFrame>
//#include <QGridLayout>
//#include <QPushButton>
#include "myWidget.h"
int main(int argc, char *argv[])
{
QApplication app(argc, argv); //qt5 的非console程序,都必须要创建 QApplication 对象
MyWidget window; //使用自己定制的 QWidget,所以这样定制的 QWidget 可以被放到单独的模块里
window.resize(500, 300);
window.move(300, 300);
window.setWindowTitle("simple sample");
window.setWindowIcon(QIcon("icon.png")); //app启动后左侧dock栏会显示这个图标
window.show();
return app.exec();
}
| [
"[email protected]"
] | |
954cc5f1d3a7addedd782b911853e4eaf34b0f06 | f13e48ec88b43167a30927859aa59bc5161e1fa4 | /G1/aula1/main.cpp | 77526a8b22005c9d0e89952defc6f91acf6b6a4f | [] | no_license | alexandrewanick/MAT1303 | 8214bba70a7648b03edfe56d01d15b63c881b89f | b4b4e802db1d53986d8f63fa59db3899ea986a89 | refs/heads/master | 2020-03-09T13:55:59.692841 | 2018-07-07T15:24:25 | 2018-07-07T15:24:25 | 128,822,930 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 586 | cpp | #include <iostream>
using namespace std; // std determina comandos cout e endl como standard
int main(void)
{
int a, f;
a = 2;
if (a > 3) {
f = 2 + a;
cout << a << endl;
} else {
f = 4;
a = 3;
}
for (int i = 1; i < 5; i++) {
int v = 8; // variável i e variável v só existem no for
cout << v << endl;
}
cout << " a = " << a << endl;
cout << " Mensagem teste " << endl; // seria a mesma coisa do que com std::cout e std::endl se não houvesse o comando "using namespace std;"
}
// cout = saída de dados
// << = redireciona para
// endl = pula uma linha
| [
"[email protected]"
] | |
1f70f5b6ecb06ab09ed306a0a99353574897d8f0 | d0c44dd3da2ef8c0ff835982a437946cbf4d2940 | /cmake-build-debug/programs_tiling/function14689/function14689_schedule_14/function14689_schedule_14_wrapper.cpp | 19a9f17f2b23116a4317b772697ede7ee91a3081 | [] | no_license | IsraMekki/tiramisu_code_generator | 8b3f1d63cff62ba9f5242c019058d5a3119184a3 | 5a259d8e244af452e5301126683fa4320c2047a3 | refs/heads/master | 2020-04-29T17:27:57.987172 | 2019-04-23T16:50:32 | 2019-04-23T16:50:32 | 176,297,755 | 1 | 2 | null | null | null | null | UTF-8 | C++ | false | false | 933 | cpp | #include "Halide.h"
#include "function14689_schedule_14_wrapper.h"
#include "tiramisu/utils.h"
#include <cstdlib>
#include <iostream>
#include <time.h>
#include <fstream>
#include <chrono>
#define MAX_RAND 200
int main(int, char **){
Halide::Buffer<int32_t> buf00(128, 64, 64);
Halide::Buffer<int32_t> buf0(64, 128, 64, 64);
init_buffer(buf0, (int32_t)0);
auto t1 = std::chrono::high_resolution_clock::now();
function14689_schedule_14(buf00.raw_buffer(), buf0.raw_buffer());
auto t2 = std::chrono::high_resolution_clock::now();
std::chrono::duration<double> diff = t2 - t1;
std::ofstream exec_times_file;
exec_times_file.open("../data/programs/function14689/function14689_schedule_14/exec_times.txt", std::ios_base::app);
if (exec_times_file.is_open()){
exec_times_file << diff.count() * 1000000 << "us" <<std::endl;
exec_times_file.close();
}
return 0;
} | [
"[email protected]"
] | |
2e27af67bfb344792306c39005cbadef93198549 | cfd82be1fcb1bb873b1d1053579564a224813f93 | /mytest/CStringTest/PlaneFitting/Plane.h | 0fa7e81e21935452a4b32f90a65eff3fede37414 | [] | no_license | tangqinxin/qtdemo | 2d6ad1715c078290c488af852e32418f6e083719 | 91952a48e2d6bea5e5c6f7df2bfbba9868e3512b | refs/heads/master | 2020-12-11T06:57:42.990667 | 2020-09-16T11:16:45 | 2020-09-16T11:16:45 | 233,793,193 | 0 | 0 | null | null | null | null | GB18030 | C++ | false | false | 1,587 | h | #ifndef PLANE_H
#define PLANE_H
#include <opencv2\imgproc.hpp>
#include <opencv2\calib3d.hpp>
#include <opencv2\highgui.hpp>
#include<iostream>
#include <vector>
#include<math.h>
#include"myfun.h"
#include<fstream>
using namespace cv;
class LaserPlane {
private:
typedef struct {
//Z=a0*X+a1*Y+a2;
double a0;
double a1;
double a2;
}PlaneCoeffs;
typedef struct {
double kx;
double ky;
double kz;
Point3f PassPt;
}Line;
Line BaseLine;
PlaneCoeffs PCoeffs;
public:
LaserPlane();
~LaserPlane();
void PlaneFitting(vector<Point3f> &PointsCameraCoordinate);//利用三维点云集合进行拟合平面
void CleanCoeffs();//清空激光平面的系数
void ComputeImgPtOnPlane(Mat& M,vector<Point2f>& ImgPtSet,vector<Point3f>& PtsInCamera);//输入相机内参,像素坐标点集,输出他们在相机坐标系下的三维坐标
void SetBaseLine(Mat& M, vector<Point2f>& BaseLineImgPtSet);//设定一条基准线作为参考坐标
void SetBaseLineWith3DPts(vector<Point3f>& PtsInCamera);//利用空间中的三维点云坐标设置基线
float PointToBaseLine(Point3f& Pt);//计算单点Pt到基线的距离
void ComputePtDistToBaseLine(vector<Point3f>& PtSet, vector<float>& DistIn3D);//计算空间中的点集到直线的距离
void DisplayCoeffs();//打印平面参数
void DisplayBaseLine();//打印baseline的信息
float NormPoint3f(Point3f& vec);//计算向量的距离
void SetBaseLineParams(float _kx, float _ky, float _kz, Point3f& pt);//人为设定基线参数
void SavePlaneParams();//保存激光平面参数
};
#endif // ! PLANE_H
| [
"[email protected]"
] | |
64f839e7e53aa23859ebe376d62d83319935257b | 497efc69490194306a7260592a645e977a4bcd60 | /2012/assignment_1/code/src/basis/App.cpp | 1a1d382839c2f581433f912acf62a3b351ca4e78 | [] | no_license | Zerphed/computer-graphics-course | def0e15aabdec3d95938ea580d05daec9f572113 | 6d6a10a5a5de5b814fb43c5ff0cf5f4904ef6fd0 | refs/heads/master | 2021-03-12T21:19:44.899407 | 2014-01-16T21:37:36 | 2014-01-16T21:37:36 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 14,223 | cpp | #define _USE_MATH_DEFINES
#include "App.hpp"
#include "base/Main.hpp"
#include "gpu/GLContext.hpp"
#include "io/File.hpp"
#include "io/StateDump.hpp"
#include "base/Random.hpp"
#include "gui/Image.hpp"
#include "extra.h"
#include "surf.h"
#include "parse.h"
#include <stdio.h>
#include <conio.h>
#include <vector>
#include <fstream>
#include <sstream>
#include <iostream>
#include <GL/GLU.h>
using namespace FW;
using namespace std;
//------------------------------------------------------------------------
App::App(void)
: m_action (Action_None),
m_commonCtrl (CommonControls::Feature_Default & ~CommonControls::Feature_RepaintOnF5),
m_cullMode (CullMode_None),
m_mousePressed (false),
m_curveMode (CurveMode_Draw),
m_surfaceMode (SurfaceMode_Draw),
m_pointMode (PointMode_True),
m_lineLen (0.1f)
{
m_commonCtrl.showFPS(true);
m_commonCtrl.addButton((S32*)&m_action, Action_LoadSWP, FW_KEY_L, "Load SWP... (L)");
m_commonCtrl.addButton((S32*)&m_action, Action_ResetView, FW_KEY_SPACE, "Reset view... (SPACE)");
m_commonCtrl.addButton((S32*)&m_action, Action_WriteOBJ, FW_KEY_O, "Write to .obj (O)");
m_commonCtrl.addSeparator();
m_commonCtrl.addToggle((S32*)&m_curveMode, CurveMode_None, FW_KEY_NONE, "Don't draw curve");
m_commonCtrl.addToggle((S32*)&m_curveMode, CurveMode_Draw, FW_KEY_NONE, "Draw curve");
m_commonCtrl.addToggle((S32*)&m_curveMode, CurveMode_Normals, FW_KEY_NONE, "Draw normals");
m_commonCtrl.addSeparator();
m_commonCtrl.addToggle((S32*)&m_surfaceMode, SurfaceMode_None, FW_KEY_NONE, "Don't draw surface");
m_commonCtrl.addToggle((S32*)&m_surfaceMode, SurfaceMode_Draw, FW_KEY_NONE, "Draw surface");
m_commonCtrl.addToggle((S32*)&m_surfaceMode, SurfaceMode_WireFrame, FW_KEY_NONE, "Draw wireframe");
m_commonCtrl.addSeparator();
m_commonCtrl.addToggle((S32*)&m_pointMode, PointMode_False, FW_KEY_NONE, "Don't draw control points");
m_commonCtrl.addToggle((S32*)&m_pointMode, PointMode_True, FW_KEY_NONE, "Draw control points");
m_commonCtrl.addSeparator();
m_window.setTitle("basis");
m_window.addListener(this);
m_window.addListener(&m_commonCtrl);
m_window.getGL()->swapBuffers();
initRendering();
m_camera.SetDimensions(600, 600);
m_camera.SetDistance(10);
m_camera.SetCenter(Vec3f(0, 0, 0));
}
//------------------------------------------------------------------------
App::~App(void)
{}
//------------------------------------------------------------------------
bool App::handleEvent(const Window::Event& ev)
{
if (ev.type == Window::EventType_Close)
{
m_window.showModalMessage("Exiting...");
delete this;
return true;
}
if (ev.type == Window::EventType_KeyDown)
{
keyDownFunc(ev);
}
if (ev.type == Window::EventType_KeyUp)
{
keyUpFunc(ev);
}
if (ev.type == Window::EventType_Mouse)
{
motionFunc(ev);
}
Action action = m_action;
m_action = Action_None;
String name;
Mat4f eye;
eye.setIdentity();
switch (action)
{
case Action_None:
break;
case Action_LoadSWP:
name = m_window.showFileLoadDialog("Load");
if (name.getLength())
loadObjects(name.getPtr());
makeDisplayLists();
break;
case Action_ResetView:
m_camera.SetRotation(eye);
m_camera.SetCenter(Vec3f(0,0,0));
break;
case Action_WriteOBJ:
for (unsigned i=0; i<n_surfaceNames.size(); i++)
{
string filename = "surface_" + n_surfaceNames[i] + string(".obj");
ofstream out(filename.c_str());
if (!out)
{
m_commonCtrl.message(sprintf("Could not open file %s, skipping", filename.c_str()));
out.close();
continue;
}
else
{
outputObjFile(out, m_surfaces[i]);
m_commonCtrl.message(sprintf("Wrote %s", filename.c_str()));
}
}
break;
default:
FW_ASSERT(false);
break;
}
m_window.setVisible(true);
if (ev.type == Window::EventType_Paint)
{
drawScene();
}
m_window.repaint();
return false;
}
//------------------------------------------------------------------------
void App::keyDownFunc(const Window::Event& ev)
{
int x = ev.mousePos[0];
int y = ev.mousePos[1];
if (ev.key == FW_KEY_MOUSE_LEFT)
{
m_mousePressed = true;
m_camera.MouseClick(Camera::LEFT, x, y);
}
else if (ev.key == FW_KEY_MOUSE_MIDDLE)
{
m_mousePressed = true;
m_camera.MouseClick(Camera::MIDDLE, x, y);
}
else if (ev.key == FW_KEY_MOUSE_RIGHT)
{
m_mousePressed = true;
m_camera.MouseClick(Camera::RIGHT, x, y);
}
}
//------------------------------------------------------------------------
void App::keyUpFunc(const Window::Event& ev)
{
int x = ev.mousePos[0];
int y = ev.mousePos[1];
if (ev.key == FW_KEY_MOUSE_LEFT || ev.key == FW_KEY_MOUSE_MIDDLE || ev.key == FW_KEY_MOUSE_RIGHT)
{
m_camera.MouseRelease(x,y);
m_mousePressed = false;
}
}
//------------------------------------------------------------------------
// Called when mouse is moved.
void App::motionFunc(const Window::Event& ev)
{
if (m_mousePressed)
{
int x = ev.mousePos[0];
int y = ev.mousePos[1];
m_camera.MouseDrag(x,y);
}
}
//------------------------------------------------------------------------
// Called when the window is resized
// w, h - width and height of the window in pixels.
void App::reshapeFunc(int w, int h)
{
m_camera.SetDimensions(w,h);
m_camera.SetViewport(0,0,w,h);
m_camera.ApplyViewport();
// Set up a perspective view, with square aspect ratio
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
m_camera.SetPerspective(50);
m_camera.ApplyPerspective();
}
//------------------------------------------------------------------------
// This function is responsible for displaying the object.
void App::drawScene(void)
{
// Remove any shader that may be in use.
glUseProgram(0);
// Clear the rendering window
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
Vec2i size = m_window.getSize();
reshapeFunc(size[0], size[1]);
glMatrixMode( GL_MODELVIEW );
glLoadIdentity();
// Light color (RGBA)
GLfloat Lt0diff[] = {1.0,1.0,1.0,1.0};
GLfloat Lt0pos[] = {3.0,3.0,5.0,1.0};
glLightfv(GL_LIGHT0, GL_DIFFUSE, Lt0diff);
glLightfv(GL_LIGHT0, GL_POSITION, Lt0pos);
m_camera.ApplyModelview();
// Call the relevant display lists.
if (m_surfaceMode)
glCallList(m_surfaceLists[m_surfaceMode]);
if (m_curveMode)
glCallList(m_curveLists[m_curveMode]);
// This draws the coordinate axes when you're rotating, to
// keep yourself oriented.
if (m_mousePressed)
{
glPushMatrix();
glTranslated(m_camera.GetCenter()[0], m_camera.GetCenter()[1], m_camera.GetCenter()[2]);
glCallList(m_axisList);
glPopMatrix();
}
if (m_pointMode)
glCallList(m_pointList);
}
//------------------------------------------------------------------------
// Initialize OpenGL's rendering modes
void App::initRendering()
{
glEnable(GL_DEPTH_TEST); // Depth testing must be turned on
glEnable(GL_LIGHTING); // Enable lighting calculations
glEnable(GL_LIGHT0); // Turn on light #0.
// Setup polygon drawing
glShadeModel(GL_SMOOTH);
glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
// Antialiasing
// This looks like crap
/*
glEnable(GL_BLEND);
glEnable(GL_POINT_SMOOTH);
glEnable(GL_LINE_SMOOTH);
glHint(GL_POINT_SMOOTH_HINT, GL_NICEST);
glHint(GL_LINE_SMOOTH_HINT, GL_NICEST);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
*/
// Clear to black
glClearColor(0,0,0,1);
// Base material colors (they don't change)
GLfloat diffColor[] = {0.4, 0.4, 0.4, 1};
GLfloat specColor[] = {0.9, 0.9, 0.9, 1};
GLfloat shininess[] = {50.0};
glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE, diffColor);
glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, specColor);
glMaterialfv(GL_FRONT_AND_BACK, GL_SHININESS, shininess);
m_curveLists[1] = glGenLists(1);
m_curveLists[2] = glGenLists(1);
m_surfaceLists[1] = glGenLists(1);
m_surfaceLists[2] = glGenLists(1);
m_axisList = glGenLists(1);
m_pointList = glGenLists(1);
}
//------------------------------------------------------------------------
// Load in objects from standard input into the class member variables:
// m_ctrlPoints, m_curves, m_curveNames, m_surfaces, m_surfaceNames. If
// loading fails, this will exit the program.
void App::loadObjects(const string& fileName)
{
ifstream in(fileName.c_str());
cout << endl << "*** loading and constructing curves and surfaces ***" << endl;
if (!parseFile(in, m_ctrlPoints, m_curves, m_curveNames, m_surfaces, n_surfaceNames))
{
cerr << "\aerror in file format\a" << endl;
in.close();
exit(-1);
}
in.close();
cerr << endl << "*** done ***" << endl;
}
//------------------------------------------------------------------------
void App::writeObjects(const string& fileName)
{
cerr << endl << "*** writing obj files ***" << endl;
string prefix (fileName.c_str());
for (unsigned i=0; i<n_surfaceNames.size(); i++)
{
if (n_surfaceNames[i] != ".")
{
string filename =
prefix + string("_")
+ n_surfaceNames[i]
+ string(".obj");
ofstream out(filename.c_str());
if (!out)
{
cerr << "\acould not open file " << filename << ", skipping"<< endl;
out.close();
continue;
}
else
{
outputObjFile(out, m_surfaces[i]);
cerr << "wrote " << filename.c_str() << endl;
}
}
}
}
//------------------------------------------------------------------------
void App::makeDisplayLists()
{
// Compile the display lists
glNewList(m_curveLists[1], GL_COMPILE);
{
for (unsigned i=0; i<m_curves.size(); i++)
drawCurve(m_curves[i], 0.0);
}
glEndList();
glNewList(m_curveLists[2], GL_COMPILE);
{
for (unsigned i=0; i<m_curves.size(); i++)
drawCurve(m_curves[i], m_lineLen);
}
glEndList();
glNewList(m_surfaceLists[1], GL_COMPILE);
{
for (unsigned i=0; i<m_surfaces.size(); i++)
drawSurface(m_surfaces[i], true);
}
glEndList();
glNewList(m_surfaceLists[2], GL_COMPILE);
{
for (unsigned i=0; i<m_surfaces.size(); i++)
{
drawSurface(m_surfaces[i], false);
drawNormals(m_surfaces[i], m_lineLen);
}
}
glEndList();
glNewList(m_axisList, GL_COMPILE);
{
// Save current state of OpenGL
glPushAttrib(GL_ALL_ATTRIB_BITS);
// This is to draw the axes when the mouse button is down
glDisable(GL_LIGHTING);
glLineWidth(3);
glPushMatrix();
glScaled(5.0,5.0,5.0);
glBegin(GL_LINES);
glColor4f(1,0.5,0.5,1); glVertex3d(0,0,0); glVertex3d(1,0,0);
glColor4f(0.5,1,0.5,1); glVertex3d(0,0,0); glVertex3d(0,1,0);
glColor4f(0.5,0.5,1,1); glVertex3d(0,0,0); glVertex3d(0,0,1);
glColor4f(0.5,0.5,0.5,1);
glVertex3d(0,0,0); glVertex3d(-1,0,0);
glVertex3d(0,0,0); glVertex3d(0,-1,0);
glVertex3d(0,0,0); glVertex3d(0,0,-1);
glEnd();
glPopMatrix();
glPopAttrib();
}
glEndList();
glNewList(m_pointList, GL_COMPILE);
{
// Save current state of OpenGL
glPushAttrib(GL_ALL_ATTRIB_BITS);
// Setup for point drawing
glDisable(GL_LIGHTING);
glColor4f(1,1,0.0,1);
glPointSize(4);
glLineWidth(1);
for (unsigned i=0; i<m_ctrlPoints.size(); i++)
{
glBegin(GL_POINTS);
for (unsigned j=0; j<m_ctrlPoints[i].size(); j++)
glVertex(m_ctrlPoints[i][j]);
glEnd();
glBegin(GL_LINE_STRIP);
for (unsigned j=0; j<m_ctrlPoints[i].size(); j++)
glVertex(m_ctrlPoints[i][j]);
glEnd();
}
glPopAttrib();
}
glEndList();
}
void App::screenshot (const String& name)
{
// Capture image.
const Vec2i& size = m_window.getGL()->getViewSize();
Image image(size, ImageFormat::R8_G8_B8_A8);
glUseProgram(0);
glWindowPos2i(0, 0);
glReadPixels(0, 0, size.x, size.y, GL_RGBA, GL_UNSIGNED_BYTE, image.getMutablePtr());
// Display the captured image immediately.
for (int i = 0; i < 3; i++)
{
glDrawPixels(size.x, size.y, GL_RGBA, GL_UNSIGNED_BYTE, image.getPtr());
m_window.getGL()->swapBuffers();
}
glDrawPixels(size.x, size.y, GL_RGBA, GL_UNSIGNED_BYTE, image.getPtr());
// Export.
image.flipY();
exportImage(name, &image);
printf("Saved screenshot to '%s'", name.getPtr());
}
//------------------------------------------------------------------------
void FW::init(void)
{
new App;
}
//------------------------------------------------------------------------
| [
"[email protected]"
] | |
f532fe9721cd3402ad8c96791015d2ee5f7a7a2f | 126f53c896ce80422ceb75313f6220e150f271fe | /paq3.cpp | 940b6674b05767710e87b1a0628f6ee6b685a3e7 | [] | no_license | andrew-epstein/paq_history | 5697df624026840522ad43e0413fcf739d3dcbce | 0358d74d046f580056f1c6790488bb2a3d18f914 | refs/heads/master | 2021-07-07T15:04:40.606990 | 2020-08-08T17:40:57 | 2020-08-08T17:40:57 | 168,410,720 | 3 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 46,612 | cpp | /* PAQ3 - File archiver and compressor.
(C) 2003, Matt Mahoney, [email protected]
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License version 2 as
published by the Free Software Foundation at
http://www.gnu.org/licenses/gpl.txt or (at your option) any later version.
This program is distributed without any warranty.
USAGE
To compress: PAQ3 archive file file... (1 or more file names), or
or (MSDOS): dir/b | PAQ3 archive (read file names from input)
or (UNIX): ls | PAQ3 archive
To decompress: PAQ3 archive
To list contents: more < archive
Compression: The files listed are compressed and stored in the archive,
which is created. The archive must not already exist. File names may
specify a path, which is stored. If there are no file names on the command
line, then PAQ3 prompts for them, reading until the first blank line or
end of file.
Decompression: No file names are specified. The archive must exist.
If a path is stored, the file is extracted to the appropriate directory,
which must exist. PAQ3 does not create directories. If the file to be
extracted already exists, it is not replaced; rather it is compared with
the archived file, and the offset of the first difference is reported.
It is not possible to add, remove, or update files in an existing archive.
If you want to do this, extract the files, delete the archive, and
create a new archive with just the files you want.
PAQ3 is an improved version of PAQ1SSE/PAQ2 by Serge Osnach, who added
SSE to my PAQ1 (both available at http://cs.fit.edu/~mmahoney/compression/ ).
PAQ3 uses an improved SSE implementation, and adds update exclusion to
the NonstationaryPPM and WordModel models.
*/
#include <algorithm>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <new>
#include <string>
#include <vector>
using std::set_new_handler;
using std::string;
using std::vector;
const int MEM = 6; // 0-8 = 1M, 2M ... 256M memory model. 6 = 64M
// 8-32 bit unsigned types, adjust as appropriate
using U8 = unsigned char;
using U16 = unsigned short;
using U32 = unsigned int;
class U24 { // 24-bit unsigned int
U8 b0, b1, b2; // Low, mid, high byte
public:
explicit U24( int x = 0 ) : b0( x ), b1( x >> 8 ), b2( x >> 16 ) {}
operator int() const {
return ( ( ( b2 << 8 ) | b1 ) << 8 ) | b0;
}
};
// 32-bit random number generator based on r(i) = r(i-24) ^ r(i-55)
class Random {
U32 table[55]; // Last 55 random values
int i{ 0 }; // Index of current random value in table
public:
Random();
U32 operator()() { // Return 32-bit random number
if( ++i == 55 )
i = 0;
if( i >= 24 )
return table[i] ^= table[i - 24];
return table[i] ^= table[i + 31];
}
} rnd;
Random::Random() {
for( int j = 0; j < 55; ++j )
table[j] = 314159265 * j;
for( int j = 0; j < 10000; ++j )
operator()();
}
/* Model interface. A Predictor is made up of a collection of various
models, whose outputs are summed to yield a prediction. Methods:
Model.predict(int& n0, int& n1) - Adds to counts n0 and n1 such that
it predicts the next bit will be a 1 with probability n1/(n0+n1)
and confidence n0+n1.
Model.update(int y) - Appends bit y (0 or 1) to the model.
*/
class Model {
public:
virtual void predict( int &n0, int &n1 ) const = 0;
virtual void update( int y ) = 0;
virtual ~Model() = default;
};
/* Hash table element base class. It contains an 8-bit checksum to
detect collisions, and a priority() method which is used to control
replacement when full by replacing the element with the lowest priority
(0 = unused). The derived class should supply the data
to be stored and override priority(). */
class HashElement {
U8 ch; // Checksum
public:
HashElement( int c = 0 ) : ch( c ) {} // Initialize the checksum, 0 = unused
int checksum() const {
return ch;
} // Collision if not matched
int priority() const {
return static_cast<int>( ch != 0 );
} // Override: lowest replaced first
};
/* 3 byte counter, shown for reference only. It implements a
nonstationary pair of counters of 0s and 1s such that preference is
given to recent history by discarding old bits. */
class Counter3 : public HashElement {
U8 n[2]; // n[y] is the counts of ys (0s or 1s)
public:
Counter3( int c = 0 ) : HashElement( c ) {
n[0] = n[1] = 0;
}
int get0() const {
return n[0];
} // Return count of 0s
int get1() const {
return n[1];
} // Return count of 1s
int priority() const {
return get0() + get1();
} // For hash replacement
void add( int y ) { // Add y (0 or 1) to n[y] and age the opposite count
if( n[y] < 255 )
++n[y];
if( n[1 - y] > 2 )
( n[1 - y] /= 2 ) += 1;
}
};
/* Approximately equivalent 2 byte counter implementing the above.
The representable counts (n0, n1) are 0-10, 12, 14, 16, 20, 24, 28,
32, 48, 64, 128, 256, 512. Both counts are represented by a single
8-bit state. Counts larger than 10 are incremented probabilistically.
Although it uses 1/3 less memory, it is 8% slower and gives 0.05% worse
compression than the 3 byte counter. */
class Counter : public HashElement {
U8 state{ 0 };
struct E { // State table entry
U16 n0, n1; // Counts represented by state
U8 s00, s01; // Next state on input 0 without/with probabilistic incr.
U8 s10, s11; // Next state on input 1
U32 p0, p1; // Probability of increment x 2^32-1 on inputs 0, 1
};
static E table[244]; // State table
public:
Counter( int c = 0 ) : HashElement( c ) {}
int get0() const {
return table[state].n0;
}
int get1() const {
return table[state].n1;
}
int priority() const {
return state;
}
void add( int y ) {
if( y != 0 ) {
if( state < 94 || rnd() < table[state].p1 )
state = table[state].s11;
else
state = table[state].s10;
} else {
if( state < 94 || rnd() < table[state].p0 )
state = table[state].s01;
else
state = table[state].s00;
}
}
};
// State table generated by stategen.cpp
Counter::E Counter::table[244] = {
// n0 n1 s00 s01 s10 s11 p0 p1 state
{ 0, 0, 0, 2, 0, 1, 4294967295U, 4294967295U }, // 0
{ 0, 1, 1, 4, 1, 3, 4294967295U, 4294967295U }, // 1
{ 1, 0, 2, 5, 2, 4, 4294967295U, 4294967295U }, // 2
{ 0, 2, 3, 7, 3, 6, 4294967295U, 4294967295U }, // 3
{ 1, 1, 4, 8, 4, 7, 4294967295U, 4294967295U }, // 4
{ 2, 0, 5, 9, 5, 8, 4294967295U, 4294967295U }, // 5
{ 0, 3, 3, 7, 6, 10, 4294967295U, 4294967295U }, // 6
{ 1, 2, 7, 12, 7, 11, 4294967295U, 4294967295U }, // 7
{ 2, 1, 8, 13, 8, 12, 4294967295U, 4294967295U }, // 8
{ 3, 0, 9, 14, 5, 8, 4294967295U, 4294967295U }, // 9
{ 0, 4, 6, 11, 10, 15, 4294967295U, 4294967295U }, // 10
{ 1, 3, 7, 12, 11, 16, 4294967295U, 4294967295U }, // 11
{ 2, 2, 12, 18, 12, 17, 4294967295U, 4294967295U }, // 12
{ 3, 1, 13, 19, 8, 12, 4294967295U, 4294967295U }, // 13
{ 4, 0, 14, 20, 9, 13, 4294967295U, 4294967295U }, // 14
{ 0, 5, 6, 11, 15, 21, 4294967295U, 4294967295U }, // 15
{ 1, 4, 11, 17, 16, 22, 4294967295U, 4294967295U }, // 16
{ 2, 3, 12, 18, 17, 23, 4294967295U, 4294967295U }, // 17
{ 3, 2, 18, 25, 12, 17, 4294967295U, 4294967295U }, // 18
{ 4, 1, 19, 26, 13, 18, 4294967295U, 4294967295U }, // 19
{ 5, 0, 20, 27, 9, 13, 4294967295U, 4294967295U }, // 20
{ 0, 6, 10, 16, 21, 28, 4294967295U, 4294967295U }, // 21
{ 1, 5, 11, 17, 22, 29, 4294967295U, 4294967295U }, // 22
{ 2, 4, 17, 24, 23, 30, 4294967295U, 4294967295U }, // 23
{ 3, 3, 18, 25, 17, 23, 4294967295U, 4294967295U }, // 24
{ 4, 2, 25, 33, 18, 24, 4294967295U, 4294967295U }, // 25
{ 5, 1, 26, 34, 13, 18, 4294967295U, 4294967295U }, // 26
{ 6, 0, 27, 35, 14, 19, 4294967295U, 4294967295U }, // 27
{ 0, 7, 10, 16, 28, 36, 4294967295U, 4294967295U }, // 28
{ 1, 6, 16, 23, 29, 37, 4294967295U, 4294967295U }, // 29
{ 2, 5, 17, 24, 30, 38, 4294967295U, 4294967295U }, // 30
{ 3, 4, 24, 32, 23, 30, 4294967295U, 4294967295U }, // 31
{ 4, 3, 25, 33, 24, 31, 4294967295U, 4294967295U }, // 32
{ 5, 2, 33, 42, 18, 24, 4294967295U, 4294967295U }, // 33
{ 6, 1, 34, 43, 19, 25, 4294967295U, 4294967295U }, // 34
{ 7, 0, 35, 44, 14, 19, 4294967295U, 4294967295U }, // 35
{ 0, 8, 15, 22, 36, 45, 4294967295U, 4294967295U }, // 36
{ 1, 7, 16, 23, 37, 46, 4294967295U, 4294967295U }, // 37
{ 2, 6, 23, 31, 38, 47, 4294967295U, 4294967295U }, // 38
{ 3, 5, 24, 32, 30, 38, 4294967295U, 4294967295U }, // 39
{ 4, 4, 32, 41, 31, 39, 4294967295U, 4294967295U }, // 40
{ 5, 3, 33, 42, 24, 31, 4294967295U, 4294967295U }, // 41
{ 6, 2, 42, 52, 25, 32, 4294967295U, 4294967295U }, // 42
{ 7, 1, 43, 53, 19, 25, 4294967295U, 4294967295U }, // 43
{ 8, 0, 44, 54, 20, 26, 4294967295U, 4294967295U }, // 44
{ 0, 9, 15, 22, 45, 94, 4294967295U, 4294967295U }, // 45
{ 1, 8, 22, 30, 46, 55, 4294967295U, 4294967295U }, // 46
{ 2, 7, 23, 31, 47, 56, 4294967295U, 4294967295U }, // 47
{ 3, 6, 31, 40, 38, 47, 4294967295U, 4294967295U }, // 48
{ 4, 5, 32, 41, 39, 48, 4294967295U, 4294967295U }, // 49
{ 5, 4, 41, 51, 31, 39, 4294967295U, 4294967295U }, // 50
{ 6, 3, 42, 52, 32, 40, 4294967295U, 4294967295U }, // 51
{ 7, 2, 52, 62, 25, 32, 4294967295U, 4294967295U }, // 52
{ 8, 1, 53, 63, 26, 33, 4294967295U, 4294967295U }, // 53
{ 9, 0, 54, 95, 20, 26, 4294967295U, 4294967295U }, // 54
{ 1, 9, 22, 30, 55, 96, 4294967295U, 4294967295U }, // 55
{ 2, 8, 30, 39, 56, 64, 4294967295U, 4294967295U }, // 56
{ 3, 7, 31, 40, 47, 56, 4294967295U, 4294967295U }, // 57
{ 4, 6, 40, 50, 48, 57, 4294967295U, 4294967295U }, // 58
{ 5, 5, 41, 51, 39, 48, 4294967295U, 4294967295U }, // 59
{ 6, 4, 51, 61, 40, 49, 4294967295U, 4294967295U }, // 60
{ 7, 3, 52, 62, 32, 40, 4294967295U, 4294967295U }, // 61
{ 8, 2, 62, 71, 33, 41, 4294967295U, 4294967295U }, // 62
{ 9, 1, 63, 97, 26, 33, 4294967295U, 4294967295U }, // 63
{ 2, 9, 30, 39, 64, 99, 4294967295U, 4294967295U }, // 64
{ 3, 8, 39, 49, 56, 64, 4294967295U, 4294967295U }, // 65
{ 4, 7, 40, 50, 57, 65, 4294967295U, 4294967295U }, // 66
{ 5, 6, 50, 60, 48, 57, 4294967295U, 4294967295U }, // 67
{ 6, 5, 51, 61, 49, 58, 4294967295U, 4294967295U }, // 68
{ 7, 4, 61, 70, 40, 49, 4294967295U, 4294967295U }, // 69
{ 8, 3, 62, 71, 41, 50, 4294967295U, 4294967295U }, // 70
{ 9, 2, 71, 100, 33, 41, 4294967295U, 4294967295U }, // 71
{ 3, 9, 39, 49, 64, 99, 4294967295U, 4294967295U }, // 72
{ 4, 8, 49, 59, 65, 72, 4294967295U, 4294967295U }, // 73
{ 5, 7, 50, 60, 57, 65, 4294967295U, 4294967295U }, // 74
{ 6, 6, 60, 69, 58, 66, 4294967295U, 4294967295U }, // 75
{ 7, 5, 61, 70, 49, 58, 4294967295U, 4294967295U }, // 76
{ 8, 4, 70, 78, 50, 59, 4294967295U, 4294967295U }, // 77
{ 9, 3, 71, 100, 41, 50, 4294967295U, 4294967295U }, // 78
{ 4, 9, 49, 59, 72, 103, 4294967295U, 4294967295U }, // 79
{ 5, 8, 59, 68, 65, 72, 4294967295U, 4294967295U }, // 80
{ 6, 7, 60, 69, 66, 73, 4294967295U, 4294967295U }, // 81
{ 7, 6, 69, 77, 58, 66, 4294967295U, 4294967295U }, // 82
{ 8, 5, 70, 78, 59, 67, 4294967295U, 4294967295U }, // 83
{ 9, 4, 78, 104, 50, 59, 4294967295U, 4294967295U }, // 84
{ 5, 9, 59, 68, 72, 103, 4294967295U, 4294967295U }, // 85
{ 7, 7, 69, 77, 66, 73, 4294967295U, 4294967295U }, // 86
{ 9, 5, 78, 104, 59, 67, 4294967295U, 4294967295U }, // 87
{ 6, 9, 68, 76, 79, 108, 4294967295U, 4294967295U }, // 88
{ 9, 6, 84, 109, 67, 74, 4294967295U, 4294967295U }, // 89
{ 7, 9, 76, 83, 79, 108, 4294967295U, 4294967295U }, // 90
{ 9, 7, 84, 109, 74, 80, 4294967295U, 4294967295U }, // 91
{ 8, 9, 83, 87, 85, 114, 4294967295U, 4294967295U }, // 92
{ 9, 8, 87, 115, 80, 85, 4294967295U, 4294967295U }, // 93
{ 0, 10, 21, 29, 94, 98, 4294967295U, 2147483647U }, // 94
{ 10, 0, 95, 101, 27, 34, 2147483647U, 4294967295U }, // 95
{ 1, 10, 29, 38, 96, 102, 4294967295U, 2147483647U }, // 96
{ 10, 1, 97, 105, 34, 42, 2147483647U, 4294967295U }, // 97
{ 0, 12, 28, 37, 98, 106, 4294967295U, 2147483647U }, // 98
{ 2, 10, 38, 48, 99, 107, 4294967295U, 2147483647U }, // 99
{ 10, 2, 100, 110, 42, 51, 2147483647U, 4294967295U }, // 100
{ 12, 0, 101, 111, 35, 43, 2147483647U, 4294967295U }, // 101
{ 1, 12, 37, 47, 102, 112, 4294967295U, 2147483647U }, // 102
{ 3, 10, 48, 58, 99, 107, 4294967295U, 2147483647U }, // 103
{ 10, 3, 100, 110, 51, 60, 2147483647U, 4294967295U }, // 104
{ 12, 1, 105, 117, 43, 52, 2147483647U, 4294967295U }, // 105
{ 0, 14, 36, 46, 106, 118, 4294967295U, 2147483647U }, // 106
{ 2, 12, 47, 57, 107, 119, 4294967295U, 2147483647U }, // 107
{ 4, 10, 58, 67, 103, 113, 4294967295U, 2147483647U }, // 108
{ 10, 4, 104, 116, 60, 68, 2147483647U, 4294967295U }, // 109
{ 12, 2, 110, 122, 52, 61, 2147483647U, 4294967295U }, // 110
{ 14, 0, 111, 123, 44, 53, 2147483647U, 4294967295U }, // 111
{ 1, 14, 46, 56, 112, 124, 4294967295U, 2147483647U }, // 112
{ 3, 12, 57, 66, 107, 119, 4294967295U, 2147483647U }, // 113
{ 5, 10, 67, 75, 103, 113, 4294967295U, 2147483647U }, // 114
{ 10, 5, 104, 116, 68, 75, 2147483647U, 4294967295U }, // 115
{ 12, 3, 110, 122, 61, 69, 2147483647U, 4294967295U }, // 116
{ 14, 1, 117, 129, 53, 62, 2147483647U, 4294967295U }, // 117
{ 0, 16, 45, 55, 118, 138, 4294967295U, 1073741823U }, // 118
{ 2, 14, 56, 65, 119, 130, 4294967295U, 2147483647U }, // 119
{ 4, 12, 66, 74, 113, 125, 4294967295U, 2147483647U }, // 120
{ 12, 4, 116, 128, 69, 76, 2147483647U, 4294967295U }, // 121
{ 14, 2, 122, 135, 62, 70, 2147483647U, 4294967295U }, // 122
{ 16, 0, 123, 141, 54, 63, 1073741823U, 4294967295U }, // 123
{ 1, 16, 55, 64, 124, 142, 4294967295U, 1073741823U }, // 124
{ 3, 14, 65, 73, 119, 130, 4294967295U, 2147483647U }, // 125
{ 5, 12, 74, 81, 113, 125, 4294967295U, 2147483647U }, // 126
{ 12, 5, 116, 128, 76, 82, 2147483647U, 4294967295U }, // 127
{ 14, 3, 122, 135, 70, 77, 2147483647U, 4294967295U }, // 128
{ 16, 1, 129, 145, 63, 71, 1073741823U, 4294967295U }, // 129
{ 2, 16, 64, 72, 130, 146, 4294967295U, 1073741823U }, // 130
{ 4, 14, 73, 80, 125, 136, 4294967295U, 2147483647U }, // 131
{ 6, 12, 81, 86, 120, 131, 4294967295U, 2147483647U }, // 132
{ 12, 6, 121, 134, 82, 86, 2147483647U, 4294967295U }, // 133
{ 14, 4, 128, 137, 77, 83, 2147483647U, 4294967295U }, // 134
{ 16, 2, 135, 149, 71, 78, 1073741823U, 4294967295U }, // 135
{ 3, 16, 72, 79, 130, 146, 4294967295U, 1073741823U }, // 136
{ 16, 3, 135, 149, 78, 84, 1073741823U, 4294967295U }, // 137
{ 0, 20, 94, 96, 138, 154, 4294967295U, 1073741823U }, // 138
{ 4, 16, 79, 85, 136, 150, 4294967295U, 1073741823U }, // 139
{ 16, 4, 137, 153, 84, 87, 1073741823U, 4294967295U }, // 140
{ 20, 0, 141, 157, 95, 97, 1073741823U, 4294967295U }, // 141
{ 1, 20, 96, 99, 142, 158, 4294967295U, 1073741823U }, // 142
{ 5, 16, 85, 88, 136, 150, 4294967295U, 1073741823U }, // 143
{ 16, 5, 137, 153, 87, 89, 1073741823U, 4294967295U }, // 144
{ 20, 1, 145, 159, 97, 100, 1073741823U, 4294967295U }, // 145
{ 2, 20, 99, 103, 146, 160, 4294967295U, 1073741823U }, // 146
{ 6, 16, 88, 90, 139, 155, 4294967295U, 1073741823U }, // 147
{ 16, 6, 140, 156, 89, 91, 1073741823U, 4294967295U }, // 148
{ 20, 2, 149, 161, 100, 104, 1073741823U, 4294967295U }, // 149
{ 3, 20, 103, 108, 146, 160, 4294967295U, 1073741823U }, // 150
{ 7, 16, 90, 92, 139, 155, 4294967295U, 1073741823U }, // 151
{ 16, 7, 140, 156, 91, 93, 1073741823U, 4294967295U }, // 152
{ 20, 3, 149, 161, 104, 109, 1073741823U, 4294967295U }, // 153
{ 0, 24, 98, 102, 154, 164, 4294967295U, 1073741823U }, // 154
{ 4, 20, 108, 114, 150, 162, 4294967295U, 1073741823U }, // 155
{ 20, 4, 153, 163, 109, 115, 1073741823U, 4294967295U }, // 156
{ 24, 0, 157, 167, 101, 105, 1073741823U, 4294967295U }, // 157
{ 1, 24, 102, 107, 158, 168, 4294967295U, 1073741823U }, // 158
{ 24, 1, 159, 171, 105, 110, 1073741823U, 4294967295U }, // 159
{ 2, 24, 107, 113, 160, 172, 4294967295U, 1073741823U }, // 160
{ 24, 2, 161, 173, 110, 116, 1073741823U, 4294967295U }, // 161
{ 3, 24, 113, 120, 160, 172, 4294967295U, 1073741823U }, // 162
{ 24, 3, 161, 173, 116, 121, 1073741823U, 4294967295U }, // 163
{ 0, 28, 106, 112, 164, 176, 4294967295U, 1073741823U }, // 164
{ 4, 24, 120, 126, 162, 174, 4294967295U, 1073741823U }, // 165
{ 24, 4, 163, 175, 121, 127, 1073741823U, 4294967295U }, // 166
{ 28, 0, 167, 177, 111, 117, 1073741823U, 4294967295U }, // 167
{ 1, 28, 112, 119, 168, 178, 4294967295U, 1073741823U }, // 168
{ 5, 24, 126, 132, 162, 174, 4294967295U, 1073741823U }, // 169
{ 24, 5, 163, 175, 127, 133, 1073741823U, 4294967295U }, // 170
{ 28, 1, 171, 179, 117, 122, 1073741823U, 4294967295U }, // 171
{ 2, 28, 119, 125, 172, 180, 4294967295U, 1073741823U }, // 172
{ 28, 2, 173, 181, 122, 128, 1073741823U, 4294967295U }, // 173
{ 3, 28, 125, 131, 172, 180, 4294967295U, 1073741823U }, // 174
{ 28, 3, 173, 181, 128, 134, 1073741823U, 4294967295U }, // 175
{ 0, 32, 118, 124, 176, 190, 4294967295U, 268435455U }, // 176
{ 32, 0, 177, 191, 123, 129, 268435455U, 4294967295U }, // 177
{ 1, 32, 124, 130, 178, 192, 4294967295U, 268435455U }, // 178
{ 32, 1, 179, 193, 129, 135, 268435455U, 4294967295U }, // 179
{ 2, 32, 130, 136, 180, 194, 4294967295U, 268435455U }, // 180
{ 32, 2, 181, 195, 135, 137, 268435455U, 4294967295U }, // 181
{ 3, 32, 136, 139, 180, 194, 4294967295U, 268435455U }, // 182
{ 32, 3, 181, 195, 137, 140, 268435455U, 4294967295U }, // 183
{ 4, 32, 139, 143, 182, 196, 4294967295U, 268435455U }, // 184
{ 32, 4, 183, 197, 140, 144, 268435455U, 4294967295U }, // 185
{ 5, 32, 143, 147, 182, 196, 4294967295U, 268435455U }, // 186
{ 32, 5, 183, 197, 144, 148, 268435455U, 4294967295U }, // 187
{ 6, 32, 147, 151, 184, 198, 4294967295U, 268435455U }, // 188
{ 32, 6, 185, 199, 148, 152, 268435455U, 4294967295U }, // 189
{ 0, 48, 154, 158, 190, 200, 4294967295U, 268435455U }, // 190
{ 48, 0, 191, 201, 157, 159, 268435455U, 4294967295U }, // 191
{ 1, 48, 158, 160, 192, 202, 4294967295U, 268435455U }, // 192
{ 48, 1, 193, 203, 159, 161, 268435455U, 4294967295U }, // 193
{ 2, 48, 160, 162, 194, 204, 4294967295U, 268435455U }, // 194
{ 48, 2, 195, 205, 161, 163, 268435455U, 4294967295U }, // 195
{ 3, 48, 162, 165, 194, 204, 4294967295U, 268435455U }, // 196
{ 48, 3, 195, 205, 163, 166, 268435455U, 4294967295U }, // 197
{ 4, 48, 165, 169, 196, 206, 4294967295U, 268435455U }, // 198
{ 48, 4, 197, 207, 166, 170, 268435455U, 4294967295U }, // 199
{ 0, 64, 176, 178, 200, 212, 4294967295U, 134217727U }, // 200
{ 64, 0, 201, 213, 177, 179, 134217727U, 4294967295U }, // 201
{ 1, 64, 178, 180, 202, 214, 4294967295U, 134217727U }, // 202
{ 64, 1, 203, 215, 179, 181, 134217727U, 4294967295U }, // 203
{ 2, 64, 180, 182, 204, 216, 4294967295U, 134217727U }, // 204
{ 64, 2, 205, 217, 181, 183, 134217727U, 4294967295U }, // 205
{ 3, 64, 182, 184, 204, 216, 4294967295U, 134217727U }, // 206
{ 64, 3, 205, 217, 183, 185, 134217727U, 4294967295U }, // 207
{ 4, 64, 184, 186, 206, 218, 4294967295U, 134217727U }, // 208
{ 64, 4, 207, 219, 185, 187, 134217727U, 4294967295U }, // 209
{ 5, 64, 186, 188, 206, 218, 4294967295U, 134217727U }, // 210
{ 64, 5, 207, 219, 187, 189, 134217727U, 4294967295U }, // 211
{ 0, 96, 190, 192, 212, 220, 4294967295U, 134217727U }, // 212
{ 96, 0, 213, 221, 191, 193, 134217727U, 4294967295U }, // 213
{ 1, 96, 192, 194, 214, 222, 4294967295U, 134217727U }, // 214
{ 96, 1, 215, 223, 193, 195, 134217727U, 4294967295U }, // 215
{ 2, 96, 194, 196, 216, 224, 4294967295U, 134217727U }, // 216
{ 96, 2, 217, 225, 195, 197, 134217727U, 4294967295U }, // 217
{ 3, 96, 196, 198, 216, 224, 4294967295U, 134217727U }, // 218
{ 96, 3, 217, 225, 197, 199, 134217727U, 4294967295U }, // 219
{ 0, 128, 200, 202, 220, 230, 4294967295U, 33554431U }, // 220
{ 128, 0, 221, 231, 201, 203, 33554431U, 4294967295U }, // 221
{ 1, 128, 202, 204, 222, 232, 4294967295U, 33554431U }, // 222
{ 128, 1, 223, 233, 203, 205, 33554431U, 4294967295U }, // 223
{ 2, 128, 204, 206, 224, 234, 4294967295U, 33554431U }, // 224
{ 128, 2, 225, 235, 205, 207, 33554431U, 4294967295U }, // 225
{ 3, 128, 206, 208, 224, 234, 4294967295U, 33554431U }, // 226
{ 128, 3, 225, 235, 207, 209, 33554431U, 4294967295U }, // 227
{ 4, 128, 208, 210, 226, 236, 4294967295U, 33554431U }, // 228
{ 128, 4, 227, 237, 209, 211, 33554431U, 4294967295U }, // 229
{ 0, 256, 220, 222, 230, 238, 4294967295U, 16777215U }, // 230
{ 256, 0, 231, 239, 221, 223, 16777215U, 4294967295U }, // 231
{ 1, 256, 222, 224, 232, 240, 4294967295U, 16777215U }, // 232
{ 256, 1, 233, 241, 223, 225, 16777215U, 4294967295U }, // 233
{ 2, 256, 224, 226, 234, 242, 4294967295U, 16777215U }, // 234
{ 256, 2, 235, 243, 225, 227, 16777215U, 4294967295U }, // 235
{ 3, 256, 226, 228, 234, 242, 4294967295U, 16777215U }, // 236
{ 256, 3, 235, 243, 227, 229, 16777215U, 4294967295U }, // 237
{ 0, 512, 230, 232, 238, 238, 4294967295U, 0U }, // 238
{ 512, 0, 239, 239, 231, 233, 0U, 4294967295U }, // 239
{ 1, 512, 232, 234, 240, 240, 4294967295U, 0U }, // 240
{ 512, 1, 241, 241, 233, 235, 0U, 4294967295U }, // 241
{ 2, 512, 234, 236, 242, 242, 4294967295U, 0U }, // 242
{ 512, 2, 243, 243, 235, 237, 0U, 4294967295U } // 243
};
/* Hashtable<T, N, M> is a hash table of 2^N elements of type T
(derived from HashElement) with linear search
of M elements in case of collision. If all elements collide,
then the one with the lowest .priority() is replaced.
Hashtable[i] returns a T& indexed by the lower bits of i whose
checksum matches the upper bits of i, creating or replacing if needed.
*/
template <class T, int N, int M = 3>
class Hashtable {
private:
T *table; // Array of 2^N+M elements
Hashtable( const Hashtable & ) = delete; // No copy
Hashtable &operator=( const Hashtable & ) = delete; // No assignment
public:
Hashtable() : table( new Counter[( 1 << N ) + M] ) {}
T &operator[]( U32 i );
~Hashtable() {
delete[] table;
}
};
template <class T, int N, int M>
inline T &Hashtable<T, N, M>::operator[]( U32 i ) {
const U32 lb = i & ( ( 1 << N ) - 1 ); // Lower bound of search range
const U32 ub = lb + M; // Upper bound + 1
const int checksum = i >> 24;
int bj = lb;
int bget = 1000000000;
for( U32 j = lb; j < ub; ++j ) {
T &c = table[j];
int g = c.priority();
if( g == 0 )
return c = T( checksum );
if( checksum == c.checksum() )
return c;
if( g < bget ) {
bget = g;
bj = j;
}
}
return table[bj] = T( checksum );
}
/* A NonstationaryPPM model guesses the next bit by finding all
matching contexts of n = 1 to 8 bytes (including the last partial
byte of 0-7 bits) and guessing for each match that the next bit
will be the same with weight n^2/f(age). The function f(age) decays
the count of 0s or 1s for each context by half whenever there are
more than 2 and the opposite bit is observed. This is an approximation
of the nonstationary model, weight = 1/(t*variance) where t is the
number of subsequent observations and the variance is tp(1-p) for
t observations and p the probability of a 1 bit given the last t
observations. The aged counts are stored in a hash table of
contexts. */
class NonstationaryPPM : public Model {
enum { N = 8 }; // Number of contexts
int c0{ 1 }; // Current 0-7 bits of input with a leading 1
int c1{ 0 }; // Previous whole byte
int cn{ 1 }; // c0 mod 53 (low bits of hash)
vector<Counter> counter0; // Counters for context lengths 0 and 1
vector<Counter> counter1;
Hashtable<Counter, 18 + MEM> counter2; // for lengths 2 to N-1
Counter *cp[N]; // Pointers to current counters
U32 hash[N]; // Hashes of last 0 to N-1 bytes
public:
inline void predict( int &n0, int &n1 ) const override; // Add to counts of 0s and 1s
inline void update( int y ) override; // Append bit y (0 or 1) to model
NonstationaryPPM();
int getc0() const {
return c0;
}
};
NonstationaryPPM::NonstationaryPPM() : counter0( 256 ), counter1( 65536 ) {
for( int i = 0; i < N; ++i ) {
cp[i] = &counter0[0];
hash[i] = 0;
}
}
void NonstationaryPPM::predict( int &n0, int &n1 ) const {
for( int i = 0; i < N; ++i ) {
const int wt = ( i + 1 ) * ( i + 1 );
n0 += cp[i]->get0() * wt;
n1 += cp[i]->get1() * wt;
}
}
// Add bit y (0 or 1) to model
void NonstationaryPPM::update( int y ) {
// Count y by context
for( int i = N - 1; i >= 0; --i ) {
cp[i]->add( y );
if( ( cp[i]->get0() + cp[i]->get1() ) * i > 100 ) { // Update exclusion
cp[i]->add( y );
break;
}
}
// Store bit y
cn += cn + y;
if( cn >= 53 )
cn -= 53;
c0 += c0 + y;
if( c0 >= 256 ) { // Start new byte
for( int i = N - 1; i > 0; --i )
hash[i] = ( hash[i - 1] + c0 ) * 987660757;
c1 = c0 - 256;
c0 = 1;
cn = 1;
}
// Set up pointers to next counters
cp[0] = &counter0[c0];
cp[1] = &counter1[c0 + ( c1 << 8 )];
for( int i = 2; i < N; ++i )
cp[i] = &counter2[hash[i] + cn + ( c0 << 24 )];
}
/* A MatchModel looks for a match of length n = 8 bytes or more between
the current context and previous input and guesses that the next bit
will be the same with weight 3n^2. Matches are found in a 4MB rotating
buffer using a 1M hash table of pointers. */
class MatchModel : public Model {
vector<U8> buf; // Input buffer, wraps at end
vector<U24> ptr; // Hash table of pointers
U32 hash{ 0 }; // Hash of current context up to pos-1
int pos{ 0 }; // Element of buf where next bit will be stored
int bpos{ 0 }; // Number of bits (0-7) stored at buf[pos]
int begin{ 0 }; // Points to first matching byte (does not wrap)
int end{ 0 }; // Points to last matching byte + 1, 0 if no match
public:
MatchModel() : buf( 0x10000 * ( 1 << MEM ) ), ptr( 0x4000 * ( 1 << MEM ) ) {}
void predict( int &n0, int &n1 ) const override {
if( end != 0 ) {
int wt = end - begin;
if( wt > 1000 )
wt = 3000000;
else
wt *= wt * 3;
if( ( ( buf[end] >> ( 7 - bpos ) ) & 1 ) != 0 )
n1 += wt;
else
n0 += wt;
}
}
// Append bit y to buf and check that it matches at the end.
// After a byte is completed, compute a new hash and store it.
// If there is no current match, search for one.
void update( int y ) override {
( buf[pos] <<= 1 ) += y; // Store bit
++bpos;
if( ( end != 0 ) && ( buf[end] >> ( 8 - bpos ) ) != buf[pos] ) // Does it match?
begin = end = 0; // no
if( bpos == 8 ) { // New byte
bpos = 0;
hash = hash * ( 16 * 123456791 ) + buf[pos] + 1;
if( ++pos == int( buf.size() ) )
pos = 0;
if( end != 0 )
++end;
else { // If no match, search for one
U32 h = ( hash ^ ( hash >> 16 ) ) & ( ptr.size() - 1 );
end = ptr[h];
if( end > 0 ) {
begin = end;
int p = pos;
while( begin > 0 && p > 0 && begin != p + 1 && buf[begin - 1] == buf[p - 1] ) {
--begin;
--p;
}
}
if( end == begin ) // No match found
begin = end = 0;
ptr[h] = U24( pos );
}
}
}
};
/* A WordModel predicts in the context of whole words (a-z, case
insensitive) using a trigram model. */
class WordModel {
private:
U32 word1{ 0 }, word0{ 0 }; // Hash of previous and current word
int ww1{ 0 }, ww0{ 0 }; // Word weights (lengths)
Hashtable<Counter, 16 + MEM> t1; // Model
int c1{ 0 }; // Previous char, lower case
int c0{ 1 }; // 0-7 bits of current char with leading 1 bit
int c0h{ 1 }; // Small hash of c0
Counter *cp0, *cp1; // Points into t1 current context
int lettercount{ 0 }; // For detecting English
enum { THRESHOLD = 5 }; // lettercount threshold for English
public:
WordModel() :
cp0( &t1[0] ), cp1( &t1[0] ) {}
void predict( int &n0, int &n1 ) const {
if( lettercount >= THRESHOLD ) {
const int wt0 = ( ww0 + 1 ) * ( ww0 + 1 );
n0 += cp0->get0() * wt0;
n1 += cp0->get1() * wt0;
const int wt1 = ( ww0 + ww1 + 2 ) * ( ww0 + ww1 + 2 );
n0 += cp1->get0() * wt1;
n1 += cp1->get1() * wt1;
}
}
void update( int y ) {
if( lettercount >= THRESHOLD ) {
cp1->add( y );
if( cp1->get0() + cp1->get1() < 100 )
cp0->add( y );
}
// Update contexts with next bit
c0 += c0 + y;
c0h += c0h + y;
if( c0h >= 59 )
c0h -= 59;
if( c0 >= 256 ) {
c0 -= 256;
if( lettercount > 0 && ( c0 > 127 || ( c0 < 32 && c0 != '\n' && c0 != '\r' && c0 != '\t' ) ) )
--lettercount;
if( isalpha( c0 ) != 0 ) {
word0 = ( word0 + tolower( c0 ) + 1 ) * 234577751 * 16;
if( ++ww0 > 8 )
ww0 = 8;
if( lettercount < THRESHOLD * 2 )
++lettercount;
} else if( word0 != 0U ) {
ww1 = ww0;
ww0 = 0;
word1 = word0;
word0 = 0;
}
c1 = c0;
c0 = 1;
c0h = 1;
}
// Set up pointers to new contexts
if( lettercount >= THRESHOLD ) {
U32 h = word0 * 123456791 + c1 * 345689647 + c0h + ( c0 << 24 );
cp0 = &t1[h];
cp1 = &t1[word1 + h];
}
}
};
/* CyclicModel models data with fixed length records such as tables,
databases, images, audio, binary numeric data, etc. It models
runs of 0s or 1s in bit columns. A table is detected when an 8-bit
pattern occurs 4 or more times in a row spaced by the same interval. The
table ends after no repetition detection for the same number of bits
as were in the table. */
class CyclicModel : public Model {
struct E {
int p{ 0 }, n{ 0 }, r{ 0 }; // Position of last match, number of matches, interval
E() = default;
};
vector<E> cpos; // Table of repeat patterns by char
int pos{ 0 }; // Current bit position in input
int c0{ 1 }; // Last 8 bits
int cycle{ 0 }; // Most likely number of columns
int column{ 0 }; // Column number, 0 to cycle-1
int size{ 0 }; // Number of bits before the table expires, 0 to 3*cycle
Hashtable<Counter, 15> t; // Context is last 8 bits in column
vector<Counter> t1; // Context is the column number only
Counter *cp, *cp1; // Points to t, t1
public:
CyclicModel() :
cpos( 256 ),
t1( 2048 ),
cp( &t[0] ),
cp1( &t1[0] ) {}
void predict( int &n0, int &n1 ) const override {
if( cycle > 0 ) {
int wt = 16;
n0 += cp->get0() * wt;
n1 += cp->get1() * wt;
wt = 4;
n0 += cp1->get0() * wt;
n1 += cp1->get1() * wt;
}
}
void update( int y ) override {
if( ++column >= cycle )
column = 0;
if( size > 0 && --size == 0 )
cycle = 0;
cp->add( y );
cp1->add( y );
c0 = ( c0 + c0 + y ) & 0xff;
++pos;
E &e = cpos[c0];
if( e.p + e.r == pos ) {
++e.n;
if( e.n > 3 && e.r > 8 && e.r * e.n > size ) {
size = e.r * e.n;
if( cycle != e.r ) {
cycle = e.r;
column = pos % cycle;
}
}
} else {
e.n = 1;
e.r = pos - e.p;
}
e.p = pos;
int h = column * 3 + c0 * 876546821;
cp = &t[h];
cp1 = &t1[column & 2047];
}
};
// Secondary source encoder
struct SSEContext {
U8 c1, n; // Count of 1's, count of bits
U16 p() const {
return U32( 65535 ) * ( c1 * 64 + 1 ) / ( n * 64 + 2 );
}
void update( int y ) {
if( y != 0 )
++c1;
if( ++n > 254 ) {
c1 /= 2;
n /= 2;
}
}
};
const int SSE1 = 256 * 3 * 3 * 3 * 3, SSE2 = 32; // dimensions
const int SSESCALE = 1024 / SSE2;
SSEContext sse[SSE1][SSE2 + 1]; // [context][mapped probability]
// Scale probability p (0 to 64K-1) into a context in the range 0 to 1K-1
class SSEMap {
enum { N = 4096 };
U16 table[N];
public:
int operator()( int p ) const {
return table[p / ( 65536 / N )];
}
SSEMap();
} ssemap; // global functoid
SSEMap::SSEMap() {
for( int i = 0; i < N; ++i ) {
int p = int( 64 * log( ( i + 0.5 ) / ( N - 0.5 - i ) ) + 512 );
if( p > 1023 )
p = 1023;
if( p < 0 )
p = 0;
table[i] = p;
}
}
/* A Predictor predicts the next bit given the bits so far using a
collection of models. Methods:
p() returns probability of a 1 being the next bit, P(y = 1)
as a 16 bit number (0 to 64K-1).
update(y) updates the models with bit y (0 or 1)
*/
class Predictor {
NonstationaryPPM m1;
MatchModel m2;
WordModel m3;
CyclicModel m4;
mutable int context, ssep;
public:
Predictor();
~Predictor();
U16 p() const {
int n0 = 1;
int n1 = n0;
context = m1.getc0();
m4.predict( n0, n1 );
context = context * 3 + static_cast<int>( n0 * 2 > n1 ) + static_cast<int>( n0 > n1 * 2 );
m2.predict( n0, n1 );
context = context * 3 + static_cast<int>( n0 * 4 > n1 ) + static_cast<int>( n0 > n1 * 4 );
m3.predict( n0, n1 );
context = context * 3 + static_cast<int>( n0 * 8 > n1 ) + static_cast<int>( n0 > n1 * 8 );
m1.predict( n0, n1 );
context = context * 3 + static_cast<int>( n0 * 16 > n1 ) + static_cast<int>( n0 > n1 * 16 );
int n = n0 + n1;
while( n > 32767 ) {
n1 /= 16;
n /= 16;
}
U16 pr = 65535 * n1 / n;
ssep = ssemap( pr );
int wt = ssep % SSESCALE;
int i = ssep / SSESCALE;
return ( ( ( sse[context][i].p() * ( SSESCALE - wt ) + sse[context][i + 1].p() * wt ) / SSESCALE ) * 3 + pr ) / 4;
}
void update( int y ) {
m1.update( y );
m2.update( y );
m3.update( y );
m4.update( y );
sse[context][ssep / SSESCALE].update( y );
sse[context][ssep / SSESCALE + 1].update( y );
}
};
Predictor::Predictor() {
int N = 4096;
int oldp = SSE2 + 1;
for( int i = N - 1; i >= 0; --i ) {
int p = ( ssemap( i * 65536 / N ) + SSESCALE / 2 ) / SSESCALE;
int n = 1 + N * N / ( ( i + 1 ) * ( N - i ) );
if( n > 254 )
n = 254;
int c1 = ( i * n + N / 2 ) / N;
for( int j = oldp - 1; j >= p; --j ) {
for( auto &k: sse ) {
k[j].n = n;
k[j].c1 = c1;
}
}
oldp = p;
}
}
Predictor::~Predictor() {
/*
for (int i=0; i<SSE1; ++i) {
for (int j=0; j<SSE2; ++j) {
printf("%d/%d ", sse[i][j].c1, sse[i][j].n);
}
printf("\n");
} */
}
/* An Encoder does arithmetic encoding. Methods:
Encoder(COMPRESS, f) creates encoder for compression to archive f, which
must be open for writing in binary mode
Encoder(DECOMPRESS, f) creates encoder for decompression from archive f,
which must be open for reading in binary mode
encode(bit) in COMPRESS mode compresses bit to file f.
decode() in DECOMPRESS mode returns the next decompressed bit from file f.
flush() should be called when there is no more to compress
*/
typedef enum { COMPRESS, DECOMPRESS } Mode;
class Encoder {
private:
Predictor predictor;
const Mode mode; // Compress or decompress?
FILE *archive; // Compressed data file
U32 x1, x2; // Range, initially [0, 1), scaled by 2^32
U32 x; // Last 4 input bytes of archive.
public:
Encoder( Mode m, FILE *f );
void encode( int y );
int decode();
void flush();
};
// Constructor
Encoder::Encoder( Mode m, FILE *f ) : predictor(), mode( m ), archive( f ), x1( 0 ), x2( 0xffffffff ), x( 0 ) {
// In DECOMPRESS mode, initialize x to the first 4 bytes of the archive
if( mode == DECOMPRESS ) {
for( int i = 0; i < 4; ++i ) {
int c = getc( archive );
x = ( x << 8 ) + ( c & 0xff );
}
}
}
/* encode(y) -- Encode bit y by splitting the range [x1, x2] in proportion
to P(1) and P(0) as given by the predictor and narrowing to the appropriate
subrange. Output leading bytes of the range as they become known.
*/
inline void Encoder::encode( int y ) {
// Split the range
const U32 p = predictor.p(); // Probability P(1) * 64K rounded down
const U32 xdiff = x2 - x1;
U32 xmid = x1; // = x1+p*(x2-x1) multiply without overflow, round down
if( xdiff >= 0x10000000 )
xmid += ( xdiff >> 16 ) * p;
else if( xdiff >= 0x1000000 )
xmid += ( ( xdiff >> 12 ) * p ) >> 4;
else if( xdiff >= 0x100000 )
xmid += ( ( xdiff >> 8 ) * p ) >> 8;
else if( xdiff >= 0x10000 )
xmid += ( ( xdiff >> 4 ) * p ) >> 12;
else
xmid += ( xdiff * p ) >> 16;
// Update the range
if( y != 0 )
x2 = xmid;
else
x1 = xmid + 1;
predictor.update( y );
// Shift equal MSB's out
while( ( ( x1 ^ x2 ) & 0xff000000 ) == 0 ) {
putc( x2 >> 24, archive );
x1 <<= 8;
x2 = ( x2 << 8 ) + 255;
}
}
/* Decode one bit from the archive, splitting [x1, x2] as in the encoder
and returning 1 or 0 depending on which subrange the archive point x is in.
*/
inline int Encoder::decode() {
// Split the range
const U32 p = predictor.p(); // Probability P(1) * 64K rounded down
const U32 xdiff = x2 - x1;
U32 xmid = x1; // = x1+p*(x2-x1) multiply without overflow, round down
if( xdiff >= 0x10000000 )
xmid += ( xdiff >> 16 ) * p;
else if( xdiff >= 0x1000000 )
xmid += ( ( xdiff >> 12 ) * p ) >> 4;
else if( xdiff >= 0x100000 )
xmid += ( ( xdiff >> 8 ) * p ) >> 8;
else if( xdiff >= 0x10000 )
xmid += ( ( xdiff >> 4 ) * p ) >> 12;
else
xmid += ( xdiff * p ) >> 16;
// Update the range
int y = 0;
if( x <= xmid ) {
y = 1;
x2 = xmid;
} else
x1 = xmid + 1;
predictor.update( y );
// Shift equal MSB's out
while( ( x1 >> 24 ) == ( x2 >> 24 ) ) {
x1 <<= 8;
x2 = ( x2 << 8 ) + 255;
x = ( x << 8 ) + getc( archive );
}
return y;
}
// Should be called when there is no more to compress
void Encoder::flush() {
// In COMPRESS mode, write out the remaining bytes of x, x1 < x < x2
if( mode == COMPRESS ) {
while( ( ( x1 ^ x2 ) & 0xff000000 ) == 0 ) {
putc( x2 >> 24, archive );
x1 <<= 8;
x2 = ( x2 << 8 ) + 255;
}
putc( x2 >> 24, archive ); // First unequal byte
}
}
// Read one byte from encoder e
int decompress( Encoder &e ) { // Decompress 8 bits, MSB first
int c = 0;
for( int i = 0; i < 8; ++i )
c = c + c + e.decode();
return c;
}
// Write one byte c to encoder e
void compress( Encoder &e, int c ) {
for( int i = 7; i >= 0; --i )
e.encode( ( c >> i ) & 1 );
}
// Fail if out of memory
void handler() {
printf( "Out of memory\n" );
exit( 1 );
}
// Read and return a line of input from FILE f (default stdin) up to
// first control character except tab. Skips CR in CR LF.
string getline( FILE *f = stdin ) {
int c = 0;
string result;
while( ( c = getc( f ) ) != EOF && ( c >= 32 || c == '\t' ) )
result += char( c );
if( c == '\r' )
( void ) getc( f );
return result;
}
// User interface
int main( int argc, char **argv ) {
set_new_handler( handler );
// Check arguments
if( argc < 2 ) {
printf( "PAQ3 file compressor/archiver, (C) 2003, Matt Mahoney, [email protected]\n"
"This program is free software distributed without warranty under the terms\n"
"of the GNU General Public License, see http://www.gnu.org/licenses/gpl.txt\n"
"\n"
"To compress: PAQ3 archive filenames... (archive will be created)\n"
" or (MSDOS): dir/b | PAQ3 archive (reads file names from input)\n"
"To extract/compare: PAQ3 archive (does not clobber existing files)\n"
"To view contents: more < archive\n" );
return 1;
}
// File names and sizes from input or archive
vector<string> filename; // List of names
vector<long> filesize; // Size or -1 if error
int start_time = clock();
int uncompressed_bytes = 0;
int compressed_bytes = 0; // Input, output sizes
// Extract files
FILE *archive = fopen( argv[1], "rbe" );
if( archive != nullptr ) {
if( argc > 2 ) {
printf( "File %s already exists\n", argv[1] );
return 1;
}
printf( "Extracting archive %s ...\n", argv[1] );
// Read "PAQ3\r\n" at start of archive
if( getline( archive ) != "PAQ3" ) {
printf( "Archive file %s not in PAQ3 format\n", argv[1] );
return 1;
}
// Read "size filename" in "%d\t%s\r\n" format
while( true ) {
string s = getline( archive );
if( s.size() > 1 ) {
filesize.push_back( atol( s.c_str() ) );
string::iterator tab = find( s.begin(), s.end(), '\t' );
if( tab != s.end() )
filename.emplace_back( tab + 1, s.end() );
else
filename.emplace_back( "" );
} else
break;
}
// Test end of header for "\f\0"
{
int c1 = 0;
int c2 = 0;
if( ( c1 = getc( archive ) ) != '\f' || ( c2 = getc( archive ) ) != 0 ) {
printf( "%s: Bad PAQ3 header format %d %d\n", argv[1], c1, c2 );
return 1;
}
}
// Extract files from archive data
Encoder e( DECOMPRESS, archive );
for( int i = 0; i < int( filename.size() ); ++i ) {
printf( "%10ld %s: ", filesize[i], filename[i].c_str() );
// Compare with existing file
FILE *f = fopen( filename[i].c_str(), "rbe" );
const long size = filesize[i];
uncompressed_bytes += size;
if( f != nullptr ) {
bool different = false;
for( long j = 0; j < size; ++j ) {
int c1 = decompress( e );
int c2 = getc( f );
if( !different && c1 != c2 ) {
printf( "differ at offset %ld, archive=%d file=%d\n", j, c1, c2 );
different = true;
}
}
if( !different )
printf( "identical\n" );
fclose( f );
}
// Extract to new file
else {
f = fopen( filename[i].c_str(), "wbe" );
if( f == nullptr )
printf( "cannot create, skipping...\n" );
for( long j = 0; j < size; ++j ) {
int c = decompress( e );
if( f != nullptr )
putc( c, f );
}
if( f != nullptr ) {
printf( "extracted\n" );
fclose( f );
}
}
}
compressed_bytes = ftell( archive );
fclose( archive );
}
// Compress files
else {
// Read file names from command line or input
if( argc > 2 )
for( int i = 2; i < argc; ++i )
filename.emplace_back( argv[i] );
else {
printf( "Enter names of files to compress, followed by blank line or EOF.\n" );
while( true ) {
string s = getline( stdin );
if( s.empty() )
break;
filename.push_back( s );
}
}
// Get file sizes
for( auto &i: filename ) {
FILE *f = fopen( i.c_str(), "rbe" );
if( f == nullptr ) {
printf( "File not found, skipping: %s\n", i.c_str() );
filesize.push_back( -1 );
} else {
fseek( f, 0L, SEEK_END );
filesize.push_back( ftell( f ) );
fclose( f );
}
}
if( filesize.empty() || *max_element( filesize.begin(), filesize.end() ) < 0 ) {
printf( "No files to compress, no archive created.\n" );
return 1;
}
// Write header
archive = fopen( argv[1], "wbe" );
if( archive == nullptr ) {
printf( "Cannot create archive: %s\n", argv[1] );
return 1;
}
fprintf( archive, "PAQ3\r\n" );
for( int i = 0; i < int( filename.size() ); ++i ) {
if( filesize[i] >= 0 )
fprintf( archive, "%ld\t%s\r\n", filesize[i], filename[i].c_str() );
}
putc( 032, archive ); // MSDOS EOF
putc( '\f', archive );
putc( 0, archive );
// Write data
Encoder e( COMPRESS, archive );
long file_start = ftell( archive );
for( int i = 0; i < int( filename.size() ); ++i ) {
const long size = filesize[i];
if( size >= 0 ) {
uncompressed_bytes += size;
printf( "%-23s %10ld -> ", filename[i].c_str(), size );
FILE *f = fopen( filename[i].c_str(), "rbe" );
int c = 0;
for( long j = 0; j < size; ++j ) {
if( f != nullptr )
c = getc( f );
else
c = 0;
compress( e, c );
}
if( f != nullptr )
fclose( f );
printf( "%ld\n", ftell( archive ) - file_start );
file_start = ftell( archive );
}
}
e.flush();
compressed_bytes = ftell( archive );
fclose( archive );
}
// Report statistics
const double elapsed_time = double( clock() - start_time ) / CLOCKS_PER_SEC;
printf( "%d/%d in %1.2f sec.", compressed_bytes, uncompressed_bytes, elapsed_time );
if( uncompressed_bytes > 0 && elapsed_time > 0 ) {
printf( " (%1.4f bpc, %1.2f%% at %1.0f KB/s)", compressed_bytes * 8.0 / uncompressed_bytes,
compressed_bytes * 100.0 / uncompressed_bytes, uncompressed_bytes / ( elapsed_time * 1000.0 ) );
}
printf( "\n" );
return 0;
}
| [
"[email protected]"
] | |
bef448a3fc650a04427ba3c6a3e6a47e3654fe0b | 34be098d37471c5aa09b70d8de275747c239647c | /src/tx11.cpp | 1fc09b2c7d5315530cc95d0fa7a202192d300de9 | [] | no_license | akinomyoga/contra | e55678c0ce5acccc7f30468c3a8666d6e6c0de06 | 42367a7e8ccc0ace9b5fa2fbd42f8471c93826df | refs/heads/master | 2023-04-07T04:23:33.547253 | 2023-03-16T03:19:49 | 2023-03-16T03:22:26 | 68,645,437 | 5 | 1 | null | 2020-10-06T03:40:10 | 2016-09-19T20:50:31 | C++ | UTF-8 | C++ | false | false | 45,610 | cpp | #define CONTRA_TX11_SUPPORT_HIGHDPI
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <unistd.h>
#include <X11/Xlib.h>
#include <X11/XKBlib.h>
#include <X11/Xutil.h>
#include <X11/Xatom.h>
#include <X11/Xft/Xft.h>
#include "ansi/render.hpp"
#include "manager.hpp"
#include "pty.hpp"
#include "context.hpp"
#include <memory>
namespace contra::tx11 {
namespace {
const char* get_x11_event_name(XEvent const& event) {
switch (event.type) {
case ButtonPress: return "ButtonPress";
case ButtonRelease: return "ButtonRelease";
case CirculateNotify: return "CirculateNotify";
case CirculateRequest: return "CirculateRequest";
case ClientMessage: return "ClientMessage";
case ColormapNotify: return "ColormapNotify";
case ConfigureNotify: return "ConfigureNotify";
case ConfigureRequest: return "ConfigureRequest";
case CreateNotify: return "CreateNotify";
case DestroyNotify: return "DestroyNotify";
case EnterNotify: return "EnterNotify";
case Expose: return "Expose";
case FocusIn: return "FocusIn";
case FocusOut: return "FocusOut";
case GraphicsExpose: return "GraphicsExpose";
case GravityNotify: return "GravityNotify";
case KeyPress: return "KeyPress";
case KeyRelease: return "KeyRelease";
case KeymapNotify: return "KeymapNotify";
case LeaveNotify: return "LeaveNotify";
case MapNotify: return "MapNotify";
case MapRequest: return "MapRequest";
case MappingNotify: return "MappingNotify";
case MotionNotify: return "MotionNotify";
case NoExpose: return "NoExpose";
case PropertyNotify: return "PropertyNotify";
case ReparentNotify: return "ReparentNotify";
case ResizeRequest: return "ResizeRequest";
case SelectionClear: return "SelectionClear";
case SelectionNotify: return "SelectionNotify";
case SelectionRequest: return "SelectionRequest";
case UnmapNotify: return "UnmapNotify";
case VisibilityNotify: return "VisibilityNotify";
default:
static char name[16];
std::sprintf(name, "unknown%d", event.type);
return name;
}
}
struct x11_color_manager_t {
Display* m_display;
Colormap m_cmap;
std::size_t npixel = 0;
ansi::color_t color256[256];
unsigned long color256_to_pixel[256];
void initialize_colors() {
std::size_t index = 0;
XColor xcolor {};
auto _alloc = [this, &index, &xcolor] (byte r, byte g, byte b) {
xcolor.red = r | r << 8;
xcolor.green = g | g << 8;
xcolor.blue = b | b << 8;
XAllocColor(m_display, m_cmap, &xcolor);
color256[index] = contra::ansi::rgb(
(xcolor.red + 128) / 257,
(xcolor.green + 128) / 257,
(xcolor.blue + 128) / 257);
color256_to_pixel[index] = xcolor.pixel;
index++;
};
auto _intensity = [] (int i) -> byte { return i == 0 ? 0 : i * 40 + 55; };
// 8colors
for (int i = 0; i < 8; i++)
_alloc(i & 1 ? 0x80 : 0, i & 2 ? 0x80 : 0, i & 4 ? 0x80 : 0);
// highlight 8 colors
for (int i = 0; i < 8; i++)
_alloc(i & 1 ? 0xFF : 0, i & 2 ? 0xFF : 0, i & 4 ? 0xFF : 0);
// 6x6x6 colors
for (int r = 0; r < 6; r++) {
auto const R = _intensity(r);
for (int g = 0; g < 6; g++) {
auto const G = _intensity(g);
for (int b = 0; b < 6; b++) {
auto const B = _intensity(b);
_alloc(R, G, B);
}
}
}
// 24 grayscale
for (int k = 0; k < 24; k++) {
byte const K = k * 10 + 8;
_alloc(K, K, K);
}
mwg_assert(index == 256);
}
public:
x11_color_manager_t(Display* display) {
this->m_display = display;
int const screen = DefaultScreen(display);
this->m_cmap = DefaultColormap(display, screen);
this->initialize_colors();
}
~x11_color_manager_t() {
XFreeColors(m_display, m_cmap, &color256_to_pixel[0], std::size(color256_to_pixel), 0);
}
private:
template<typename T>
static std::pair<T, T> get_minmax3(T a, T b, T c) {
if (a > b) std::swap(a, b);
if (b <= c) return {a, c};
return {std::min(a, c), b};
}
public:
int index(ansi::color_t color) {
byte r = contra::ansi::rgba2r(color);
byte g = contra::ansi::rgba2g(color);
byte b = contra::ansi::rgba2b(color);
auto [mn, mx] = get_minmax3(r, g, b);
if (mx - mn < 20) {
byte k = (r + g + b) / 3;
k = (k + 2) / 10;
return k == 0 ? 16 : k == 25 ? 231 : 231 + k;
} else {
r = (r - 24) / 40;
g = (g - 24) / 40;
b = (b - 24) / 40;
return 16 + r * 36 + g * 6 + b;
}
}
unsigned long pixel(ansi::color_t color) {
return color256_to_pixel[index(color)];
}
};
class xft_font_factory {
public:
typedef XftFont* font_type;
private:
using font_t = ansi::font_t;
Display* m_display = NULL;
int m_screen = 0;
std::string m_fontnames[16];
int m_font_padding;
public:
xft_font_factory(contra::app::context& actx) {
// 既定ではどのフォントが入っているのか分からないので monospace にする
m_fontnames[0] = "monospace";
m_fontnames[1] = "monospace";
m_fontnames[2] = "monospace";
m_fontnames[3] = "monospace";
m_fontnames[4] = "monospace";
m_fontnames[5] = "monospace";
m_fontnames[6] = "monospace";
m_fontnames[7] = "monospace";
m_fontnames[8] = "monospace";
m_fontnames[9] = "monospace";
m_fontnames[10] = "monospace";
actx.read("tx11_font_default", m_fontnames[0] );
actx.read("tx11_font_ansi1" , m_fontnames[1] );
actx.read("tx11_font_ansi2" , m_fontnames[2] );
actx.read("tx11_font_ansi3" , m_fontnames[3] );
actx.read("tx11_font_ansi4" , m_fontnames[4] );
actx.read("tx11_font_ansi5" , m_fontnames[5] );
actx.read("tx11_font_ansi6" , m_fontnames[6] );
actx.read("tx11_font_ansi7" , m_fontnames[7] );
actx.read("tx11_font_ansi8" , m_fontnames[8] );
actx.read("tx11_font_ansi9" , m_fontnames[9] );
actx.read("tx11_font_frak" , m_fontnames[10]);
actx.read("tx11_font_padding", m_font_padding = 0);
}
bool setup_display(Display* display) {
if (m_display == display) return false;
m_display = display;
m_screen = DefaultScreen(display);
return true;
}
public:
font_type create_font(font_t font, ansi::font_metric_t const& metric) const {
using namespace contra::ansi;
const char* fontname = m_fontnames[0].c_str();
if (font_t const face = (font & font_face_mask) >> font_face_shft)
if (const char* const name = m_fontnames[face].c_str())
fontname = name;
int slant = FC_SLANT_ROMAN;
int weight = FC_WEIGHT_NORMAL;
double height = metric.height();
double width = metric.width();
FcMatrix matrix;
if (font & font_flag_italic)
slant = FC_SLANT_OBLIQUE;
switch (font & font_weight_mask) {
case font_weight_bold: weight = FC_WEIGHT_BOLD; break;
case font_weight_faint: weight = FC_WEIGHT_THIN; break;
case font_weight_heavy: weight = FC_WEIGHT_HEAVY; break;
}
if (font & font_flag_small) {
height = metric.small_height();
width = metric.small_width();
}
if (font & font_decdhl) height *= 2;
if (font & font_decdwl) width *= 2;
// Note: ぴったりだと隣の文字とくっついてしまう様だ (使っているフォントの問題?)
if (!(font & font_flag_small) && m_font_padding) {
int const padding = std::min(m_font_padding, (int) std::ceil(width / 4));
height -= padding;
width -= padding;
}
double const xscale = std::floor(std::max(width, 1.0)) / (height * 0.5);
if (font_t const rotation = (font & font_rotation_mask) >> font_rotation_shft) {
double const radian = 0.25 * M_PI * rotation;
double const c = std::cos(radian), s = std::sin(radian);
matrix.xx = c * xscale;
matrix.xy = -s;
matrix.yx = s * xscale;
matrix.yy = c;
} else {
matrix.xx = xscale;
matrix.yy = 1.0;
matrix.xy = 0.0;
matrix.yx = 0.0;
}
return XftFontOpen(
m_display, m_screen,
XFT_FAMILY, XftTypeString, fontname,
XFT_PIXEL_SIZE, XftTypeDouble, height,
XFT_SLANT, XftTypeInteger, slant,
XFT_WEIGHT, XftTypeInteger, weight,
XFT_MATRIX, XftTypeMatrix, &matrix,
NULL);
}
void delete_font(font_type font) const {
::XftFontClose(m_display, font);
}
};
struct xft_character_buffer {
using coord_t = ansi::coord_t;
std::vector<byte> characters;
std::vector<coord_t> position;
std::vector<std::size_t> next;
public:
bool empty() const { return position.empty(); }
void add_char(std::uint32_t code, coord_t x, bool is_extension) {
contra::encoding::put_u8(code, characters);
if (is_extension && position.size()) {
next.back() = characters.size();
} else {
next.push_back(characters.size());
position.push_back(x);
}
}
void clear() {
characters.clear();
position.clear();
next.clear();
}
void reserve(std::size_t capacity) {
characters.reserve(capacity * 3);
position.reserve(capacity);
}
};
class xft_text_drawer_t {
using font_t = ansi::font_t;
using coord_t = ansi::coord_t;
using color_t = ansi::color_t;
Display* m_display = NULL;
Colormap m_cmap = 0;
Visual* m_visual = NULL;
x11_color_manager_t* m_color_manager = NULL;
ansi::font_manager_t<xft_font_factory> font_manager;
Drawable m_drawable = 0;
XftDraw* m_draw = NULL;
Region m_clip_region = NULL;
public:
void clip_rectangle(coord_t x1, coord_t y1, coord_t x2, coord_t y2) {
if (m_clip_region) XDestroyRegion(m_clip_region);
m_clip_region = XCreateRegion();
XRectangle rect;
rect.x = x1;
rect.y = y1;
rect.width = x2 - x1;
rect.height = y2 - y1;
XUnionRectWithRegion(&rect, m_clip_region, m_clip_region);
XftDrawSetClip(m_draw, m_clip_region);
}
void clip_clear() {
XftDrawSetClip(m_draw, 0);
}
private:
void release() {
if (m_draw) {
XftDrawDestroy(m_draw);
m_draw = NULL;
}
if (m_clip_region) {
XDestroyRegion(m_clip_region);
m_clip_region = NULL;
}
}
public:
xft_text_drawer_t(contra::app::context& actx): font_manager(actx) {}
~xft_text_drawer_t() { release(); }
void initialize(Display* display, x11_color_manager_t* color_manager) {
m_display = display;
int const screen = DefaultScreen(display);
m_cmap = DefaultColormap(m_display, screen);
m_visual = DefaultVisual(m_display, screen);
m_color_manager = color_manager;
if (font_manager.factory().setup_display(display))
font_manager.clear();
}
void set_size(coord_t width, coord_t height) {
font_manager.set_size(width, height);
}
private:
void update_target(Drawable drawable) {
if (drawable == m_drawable) return;
release();
this->m_drawable = drawable;
this->m_draw = ::XftDrawCreate(m_display, drawable, m_visual, m_cmap);
}
private:
void render(coord_t x, coord_t y, xft_character_buffer const& buff, XftFont* xftFont, color_t color) {
XftColor xftcolor;
xftcolor.pixel = m_color_manager ? m_color_manager->pixel(color) : contra::ansi::rgba2bgr(color);
xftcolor.color.red = 257 * contra::ansi::rgba2r(color);
xftcolor.color.green = 257 * contra::ansi::rgba2g(color);
xftcolor.color.blue = 257 * contra::ansi::rgba2b(color);
xftcolor.color.alpha = 0xFFFF;
std::size_t index = 0;
for (std::size_t i = 0, iN = buff.position.size(); i < iN; i++) {
::XftDrawStringUtf8(
m_draw, &xftcolor, xftFont,
x + buff.position[i], y, (FcChar8*) &buff.characters[index], buff.next[i] - index);
index = buff.next[i];
}
}
public:
void draw_characters(Drawable drawable, coord_t x1, coord_t y1, xft_character_buffer const& buff, font_t font, color_t color) {
this->update_target(drawable);
coord_t const h = font_manager.get_font_height(font);
XftFont* const xftFont = font_manager.get_font(font);
double const xftHeight = std::max({xftFont->ascent + xftFont->descent, xftFont->height, 1});
render(x1, y1 + h - h * xftFont->descent / xftHeight, buff, xftFont, color);
}
void draw_rotated_characters(
Drawable drawable,
coord_t x0, coord_t y0, coord_t dx, coord_t dy, coord_t w,
xft_character_buffer const& buff, font_t font, color_t color
) {
this->update_target(drawable);
coord_t const h = font_manager.get_font_height(font);
font_t const sco = (font & ansi::font_rotation_mask) >> ansi::font_rotation_shft;
XftFont* const xftFont0 = font_manager.get_font(font & ~ansi::font_rotation_mask);
double const xftHeight = std::max({xftFont0->ascent + xftFont0->descent, xftFont0->height, 1});
double const yshift = h * xftFont0->descent / xftHeight + (sco & 1 ? 1.0 : 0.0);
double const angle = -(M_PI / 4.0) * sco;
double const xc1 = 0.5 * w - dx;
double const yc1 = -0.5 * h + yshift;
double const xc2 = xc1 * std::cos(angle) - yc1 * std::sin(angle);
double const yc2 = xc1 * std::sin(angle) + yc1 * std::cos(angle);
int const rot_dx = (int) std::round(xc2 - xc1);
int const rot_dy = (int) std::round(yc2 - yc1 + yshift);
x0 += -rot_dx;
y0 += -rot_dy;
render(x0 + dx, y0 + dy + h, buff, font_manager.get_font(font), color);
}
};
class tx11_graphics_t;
class tx11_graphics_buffer {
using coord_t = ansi::coord_t;
private:
Display* m_display = NULL;
int m_screen = 0;
std::unique_ptr<x11_color_manager_t> m_color_manager;
xft_text_drawer_t m_text_drawer;
public:
Display* display() const { return m_display; }
x11_color_manager_t* color_manager() { return m_color_manager.get(); }
xft_text_drawer_t& text_drawer() { return m_text_drawer; }
void initialize(Display* display) {
this->m_display = display;
this->m_screen = DefaultScreen(display);
Visual* const visual = DefaultVisual(m_display, m_screen);
if (visual->c_class != TrueColor)
m_color_manager = std::make_unique<x11_color_manager_t>(m_display);
this->m_text_drawer.initialize(display, color_manager());
}
private:
coord_t m_width = -1, m_height = -1;
public:
coord_t width() { return m_width; }
coord_t height() { return m_height; }
void update_window_size(coord_t width, coord_t height, bool* out_resized = NULL) {
bool const is_resized = width != m_width || height != m_height;
if (is_resized) {
release();
m_width = width;
m_height = height;
}
if (out_resized) *out_resized = is_resized;
}
private:
Window m_window = 0;
GC m_gc = NULL;
public:
void setup(Window hWnd, GC hdc) {
this->m_window = hWnd;
this->m_gc = hdc;
}
private:
struct layer_t {
GC gc = NULL;
Pixmap pixmap = 0;
};
std::vector<layer_t> m_layers;
void release() {
for (layer_t& layer : m_layers) release_layer(layer);
m_layers.clear();
}
void release_layer(layer_t& layer) {
if (layer.gc) {
XFreeGC(m_display, layer.gc);
layer.gc = NULL;
}
if (layer.pixmap) {
XFreePixmap(m_display, layer.pixmap);
layer.pixmap = 0;
}
}
void initialize_layer(layer_t& layer) {
release_layer(layer);
layer.pixmap = XCreatePixmap(m_display, m_window, m_width, m_height, DefaultDepth(m_display, m_screen));
// create GC
XGCValues gcparams;
gcparams.graphics_exposures = false;
layer.gc = XCreateGC(m_display, layer.pixmap, GCGraphicsExposures, &gcparams);
}
public:
typedef layer_t context_t;
context_t layer(std::size_t index) {
if (index < m_layers.size() && m_layers[index].gc)
return m_layers[index];
if (index >= m_layers.size()) m_layers.resize(index + 1);
layer_t& layer = m_layers[index];
initialize_layer(layer);
return layer;
}
public:
tx11_graphics_buffer(contra::app::context& actx, ansi::window_state_t& wstat): m_text_drawer(actx) {
m_text_drawer.set_size(wstat.m_xunit, wstat.m_yunit);
}
~tx11_graphics_buffer() {
release();
}
void reset_size(ansi::window_state_t const& wstat) {
m_text_drawer.set_size(wstat.m_xunit, wstat.m_yunit);
}
public:
void bitblt(
context_t ctx1, coord_t x1, coord_t y1, coord_t w, coord_t h,
context_t ctx2, coord_t x2, coord_t y2
) {
::XCopyArea(m_display, ctx2.pixmap, ctx1.pixmap, ctx1.gc, x2, y2, w, h, x1, y1);
}
void render(coord_t x1, coord_t y1, coord_t w, coord_t h, context_t ctx2, coord_t x2, coord_t y2) {
::XCopyArea(m_display, ctx2.pixmap, m_window, m_gc, x2, y2, w, h, x1, y1);
}
typedef tx11_graphics_t graphics_t;
};
class tx11_graphics_t {
using coord_t = ansi::coord_t;
using color_t = ansi::color_t;
using font_t = ansi::font_t;
Display* m_display = NULL;
x11_color_manager_t* color_manager = nullptr;
xft_text_drawer_t& text_drawer;
Drawable m_drawable = 0;
GC m_gc = NULL;
GC m_gc_delete = NULL;
void release() {
if (m_stipple) {
XFreePixmap(m_display, m_stipple);
m_stipple = 0;
}
if (m_gc_delete) {
XFreeGC(m_display, m_gc_delete);
m_gc_delete = NULL;
}
}
public:
typedef xft_character_buffer character_buffer;
public:
tx11_graphics_t(tx11_graphics_buffer& gbuffer, Drawable drawable):
m_display(gbuffer.display()),
color_manager(gbuffer.color_manager()),
text_drawer(gbuffer.text_drawer())
{
XGCValues gcparams;
gcparams.graphics_exposures = false;
this->m_drawable = drawable;
this->m_gc_delete = XCreateGC(m_display, drawable, GCGraphicsExposures, &gcparams);
this->m_gc = m_gc_delete;
}
tx11_graphics_t(tx11_graphics_buffer& gbuffer, tx11_graphics_buffer::context_t const& context):
m_display(gbuffer.display()),
color_manager(gbuffer.color_manager()),
text_drawer(gbuffer.text_drawer())
{
this->m_drawable = context.pixmap;
this->m_gc = context.gc;
}
~tx11_graphics_t() {
this->release();
}
GC gc() const { return m_gc; }
private:
unsigned long color2pixel(color_t color) const {
return color_manager ? color_manager->pixel(color) : contra::ansi::rgba2bgr(color);
}
void set_foreground(color_t color) {
XSetForeground(m_display, m_gc, color2pixel(color));
}
public:
void clip_rectangle(coord_t x1, coord_t y1, coord_t x2, coord_t y2) {
XRectangle rect;
rect.x = 0;
rect.y = 0;
rect.width = x2 - x1;
rect.height = y2 - y1;
XSetClipRectangles(m_display, m_gc, x1, y1, &rect, 1, YXBanded);
text_drawer.clip_rectangle(x1, y1, x2, y2);
}
void clip_clear() {
XSetClipMask(m_display, m_gc, None);
text_drawer.clip_clear();
}
private:
std::vector<XPoint> xpoints;
Pixmap m_stipple = 0;
Pixmap get_stipple() {
if (!m_stipple) {
m_stipple = XCreatePixmap(m_display, m_drawable, 2, 2, 1);
GC gc2 = XCreateGC(m_display, m_stipple, 0, 0);
XSetForeground(m_display, gc2, 0);
XFillRectangle(m_display, m_stipple, gc2, 0, 0, 2, 2);
XSetForeground(m_display, gc2, 1);
XDrawPoint(m_display, m_stipple, gc2, 0, 0);
XDrawPoint(m_display, m_stipple, gc2, 1, 1);
XFreeGC(m_display, gc2);
}
return m_stipple;
}
public:
void fill_rectangle(coord_t x1, coord_t y1, coord_t x2, coord_t y2, color_t color) {
set_foreground(color);
::XFillRectangle(m_display, m_drawable, m_gc, x1, y1, x2 - x1, y2 - y1);
}
void invert_rectangle(coord_t x1, coord_t y1, coord_t x2, coord_t y2) {
XGCValues params;
params.function = GXcopyInverted;
XChangeGC(m_display, m_gc, GCFunction, ¶ms);
XCopyArea(m_display, m_drawable, m_drawable, m_gc, x1, y1, x2 - x1, y2 - y1, x1, y1);
params.function = GXcopy; // default
XChangeGC(m_display, m_gc, GCFunction, ¶ms);
}
void checked_rectangle(coord_t x1, coord_t y1, coord_t x2, coord_t y2, color_t color) {
XGCValues params;
params.foreground = color2pixel(color);
params.fill_style = FillStippled;
params.stipple = get_stipple();
XChangeGC(m_display, m_gc, GCForeground | GCStipple | GCFillStyle, ¶ms);
XFillRectangle(m_display, m_drawable, m_gc, x1, y1, x2 - x1, y2 - y1);
params.fill_style = FillSolid; // default
XChangeGC(m_display, m_gc, GCFillStyle, ¶ms);
}
void draw_ellipse(coord_t x1, coord_t y1, coord_t x2, coord_t y2, color_t color, int line_width) {
XGCValues params;
params.foreground = color2pixel(color);
params.line_width = line_width;
XChangeGC(m_display, m_gc, GCForeground | GCLineWidth, ¶ms);
XDrawArc(m_display, m_drawable, m_gc, x1, y1, x2 - x1, y2 - y1, 0 * 64, 360 * 64);
}
void fill_ellipse(coord_t x1, coord_t y1, coord_t x2, coord_t y2, color_t color) {
set_foreground(color);
XFillArc(m_display, m_drawable, m_gc, x1, y1, x2 - x1, y2 - y1, 0 * 64, 360 * 64);
}
void fill_polygon(coord_t const (*points)[2], std::size_t count, color_t color) {
set_foreground(color);
xpoints.resize(count);
for (std::size_t i = 0; i < count; i++) {
xpoints[i].x = points[i][0];
xpoints[i].y = points[i][1];
}
XFillPolygon(m_display, m_drawable, m_gc, &xpoints[0], count, Nonconvex, CoordModeOrigin);
}
void draw_line(coord_t x1, coord_t y1, coord_t x2, coord_t y2, color_t color, int line_width) {
XGCValues params;
params.foreground = color2pixel(color);
params.line_width = line_width;
params.cap_style = CapRound;
XChangeGC(m_display, m_gc, GCForeground | GCLineWidth | GCCapStyle, ¶ms);
XDrawLine(m_display, m_drawable, m_gc, x1, y1, x2, y2);
}
public:
void draw_characters(coord_t x1, coord_t y1, character_buffer const& buff, font_t font, color_t color) {
// set_foreground(color);
// contra_unused(font);
// coord_t x = x1, y = y1 + wstat.m_yunit - 1;
// for (std::size_t i = 0, iN = buff.characters.size(); i < iN; i++) {
// ::XDrawString(m_display, m_drawable, m_gc, x, y, &buff.characters[i], 1);
// x += buff.progress[i];
// }
text_drawer.draw_characters(m_drawable, x1, y1, buff, font, color);
}
void draw_rotated_characters(
coord_t x0, coord_t y0, coord_t dx, coord_t dy, coord_t width,
character_buffer const& buff, font_t font, color_t color
) {
text_drawer.draw_rotated_characters(m_drawable, x0, y0, dx, dy, width, buff, font, color);
}
void draw_text(coord_t x1, coord_t y1, character_buffer const& buff, font_t font, color_t color) {
draw_characters(x1, y1, buff, font, color);
}
};
struct tx11_settings: public ansi::window_settings_base {
typedef ansi::window_settings_base base;
const char* m_env_term = "xterm-256color";
const char* m_env_shell = "/bin/bash";
bool tx11_disableMouseReportOnScrLock = false;
void configure(contra::app::context& actx) {
base::configure(actx);
actx.read("tx11_disable_mouse_report_on_scrlock", tx11_disableMouseReportOnScrLock = true);
}
};
class tx11_window_t: term::terminal_events {
contra::app::context& actx;
ansi::window_state_t wstat;
ansi::status_tracer_t m_tracer;
term::terminal_manager manager;
ansi::window_renderer_t<tx11_graphics_t> renderer { wstat };
::Display* display = NULL;
::Window main = 0;
::Atom WM_DELETE_WINDOW;
tx11_settings settings;
tx11_graphics_buffer gbuffer { actx, wstat };
public:
tx11_window_t(contra::app::context& actx): actx(actx) {
// size and dimension
wstat.configure_metric(actx);
manager.reset_size(wstat.m_col, wstat.m_row, wstat.m_xunit, wstat.m_yunit);
gbuffer.reset_size(wstat);
// other settings
settings.configure(actx);
kbflags_initialize();
}
~tx11_window_t() {}
private:
bool is_session_ready() { return display && manager.is_active(); }
#ifdef CONTRA_TX11_SUPPORT_HIGHDPI
double get_dpi(Display* display) {
const char* dpi_resource = ::XGetDefault(display, "Xft", "dpi");
if (!dpi_resource) return 0.0;
char* endptr;
double const result = std::strtod(dpi_resource, &endptr);
if (endptr && *endptr) return 0.0;
return result;
}
#endif
public:
Display* display_handle() { return this->display; }
Window window_handle() const { return this->main; }
bool create_window() {
// Setup X11
this->display = ::XOpenDisplay(NULL);
if (this->display == NULL) {
std::fprintf(stderr, "contra: Failed to open DISPLAY=%s\n", std::getenv("DISPLAY"));
return false;
}
#ifdef CONTRA_TX11_SUPPORT_HIGHDPI
if (double const dpi = get_dpi(display)) {
double const dpiscale = std::max(1.0, dpi / 96.0);
wstat.configure_metric(actx, dpiscale);
gbuffer.reset_size(wstat);
manager.initialize_zoom(wstat.m_xunit, wstat.m_yunit);
manager.reset_size(wstat.m_col, wstat.m_row, wstat.m_xunit, wstat.m_yunit);
}
#endif
int const screen = DefaultScreen(display);
Window const root = RootWindow(display, screen);
unsigned long const black = BlackPixel(display, screen);
unsigned long const white = WhitePixel(display, screen);
// Main Window
this->m_window_width = wstat.calculate_client_width();
this->m_window_height = wstat.calculate_client_height();
this->main = XCreateSimpleWindow(display, root, 100, 100, m_window_width, m_window_height, 1, black, white);
{
// Properties
XTextProperty win_name;
win_name.value = (unsigned char*) "Contra/X11";
win_name.encoding = XA_STRING;
win_name.format = 8;
win_name.nitems = std::strlen((char const*) win_name.value);
::XSetWMName(display, this->main, &win_name);
// Events
long event_mask = ExposureMask | StructureNotifyMask; // ウィンドウ関連
event_mask |= FocusChangeMask; // FocusIn, FocusOut
event_mask |= KeyPressMask | KeyReleaseMask; // キーボード関連
event_mask |= ButtonPressMask | ButtonReleaseMask | PointerMotionMask; // マウス関連
XSelectInput(display, this->main, event_mask);
}
// #D0162 何だかよく分からないが終了する時はこうするらしい。
this->WM_DELETE_WINDOW = XInternAtom(display, "WM_DELETE_WINDOW", False);
XSetWMProtocols(display, this->main, &this->WM_DELETE_WINDOW, 1);
this->gbuffer.initialize(this->display);
XAutoRepeatOn(display);
XkbSetDetectableAutoRepeat(display, True, NULL); // #D0238
this->manager.set_events(static_cast<term::terminal_events&>(*this));
return true;
}
private:
ansi::coord_t m_window_width = 100;
ansi::coord_t m_window_height = 100;
public:
void process_window_resize() {
if (!is_session_ready()) return;
XWindowAttributes attrs;
XGetWindowAttributes(this->display, this->main, &attrs);
this->m_window_width = attrs.width;
this->m_window_height = attrs.height;
ansi::curpos_t const new_col = std::max(1, (attrs.width - 2 * wstat.m_xframe) / wstat.m_xunit);
ansi::curpos_t const new_row = std::max(1, (attrs.height - 2 * wstat.m_yframe) / wstat.m_yunit);
if (new_col != wstat.m_col || new_row != wstat.m_row) {
wstat.m_col = new_col;
wstat.m_row = new_row;
manager.reset_size(new_col, new_row);
}
}
void adjust_window_size() {
ansi::coord_t const width = wstat.calculate_client_width();
ansi::coord_t const height = wstat.calculate_client_height();
::XResizeWindow(display, main, width, height);
}
private:
// Implement terminal_events::request_change_size
virtual bool request_change_size(ansi::curpos_t col, ansi::curpos_t row, ansi::coord_t xunit, ansi::coord_t yunit) override {
auto& wm = wstat;
if (xunit >= 0) xunit = limit::term_xunit.clamp(xunit);
if (yunit >= 0) yunit = limit::term_yunit.clamp(yunit);
if (col < 0 && row < 0) {
// 文字サイズだけを変更→自動的に列・行を変えてウィンドウサイズを変えなくて済む様にする。
if (wm.m_xunit != xunit || wm.m_yunit != yunit) {
wm.m_xunit = xunit;
wm.m_yunit = yunit;
gbuffer.reset_size(wm);
process_window_resize();
return true;
}
}
bool changed = false;
if (xunit >= 0 && wm.m_xunit != xunit) { wm.m_xunit = xunit; changed = true; }
if (yunit >= 0 && wm.m_yunit != yunit) { wm.m_yunit = yunit; changed = true; }
if (col >= 0) {
col = limit::term_col.clamp(col);
if (col != wm.m_col) { wm.m_col = col; changed = true; }
}
if (row >= 0) {
row = limit::term_row.clamp(row);
if (row != wm.m_row) { wm.m_row = row; changed = true; }
}
if (changed) {
this->gbuffer.reset_size(wm);
this->adjust_window_size();
//this->manager.reset_size(wm.m_col, wm.m_row, wm.m_xunit, wm.m_yunit);
}
return true;
}
private:
friend class ansi::window_renderer_t<tx11_graphics_t>;
void unset_cursor_timer() {}
void reset_cursor_timer() {}
private:
void render_window() {
tx11_graphics_t g(gbuffer, this->main);
if (!is_session_ready()) {
const char* message = "Hello, world!";
XDrawString(display, this->main, g.gc(), 3, 15, message, std::strlen(message));
} else {
bool resized = true;
gbuffer.setup(this->main, g.gc());
gbuffer.update_window_size(this->m_window_width, this->m_window_height, &resized);
renderer.render_view(*this, gbuffer, manager.app().view(), resized);
}
XFlush(display);
}
private:
void process_input(std::uint32_t key) {
//contra::print_key(key, stderr);
manager.input_key(key);
}
private:
byte m_kbflags[256];
enum kbflag_flags {
kbflag_pressed = 1,
kbflag_locked = 2,
};
enum extended_key_flags {
toggle_capslock = 0x100,
toggle_numlock = 0x200,
toggle_scrolllock = 0x400,
};
void kbflags_initialize() {
std::fill(std::begin(m_kbflags), std::end(m_kbflags), 0);
}
void kbflags_update_modifiers() {
char table[32];
::XQueryKeymap(display, table);
auto const _update_kbflags = [this, &table] (KeySym sym) {
KeyCode const keycode = XKeysymToKeycode(display, sym);
if (keycode == 0) return;
int const bit = 1 << (keycode & 7);
if (table[keycode >> 3] & bit)
m_kbflags[keycode] |= kbflag_pressed;
else
m_kbflags[keycode] &= ~kbflag_pressed;
};
_update_kbflags(XK_Shift_L );
_update_kbflags(XK_Shift_R );
_update_kbflags(XK_Control_L);
_update_kbflags(XK_Control_R);
_update_kbflags(XK_Alt_L );
_update_kbflags(XK_Alt_R );
_update_kbflags(XK_Meta_L );
_update_kbflags(XK_Meta_R );
_update_kbflags(XK_Super_L );
_update_kbflags(XK_Super_R );
_update_kbflags(XK_Hyper_L );
_update_kbflags(XK_Hyper_R );
_update_kbflags(XK_Menu );
unsigned indicators = 0;
if (XkbGetIndicatorState(display, XkbUseCoreKbd, &indicators) == Success) {
auto const _update_locked = [this] (KeySym sym, bool state) {
KeyCode const keycode = XKeysymToKeycode(display, sym);
if (keycode == 0) return;
if (state)
m_kbflags[keycode] |= kbflag_locked;
else
m_kbflags[keycode] &= ~kbflag_locked;
};
_update_locked(XK_Caps_Lock , indicators & 1);
_update_locked(XK_Num_Lock , indicators & 2);
_update_locked(XK_Scroll_Lock, indicators & 4); // 効かない様だ @ Cygwin,Linux
}
}
bool kbflags_process_lockkey(KeySym sym) {
switch (sym) {
case XK_Caps_Lock :
case XK_Num_Lock :
case XK_Scroll_Lock:
kbflags_update_modifiers();
return true;
default:
// Japanese & Korean keyboards
if (0xFF20 <= sym && sym <= 0xFF3F) {
kbflags_update_modifiers();
return true;
}
return false;
}
}
key_t kbflags_get_modifiers() {
key_t ret = 0;
auto const _read_kbflags = [&ret, this] (KeySym sym, kbflag_flags flag, key_t mod) {
KeyCode const keycode = XKeysymToKeycode(display, sym);
if (keycode == 0) return;
if (m_kbflags[keycode] & flag) ret |= mod;
};
_read_kbflags(XK_Shift_L , kbflag_pressed, settings.term_mod_lshift);
_read_kbflags(XK_Shift_R , kbflag_pressed, settings.term_mod_rshift);
_read_kbflags(XK_Control_L , kbflag_pressed, settings.term_mod_lcontrol);
_read_kbflags(XK_Control_R , kbflag_pressed, settings.term_mod_rcontrol);
_read_kbflags(XK_Alt_L , kbflag_pressed, settings.term_mod_lalter);
_read_kbflags(XK_Alt_R , kbflag_pressed, settings.term_mod_ralter);
_read_kbflags(XK_Meta_L , kbflag_pressed, settings.term_mod_lmeta);
_read_kbflags(XK_Meta_R , kbflag_pressed, settings.term_mod_rmeta);
_read_kbflags(XK_Super_L , kbflag_pressed, settings.term_mod_lsuper);
_read_kbflags(XK_Super_R , kbflag_pressed, settings.term_mod_rsuper);
_read_kbflags(XK_Hyper_L , kbflag_pressed, settings.term_mod_lhyper);
_read_kbflags(XK_Hyper_R , kbflag_pressed, settings.term_mod_rhyper);
_read_kbflags(XK_Menu , kbflag_pressed, settings.term_mod_menu);
_read_kbflags(XK_Caps_Lock , kbflag_locked , toggle_capslock);
_read_kbflags(XK_Num_Lock , kbflag_locked , toggle_numlock);
_read_kbflags(XK_Scroll_Lock, kbflag_locked , toggle_scrolllock);
return ret;
}
private:
void process_keyup(KeyCode keycode) {
m_kbflags[(byte) keycode] &= ~kbflag_pressed;
KeySym const sym = XkbKeycodeToKeysym(display, keycode, 0, 0);
kbflags_process_lockkey(sym);
}
bool process_key(KeyCode keycode) {
key_t modifiers = kbflags_get_modifiers();
// Note #D0238: autorepeat 検出
if (m_kbflags[(byte) keycode] & kbflag_pressed)
modifiers |= modifier_autorepeat;
else
m_kbflags[(byte) keycode] |= kbflag_pressed;
key_t code = XkbKeycodeToKeysym(display, keycode, 0, 0);
if (ascii_sp <= code && code <= ascii_tilde) {
// 前提: G1 の文字は XK は ASCII/Unicode に一致している。
mwg_assert(XK_space == ascii_sp && XK_asciitilde == ascii_tilde);
// 観察した感じ XkbdKeycodeToKeysym に 0 を渡していれば此処には来ない?
if (ascii_A <= code && code <= ascii_Z) code += ascii_a - ascii_A;
if (ascii_a <= code && code <= ascii_z) {
bool const modified = modifiers & ~(modifier_shift | modifier_autorepeat) & _modifier_mask;
if (!modified) {
bool const capslock = modifiers & toggle_capslock;
bool const shifted = modifiers & modifier_shift;
if (capslock != shifted) code += ascii_A - ascii_a;
modifiers &= ~modifier_shift;
}
} else {
if (modifiers & modifier_shift) {
key_t code2 = XkbKeycodeToKeysym(display, keycode, 0, 1) & _character_mask;
if (code2 != code) {
modifiers &= ~modifier_shift;
code = code2;
}
}
}
process_input(code | (modifiers & _modifier_mask));
return true;
} else if (XK_F1 <= code && code < XK_F24) { // X11 では実は35まで実はあったりする。
process_input((code - XK_F1 + key_f1) | (modifiers & _modifier_mask));
return true;
} else {
key_t numlock = 0;
switch (code) {
case XK_BackSpace: code = ascii_bs; goto function_key;
case XK_Tab : code = ascii_ht; goto function_key;
case XK_Return : code = ascii_cr; goto function_key;
case XK_Escape : code = ascii_esc; goto function_key;
case XK_Delete : code = key_delete; goto function_key;
case XK_Insert : code = key_insert; goto function_key;
case XK_Prior : code = key_prior; goto function_key;
case XK_Next : code = key_next; goto function_key;
case XK_End : code = key_end; goto function_key;
case XK_Home : code = key_home; goto function_key;
case XK_Left : code = key_left; goto function_key;
case XK_Up : code = key_up; goto function_key;
case XK_Right : code = key_right; goto function_key;
case XK_Down : code = key_down; goto function_key;
function_key:
process_input(code | (modifiers & _modifier_mask));
return true;
case XK_KP_Insert : code = key_insert; numlock = ascii_0; goto keypad;
case XK_KP_End : code = key_end; numlock = ascii_1; goto keypad;
case XK_KP_Down : code = key_down; numlock = ascii_2; goto keypad;
case XK_KP_Next : code = key_next; numlock = ascii_3; goto keypad;
case XK_KP_Left : code = key_left; numlock = ascii_4; goto keypad;
case XK_KP_Begin : code = key_begin; numlock = ascii_5; goto keypad;
case XK_KP_Right : code = key_right; numlock = ascii_6; goto keypad;
case XK_KP_Home : code = key_home; numlock = ascii_7; goto keypad;
case XK_KP_Up : code = key_up; numlock = ascii_8; goto keypad;
case XK_KP_Prior : code = key_prior; numlock = ascii_9; goto keypad;
case XK_KP_Delete : code = key_delete; numlock = key_kpdec; goto keypad;
keypad:
if ((modifiers & toggle_numlock) != (modifiers & modifier_shift)) code = numlock;
modifiers &= ~modifier_shift;
goto function_key;
case XK_KP_Divide : code = key_kpdiv; goto function_key;
case XK_KP_Multiply: code = key_kpmul; goto function_key;
case XK_KP_Subtract: code = key_kpsub; goto function_key;
case XK_KP_Add : code = key_kpadd; goto function_key;
case XK_KP_Enter : code = key_kpent; goto function_key;
default:
if (!kbflags_process_lockkey(code)) {
// std::printf("ksym=%04x:XK_%s mods=%08x\n", code, XKeysymToString((KeySym) code), modifiers);
// std::fflush(stdout);
}
break;
}
}
return false;
}
bool process_mouse(key_t mouse_event, int x, int y) {
key_t const modifiers = kbflags_get_modifiers();
key_t key = mouse_event | (modifiers & _modifier_mask);
if (settings.tx11_disableMouseReportOnScrLock && (modifiers & toggle_scrolllock))
key |= modifier_application;
ansi::coord_t const px = x - wstat.m_xframe;
ansi::coord_t const py = y - wstat.m_yframe;
ansi::curpos_t const x1 = px / wstat.m_xunit;
ansi::curpos_t const y1 = py / wstat.m_yunit;
manager.input_mouse(key, px, py, x1, y1);
if (manager.m_dirty) render_window();
return true;
}
void process_event(XEvent const& event) {
switch (event.type) {
case Expose:
if (event.xexpose.count == 0)
render_window();
break;
case ClientMessage: // #D0162
if ((Atom) event.xclient.data.l[0] == WM_DELETE_WINDOW)
XDestroyWindow(display, this->main);
break;
case DestroyNotify: // #D0162
::XSetCloseDownMode(display, DestroyAll);
::XCloseDisplay(display);
this->display = NULL;
break;
case ConfigureNotify:
this->process_window_resize();
break;
case MapNotify:
case UnmapNotify:
case ReparentNotify:
// 無視
break;
case KeyPress:
process_key(event.xkey.keycode);
break;
case KeyRelease:
process_keyup(event.xkey.keycode);
break;
case FocusIn:
kbflags_update_modifiers();
process_input(key_focus);
break;
case FocusOut:
process_input(key_blur);
break;
case ButtonPress: // mousedown, wheel
{
key_t key;
unsigned const button = event.xbutton.button;
// 1: left, 2: middle, 3: right, 4: wheel up, 5: wheel down
switch (button) {
case 1: key = key_mouse1_down; break;
case 2: key = key_mouse2_down; break;
case 3: key = key_mouse3_down; break;
case 4: key = key_wheel_up; break;
case 5: key = key_wheel_down; break;
default: return;
}
process_mouse(key, event.xbutton.x, event.xbutton.y);
}
break;
case ButtonRelease: // mouseup
{
key_t key;
unsigned const button = event.xbutton.button;
switch (button) {
case 1: key = key_mouse1_up; break;
case 2: key = key_mouse2_up; break;
case 3: key = key_mouse3_up; break;
default: return;
}
process_mouse(key, event.xbutton.x, event.xbutton.y);
}
break;
case MotionNotify: // mousemove
{
constexpr unsigned mouse_buttons = Button1Mask | Button2Mask | Button3Mask;
key_t key = key_mouse_move;
unsigned const kstate = event.xbutton.state;
if (kstate & mouse_buttons) {
if (kstate & Button1Mask)
key = key_mouse1_drag;
else if (kstate & Button2Mask)
key = key_mouse3_drag;
else if (kstate & Button3Mask)
key = key_mouse2_drag;
}
process_mouse(key, event.xbutton.x, event.xbutton.y);
}
break;
default:
std::fprintf(stderr, "Event %s (%d)\n", get_x11_event_name(event), event.type);
break;
}
}
private:
// この部分は twin.cpp からのコピー。後で整理する必要がある。
static void exec_error_handler(int errno1, std::uintptr_t) {
char const* msg = std::strerror(errno1);
std::ostringstream buff;
buff << "exec: " << msg << " (errno=" << errno1 << ")";
//::MessageBoxA(NULL, buff.str().c_str(), "Contra/X11 - exec failed", MB_OK);
}
bool add_terminal_session() {
term::terminal_session_parameters params;
params.col = wstat.m_col;
params.row = wstat.m_row;
params.xunit = wstat.m_xunit;
params.yunit = wstat.m_yunit;
params.exec_error_handler = &exec_error_handler;
//params.dbg_sequence_logfile = "tx11-allseq.txt";
actx.read("session_term", params.env["TERM"] = "xterm-256color");
actx.read("session_shell", params.shell = "/bin/bash");
std::unique_ptr<term::terminal_application> sess = contra::term::create_terminal_session(params);
if (!sess) return false;
contra::ansi::tstate_t& s = sess->state();
s.m_default_fg_space = contra::ansi::color_space_rgb;
s.m_default_bg_space = contra::ansi::color_space_rgb;
s.m_default_fg_color = contra::ansi::rgb(0x00, 0x00, 0x00);
s.m_default_bg_color = contra::ansi::rgb(0xFF, 0xFF, 0xFF);
// s.m_default_fg_color = contra::ansi::rgb(0xD0, 0xD0, 0xD0);//@color
// s.m_default_bg_color = contra::ansi::rgb(0x00, 0x00, 0x00);
manager.add_app(std::move(sess));
return true;
}
virtual bool create_new_session() override {
return add_terminal_session();
}
public:
bool do_loop() {
// CheckIfEvent 用のダミーフィルター
Bool (*event_filter_proc)(Display*, XEvent*, XPointer) = [] (auto...) -> Bool { return True; };
this->kbflags_update_modifiers();
if (!this->add_terminal_session()) return false;
XEvent event;
while (this->display) {
bool processed = manager.do_events();
if (manager.m_dirty) {
render_window();
manager.m_dirty = false;
}
while (::XCheckIfEvent(display, &event, event_filter_proc, NULL)) {
processed = true;
process_event(event);
if (!display) goto exit;
}
if (!manager.is_alive()) break;
if (!processed)
contra::term::msleep(10);
}
exit:
manager.terminate();
return true;
}
};
}
bool run(contra::app::context& actx) {
contra::tx11::tx11_window_t win(actx);
if (!win.create_window()) return 1;
::XMapWindow(win.display_handle(), win.window_handle());
::XFlush(win.display_handle());
return win.do_loop();
}
}
| [
"[email protected]"
] | |
72d33cbd2a1307e7573202a824fd08c480803cf2 | f3970177529032d412b299c5cf7fc3ca51a9e66e | /EvtOmegaOmega3pi.cpp | 3449f366ef2190c829a85b37cf421b7b9d542931 | [] | no_license | AntonGerasimov/evtgen | a0a779d89054b5fa098e83d2081eb816aa8527a5 | b5dd7bded6d535a6de2b405d6e9ba9e569e03fc5 | refs/heads/master | 2020-06-06T01:07:18.130797 | 2019-06-25T14:06:17 | 2019-06-25T14:06:17 | 192,597,148 | 0 | 1 | null | 2019-06-19T00:54:52 | 2019-06-18T19:01:13 | C++ | UTF-8 | C++ | false | false | 5,963 | cpp | #include "EvtGenBase/EvtPatches.hh"
#include <stdlib.h>
#include <iostream>
#include <string>
#include "EvtGenBase/EvtParticle.hh"
#include "EvtGenBase/EvtPDL.hh"
#include "EvtGenBase/EvtGenKine.hh"
#include "EvtGenModels/EvtOmegaOmega3pi.hh"
#include "EvtGenBase/EvtDiracSpinor.hh"
#include "EvtGenBase/EvtReport.hh"
#include "EvtGenBase/EvtVector4C.hh"
#include "EvtGenBase/EvtComplex.hh"
#include "EvtGenBase/EvtVector4R.hh"
#include "EvtGenBase/EvtVector3R.hh"
#include "EvtGenModels/EvtWHad.hh"
EvtOmegaOmega3pi::~EvtOmegaOmega3pi() {
f1a = 1; f1b = 1; f1c = 1; f1d = 1;
f2a = 1; f2b = 1; f2c = 1; f2d = 1;
g1a = 1; g1b = 1; g1c = 1; g1d = 1;
g2a = 1; g2b = 1; g2c = 1; g2d = 1;
}
std::string EvtOmegaOmega3pi::getName(){
return "OMEGAOMEGA3PI";
}
EvtDecayBase* EvtOmegaOmega3pi::clone(){
return new EvtOmegaOmega3pi;
}
void EvtOmegaOmega3pi::init(){
// check that there are 0 arguments
checkNArg(0);
checkNDaug(4);
checkSpinParent(EvtSpinType::DIRAC);
checkSpinDaughter(0,EvtSpinType::DIRAC);
checkSpinDaughter(1,EvtSpinType::SCALAR);
checkSpinDaughter(2,EvtSpinType::SCALAR);
checkSpinDaughter(3,EvtSpinType::SCALAR);
static EvtId idOmegaccplus = EvtPDL::getId("Omega_cc+");
static EvtId idOmegaczero = EvtPDL::getId("Omega_c0");
static EvtId idXiccplus = EvtPDL::getId("Xi_cc+");
static EvtId idXiczero = EvtPDL::getId("Xi_c0");
EvtId parnum=getParentId();
EvtId daughtnum = idOmegaczero;
/*f1a = 0; f1b = 0; f1c = 0; f1d = 0;
f2a = 0; f2b = 0; f2c = 0; f2d = 0;
g1a = 0; g1b = 0; g1c = 0; g1d = 0;
g2a = 0; g2b = 0; g2c = 0; g2d = 0;*/
if ( parnum == idOmegaccplus && daughtnum == idOmegaczero){
f1a = -0.754; f1b = 0.263; f1c = 0.047; f1d = 0.0205;
f2a = -1.02; f2b = 0.225; f2c = 0.0329; f2d = 0.00381;
g1a = 1.59; g1b = 0.376; g1c = 0.0926; g1d = 0.0244;
g2a = 0.119; g2b = 0.671; g2c = 0.297; g2d = -0.159;
}
if (parnum == idXiccplus && daughtnum == idOmegaczero){
f1a = 0.914; f1b = 0.348; f1c = 0.0818; f1d = 0.0187;
f2a = 0.0116; f2b = 1.31; f2c = 0.513; f2d = 0.15;
g1a = 0.258; g1b = 0.208; g1c = 0.0262; g1d = -0.00028;
g2a = -0.0608; g2b = 0.364; g2c = 0.289; g2d = -0.16;
}
}
void EvtOmegaOmega3pi::initProbMax(){
setProbMax(9000.0);
}
void EvtOmegaOmega3pi::HadronicAmp( EvtParticle* parent,
EvtParticle* child,
EvtVector4C* T,
const int i,
const int j )
{
const EvtDiracSpinor Sfinal = child->spParent(i);
const EvtDiracSpinor Sinit = parent->sp(j);
const EvtVector4R pp = parent->getP4Lab();
const EvtVector4R cp = child->getP4Lab();
const double pm = parent->mass();
const double cm = child->mass();
// \bar{u} \gamma^{\mu} u
T[0] = EvtLeptonVCurrent( Sfinal, Sinit );
// \bar{u} \gamma^{\mu}\gamma^{5} u
T[1] = EvtLeptonACurrent( Sfinal, Sinit );
// \bar{u} u
T[2] = EvtLeptonSCurrent( Sfinal, Sinit ) * ((pp+cp)/pm);
// \bar{u} \gamma^{5} u
T[3] = EvtLeptonPCurrent( Sfinal, Sinit ) * ((pp+cp)/pm);
return;
}
const double EvtOmegaOmega3pi::ff(const double f0, const double alpha, const double beta, const double gamma, EvtVector4R qqq){
return f0*(1 + alpha*qqq*qqq + beta*qqq*qqq*qqq*qqq + gamma*qqq*qqq*qqq*qqq*qqq*qqq);
}
void EvtOmegaOmega3pi::decay(EvtParticle *b1){
static EvtId TAUM=EvtPDL::getId("tau-");
b1->initializePhaseSpace(getNDaug(),getDaugs());
EvtParticle *b2, *pi1, *pi2, *pi3;
b2=b1->getDaug(0);
pi1 = b1->getDaug(1);
pi2 = b1->getDaug(2);
pi3 = b1->getDaug(3);
EvtVector4R ppi1, ppi2, ppi3; //Импульсы пионов
ppi1 = pi1 -> getP4Lab();
ppi2 = pi2 -> getP4Lab();
ppi3 = pi3 -> getP4Lab();
const EvtVector4R pb1 = b1->getP4Lab();
const EvtVector4R pb2 = b2->getP4Lab();
EvtVector4R q=pb1-pb2;
const double m1=b1->mass();
const double m2=b2->mass();
const double f1 = ff(f1a, f1b, f1c, f1d, q);
const double f2 = ff(f2a, f2b, f2c, f2d, q);
const double g1 = ff(g1a, g1b, g1c, g1d, q);
const double g2 = ff(g2a, g2b, g2c, g2d, q);
/*const double f1 = ff(-0.754,0.263,0.047,0.0205,q);
const double g1 = ff(-1.02, 0.225, 0.0329, 0.00381, q);
const double f2 = ff(1.59, 0.376, 0.0926, 0.0244, q);
const double g2 = ff(0.119, 0.671, 0.297, -0.159, q);*/
EvtVector4C H[2][2]; // vector current
EvtVector4C T[6];
// Hadronic current
for ( int i =0 ; i < 2; ++i ){
for ( int j = 0; j < 2; ++j ){
HadronicAmp( b1, b2, T, i, j );
H[i][j] = ( f1*T[0] - g1*T[1] + f2 * T[2] - f2*(m1+m2)/m1*T[0]-g2*T[3] - g2*(m1-m2)/m1*T[1]);
}
}
//Leptonic current
EvtWHad qqqqqq = EvtWHad();
EvtVector4C lep=qqqqqq.WCurrent(ppi1, ppi2, ppi3);
for ( int i =0 ; i < 2; ++i ){
for ( int j = 0; j < 2; ++j ){
vertex(i,j, H[i][j]*lep);
}
}
return;
}
/*
EvtVector4C l1, l2, tau1, tau2;
if (p->getId()==TAUM) {
tau1=EvtLeptonVACurrent(nut->spParentNeutrino(),p->sp(0));
tau2=EvtLeptonVACurrent(nut->spParentNeutrino(),p->sp(1));
l1=EvtLeptonVACurrent(l->spParent(0),nul->spParentNeutrino());
l2=EvtLeptonVACurrent(l->spParent(1),nul->spParentNeutrino());
}
else{
tau1=EvtLeptonVACurrent(p->sp(0),nut->spParentNeutrino());
tau2=EvtLeptonVACurrent(p->sp(1),nut->spParentNeutrino());
l1=EvtLeptonVACurrent(nul->spParentNeutrino(),l->spParent(0));
l2=EvtLeptonVACurrent(nul->spParentNeutrino(),l->spParent(1));
}
vertex(0,0,tau1*l1);
vertex(0,1,tau1*l2);
vertex(1,0,tau2*l1);
vertex(1,1,tau2*l2);
return;
}*/
| [
"[email protected]"
] | |
1e4ef93f96f29a8418cda2776302ed5f7d60c711 | afcae84399b4745d2931f630b1a504a992eb0186 | /tools/nan.cc | 72676e4821ab44fd9b2e23aba46054b8d9eb9cf3 | [
"Apache-2.0",
"LicenseRef-scancode-proprietary-license"
] | permissive | SVRTK/SVRTK | 6f97f137e06446186792f9ab91d56ab4fcec1c66 | 91d4e75ef0f6bcf18b830114dce1a9261e8755f2 | refs/heads/master | 2023-08-30T20:59:15.767601 | 2023-08-19T12:45:02 | 2023-08-19T12:45:02 | 153,183,935 | 40 | 6 | Apache-2.0 | 2022-01-07T14:13:01 | 2018-10-15T21:26:46 | C++ | UTF-8 | C++ | false | false | 3,204 | cc | /*
* SVRTK : SVR reconstruction based on MIRTK
*
* Copyright 2018- King's College London
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include "mirtk/Common.h"
#include "mirtk/Options.h"
#include "mirtk/IOConfig.h"
#include "mirtk/GenericImage.h"
#include "mirtk/ImageReader.h"
using namespace mirtk;
using namespace std;
// =============================================================================
// Auxiliary functions
// =============================================================================
// -----------------------------------------------------------------------------
void usage()
{
cout << "Usage: nan [stack_name] [threshold] \n" << endl;
cout << endl;
cout << "Function for setting voxels with large (abs) and NaN values to 0." << endl;
cout << endl;
cout << "\t" << endl;
cout << "\t" << endl;
exit(0);
}
// -----------------------------------------------------------------------------
// =============================================================================
// Main function
// =============================================================================
// -----------------------------------------------------------------------------
int main(int argc, char **argv)
{
if (argc < 3)
usage();
const char *tmp_fname;
UniquePtr<BaseImage> tmp_image;
UniquePtr<ImageReader> image_reader;
InitializeIOLibrary();
//-------------------------------------------------------------------
RealImage main_stack;
tmp_fname = argv[1];
image_reader.reset(ImageReader::TryNew(tmp_fname));
tmp_image.reset(image_reader->Run());
main_stack = *tmp_image;
argc--;
argv++;
double lower_threshold = 0;
lower_threshold = atof(argv[1]);
argc--;
argv++;
for (int z = 0; z < main_stack.GetZ(); z++) {
for (int y = 0; y < main_stack.GetY(); y++) {
for (int x = 0; x < main_stack.GetX(); x++) {
for (int t = 0; t < main_stack.GetT(); t++) {
if (main_stack(x,y,z,t) != main_stack(x,y,z,t) || abs(main_stack(x,y,z,t)) > lower_threshold || main_stack(x,y,z,t) < 0) {
main_stack(x,y,z,t) = 0;
}
}
}
}
}
main_stack.Write(tmp_fname);
//-------------------------------------------------------------------
return 0;
}
| [
"[email protected]"
] | |
db2b982e44641f12b40ea741094245a64af235ab | 3349be5969cac6fea2327873549e9ed7e70847f4 | /NYXEngine/OpenGLRenderer.h | 537885d1b3a70ad5be5e21b9aceb4f069ce30e5e | [] | no_license | RayMicheau/Old-Nyx-Engine | e3f7e746863b92cbe0d9351e1b2696094951b7f2 | eb3d0d6fc2c155905060439e98108efdb7b36181 | refs/heads/master | 2020-06-11T14:59:55.724628 | 2016-12-05T16:25:00 | 2016-12-05T16:25:00 | 75,643,637 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,135 | h | #pragma once
#include "AbstractRenderer.h"
#include <vector>
#include "OpenGL\include\glew.h"
#include "OpenGL\include\glut.h"
#include "vgl.h"
#include "glm\glm\glm.hpp"
#include "glm\glm\gtc\matrix_transform.hpp"
#include "LoadShaders.h"
#include "Camera.h"
class OpenGLRenderer :
public AbstractRenderer
{
public:
OpenGLRenderer();
~OpenGLRenderer();
enum VAO_IDs { Triangles, NumVAOs };
enum Buffer_IDs { ArrayBuffer, NumBuffers };
enum Attrib_IDs { vPosition = 0 };
GLuint VAOs[NumVAOs];
GLuint Buffers[NumBuffers];
float CamDist = 1;
GLuint location, location2, location3;
Camera* CameraOne;
float AminX, AmaxX, AminY, AmaxY, AminZ, AmaxZ;
float BminX, BmaxX, BminY, BmaxY, BminZ, BmaxZ;
float CminX, CmaxX, CminY, CmaxY, CminZ, CmaxZ;
int playerScore = 0, aiScore = 0;
void PreRender();
void PostRender();
void renderPrimitive(PRIMITIVETYPE prim);
bool AABBTemp();
float movementX = 0.3;
float movementY = 0.2f;
glm::vec3 zero = glm::vec3(0, 0, 0);
//bool loadOBJ(const char* path, std::vector<glm::vec3> &out_vertices, std::vector<glm::vec2> &out_uvs, std::vector<glm::vec3> &out_normals);
};
| [
"[email protected]"
] | |
af9fbeac297c296befaeab984b12bbc324cadbdd | 209779c03feff329fcc7e0898854c4ba0c6d4d16 | /codeforces/codes/CF1A.cpp | 7b20a7835ab55db2ae440fa96a09d79d25c513ff | [
"MIT"
] | permissive | TonyCrane/OI | 76b90833a495bf491377b91e88b944e2113bc49b | 562f5f45d0448f4eab77643b99b825405a123d92 | refs/heads/master | 2022-11-08T20:00:37.196582 | 2020-06-27T14:51:54 | 2020-06-27T14:51:54 | 161,732,784 | 3 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 712 | cpp | /*************************************************************
* > File Name : CF1A.cpp
* > Author : Tony_Wong
* > Created Time : 2019/11/11 20:49:58
* > Algorithm :
**************************************************************/
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
inline LL read() {
LL x = 0; LL f = 1; char ch = getchar();
while (!isdigit(ch)) {if (ch == '-') f = -1; ch = getchar();}
while (isdigit(ch)) {x = x * 10 + ch - 48; ch = getchar();}
return x * f;
}
LL n, m, a;
int main() {
n = read(); m = read(); a = read();
printf("%lld\n", (long long)(ceil(n / (double)a) * ceil(m / (double)a)));
return 0;
} | [
"[email protected]"
] | |
933f0194df2b0baec1fe6589412c10b3d7b95277 | 6a9b877ca9b18ccf3764a999340aeda1679eb76c | /src/capengine/Point2d.h | d4dc640b0f69ec4a0735043c07521dce6733b1df | [] | no_license | calebpalmer/capengine | f63299ce55bba6621d021daa4d5857efcc12a1b4 | d6851a776372e676afcb17711cec115cdcf2b392 | refs/heads/master | 2023-07-07T09:07:38.862127 | 2023-06-29T23:44:52 | 2023-06-29T23:44:52 | 8,950,745 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 541 | h | #ifndef POINT2D_H
#define POINT2D_H
//@brief - Class representing a point
//@author - Caleb Palmer
namespace CapEngine
{
class Point2d
{
double x;
double y;
private:
// Making copy constructor private
Point2d(const Point2d &){};
// make operator= private so that it is not used
Point2d &operator=(const Point2d &) { return *this; }
public:
Point2d();
Point2d(double x_in, double y_in);
double getX() const;
double getY() const;
void setX(double x_in);
void setY(double y_in);
};
} // namespace CapEngine
#endif
| [
"[email protected]"
] | |
4012df275ec063383264019d5d6b6c197615e14a | 55d560fe6678a3edc9232ef14de8fafd7b7ece12 | /libs/hana/example/pair/orderable.cpp | cf78b347d0d47583af8eba0ca60e8fbc4ce7178c | [
"BSL-1.0",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | stardog-union/boost | ec3abeeef1b45389228df031bf25b470d3d123c5 | caa4a540db892caa92e5346e0094c63dea51cbfb | refs/heads/stardog/develop | 2021-06-25T02:15:10.697006 | 2020-11-17T19:50:35 | 2020-11-17T19:50:35 | 148,681,713 | 0 | 0 | BSL-1.0 | 2020-11-17T19:50:36 | 2018-09-13T18:38:54 | C++ | UTF-8 | C++ | false | false | 517 | cpp | // Copyright Louis Dionne 2013-2017
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt)
#include <boost/hana/less.hpp>
#include <boost/hana/pair.hpp>
namespace hana = boost::hana;
static_assert(hana::make_pair(1, 'x') < hana::make_pair(1, 'y'), "");
static_assert(hana::make_pair(1, 'x') < hana::make_pair(10, 'x'), "");
static_assert(hana::make_pair(1, 'y') < hana::make_pair(10, 'x'), "");
int main() { }
| [
"[email protected]"
] | |
e8ea70bee5e8183d8ca78562deaa8fd72dff09ba | e7048e0c504bf52660214efedae436952d082111 | /ca/communityconfigurationproject_e/AI_DisabledATLauncherUseAgainstInfantry/config.cpp | 8ced17a4728caaef219029b49dd68213c1962252 | [] | no_license | RomKaz/work-in-progress | cf08e95636309c4b66701857bd3ae78ea96c8a3b | 61acddd17411055f3706e8cde95e10f4a4949e67 | refs/heads/master | 2020-12-30T10:23:10.094084 | 2015-06-29T22:44:08 | 2015-06-29T22:44:08 | 38,160,476 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,081 | cpp | ////////////////////////////////////////////////////////////////////
//DeRap: Produced from mikero's Dos Tools Dll version 4.65
//Fri Oct 31 06:13:56 2014 : Source 'file' date Fri Oct 31 06:13:56 2014
//http://dev-heaven.net/projects/list_files/mikero-pbodll
////////////////////////////////////////////////////////////////////
#define _ARMA_
//Class CommunityConfigurationProject_E : AI_DisabledATLauncherUseAgainstInfantry\config.bin{
class cfgPatches
{
class CA_CommunityConfigurationProject_E_AI_DisabledATLauncherUseAgainstInfantry
{
units[] = {};
weapons[] = {};
requiredVersion = 0.1;
requiredAddons[] = {"CA_CommunityConfigurationProject_E"};
};
};
class CfgAmmo
{
class RocketBase;
class R_SMAW_HEDP;
class R_M136_AT: RocketBase
{
irLock = 1;
};
class R_RPG18_AT: RocketBase
{
irLock = 1;
};
class R_PG7V_AT: RocketBase
{
irLock = 1;
};
class R_OG7_AT: R_PG7V_AT
{
irLock = 0;
};
class R_PG9_AT: RocketBase
{
irLock = 1;
};
class R_OG9_HE: R_PG9_AT
{
irLock = 0;
};
class R_SMAW_HEAA: R_SMAW_HEDP
{
irLock = 1;
};
};
//};
| [
"[email protected]"
] | |
e441d60eb61da6c5b199d6c6bf0fa93b85bd1492 | 4a50dedb00faee7f03d5d5615eb2104f1a32968e | /Assg9-Task1_jjennin/fractiontype.h | 02b8e541aee15fa5dff99725fdfb6cfa4b017f32 | [] | no_license | jjennin/odu-cs250 | 75b03cfe19edb3cd879497e68924d618dfb5d948 | 0697ec01527263e22b03c1a44a28d9b6440c34e6 | refs/heads/master | 2021-09-10T07:00:02.610538 | 2018-03-22T01:33:51 | 2018-03-22T01:33:51 | 124,950,536 | 2 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 962 | h | #ifndef FRACTIONTYPE_H
#define FRACTIONTYPE_H
#include <iostream>
class fractionType{
int numerator;
int denominator;
friend std::ostream& operator<<(std::ostream& out, const fractionType& rightFr);
friend std::istream& operator>>(std::istream& in, fractionType& rightFr);
public:
fractionType(){
numerator=0; denominator=1;
}
fractionType(int num, int den){
numerator=num; denominator=den;
}
bool operator==(fractionType rightFr);
bool operator!=(fractionType rightFr);
bool operator<=(fractionType rightFr);
bool operator>=(fractionType rightFr);
bool operator<(fractionType rightFr);
bool operator>(fractionType rightFr);
fractionType operator+(fractionType rightFr);
fractionType operator-(fractionType rightFr);
fractionType operator/(fractionType rightFr);
fractionType operator*(fractionType rightFr);
};
#endif // FRACTIONTYPE_H
| [
"[email protected]"
] | |
0d15c5740aeb90eca37f14cfc1fed5542fecb759 | d875df6d3ab5161475156661777aabfa01cef560 | /uva/uva12786.cpp | d33736752a98258e7ec2a10e2e7284fcee02903e | [
"BSD-2-Clause"
] | permissive | partho222/programming | 385de1c86e203d305e89543d7590012367dec41c | 98a87b6a04f39c343125cf5f0dd85e0f1c37d56c | refs/heads/master | 2021-01-10T05:23:46.470483 | 2015-11-24T15:35:36 | 2015-11-24T15:35:36 | 46,603,152 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,335 | cpp | /* Tariq ahmed khan - Daffodil */
#include <bits/stdc++.h>
#define pi 2*acos(0.0)
#define scan(x) scanf("%d",&x)
#define sf scanf
#define pf printf
#define pb push_back
#define memoclr(n,x) memset(n,x,sizeof(n) )
#define INF 1 << 30
#define foo(i,j,k) for(int (x)=(i);(x)<(j);(x)+=(k))
#define ffoo(i,j,k) for(int (x)=(i);(x)<=(j);(x)+=(k))
typedef long long LLI;
typedef unsigned long long LLU;
template<class T> T gcd(T x, T y){if (y==0) return x; return gcd(y,x%y);}
template<class T> T lcm(T x, T y){return ((x/gcd(x,y))*y);}
template<class T> T maxt(T x, T y){if (x > y) return x; else return y;}
template<class T> T mint(T x, T y){if (x < y) return x; else return y;}
template<class T> T power(T x, T y){T res=1,a = x; while(y){if(y&1){res*=a;}a*=a;y>>=1;}return res;}
template<class T> T bigmod(T x,T y,T mod){T res=1,a=x; while(y){if(y&1){res=(res*a)%mod;}a=((a%mod)*(a%mod))%mod;y>>=1;}return res;}
int dir[8][2]={{-1,0}
,{1,0}
,{0,-1}
,{0,1}
,{-1,-1}
,{-1,1}
,{1,-1}
,{1,1}};
using namespace std;
bool comp (const int &a, const int &b){
return a>b;
}
int main() {
#ifdef partho222
freopen("input.txt","r",stdin);
//freopen("output.txt","w",stdout);
#endif
int n;
while(scan(n) == 1){
int ary[n];
for(int i=0 ; i<n ; i++){
scan(ary[i]);
}
int f=0;
sort(ary+0,ary+n,comp);
for(int i=0 ; i<n ; i++){
/*for(int m=0 ; m<n ; m++){
cout << ary[m] << endl;
}
cout << endl;*/
int x = ary[i];
for(int j=i+1 ; j<n && x>0 ; j++ , x--){
ary[j]--;
}
/*for(int m=0 ; m<n ; m++){
cout << ary[m] << endl;
}
cout << endl;*/
sort(ary+i,ary+n,comp);
/*if(x < 0 ){
f = 1; break;
}*/
}
for(int i = 0 ; i<n ; i++){
if(ary[i] < 0) f=1;
}
if(f == 1){
pf("0\n");
}
else{
pf("1\n");
}
}
return 0;
}
| [
"[email protected]"
] | |
8b34f2994f9c78a6a168d135461e9bb9a48de98d | bb2a47d45c7c6ba774ac1b23343a26bfb34f68e7 | /LeetCode/2_AddTwoNumbers.cpp | 3dd67c0f914cf9b9dc3f582fa3896c01a4778bef | [] | no_license | qianfeng0/CodePractice | 20e89603cd1029d77045243687e915b2bf966cdb | 083eb2f5eff8a242e79a407b9354f6a155f100c8 | refs/heads/master | 2023-01-22T09:59:09.888463 | 2020-11-22T08:50:47 | 2020-11-22T08:50:47 | 89,705,189 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,609 | cpp | /**
You are given two non-empty linked lists representing two non-negative integers. The digits are stored in reverse order and each of their nodes contain a single digit. Add the two numbers and return it as a linked list.
You may assume the two numbers do not contain any leading zero, except the number 0 itself.
Input: (2 -> 4 -> 3) + (5 -> 6 -> 4)
Output: 7 -> 0 -> 8
*/
/**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* ListNode *next;
* ListNode(int x) : val(x), next(NULL) {}
* };
*/
#include <stdio.h>
struct ListNode {
int val;
ListNode *next;
ListNode(int x) : val(x), next(NULL) {}
};
class Solution {
public:
ListNode* addTwoNumbers(ListNode* l1, ListNode* l2) {
ListNode* const list = new ListNode(l1->val + l2->val);
ListNode* cur = list;
l1 = l1->next;
l2 = l2->next;
while(l1 != NULL || l2 != NULL)
{
int sum = 0;
if(l1 != NULL){
sum += l1->val;
l1 = l1->next;
}
if(l2 != NULL){
sum += l2->val;
l2 = l2->next;
}
cur->next = new ListNode(sum);
cur = cur->next;
}
cur = list;
while(cur)
{
if(cur->val >= 10)
{
cur->val -= 10;
if(cur->next)
{
cur->next->val++;
}
else
{
cur->next = new ListNode(1);
}
}
cur = cur->next;
}
return list;
}
};
int main()
{
//init list1 and list2
ListNode *list1, *list2;
list1 = new ListNode(2);
list2 = new ListNode(5);
ListNode *cur;
cur = list1;
cur->next = new ListNode(4);
cur = cur->next;
cur->next = new ListNode(3);
cur = list2;
cur->next = new ListNode(6);
cur = cur->next;
cur->next = new ListNode(8);
//solution
Solution solution;
ListNode* listAdd = solution.addTwoNumbers(list1, list2);
//print out
cur = listAdd;
while(cur)
{
printf("%d ", cur->val);
cur = cur->next;
}
printf("\n");
//delete
while(list1)
{
cur = list1;
list1 = list1->next;
delete(cur);
}
while(list2)
{
cur = list2;
list2 = list2->next;
delete(cur);
}
while(listAdd)
{
cur = listAdd;
listAdd = listAdd->next;
delete(cur);
}
return 0;
} | [
"[email protected]"
] | |
a68df48903d8559e55546f3cc34d3309c0db12a7 | 18ca163c7953831d6b9147104b4d98bdb79dc9ad | /VS version/LSG/GameStatistics.h | 6408fca5532b23cda08a68887175ece0078b726a | [] | no_license | chegainthegithub/LSG | 27214167725a9910b423f7a55e44946c42274f05 | f17aa5bf3a92a243dc22eb75bd1fb39a928b5799 | refs/heads/master | 2016-09-05T10:36:39.452609 | 2015-04-24T15:46:53 | 2015-04-24T15:46:53 | 33,578,896 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 616 | h | #ifndef GAMESTATISTICS_H
#define GAMESTATISTICS_H
class GameStatistics
{
public:
struct statistics
{
int eaten ;
int movesmade ;
int enemieskilled ;
};
statistics element;
GameStatistics()
{
element.eaten = 0;
element.movesmade = 0;
element.enemieskilled = 0;
}
void UpdateStats(int local)
{
if (local)
element.eaten++;
element.movesmade++;
}
void show()
{
std::cout << "eaten == " << element.eaten<<std::endl;
std::cout << "moves made == " << element.movesmade <<std::endl;
}
};
#endif // GAMESTATISTICS
| [
"[email protected]"
] | |
d02a2edfce8b098f11f39323a66ff301d7a1bc9a | ab9324a08e91a44e14204240b57b3085366a1b6f | /Renderer/RendererRuntime/src/Resource/Detail/IResource.cpp | d299f85b7b2b515a93ebed2ff7e61d1c1cd7bd1f | [
"MIT"
] | permissive | CitrusForks/unrimp | fe78fe19e5d9ad37135a1eaea652aadb679be7c9 | 94b68b773999d152667891bd4742910968aefbad | refs/heads/master | 2021-01-02T22:46:12.212430 | 2017-07-30T06:41:50 | 2017-07-30T10:03:53 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 6,992 | cpp | /*********************************************************\
* Copyright (c) 2012-2017 The Unrimp Team
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software
* and associated documentation files (the "Software"), to deal in the Software without
* restriction, including without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all copies or
* substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
* BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
\*********************************************************/
//[-------------------------------------------------------]
//[ Includes ]
//[-------------------------------------------------------]
#include "RendererRuntime/PrecompiledHeader.h"
#include "RendererRuntime/Resource/Detail/IResource.h"
#include "RendererRuntime/Resource/IResourceListener.h"
#include <algorithm>
//[-------------------------------------------------------]
//[ Anonymous detail namespace ]
//[-------------------------------------------------------]
namespace
{
namespace detail
{
//[-------------------------------------------------------]
//[ Global functions ]
//[-------------------------------------------------------]
inline bool orderByResourceListener(RendererRuntime::IResourceListener* left, RendererRuntime::IResourceListener* right)
{
return (left < right);
}
//[-------------------------------------------------------]
//[ Anonymous detail namespace ]
//[-------------------------------------------------------]
} // detail
}
//[-------------------------------------------------------]
//[ Namespace ]
//[-------------------------------------------------------]
namespace RendererRuntime
{
//[-------------------------------------------------------]
//[ Public methods ]
//[-------------------------------------------------------]
void IResource::connectResourceListener(IResourceListener& resourceListener)
{
SortedResourceListeners::iterator iterator = std::lower_bound(mSortedResourceListeners.begin(), mSortedResourceListeners.end(), &resourceListener, ::detail::orderByResourceListener);
if (iterator == mSortedResourceListeners.end() || *iterator != &resourceListener)
{
mSortedResourceListeners.insert(iterator, &resourceListener);
resourceListener.mResourceConnections.emplace_back(IResourceListener::ResourceConnection(mResourceManager, mResourceId));
resourceListener.onLoadingStateChange(*this);
}
}
void IResource::disconnectResourceListener(IResourceListener& resourceListener)
{
SortedResourceListeners::iterator iterator = std::lower_bound(mSortedResourceListeners.begin(), mSortedResourceListeners.end(), &resourceListener, ::detail::orderByResourceListener);
if (iterator != mSortedResourceListeners.end() && *iterator == &resourceListener)
{
{ // TODO(co) If this turns out to be a performance problem, we might want to use e.g. a sorted vector
const IResourceListener::ResourceConnection resourceConnection(mResourceManager, mResourceId);
IResourceListener::ResourceConnections::iterator connectionIterator = std::find_if(resourceListener.mResourceConnections.begin(), resourceListener.mResourceConnections.end(),
[resourceConnection](const IResourceListener::ResourceConnection& currentResourceConnection) { return (currentResourceConnection.resourceManager == resourceConnection.resourceManager && currentResourceConnection.resourceId == resourceConnection.resourceId); }
);
assert(connectionIterator != resourceListener.mResourceConnections.end());
resourceListener.mResourceConnections.erase(connectionIterator);
}
mSortedResourceListeners.erase(iterator);
}
}
//[-------------------------------------------------------]
//[ Protected methods ]
//[-------------------------------------------------------]
IResource& IResource::operator=(IResource&& resource)
{
// Swap data
std::swap(mResourceManager, resource.mResourceManager);
std::swap(mResourceId, resource.mResourceId);
std::swap(mAssetId, resource.mAssetId);
std::swap(mLoadingState, resource.mLoadingState);
std::swap(mSortedResourceListeners, resource.mSortedResourceListeners); // This is fine, resource listeners store a resource ID instead of a raw pointer
// Done
return *this;
}
void IResource::setLoadingState(LoadingState loadingState)
{
mLoadingState = loadingState;
for (IResourceListener* resourceListener : mSortedResourceListeners)
{
resourceListener->onLoadingStateChange(*this);
}
}
void IResource::deinitializeElement()
{
// Sanity check
assert((LoadingState::LOADED == mLoadingState || LoadingState::UNLOADED == mLoadingState) && "Resource deinitialized while in-flight inside the resource streamer");
// Disconnect all resource listeners
const IResourceListener::ResourceConnection resourceConnection(mResourceManager, mResourceId);
for (IResourceListener* resourceListener : mSortedResourceListeners)
{
// TODO(co) If this turns out to be a performance problem, we might want to use e.g. a sorted vector
IResourceListener::ResourceConnections::iterator connectionIterator = std::find_if(resourceListener->mResourceConnections.begin(), resourceListener->mResourceConnections.end(),
[resourceConnection](const IResourceListener::ResourceConnection& currentResourceConnection) { return (currentResourceConnection.resourceManager == resourceConnection.resourceManager && currentResourceConnection.resourceId == resourceConnection.resourceId); }
);
assert(connectionIterator != resourceListener->mResourceConnections.end());
resourceListener->mResourceConnections.erase(connectionIterator);
}
// Reset everything
mResourceManager = nullptr;
setUninitialized(mResourceId);
setUninitialized(mAssetId);
mLoadingState = LoadingState::UNLOADED;
mSortedResourceListeners.clear();
}
//[-------------------------------------------------------]
//[ Namespace ]
//[-------------------------------------------------------]
} // RendererRuntime
| [
"[email protected]"
] | |
00f5b125f44565863e19de57baebd186c6a5aa85 | f7c622b72bc3297df87350897c055ad5b38475ae | /practice/cpp/findsinglenumber/findSingleNumber.cpp | 7333e8e82170d217077e4daaf208abaee2f24971 | [] | no_license | xinnige/practice | c88f30afae502beac9046686dfd0b10baec83f55 | ef627bc4a5031054e8f7144ea6df04dc7e95be73 | refs/heads/master | 2023-01-12T01:54:49.340274 | 2020-11-20T06:56:57 | 2020-11-20T06:56:57 | 21,447,704 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 315 | cpp | #include "stdlib.h"
#include "stdio.h"
int singleNumber(int A[], int n)
{
int sum = 0;
for (int i=0; i<n; i++){
sum ^= A[i];
}
return sum;
}
int main()
{
int a[]={-11,2,3,4,5,6,7,8,9,3,4,5,6,7,8,9,-11};
int single = singleNumber(a,17);
printf("%d\n",single);
return 0;
}
| [
"[email protected]"
] | |
2bedbda027981c68e32835e7eda8d06866e3326b | bf007dec921b84d205bffd2527e376bb60424f4c | /Codeforces_Submissions/1248A.cpp | abd3c69b8693abe365e69dcae0070f9a3cfbb1a7 | [] | no_license | Suvrojyoti/APS-2020 | 257e4a94f52f5fe8adcac1ba4038cc66e81d9d26 | d4de0ef098e7ce9bb40036ef55616fa1f159f7a5 | refs/heads/master | 2020-12-21T19:27:59.955338 | 2020-04-22T13:27:49 | 2020-04-22T13:27:49 | 236,534,218 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 699 | cpp | #include <bits/stdc++.h>
#define ll long long int
#define pb push_back
#define MOD 1000000007
using namespace std;
int main()
{
#ifndef ONLINE_JUDGE
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
#endif
ll n,m,test,o,e,o1,e1;
cin>>test;
while (test--)
{
cin >> n ;
o=o1=e=e1=0;
ll test;
for (ll i = 0; i < n; i++)
{
cin>>test;
if(test%2)
o++;
else
{
e++;
}
}
cin>>n;
for (ll i = 0; i < n; i++)
{
cin >> test;
if (test % 2)
o1++;
else
{
e1++;
}
}
cout<<o1*o+e1*e<<endl;
}
return 0;
} | [
"[email protected]"
] | |
666b858d7c06eba09414207b7e5c41513820ce59 | 196a89c3dc4fcef9492a233cb58423b3a3f49829 | /QT/Maze/maze_page.h | 79c5045e0246b5eb0c0afaa279ef6de69537ce61 | [] | no_license | Mostafa-Hamidifard/midterm_project | e52fedb4734bbd230379532a32a6764d9bf53b43 | 806bcdebb2e3c1428e7edd322256084d80061e08 | refs/heads/main | 2023-05-28T13:56:17.968227 | 2021-06-05T19:50:10 | 2021-06-05T19:50:10 | 365,745,843 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 599 | h | #ifndef MAZE_PAGE_H
#define MAZE_PAGE_H
#include <QDialog>
#include"maze.h"
#include "rectnode.h"
namespace Ui {
class maze_page;
}
class maze_page : public QDialog
{
Q_OBJECT
public:
Maze *maze;
explicit maze_page(QWidget *parent = nullptr,int m=10,int n=20);
~maze_page();
private slots:
void on_pushButton_5_clicked();
void on_pad_up_clicked();
void on_pad_right_clicked();
void on_pad_down_clicked();
void on_pad_left_clicked();
void on_btn_bfs_clicked();
void on_btn_dfs_clicked();
private:
Ui::maze_page *ui;
};
#endif // MAZE_PAGE_H
| [
"[email protected]"
] | |
65d08a049bdb5ac65955ae5d31c76ffbeb3681cc | 353aa7e8c742ed640eba5bbe7c40ec2c67002a88 | /include/subject_events.hpp | 6fe5cc9d2d8a734f9b631fb2e863a323488082df | [] | no_license | bennykr/observers | a3e1eff71fc30619d6f74b7dc25e6dcaa1ff9ddc | a632bbc1eb7773b51ddbcf04bdce4b7a8d2bad0e | refs/heads/master | 2022-12-07T19:55:25.113942 | 2020-09-03T11:27:17 | 2020-09-03T11:27:17 | 288,672,725 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,784 | hpp | /*
* subject_events.hpp
*
* Created on: Aug 19, 2020
* Author: benny
*/
#ifndef OBSERVERS_SUBJECT_EVENTS_HPP_
#define OBSERVERS_SUBJECT_EVENTS_HPP_
#include "logging.hpp"
#include "event_handle.hpp"
#include <set>
#include <string>
namespace observers {
// Forward deceleration, for the purpose of declaring 'Subject' a friend
template <typename TDerived>
class SubjectBase;
template <typename TSubject>
class SubjectEvents{
private:
// Observers are attached (detached) in EventHandlesContainer
// using `SubjectBase::attach_event_handle(event_handle)`, which
// refers the attachment (detachment) operation to its `events` object.
// For this purpose it needs to be a friend of the 'SubjectEvents' class.
template <typename TDerived>
friend class SubjectBase;
// One events handle per attached data structure parameterized on TAxis
std::set<EventHandle<TSubject>*> attached_event_handles;
void attach_event_handle(EventHandle<TSubject> & event_handle){
assert(attached_event_handles.count(&event_handle) == 0);
attached_event_handles.insert(&event_handle);
}
// Called by base class BaseAxis of TAxis
void detach_event_handle(EventHandle<TSubject> & event_handle){
assert(attached_event_handles.count(&event_handle) > 0);
attached_event_handles.erase(&event_handle);
}
// Used to make sure TSubject can safely be deleted.
// Also used for tests.
size_t number_of_attached_handles() const {
return attached_event_handles.size();
}
void notify(std::string const & message){
for(EventHandle<TSubject> * event_handle : attached_event_handles){
event_handle->notify(message);
}
}
};
} // namespace observers
#endif /* OBSERVERS_SUBJECT_EVENTS_HPP_ */
| [
"[email protected]"
] | |
2f9614d1dff8f902f7ba86aa32dbf34cd915bc99 | 8f6f2f1c105b106f8b1b8309bb59630f5a166f05 | /property/qteditorfactory.cpp | e7ef7531ce36a866593675efe9585c7b49abfe0d | [] | no_license | lyl12345/LearnOpenGLQt | 230024ce813d512c72001401220fb1d66e8fbd15 | 7b1f7a62b8ed10de4c541ae8a3db4605f2fb5d54 | refs/heads/master | 2022-12-05T08:23:52.313521 | 2020-08-18T12:44:49 | 2020-08-18T12:44:49 | 276,817,848 | 1 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 89,001 | cpp | /****************************************************************************
**
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the Qt Solutions component.
**
** $QT_BEGIN_LICENSE:BSD$
** You may use this file under the terms of the BSD license as follows:
**
** "Redistribution and use in source and binary forms, with or without
** modification, are permitted provided that the following conditions are
** met:
** * Redistributions of source code must retain the above copyright
** notice, this list of conditions and the following disclaimer.
** * Redistributions in binary form must reproduce the above copyright
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names
** of its contributors may be used to endorse or promote products derived
** from this software without specific prior written permission.
**
**
** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
**
** $QT_END_LICENSE$
**
****************************************************************************/
#include "qteditorfactory.h"
#include "qtpropertybrowserutils_p.h"
#include <QSpinBox>
#include <QScrollBar>
#include <QComboBox>
#include <QAbstractItemView>
#include <QLineEdit>
#include <QDateTimeEdit>
#include <QHBoxLayout>
#include <QMenu>
#include <QKeyEvent>
#include <QApplication>
#include <QLabel>
#include <QToolButton>
#include <QColorDialog>
#include <QFontDialog>
#include <QSpacerItem>
#include <QStyleOption>
#include <QPainter>
#include <QMap>
#include "matrixeditor.h"
#if defined(Q_CC_MSVC)
# pragma warning(disable: 4786) /* MS VS 6: truncating debug info after 255 characters */
#endif
#if QT_VERSION >= 0x040400
QT_BEGIN_NAMESPACE
#endif
// Set a hard coded left margin to account for the indentation
// of the tree view icon when switching to an editor
static inline void setupTreeViewEditorMargin(QLayout *lt)
{
enum { DecorationMargin = 4 };
if (QApplication::layoutDirection() == Qt::LeftToRight)
lt->setContentsMargins(DecorationMargin, 0, 0, 0);
else
lt->setContentsMargins(0, 0, DecorationMargin, 0);
}
// ---------- EditorFactoryPrivate :
// Base class for editor factory private classes. Manages mapping of properties to editors and vice versa.
template <class Editor>
class EditorFactoryPrivate
{
public:
typedef QList<Editor *> EditorList;
typedef QMap<QtProperty *, EditorList> PropertyToEditorListMap;
typedef QMap<Editor *, QtProperty *> EditorToPropertyMap;
Editor *createEditor(QtProperty *property, QWidget *parent);
void initializeEditor(QtProperty *property, Editor *e);
void slotEditorDestroyed(QObject *object);
PropertyToEditorListMap m_createdEditors;
EditorToPropertyMap m_editorToProperty;
};
template <class Editor>
Editor *EditorFactoryPrivate<Editor>::createEditor(QtProperty *property, QWidget *parent)
{
Editor *editor = new Editor(parent);
initializeEditor(property, editor);
return editor;
}
template <class Editor>
void EditorFactoryPrivate<Editor>::initializeEditor(QtProperty *property, Editor *editor)
{
typename PropertyToEditorListMap::iterator it = m_createdEditors.find(property);
if (it == m_createdEditors.end())
it = m_createdEditors.insert(property, EditorList());
it.value().append(editor);
m_editorToProperty.insert(editor, property);
}
template <class Editor>
void EditorFactoryPrivate<Editor>::slotEditorDestroyed(QObject *object)
{
const typename EditorToPropertyMap::iterator ecend = m_editorToProperty.end();
for (typename EditorToPropertyMap::iterator itEditor = m_editorToProperty.begin(); itEditor != ecend; ++itEditor) {
if (itEditor.key() == object) {
Editor *editor = itEditor.key();
QtProperty *property = itEditor.value();
const typename PropertyToEditorListMap::iterator pit = m_createdEditors.find(property);
if (pit != m_createdEditors.end()) {
pit.value().removeAll(editor);
if (pit.value().empty())
m_createdEditors.erase(pit);
}
m_editorToProperty.erase(itEditor);
return;
}
}
}
// ------------ QtSpinBoxFactory
class QtSpinBoxFactoryPrivate : public EditorFactoryPrivate<QSpinBox>
{
QtSpinBoxFactory *q_ptr;
Q_DECLARE_PUBLIC(QtSpinBoxFactory)
public:
void slotPropertyChanged(QtProperty *property, int value);
void slotRangeChanged(QtProperty *property, int min, int max);
void slotSingleStepChanged(QtProperty *property, int step);
void slotReadOnlyChanged(QtProperty *property, bool readOnly);
void slotSetValue(int value);
};
void QtSpinBoxFactoryPrivate::slotPropertyChanged(QtProperty *property, int value)
{
if (!m_createdEditors.contains(property))
return;
QListIterator<QSpinBox *> itEditor(m_createdEditors[property]);
while (itEditor.hasNext()) {
QSpinBox *editor = itEditor.next();
if (editor->value() != value) {
editor->blockSignals(true);
editor->setValue(value);
editor->blockSignals(false);
}
}
}
void QtSpinBoxFactoryPrivate::slotRangeChanged(QtProperty *property, int min, int max)
{
if (!m_createdEditors.contains(property))
return;
QtIntPropertyManager *manager = q_ptr->propertyManager(property);
if (!manager)
return;
QListIterator<QSpinBox *> itEditor(m_createdEditors[property]);
while (itEditor.hasNext()) {
QSpinBox *editor = itEditor.next();
editor->blockSignals(true);
editor->setRange(min, max);
editor->setValue(manager->value(property));
editor->blockSignals(false);
}
}
void QtSpinBoxFactoryPrivate::slotSingleStepChanged(QtProperty *property, int step)
{
if (!m_createdEditors.contains(property))
return;
QListIterator<QSpinBox *> itEditor(m_createdEditors[property]);
while (itEditor.hasNext()) {
QSpinBox *editor = itEditor.next();
editor->blockSignals(true);
editor->setSingleStep(step);
editor->blockSignals(false);
}
}
void QtSpinBoxFactoryPrivate::slotReadOnlyChanged( QtProperty *property, bool readOnly)
{
if (!m_createdEditors.contains(property))
return;
QtIntPropertyManager *manager = q_ptr->propertyManager(property);
if (!manager)
return;
QListIterator<QSpinBox *> itEditor(m_createdEditors[property]);
while (itEditor.hasNext()) {
QSpinBox *editor = itEditor.next();
editor->blockSignals(true);
editor->setReadOnly(readOnly);
editor->blockSignals(false);
}
}
void QtSpinBoxFactoryPrivate::slotSetValue(int value)
{
QObject *object = q_ptr->sender();
const QMap<QSpinBox *, QtProperty *>::ConstIterator ecend = m_editorToProperty.constEnd();
for (QMap<QSpinBox *, QtProperty *>::ConstIterator itEditor = m_editorToProperty.constBegin(); itEditor != ecend; ++itEditor) {
if (itEditor.key() == object) {
QtProperty *property = itEditor.value();
QtIntPropertyManager *manager = q_ptr->propertyManager(property);
if (!manager)
return;
manager->setValue(property, value);
return;
}
}
}
/*!
\class QtSpinBoxFactory
\brief The QtSpinBoxFactory class provides QSpinBox widgets for
properties created by QtIntPropertyManager objects.
\sa QtAbstractEditorFactory, QtIntPropertyManager
*/
/*!
Creates a factory with the given \a parent.
*/
QtSpinBoxFactory::QtSpinBoxFactory(QObject *parent)
: QtAbstractEditorFactory<QtIntPropertyManager>(parent)
{
d_ptr = new QtSpinBoxFactoryPrivate();
d_ptr->q_ptr = this;
}
/*!
Destroys this factory, and all the widgets it has created.
*/
QtSpinBoxFactory::~QtSpinBoxFactory()
{
qDeleteAll(d_ptr->m_editorToProperty.keys());
delete d_ptr;
}
/*!
\internal
Reimplemented from the QtAbstractEditorFactory class.
*/
void QtSpinBoxFactory::connectPropertyManager(QtIntPropertyManager *manager)
{
connect(manager, SIGNAL(valueChanged(QtProperty *, int)),
this, SLOT(slotPropertyChanged(QtProperty *, int)));
connect(manager, SIGNAL(rangeChanged(QtProperty *, int, int)),
this, SLOT(slotRangeChanged(QtProperty *, int, int)));
connect(manager, SIGNAL(singleStepChanged(QtProperty *, int)),
this, SLOT(slotSingleStepChanged(QtProperty *, int)));
connect(manager, SIGNAL(readOnlyChanged(QtProperty *, bool)),
this, SLOT(slotReadOnlyChanged(QtProperty *, bool)));
}
/*!
\internal
Reimplemented from the QtAbstractEditorFactory class.
*/
QWidget *QtSpinBoxFactory::createEditor(QtIntPropertyManager *manager, QtProperty *property,
QWidget *parent)
{
QSpinBox *editor = d_ptr->createEditor(property, parent);
editor->setSingleStep(manager->singleStep(property));
editor->setRange(manager->minimum(property), manager->maximum(property));
editor->setValue(manager->value(property));
editor->setKeyboardTracking(false);
editor->setReadOnly(manager->isReadOnly(property));
connect(editor, SIGNAL(valueChanged(int)), this, SLOT(slotSetValue(int)));
connect(editor, SIGNAL(destroyed(QObject *)),
this, SLOT(slotEditorDestroyed(QObject *)));
return editor;
}
/*!
\internal
Reimplemented from the QtAbstractEditorFactory class.
*/
void QtSpinBoxFactory::disconnectPropertyManager(QtIntPropertyManager *manager)
{
disconnect(manager, SIGNAL(valueChanged(QtProperty *, int)),
this, SLOT(slotPropertyChanged(QtProperty *, int)));
disconnect(manager, SIGNAL(rangeChanged(QtProperty *, int, int)),
this, SLOT(slotRangeChanged(QtProperty *, int, int)));
disconnect(manager, SIGNAL(singleStepChanged(QtProperty *, int)),
this, SLOT(slotSingleStepChanged(QtProperty *, int)));
disconnect(manager, SIGNAL(readOnlyChanged(QtProperty *, bool)),
this, SLOT(slotReadOnlyChanged(QtProperty *, bool)));
}
// QtSliderFactory
class QtSliderFactoryPrivate : public EditorFactoryPrivate<QSlider>
{
QtSliderFactory *q_ptr;
Q_DECLARE_PUBLIC(QtSliderFactory)
public:
void slotPropertyChanged(QtProperty *property, int value);
void slotRangeChanged(QtProperty *property, int min, int max);
void slotSingleStepChanged(QtProperty *property, int step);
void slotSetValue(int value);
};
void QtSliderFactoryPrivate::slotPropertyChanged(QtProperty *property, int value)
{
if (!m_createdEditors.contains(property))
return;
QListIterator<QSlider *> itEditor(m_createdEditors[property]);
while (itEditor.hasNext()) {
QSlider *editor = itEditor.next();
editor->blockSignals(true);
editor->setValue(value);
editor->blockSignals(false);
}
}
void QtSliderFactoryPrivate::slotRangeChanged(QtProperty *property, int min, int max)
{
if (!m_createdEditors.contains(property))
return;
QtIntPropertyManager *manager = q_ptr->propertyManager(property);
if (!manager)
return;
QListIterator<QSlider *> itEditor(m_createdEditors[property]);
while (itEditor.hasNext()) {
QSlider *editor = itEditor.next();
editor->blockSignals(true);
editor->setRange(min, max);
editor->setValue(manager->value(property));
editor->blockSignals(false);
}
}
void QtSliderFactoryPrivate::slotSingleStepChanged(QtProperty *property, int step)
{
if (!m_createdEditors.contains(property))
return;
QListIterator<QSlider *> itEditor(m_createdEditors[property]);
while (itEditor.hasNext()) {
QSlider *editor = itEditor.next();
editor->blockSignals(true);
editor->setSingleStep(step);
editor->blockSignals(false);
}
}
void QtSliderFactoryPrivate::slotSetValue(int value)
{
QObject *object = q_ptr->sender();
const QMap<QSlider *, QtProperty *>::ConstIterator ecend = m_editorToProperty.constEnd();
for (QMap<QSlider *, QtProperty *>::ConstIterator itEditor = m_editorToProperty.constBegin(); itEditor != ecend; ++itEditor ) {
if (itEditor.key() == object) {
QtProperty *property = itEditor.value();
QtIntPropertyManager *manager = q_ptr->propertyManager(property);
if (!manager)
return;
manager->setValue(property, value);
return;
}
}
}
/*!
\class QtSliderFactory
\brief The QtSliderFactory class provides QSlider widgets for
properties created by QtIntPropertyManager objects.
\sa QtAbstractEditorFactory, QtIntPropertyManager
*/
/*!
Creates a factory with the given \a parent.
*/
QtSliderFactory::QtSliderFactory(QObject *parent)
: QtAbstractEditorFactory<QtIntPropertyManager>(parent)
{
d_ptr = new QtSliderFactoryPrivate();
d_ptr->q_ptr = this;
}
/*!
Destroys this factory, and all the widgets it has created.
*/
QtSliderFactory::~QtSliderFactory()
{
qDeleteAll(d_ptr->m_editorToProperty.keys());
delete d_ptr;
}
/*!
\internal
Reimplemented from the QtAbstractEditorFactory class.
*/
void QtSliderFactory::connectPropertyManager(QtIntPropertyManager *manager)
{
connect(manager, SIGNAL(valueChanged(QtProperty *, int)),
this, SLOT(slotPropertyChanged(QtProperty *, int)));
connect(manager, SIGNAL(rangeChanged(QtProperty *, int, int)),
this, SLOT(slotRangeChanged(QtProperty *, int, int)));
connect(manager, SIGNAL(singleStepChanged(QtProperty *, int)),
this, SLOT(slotSingleStepChanged(QtProperty *, int)));
}
/*!
\internal
Reimplemented from the QtAbstractEditorFactory class.
*/
QWidget *QtSliderFactory::createEditor(QtIntPropertyManager *manager, QtProperty *property,
QWidget *parent)
{
QSlider *editor = new QSlider(Qt::Horizontal, parent);
d_ptr->initializeEditor(property, editor);
editor->setSingleStep(manager->singleStep(property));
editor->setRange(manager->minimum(property), manager->maximum(property));
editor->setValue(manager->value(property));
connect(editor, SIGNAL(valueChanged(int)), this, SLOT(slotSetValue(int)));
connect(editor, SIGNAL(destroyed(QObject *)),
this, SLOT(slotEditorDestroyed(QObject *)));
return editor;
}
/*!
\internal
Reimplemented from the QtAbstractEditorFactory class.
*/
void QtSliderFactory::disconnectPropertyManager(QtIntPropertyManager *manager)
{
disconnect(manager, SIGNAL(valueChanged(QtProperty *, int)),
this, SLOT(slotPropertyChanged(QtProperty *, int)));
disconnect(manager, SIGNAL(rangeChanged(QtProperty *, int, int)),
this, SLOT(slotRangeChanged(QtProperty *, int, int)));
disconnect(manager, SIGNAL(singleStepChanged(QtProperty *, int)),
this, SLOT(slotSingleStepChanged(QtProperty *, int)));
}
// QtSliderFactory
class QtScrollBarFactoryPrivate : public EditorFactoryPrivate<QScrollBar>
{
QtScrollBarFactory *q_ptr;
Q_DECLARE_PUBLIC(QtScrollBarFactory)
public:
void slotPropertyChanged(QtProperty *property, int value);
void slotRangeChanged(QtProperty *property, int min, int max);
void slotSingleStepChanged(QtProperty *property, int step);
void slotSetValue(int value);
};
void QtScrollBarFactoryPrivate::slotPropertyChanged(QtProperty *property, int value)
{
if (!m_createdEditors.contains(property))
return;
QListIterator<QScrollBar *> itEditor( m_createdEditors[property]);
while (itEditor.hasNext()) {
QScrollBar *editor = itEditor.next();
editor->blockSignals(true);
editor->setValue(value);
editor->blockSignals(false);
}
}
void QtScrollBarFactoryPrivate::slotRangeChanged(QtProperty *property, int min, int max)
{
if (!m_createdEditors.contains(property))
return;
QtIntPropertyManager *manager = q_ptr->propertyManager(property);
if (!manager)
return;
QListIterator<QScrollBar *> itEditor( m_createdEditors[property]);
while (itEditor.hasNext()) {
QScrollBar *editor = itEditor.next();
editor->blockSignals(true);
editor->setRange(min, max);
editor->setValue(manager->value(property));
editor->blockSignals(false);
}
}
void QtScrollBarFactoryPrivate::slotSingleStepChanged(QtProperty *property, int step)
{
if (!m_createdEditors.contains(property))
return;
QListIterator<QScrollBar *> itEditor(m_createdEditors[property]);
while (itEditor.hasNext()) {
QScrollBar *editor = itEditor.next();
editor->blockSignals(true);
editor->setSingleStep(step);
editor->blockSignals(false);
}
}
void QtScrollBarFactoryPrivate::slotSetValue(int value)
{
QObject *object = q_ptr->sender();
const QMap<QScrollBar *, QtProperty *>::ConstIterator ecend = m_editorToProperty.constEnd();
for (QMap<QScrollBar *, QtProperty *>::ConstIterator itEditor = m_editorToProperty.constBegin(); itEditor != ecend; ++itEditor)
if (itEditor.key() == object) {
QtProperty *property = itEditor.value();
QtIntPropertyManager *manager = q_ptr->propertyManager(property);
if (!manager)
return;
manager->setValue(property, value);
return;
}
}
/*!
\class QtScrollBarFactory
\brief The QtScrollBarFactory class provides QScrollBar widgets for
properties created by QtIntPropertyManager objects.
\sa QtAbstractEditorFactory, QtIntPropertyManager
*/
/*!
Creates a factory with the given \a parent.
*/
QtScrollBarFactory::QtScrollBarFactory(QObject *parent)
: QtAbstractEditorFactory<QtIntPropertyManager>(parent)
{
d_ptr = new QtScrollBarFactoryPrivate();
d_ptr->q_ptr = this;
}
/*!
Destroys this factory, and all the widgets it has created.
*/
QtScrollBarFactory::~QtScrollBarFactory()
{
qDeleteAll(d_ptr->m_editorToProperty.keys());
delete d_ptr;
}
/*!
\internal
Reimplemented from the QtAbstractEditorFactory class.
*/
void QtScrollBarFactory::connectPropertyManager(QtIntPropertyManager *manager)
{
connect(manager, SIGNAL(valueChanged(QtProperty *, int)),
this, SLOT(slotPropertyChanged(QtProperty *, int)));
connect(manager, SIGNAL(rangeChanged(QtProperty *, int, int)),
this, SLOT(slotRangeChanged(QtProperty *, int, int)));
connect(manager, SIGNAL(singleStepChanged(QtProperty *, int)),
this, SLOT(slotSingleStepChanged(QtProperty *, int)));
}
/*!
\internal
Reimplemented from the QtAbstractEditorFactory class.
*/
QWidget *QtScrollBarFactory::createEditor(QtIntPropertyManager *manager, QtProperty *property,
QWidget *parent)
{
QScrollBar *editor = new QScrollBar(Qt::Horizontal, parent);
d_ptr->initializeEditor(property, editor);
editor->setSingleStep(manager->singleStep(property));
editor->setRange(manager->minimum(property), manager->maximum(property));
editor->setValue(manager->value(property));
connect(editor, SIGNAL(valueChanged(int)), this, SLOT(slotSetValue(int)));
connect(editor, SIGNAL(destroyed(QObject *)),
this, SLOT(slotEditorDestroyed(QObject *)));
return editor;
}
/*!
\internal
Reimplemented from the QtAbstractEditorFactory class.
*/
void QtScrollBarFactory::disconnectPropertyManager(QtIntPropertyManager *manager)
{
disconnect(manager, SIGNAL(valueChanged(QtProperty *, int)),
this, SLOT(slotPropertyChanged(QtProperty *, int)));
disconnect(manager, SIGNAL(rangeChanged(QtProperty *, int, int)),
this, SLOT(slotRangeChanged(QtProperty *, int, int)));
disconnect(manager, SIGNAL(singleStepChanged(QtProperty *, int)),
this, SLOT(slotSingleStepChanged(QtProperty *, int)));
}
// QtCheckBoxFactory
class QtCheckBoxFactoryPrivate : public EditorFactoryPrivate<QtBoolEdit>
{
QtCheckBoxFactory *q_ptr;
Q_DECLARE_PUBLIC(QtCheckBoxFactory)
public:
void slotPropertyChanged(QtProperty *property, bool value);
void slotTextVisibleChanged(QtProperty *property, bool textVisible);
void slotSetValue(bool value);
};
void QtCheckBoxFactoryPrivate::slotPropertyChanged(QtProperty *property, bool value)
{
if (!m_createdEditors.contains(property))
return;
QListIterator<QtBoolEdit *> itEditor(m_createdEditors[property]);
while (itEditor.hasNext()) {
QtBoolEdit *editor = itEditor.next();
editor->blockCheckBoxSignals(true);
editor->setChecked(value);
editor->blockCheckBoxSignals(false);
}
}
void QtCheckBoxFactoryPrivate::slotTextVisibleChanged(QtProperty *property, bool textVisible)
{
if (!m_createdEditors.contains(property))
return;
QtBoolPropertyManager *manager = q_ptr->propertyManager(property);
if (!manager)
return;
QListIterator<QtBoolEdit *> itEditor(m_createdEditors[property]);
while (itEditor.hasNext()) {
QtBoolEdit *editor = itEditor.next();
editor->setTextVisible(textVisible);
}
}
void QtCheckBoxFactoryPrivate::slotSetValue(bool value)
{
QObject *object = q_ptr->sender();
const QMap<QtBoolEdit *, QtProperty *>::ConstIterator ecend = m_editorToProperty.constEnd();
for (QMap<QtBoolEdit *, QtProperty *>::ConstIterator itEditor = m_editorToProperty.constBegin(); itEditor != ecend; ++itEditor)
if (itEditor.key() == object) {
QtProperty *property = itEditor.value();
QtBoolPropertyManager *manager = q_ptr->propertyManager(property);
if (!manager)
return;
manager->setValue(property, value);
return;
}
}
/*!
\class QtCheckBoxFactory
\brief The QtCheckBoxFactory class provides QCheckBox widgets for
properties created by QtBoolPropertyManager objects.
\sa QtAbstractEditorFactory, QtBoolPropertyManager
*/
/*!
Creates a factory with the given \a parent.
*/
QtCheckBoxFactory::QtCheckBoxFactory(QObject *parent)
: QtAbstractEditorFactory<QtBoolPropertyManager>(parent)
{
d_ptr = new QtCheckBoxFactoryPrivate();
d_ptr->q_ptr = this;
}
/*!
Destroys this factory, and all the widgets it has created.
*/
QtCheckBoxFactory::~QtCheckBoxFactory()
{
qDeleteAll(d_ptr->m_editorToProperty.keys());
delete d_ptr;
}
/*!
\internal
Reimplemented from the QtAbstractEditorFactory class.
*/
void QtCheckBoxFactory::connectPropertyManager(QtBoolPropertyManager *manager)
{
connect(manager, SIGNAL(valueChanged(QtProperty *, bool)),
this, SLOT(slotPropertyChanged(QtProperty *, bool)));
connect(manager, SIGNAL(textVisibleChanged(QtProperty *, bool)),
this, SLOT(slotTextVisibleChanged(QtProperty *, bool)));
}
/*!
\internal
Reimplemented from the QtAbstractEditorFactory class.
*/
QWidget *QtCheckBoxFactory::createEditor(QtBoolPropertyManager *manager, QtProperty *property,
QWidget *parent)
{
QtBoolEdit *editor = d_ptr->createEditor(property, parent);
editor->setChecked(manager->value(property));
editor->setTextVisible(manager->textVisible(property));
connect(editor, SIGNAL(toggled(bool)), this, SLOT(slotSetValue(bool)));
connect(editor, SIGNAL(destroyed(QObject *)),
this, SLOT(slotEditorDestroyed(QObject *)));
return editor;
}
/*!
\internal
Reimplemented from the QtAbstractEditorFactory class.
*/
void QtCheckBoxFactory::disconnectPropertyManager(QtBoolPropertyManager *manager)
{
disconnect(manager, SIGNAL(valueChanged(QtProperty *, bool)),
this, SLOT(slotPropertyChanged(QtProperty *, bool)));
disconnect(manager, SIGNAL(textVisibleChanged(QtProperty *, bool)),
this, SLOT(slotTextVisibleChanged(QtProperty *, bool)));
}
// QtDoubleSpinBoxFactory
class QtDoubleSpinBoxFactoryPrivate : public EditorFactoryPrivate<QDoubleSpinBox>
{
QtDoubleSpinBoxFactory *q_ptr;
Q_DECLARE_PUBLIC(QtDoubleSpinBoxFactory)
public:
void slotPropertyChanged(QtProperty *property, double value);
void slotRangeChanged(QtProperty *property, double min, double max);
void slotSingleStepChanged(QtProperty *property, double step);
void slotDecimalsChanged(QtProperty *property, int prec);
void slotReadOnlyChanged(QtProperty *property, bool readOnly);
void slotSetValue(double value);
};
void QtDoubleSpinBoxFactoryPrivate::slotPropertyChanged(QtProperty *property, double value)
{
QList<QDoubleSpinBox *> editors = m_createdEditors[property];
QListIterator<QDoubleSpinBox *> itEditor(m_createdEditors[property]);
while (itEditor.hasNext()) {
QDoubleSpinBox *editor = itEditor.next();
if (editor->value() != value) {
editor->blockSignals(true);
editor->setValue(value);
editor->blockSignals(false);
}
}
}
void QtDoubleSpinBoxFactoryPrivate::slotRangeChanged(QtProperty *property,
double min, double max)
{
if (!m_createdEditors.contains(property))
return;
QtDoublePropertyManager *manager = q_ptr->propertyManager(property);
if (!manager)
return;
QList<QDoubleSpinBox *> editors = m_createdEditors[property];
QListIterator<QDoubleSpinBox *> itEditor(editors);
while (itEditor.hasNext()) {
QDoubleSpinBox *editor = itEditor.next();
editor->blockSignals(true);
editor->setRange(min, max);
editor->setValue(manager->value(property));
editor->blockSignals(false);
}
}
void QtDoubleSpinBoxFactoryPrivate::slotSingleStepChanged(QtProperty *property, double step)
{
if (!m_createdEditors.contains(property))
return;
QtDoublePropertyManager *manager = q_ptr->propertyManager(property);
if (!manager)
return;
QList<QDoubleSpinBox *> editors = m_createdEditors[property];
QListIterator<QDoubleSpinBox *> itEditor(editors);
while (itEditor.hasNext()) {
QDoubleSpinBox *editor = itEditor.next();
editor->blockSignals(true);
editor->setSingleStep(step);
editor->blockSignals(false);
}
}
void QtDoubleSpinBoxFactoryPrivate::slotReadOnlyChanged( QtProperty *property, bool readOnly)
{
if (!m_createdEditors.contains(property))
return;
QtDoublePropertyManager *manager = q_ptr->propertyManager(property);
if (!manager)
return;
QListIterator<QDoubleSpinBox *> itEditor(m_createdEditors[property]);
while (itEditor.hasNext()) {
QDoubleSpinBox *editor = itEditor.next();
editor->blockSignals(true);
editor->setReadOnly(readOnly);
editor->blockSignals(false);
}
}
void QtDoubleSpinBoxFactoryPrivate::slotDecimalsChanged(QtProperty *property, int prec)
{
if (!m_createdEditors.contains(property))
return;
QtDoublePropertyManager *manager = q_ptr->propertyManager(property);
if (!manager)
return;
QList<QDoubleSpinBox *> editors = m_createdEditors[property];
QListIterator<QDoubleSpinBox *> itEditor(editors);
while (itEditor.hasNext()) {
QDoubleSpinBox *editor = itEditor.next();
editor->blockSignals(true);
editor->setDecimals(prec);
editor->setValue(manager->value(property));
editor->blockSignals(false);
}
}
void QtDoubleSpinBoxFactoryPrivate::slotSetValue(double value)
{
QObject *object = q_ptr->sender();
const QMap<QDoubleSpinBox *, QtProperty *>::ConstIterator itcend = m_editorToProperty.constEnd();
for (QMap<QDoubleSpinBox *, QtProperty *>::ConstIterator itEditor = m_editorToProperty.constBegin(); itEditor != itcend; ++itEditor) {
if (itEditor.key() == object) {
QtProperty *property = itEditor.value();
QtDoublePropertyManager *manager = q_ptr->propertyManager(property);
if (!manager)
return;
manager->setValue(property, value);
return;
}
}
}
/*! \class QtDoubleSpinBoxFactory
\brief The QtDoubleSpinBoxFactory class provides QDoubleSpinBox
widgets for properties created by QtDoublePropertyManager objects.
\sa QtAbstractEditorFactory, QtDoublePropertyManager
*/
/*!
Creates a factory with the given \a parent.
*/
QtDoubleSpinBoxFactory::QtDoubleSpinBoxFactory(QObject *parent)
: QtAbstractEditorFactory<QtDoublePropertyManager>(parent)
{
d_ptr = new QtDoubleSpinBoxFactoryPrivate();
d_ptr->q_ptr = this;
}
/*!
Destroys this factory, and all the widgets it has created.
*/
QtDoubleSpinBoxFactory::~QtDoubleSpinBoxFactory()
{
qDeleteAll(d_ptr->m_editorToProperty.keys());
delete d_ptr;
}
/*!
\internal
Reimplemented from the QtAbstractEditorFactory class.
*/
void QtDoubleSpinBoxFactory::connectPropertyManager(QtDoublePropertyManager *manager)
{
connect(manager, SIGNAL(valueChanged(QtProperty *, double)),
this, SLOT(slotPropertyChanged(QtProperty *, double)));
connect(manager, SIGNAL(rangeChanged(QtProperty *, double, double)),
this, SLOT(slotRangeChanged(QtProperty *, double, double)));
connect(manager, SIGNAL(singleStepChanged(QtProperty *, double)),
this, SLOT(slotSingleStepChanged(QtProperty *, double)));
connect(manager, SIGNAL(decimalsChanged(QtProperty *, int)),
this, SLOT(slotDecimalsChanged(QtProperty *, int)));
connect(manager, SIGNAL(readOnlyChanged(QtProperty *, bool)),
this, SLOT(slotReadOnlyChanged(QtProperty *, bool)));
}
/*!
\internal
Reimplemented from the QtAbstractEditorFactory class.
*/
QWidget *QtDoubleSpinBoxFactory::createEditor(QtDoublePropertyManager *manager,
QtProperty *property, QWidget *parent)
{
QDoubleSpinBox *editor = d_ptr->createEditor(property, parent);
editor->setSingleStep(manager->singleStep(property));
editor->setDecimals(manager->decimals(property));
editor->setRange(manager->minimum(property), manager->maximum(property));
editor->setValue(manager->value(property));
editor->setKeyboardTracking(false);
editor->setReadOnly(manager->isReadOnly(property));
connect(editor, SIGNAL(valueChanged(double)), this, SLOT(slotSetValue(double)));
connect(editor, SIGNAL(destroyed(QObject *)),
this, SLOT(slotEditorDestroyed(QObject *)));
return editor;
}
/*!
\internal
Reimplemented from the QtAbstractEditorFactory class.
*/
void QtDoubleSpinBoxFactory::disconnectPropertyManager(QtDoublePropertyManager *manager)
{
disconnect(manager, SIGNAL(valueChanged(QtProperty *, double)),
this, SLOT(slotPropertyChanged(QtProperty *, double)));
disconnect(manager, SIGNAL(rangeChanged(QtProperty *, double, double)),
this, SLOT(slotRangeChanged(QtProperty *, double, double)));
disconnect(manager, SIGNAL(singleStepChanged(QtProperty *, double)),
this, SLOT(slotSingleStepChanged(QtProperty *, double)));
disconnect(manager, SIGNAL(decimalsChanged(QtProperty *, int)),
this, SLOT(slotDecimalsChanged(QtProperty *, int)));
disconnect(manager, SIGNAL(readOnlyChanged(QtProperty *, bool)),
this, SLOT(slotReadOnlyChanged(QtProperty *, bool)));
}
// QtLineEditFactory
class QtLineEditFactoryPrivate : public EditorFactoryPrivate<QLineEdit>
{
QtLineEditFactory *q_ptr;
Q_DECLARE_PUBLIC(QtLineEditFactory)
public:
void slotPropertyChanged(QtProperty *property, const QString &value);
void slotRegExpChanged(QtProperty *property, const QRegExp ®Exp);
void slotSetValue(const QString &value);
void slotEchoModeChanged(QtProperty *, int);
void slotReadOnlyChanged(QtProperty *, bool);
};
void QtLineEditFactoryPrivate::slotPropertyChanged(QtProperty *property,
const QString &value)
{
if (!m_createdEditors.contains(property))
return;
QListIterator<QLineEdit *> itEditor( m_createdEditors[property]);
while (itEditor.hasNext()) {
QLineEdit *editor = itEditor.next();
if (editor->text() != value) {
editor->blockSignals(true);
editor->setText(value);
editor->blockSignals(false);
}
}
}
void QtLineEditFactoryPrivate::slotRegExpChanged(QtProperty *property,
const QRegExp ®Exp)
{
if (!m_createdEditors.contains(property))
return;
QtStringPropertyManager *manager = q_ptr->propertyManager(property);
if (!manager)
return;
QListIterator<QLineEdit *> itEditor(m_createdEditors[property]);
while (itEditor.hasNext()) {
QLineEdit *editor = itEditor.next();
editor->blockSignals(true);
const QValidator *oldValidator = editor->validator();
QValidator *newValidator = 0;
if (regExp.isValid()) {
newValidator = new QRegExpValidator(regExp, editor);
}
editor->setValidator(newValidator);
if (oldValidator)
delete oldValidator;
editor->blockSignals(false);
}
}
void QtLineEditFactoryPrivate::slotEchoModeChanged(QtProperty *property, int echoMode)
{
if (!m_createdEditors.contains(property))
return;
QtStringPropertyManager *manager = q_ptr->propertyManager(property);
if (!manager)
return;
QListIterator<QLineEdit *> itEditor(m_createdEditors[property]);
while (itEditor.hasNext()) {
QLineEdit *editor = itEditor.next();
editor->blockSignals(true);
editor->setEchoMode((EchoMode)echoMode);
editor->blockSignals(false);
}
}
void QtLineEditFactoryPrivate::slotReadOnlyChanged( QtProperty *property, bool readOnly)
{
if (!m_createdEditors.contains(property))
return;
QtStringPropertyManager *manager = q_ptr->propertyManager(property);
if (!manager)
return;
QListIterator<QLineEdit *> itEditor(m_createdEditors[property]);
while (itEditor.hasNext()) {
QLineEdit *editor = itEditor.next();
editor->blockSignals(true);
editor->setReadOnly(readOnly);
editor->blockSignals(false);
}
}
void QtLineEditFactoryPrivate::slotSetValue(const QString &value)
{
QObject *object = q_ptr->sender();
const QMap<QLineEdit *, QtProperty *>::ConstIterator ecend = m_editorToProperty.constEnd();
for (QMap<QLineEdit *, QtProperty *>::ConstIterator itEditor = m_editorToProperty.constBegin(); itEditor != ecend; ++itEditor)
if (itEditor.key() == object) {
QtProperty *property = itEditor.value();
QtStringPropertyManager *manager = q_ptr->propertyManager(property);
if (!manager)
return;
manager->setValue(property, value);
return;
}
}
/*!
\class QtLineEditFactory
\brief The QtLineEditFactory class provides QLineEdit widgets for
properties created by QtStringPropertyManager objects.
\sa QtAbstractEditorFactory, QtStringPropertyManager
*/
/*!
Creates a factory with the given \a parent.
*/
QtLineEditFactory::QtLineEditFactory(QObject *parent)
: QtAbstractEditorFactory<QtStringPropertyManager>(parent)
{
d_ptr = new QtLineEditFactoryPrivate();
d_ptr->q_ptr = this;
}
/*!
Destroys this factory, and all the widgets it has created.
*/
QtLineEditFactory::~QtLineEditFactory()
{
qDeleteAll(d_ptr->m_editorToProperty.keys());
delete d_ptr;
}
/*!
\internal
Reimplemented from the QtAbstractEditorFactory class.
*/
void QtLineEditFactory::connectPropertyManager(QtStringPropertyManager *manager)
{
connect(manager, SIGNAL(valueChanged(QtProperty *, const QString &)),
this, SLOT(slotPropertyChanged(QtProperty *, const QString &)));
connect(manager, SIGNAL(regExpChanged(QtProperty *, const QRegExp &)),
this, SLOT(slotRegExpChanged(QtProperty *, const QRegExp &)));
connect(manager, SIGNAL(echoModeChanged(QtProperty*, int)),
this, SLOT(slotEchoModeChanged(QtProperty *, int)));
connect(manager, SIGNAL(readOnlyChanged(QtProperty*, bool)),
this, SLOT(slotReadOnlyChanged(QtProperty *, bool)));
}
/*!
\internal
Reimplemented from the QtAbstractEditorFactory class.
*/
QWidget *QtLineEditFactory::createEditor(QtStringPropertyManager *manager,
QtProperty *property, QWidget *parent)
{
QLineEdit *editor = d_ptr->createEditor(property, parent);
editor->setEchoMode((EchoMode)manager->echoMode(property));
editor->setReadOnly(manager->isReadOnly(property));
QRegExp regExp = manager->regExp(property);
if (regExp.isValid()) {
QValidator *validator = new QRegExpValidator(regExp, editor);
editor->setValidator(validator);
}
editor->setText(manager->value(property));
connect(editor, SIGNAL(textChanged(const QString &)),
this, SLOT(slotSetValue(const QString &)));
connect(editor, SIGNAL(destroyed(QObject *)),
this, SLOT(slotEditorDestroyed(QObject *)));
return editor;
}
/*!
\internal
Reimplemented from the QtAbstractEditorFactory class.
*/
void QtLineEditFactory::disconnectPropertyManager(QtStringPropertyManager *manager)
{
disconnect(manager, SIGNAL(valueChanged(QtProperty *, const QString &)),
this, SLOT(slotPropertyChanged(QtProperty *, const QString &)));
disconnect(manager, SIGNAL(regExpChanged(QtProperty *, const QRegExp &)),
this, SLOT(slotRegExpChanged(QtProperty *, const QRegExp &)));
disconnect(manager, SIGNAL(echoModeChanged(QtProperty*,int)),
this, SLOT(slotEchoModeChanged(QtProperty *, int)));
disconnect(manager, SIGNAL(readOnlyChanged(QtProperty*, bool)),
this, SLOT(slotReadOnlyChanged(QtProperty *, bool)));
}
// QtDateEditFactory
class QtDateEditFactoryPrivate : public EditorFactoryPrivate<QDateEdit>
{
QtDateEditFactory *q_ptr;
Q_DECLARE_PUBLIC(QtDateEditFactory)
public:
void slotPropertyChanged(QtProperty *property, const QDate &value);
void slotRangeChanged(QtProperty *property, const QDate &min, const QDate &max);
void slotSetValue(const QDate &value);
};
void QtDateEditFactoryPrivate::slotPropertyChanged(QtProperty *property, const QDate &value)
{
if (!m_createdEditors.contains(property))
return;
QListIterator<QDateEdit *> itEditor(m_createdEditors[property]);
while (itEditor.hasNext()) {
QDateEdit *editor = itEditor.next();
editor->blockSignals(true);
editor->setDate(value);
editor->blockSignals(false);
}
}
void QtDateEditFactoryPrivate::slotRangeChanged(QtProperty *property,
const QDate &min, const QDate &max)
{
if (!m_createdEditors.contains(property))
return;
QtDatePropertyManager *manager = q_ptr->propertyManager(property);
if (!manager)
return;
QListIterator<QDateEdit *> itEditor(m_createdEditors[property]);
while (itEditor.hasNext()) {
QDateEdit *editor = itEditor.next();
editor->blockSignals(true);
editor->setDateRange(min, max);
editor->setDate(manager->value(property));
editor->blockSignals(false);
}
}
void QtDateEditFactoryPrivate::slotSetValue(const QDate &value)
{
QObject *object = q_ptr->sender();
const QMap<QDateEdit *, QtProperty *>::ConstIterator ecend = m_editorToProperty.constEnd();
for (QMap<QDateEdit *, QtProperty *>::ConstIterator itEditor = m_editorToProperty.constBegin(); itEditor != ecend; ++itEditor)
if (itEditor.key() == object) {
QtProperty *property = itEditor.value();
QtDatePropertyManager *manager = q_ptr->propertyManager(property);
if (!manager)
return;
manager->setValue(property, value);
return;
}
}
/*!
\class QtDateEditFactory
\brief The QtDateEditFactory class provides QDateEdit widgets for
properties created by QtDatePropertyManager objects.
\sa QtAbstractEditorFactory, QtDatePropertyManager
*/
/*!
Creates a factory with the given \a parent.
*/
QtDateEditFactory::QtDateEditFactory(QObject *parent)
: QtAbstractEditorFactory<QtDatePropertyManager>(parent)
{
d_ptr = new QtDateEditFactoryPrivate();
d_ptr->q_ptr = this;
}
/*!
Destroys this factory, and all the widgets it has created.
*/
QtDateEditFactory::~QtDateEditFactory()
{
qDeleteAll(d_ptr->m_editorToProperty.keys());
delete d_ptr;
}
/*!
\internal
Reimplemented from the QtAbstractEditorFactory class.
*/
void QtDateEditFactory::connectPropertyManager(QtDatePropertyManager *manager)
{
connect(manager, SIGNAL(valueChanged(QtProperty *, const QDate &)),
this, SLOT(slotPropertyChanged(QtProperty *, const QDate &)));
connect(manager, SIGNAL(rangeChanged(QtProperty *, const QDate &, const QDate &)),
this, SLOT(slotRangeChanged(QtProperty *, const QDate &, const QDate &)));
}
/*!
\internal
Reimplemented from the QtAbstractEditorFactory class.
*/
QWidget *QtDateEditFactory::createEditor(QtDatePropertyManager *manager, QtProperty *property,
QWidget *parent)
{
QDateEdit *editor = d_ptr->createEditor(property, parent);
editor->setCalendarPopup(true);
editor->setDateRange(manager->minimum(property), manager->maximum(property));
editor->setDate(manager->value(property));
connect(editor, SIGNAL(dateChanged(const QDate &)),
this, SLOT(slotSetValue(const QDate &)));
connect(editor, SIGNAL(destroyed(QObject *)),
this, SLOT(slotEditorDestroyed(QObject *)));
return editor;
}
/*!
\internal
Reimplemented from the QtAbstractEditorFactory class.
*/
void QtDateEditFactory::disconnectPropertyManager(QtDatePropertyManager *manager)
{
disconnect(manager, SIGNAL(valueChanged(QtProperty *, const QDate &)),
this, SLOT(slotPropertyChanged(QtProperty *, const QDate &)));
disconnect(manager, SIGNAL(rangeChanged(QtProperty *, const QDate &, const QDate &)),
this, SLOT(slotRangeChanged(QtProperty *, const QDate &, const QDate &)));
}
// QtTimeEditFactory
class QtTimeEditFactoryPrivate : public EditorFactoryPrivate<QTimeEdit>
{
QtTimeEditFactory *q_ptr;
Q_DECLARE_PUBLIC(QtTimeEditFactory)
public:
void slotPropertyChanged(QtProperty *property, const QTime &value);
void slotSetValue(const QTime &value);
};
void QtTimeEditFactoryPrivate::slotPropertyChanged(QtProperty *property, const QTime &value)
{
if (!m_createdEditors.contains(property))
return;
QListIterator<QTimeEdit *> itEditor(m_createdEditors[property]);
while (itEditor.hasNext()) {
QTimeEdit *editor = itEditor.next();
editor->blockSignals(true);
editor->setTime(value);
editor->blockSignals(false);
}
}
void QtTimeEditFactoryPrivate::slotSetValue(const QTime &value)
{
QObject *object = q_ptr->sender();
const QMap<QTimeEdit *, QtProperty *>::ConstIterator ecend = m_editorToProperty.constEnd();
for (QMap<QTimeEdit *, QtProperty *>::ConstIterator itEditor = m_editorToProperty.constBegin(); itEditor != ecend; ++itEditor)
if (itEditor.key() == object) {
QtProperty *property = itEditor.value();
QtTimePropertyManager *manager = q_ptr->propertyManager(property);
if (!manager)
return;
manager->setValue(property, value);
return;
}
}
/*!
\class QtTimeEditFactory
\brief The QtTimeEditFactory class provides QTimeEdit widgets for
properties created by QtTimePropertyManager objects.
\sa QtAbstractEditorFactory, QtTimePropertyManager
*/
/*!
Creates a factory with the given \a parent.
*/
QtTimeEditFactory::QtTimeEditFactory(QObject *parent)
: QtAbstractEditorFactory<QtTimePropertyManager>(parent)
{
d_ptr = new QtTimeEditFactoryPrivate();
d_ptr->q_ptr = this;
}
/*!
Destroys this factory, and all the widgets it has created.
*/
QtTimeEditFactory::~QtTimeEditFactory()
{
qDeleteAll(d_ptr->m_editorToProperty.keys());
delete d_ptr;
}
/*!
\internal
Reimplemented from the QtAbstractEditorFactory class.
*/
void QtTimeEditFactory::connectPropertyManager(QtTimePropertyManager *manager)
{
connect(manager, SIGNAL(valueChanged(QtProperty *, const QTime &)),
this, SLOT(slotPropertyChanged(QtProperty *, const QTime &)));
}
/*!
\internal
Reimplemented from the QtAbstractEditorFactory class.
*/
QWidget *QtTimeEditFactory::createEditor(QtTimePropertyManager *manager, QtProperty *property,
QWidget *parent)
{
QTimeEdit *editor = d_ptr->createEditor(property, parent);
editor->setTime(manager->value(property));
connect(editor, SIGNAL(timeChanged(const QTime &)),
this, SLOT(slotSetValue(const QTime &)));
connect(editor, SIGNAL(destroyed(QObject *)),
this, SLOT(slotEditorDestroyed(QObject *)));
return editor;
}
/*!
\internal
Reimplemented from the QtAbstractEditorFactory class.
*/
void QtTimeEditFactory::disconnectPropertyManager(QtTimePropertyManager *manager)
{
disconnect(manager, SIGNAL(valueChanged(QtProperty *, const QTime &)),
this, SLOT(slotPropertyChanged(QtProperty *, const QTime &)));
}
// QtDateTimeEditFactory
class QtDateTimeEditFactoryPrivate : public EditorFactoryPrivate<QDateTimeEdit>
{
QtDateTimeEditFactory *q_ptr;
Q_DECLARE_PUBLIC(QtDateTimeEditFactory)
public:
void slotPropertyChanged(QtProperty *property, const QDateTime &value);
void slotSetValue(const QDateTime &value);
};
void QtDateTimeEditFactoryPrivate::slotPropertyChanged(QtProperty *property,
const QDateTime &value)
{
if (!m_createdEditors.contains(property))
return;
QListIterator<QDateTimeEdit *> itEditor(m_createdEditors[property]);
while (itEditor.hasNext()) {
QDateTimeEdit *editor = itEditor.next();
editor->blockSignals(true);
editor->setDateTime(value);
editor->blockSignals(false);
}
}
void QtDateTimeEditFactoryPrivate::slotSetValue(const QDateTime &value)
{
QObject *object = q_ptr->sender();
const QMap<QDateTimeEdit *, QtProperty *>::ConstIterator ecend = m_editorToProperty.constEnd();
for (QMap<QDateTimeEdit *, QtProperty *>::ConstIterator itEditor = m_editorToProperty.constBegin(); itEditor != ecend; ++itEditor)
if (itEditor.key() == object) {
QtProperty *property = itEditor.value();
QtDateTimePropertyManager *manager = q_ptr->propertyManager(property);
if (!manager)
return;
manager->setValue(property, value);
return;
}
}
/*!
\class QtDateTimeEditFactory
\brief The QtDateTimeEditFactory class provides QDateTimeEdit
widgets for properties created by QtDateTimePropertyManager objects.
\sa QtAbstractEditorFactory, QtDateTimePropertyManager
*/
/*!
Creates a factory with the given \a parent.
*/
QtDateTimeEditFactory::QtDateTimeEditFactory(QObject *parent)
: QtAbstractEditorFactory<QtDateTimePropertyManager>(parent)
{
d_ptr = new QtDateTimeEditFactoryPrivate();
d_ptr->q_ptr = this;
}
/*!
Destroys this factory, and all the widgets it has created.
*/
QtDateTimeEditFactory::~QtDateTimeEditFactory()
{
qDeleteAll(d_ptr->m_editorToProperty.keys());
delete d_ptr;
}
/*!
\internal
Reimplemented from the QtAbstractEditorFactory class.
*/
void QtDateTimeEditFactory::connectPropertyManager(QtDateTimePropertyManager *manager)
{
connect(manager, SIGNAL(valueChanged(QtProperty *, const QDateTime &)),
this, SLOT(slotPropertyChanged(QtProperty *, const QDateTime &)));
}
/*!
\internal
Reimplemented from the QtAbstractEditorFactory class.
*/
QWidget *QtDateTimeEditFactory::createEditor(QtDateTimePropertyManager *manager,
QtProperty *property, QWidget *parent)
{
QDateTimeEdit *editor = d_ptr->createEditor(property, parent);
editor->setDateTime(manager->value(property));
connect(editor, SIGNAL(dateTimeChanged(const QDateTime &)),
this, SLOT(slotSetValue(const QDateTime &)));
connect(editor, SIGNAL(destroyed(QObject *)),
this, SLOT(slotEditorDestroyed(QObject *)));
return editor;
}
/*!
\internal
Reimplemented from the QtAbstractEditorFactory class.
*/
void QtDateTimeEditFactory::disconnectPropertyManager(QtDateTimePropertyManager *manager)
{
disconnect(manager, SIGNAL(valueChanged(QtProperty *, const QDateTime &)),
this, SLOT(slotPropertyChanged(QtProperty *, const QDateTime &)));
}
// QtKeySequenceEditorFactory
class QtKeySequenceEditorFactoryPrivate : public EditorFactoryPrivate<QtKeySequenceEdit>
{
QtKeySequenceEditorFactory *q_ptr;
Q_DECLARE_PUBLIC(QtKeySequenceEditorFactory)
public:
void slotPropertyChanged(QtProperty *property, const QKeySequence &value);
void slotSetValue(const QKeySequence &value);
};
void QtKeySequenceEditorFactoryPrivate::slotPropertyChanged(QtProperty *property,
const QKeySequence &value)
{
if (!m_createdEditors.contains(property))
return;
QListIterator<QtKeySequenceEdit *> itEditor(m_createdEditors[property]);
while (itEditor.hasNext()) {
QtKeySequenceEdit *editor = itEditor.next();
editor->blockSignals(true);
editor->setKeySequence(value);
editor->blockSignals(false);
}
}
void QtKeySequenceEditorFactoryPrivate::slotSetValue(const QKeySequence &value)
{
QObject *object = q_ptr->sender();
const QMap<QtKeySequenceEdit *, QtProperty *>::ConstIterator ecend = m_editorToProperty.constEnd();
for (QMap<QtKeySequenceEdit *, QtProperty *>::ConstIterator itEditor = m_editorToProperty.constBegin(); itEditor != ecend; ++itEditor)
if (itEditor.key() == object) {
QtProperty *property = itEditor.value();
QtKeySequencePropertyManager *manager = q_ptr->propertyManager(property);
if (!manager)
return;
manager->setValue(property, value);
return;
}
}
/*!
\class QtKeySequenceEditorFactory
\brief The QtKeySequenceEditorFactory class provides editor
widgets for properties created by QtKeySequencePropertyManager objects.
\sa QtAbstractEditorFactory
*/
/*!
Creates a factory with the given \a parent.
*/
QtKeySequenceEditorFactory::QtKeySequenceEditorFactory(QObject *parent)
: QtAbstractEditorFactory<QtKeySequencePropertyManager>(parent)
{
d_ptr = new QtKeySequenceEditorFactoryPrivate();
d_ptr->q_ptr = this;
}
/*!
Destroys this factory, and all the widgets it has created.
*/
QtKeySequenceEditorFactory::~QtKeySequenceEditorFactory()
{
qDeleteAll(d_ptr->m_editorToProperty.keys());
delete d_ptr;
}
/*!
\internal
Reimplemented from the QtAbstractEditorFactory class.
*/
void QtKeySequenceEditorFactory::connectPropertyManager(QtKeySequencePropertyManager *manager)
{
connect(manager, SIGNAL(valueChanged(QtProperty *, const QKeySequence &)),
this, SLOT(slotPropertyChanged(QtProperty *, const QKeySequence &)));
}
/*!
\internal
Reimplemented from the QtAbstractEditorFactory class.
*/
QWidget *QtKeySequenceEditorFactory::createEditor(QtKeySequencePropertyManager *manager,
QtProperty *property, QWidget *parent)
{
QtKeySequenceEdit *editor = d_ptr->createEditor(property, parent);
editor->setKeySequence(manager->value(property));
connect(editor, SIGNAL(keySequenceChanged(const QKeySequence &)),
this, SLOT(slotSetValue(const QKeySequence &)));
connect(editor, SIGNAL(destroyed(QObject *)),
this, SLOT(slotEditorDestroyed(QObject *)));
return editor;
}
/*!
\internal
Reimplemented from the QtAbstractEditorFactory class.
*/
void QtKeySequenceEditorFactory::disconnectPropertyManager(QtKeySequencePropertyManager *manager)
{
disconnect(manager, SIGNAL(valueChanged(QtProperty *, const QKeySequence &)),
this, SLOT(slotPropertyChanged(QtProperty *, const QKeySequence &)));
}
// QtCharEdit
class QtCharEdit : public QWidget
{
Q_OBJECT
public:
QtCharEdit(QWidget *parent = 0);
QChar value() const;
bool eventFilter(QObject *o, QEvent *e);
public Q_SLOTS:
void setValue(const QChar &value);
Q_SIGNALS:
void valueChanged(const QChar &value);
protected:
void focusInEvent(QFocusEvent *e);
void focusOutEvent(QFocusEvent *e);
void keyPressEvent(QKeyEvent *e);
void keyReleaseEvent(QKeyEvent *e);
void paintEvent(QPaintEvent *);
bool event(QEvent *e);
private slots:
void slotClearChar();
private:
void handleKeyEvent(QKeyEvent *e);
QChar m_value;
QLineEdit *m_lineEdit;
};
QtCharEdit::QtCharEdit(QWidget *parent)
: QWidget(parent), m_lineEdit(new QLineEdit(this))
{
QHBoxLayout *layout = new QHBoxLayout(this);
layout->addWidget(m_lineEdit);
layout->setMargin(0);
m_lineEdit->installEventFilter(this);
m_lineEdit->setReadOnly(true);
m_lineEdit->setFocusProxy(this);
setFocusPolicy(m_lineEdit->focusPolicy());
setAttribute(Qt::WA_InputMethodEnabled);
}
bool QtCharEdit::eventFilter(QObject *o, QEvent *e)
{
if (o == m_lineEdit && e->type() == QEvent::ContextMenu) {
QContextMenuEvent *c = static_cast<QContextMenuEvent *>(e);
QMenu *menu = m_lineEdit->createStandardContextMenu();
QList<QAction *> actions = menu->actions();
QListIterator<QAction *> itAction(actions);
while (itAction.hasNext()) {
QAction *action = itAction.next();
action->setShortcut(QKeySequence());
QString actionString = action->text();
const int pos = actionString.lastIndexOf(QLatin1Char('\t'));
if (pos > 0)
actionString = actionString.remove(pos, actionString.length() - pos);
action->setText(actionString);
}
QAction *actionBefore = 0;
if (actions.count() > 0)
actionBefore = actions[0];
QAction *clearAction = new QAction(tr("Clear Char"), menu);
menu->insertAction(actionBefore, clearAction);
menu->insertSeparator(actionBefore);
clearAction->setEnabled(!m_value.isNull());
connect(clearAction, SIGNAL(triggered()), this, SLOT(slotClearChar()));
menu->exec(c->globalPos());
delete menu;
e->accept();
return true;
}
return QWidget::eventFilter(o, e);
}
void QtCharEdit::slotClearChar()
{
if (m_value.isNull())
return;
setValue(QChar());
emit valueChanged(m_value);
}
void QtCharEdit::handleKeyEvent(QKeyEvent *e)
{
const int key = e->key();
switch (key) {
case Qt::Key_Control:
case Qt::Key_Shift:
case Qt::Key_Meta:
case Qt::Key_Alt:
case Qt::Key_Super_L:
case Qt::Key_Return:
return;
default:
break;
}
const QString text = e->text();
if (text.count() != 1)
return;
const QChar c = text.at(0);
if (!c.isPrint())
return;
if (m_value == c)
return;
m_value = c;
const QString str = m_value.isNull() ? QString() : QString(m_value);
m_lineEdit->setText(str);
e->accept();
emit valueChanged(m_value);
}
void QtCharEdit::setValue(const QChar &value)
{
if (value == m_value)
return;
m_value = value;
QString str = value.isNull() ? QString() : QString(value);
m_lineEdit->setText(str);
}
QChar QtCharEdit::value() const
{
return m_value;
}
void QtCharEdit::focusInEvent(QFocusEvent *e)
{
m_lineEdit->event(e);
m_lineEdit->selectAll();
QWidget::focusInEvent(e);
}
void QtCharEdit::focusOutEvent(QFocusEvent *e)
{
m_lineEdit->event(e);
QWidget::focusOutEvent(e);
}
void QtCharEdit::keyPressEvent(QKeyEvent *e)
{
handleKeyEvent(e);
e->accept();
}
void QtCharEdit::keyReleaseEvent(QKeyEvent *e)
{
m_lineEdit->event(e);
}
void QtCharEdit::paintEvent(QPaintEvent *)
{
QStyleOption opt;
opt.init(this);
QPainter p(this);
style()->drawPrimitive(QStyle::PE_Widget, &opt, &p, this);
}
bool QtCharEdit::event(QEvent *e)
{
switch(e->type()) {
case QEvent::Shortcut:
case QEvent::ShortcutOverride:
case QEvent::KeyRelease:
e->accept();
return true;
default:
break;
}
return QWidget::event(e);
}
// QtCharEditorFactory
class QtCharEditorFactoryPrivate : public EditorFactoryPrivate<QtCharEdit>
{
QtCharEditorFactory *q_ptr;
Q_DECLARE_PUBLIC(QtCharEditorFactory)
public:
void slotPropertyChanged(QtProperty *property, const QChar &value);
void slotSetValue(const QChar &value);
};
void QtCharEditorFactoryPrivate::slotPropertyChanged(QtProperty *property,
const QChar &value)
{
if (!m_createdEditors.contains(property))
return;
QListIterator<QtCharEdit *> itEditor(m_createdEditors[property]);
while (itEditor.hasNext()) {
QtCharEdit *editor = itEditor.next();
editor->blockSignals(true);
editor->setValue(value);
editor->blockSignals(false);
}
}
void QtCharEditorFactoryPrivate::slotSetValue(const QChar &value)
{
QObject *object = q_ptr->sender();
const QMap<QtCharEdit *, QtProperty *>::ConstIterator ecend = m_editorToProperty.constEnd();
for (QMap<QtCharEdit *, QtProperty *>::ConstIterator itEditor = m_editorToProperty.constBegin(); itEditor != ecend; ++itEditor)
if (itEditor.key() == object) {
QtProperty *property = itEditor.value();
QtCharPropertyManager *manager = q_ptr->propertyManager(property);
if (!manager)
return;
manager->setValue(property, value);
return;
}
}
/*!
\class QtCharEditorFactory
\brief The QtCharEditorFactory class provides editor
widgets for properties created by QtCharPropertyManager objects.
\sa QtAbstractEditorFactory
*/
/*!
Creates a factory with the given \a parent.
*/
QtCharEditorFactory::QtCharEditorFactory(QObject *parent)
: QtAbstractEditorFactory<QtCharPropertyManager>(parent)
{
d_ptr = new QtCharEditorFactoryPrivate();
d_ptr->q_ptr = this;
}
/*!
Destroys this factory, and all the widgets it has created.
*/
QtCharEditorFactory::~QtCharEditorFactory()
{
qDeleteAll(d_ptr->m_editorToProperty.keys());
delete d_ptr;
}
/*!
\internal
Reimplemented from the QtAbstractEditorFactory class.
*/
void QtCharEditorFactory::connectPropertyManager(QtCharPropertyManager *manager)
{
connect(manager, SIGNAL(valueChanged(QtProperty *, const QChar &)),
this, SLOT(slotPropertyChanged(QtProperty *, const QChar &)));
}
/*!
\internal
Reimplemented from the QtAbstractEditorFactory class.
*/
QWidget *QtCharEditorFactory::createEditor(QtCharPropertyManager *manager,
QtProperty *property, QWidget *parent)
{
QtCharEdit *editor = d_ptr->createEditor(property, parent);
editor->setValue(manager->value(property));
connect(editor, SIGNAL(valueChanged(const QChar &)),
this, SLOT(slotSetValue(const QChar &)));
connect(editor, SIGNAL(destroyed(QObject *)),
this, SLOT(slotEditorDestroyed(QObject *)));
return editor;
}
/*!
\internal
Reimplemented from the QtAbstractEditorFactory class.
*/
void QtCharEditorFactory::disconnectPropertyManager(QtCharPropertyManager *manager)
{
disconnect(manager, SIGNAL(valueChanged(QtProperty *, const QChar &)),
this, SLOT(slotPropertyChanged(QtProperty *, const QChar &)));
}
// QtEnumEditorFactory
class QtEnumEditorFactoryPrivate : public EditorFactoryPrivate<QComboBox>
{
QtEnumEditorFactory *q_ptr;
Q_DECLARE_PUBLIC(QtEnumEditorFactory)
public:
void slotPropertyChanged(QtProperty *property, int value);
void slotEnumNamesChanged(QtProperty *property, const QStringList &);
void slotEnumIconsChanged(QtProperty *property, const QMap<int, QIcon> &);
void slotSetValue(int value);
};
void QtEnumEditorFactoryPrivate::slotPropertyChanged(QtProperty *property, int value)
{
if (!m_createdEditors.contains(property))
return;
QListIterator<QComboBox *> itEditor(m_createdEditors[property]);
while (itEditor.hasNext()) {
QComboBox *editor = itEditor.next();
editor->blockSignals(true);
editor->setCurrentIndex(value);
editor->blockSignals(false);
}
}
void QtEnumEditorFactoryPrivate::slotEnumNamesChanged(QtProperty *property,
const QStringList &enumNames)
{
if (!m_createdEditors.contains(property))
return;
QtEnumPropertyManager *manager = q_ptr->propertyManager(property);
if (!manager)
return;
QMap<int, QIcon> enumIcons = manager->enumIcons(property);
QListIterator<QComboBox *> itEditor(m_createdEditors[property]);
while (itEditor.hasNext()) {
QComboBox *editor = itEditor.next();
editor->blockSignals(true);
editor->clear();
editor->addItems(enumNames);
const int nameCount = enumNames.count();
for (int i = 0; i < nameCount; i++)
editor->setItemIcon(i, enumIcons.value(i));
editor->setCurrentIndex(manager->value(property));
editor->blockSignals(false);
}
}
void QtEnumEditorFactoryPrivate::slotEnumIconsChanged(QtProperty *property,
const QMap<int, QIcon> &enumIcons)
{
if (!m_createdEditors.contains(property))
return;
QtEnumPropertyManager *manager = q_ptr->propertyManager(property);
if (!manager)
return;
const QStringList enumNames = manager->enumNames(property);
QListIterator<QComboBox *> itEditor(m_createdEditors[property]);
while (itEditor.hasNext()) {
QComboBox *editor = itEditor.next();
editor->blockSignals(true);
const int nameCount = enumNames.count();
for (int i = 0; i < nameCount; i++)
editor->setItemIcon(i, enumIcons.value(i));
editor->setCurrentIndex(manager->value(property));
editor->blockSignals(false);
}
}
void QtEnumEditorFactoryPrivate::slotSetValue(int value)
{
QObject *object = q_ptr->sender();
const QMap<QComboBox *, QtProperty *>::ConstIterator ecend = m_editorToProperty.constEnd();
for (QMap<QComboBox *, QtProperty *>::ConstIterator itEditor = m_editorToProperty.constBegin(); itEditor != ecend; ++itEditor)
if (itEditor.key() == object) {
QtProperty *property = itEditor.value();
QtEnumPropertyManager *manager = q_ptr->propertyManager(property);
if (!manager)
return;
manager->setValue(property, value);
return;
}
}
/*!
\class QtEnumEditorFactory
\brief The QtEnumEditorFactory class provides QComboBox widgets for
properties created by QtEnumPropertyManager objects.
\sa QtAbstractEditorFactory, QtEnumPropertyManager
*/
/*!
Creates a factory with the given \a parent.
*/
QtEnumEditorFactory::QtEnumEditorFactory(QObject *parent)
: QtAbstractEditorFactory<QtEnumPropertyManager>(parent)
{
d_ptr = new QtEnumEditorFactoryPrivate();
d_ptr->q_ptr = this;
}
/*!
Destroys this factory, and all the widgets it has created.
*/
QtEnumEditorFactory::~QtEnumEditorFactory()
{
qDeleteAll(d_ptr->m_editorToProperty.keys());
delete d_ptr;
}
/*!
\internal
Reimplemented from the QtAbstractEditorFactory class.
*/
void QtEnumEditorFactory::connectPropertyManager(QtEnumPropertyManager *manager)
{
connect(manager, SIGNAL(valueChanged(QtProperty *, int)),
this, SLOT(slotPropertyChanged(QtProperty *, int)));
connect(manager, SIGNAL(enumNamesChanged(QtProperty *, const QStringList &)),
this, SLOT(slotEnumNamesChanged(QtProperty *, const QStringList &)));
}
/*!
\internal
Reimplemented from the QtAbstractEditorFactory class.
*/
QWidget *QtEnumEditorFactory::createEditor(QtEnumPropertyManager *manager, QtProperty *property,
QWidget *parent)
{
QComboBox *editor = d_ptr->createEditor(property, parent);
editor->setSizeAdjustPolicy(QComboBox::AdjustToMinimumContentsLengthWithIcon);
editor->setMinimumContentsLength(1);
editor->view()->setTextElideMode(Qt::ElideRight);
QStringList enumNames = manager->enumNames(property);
editor->addItems(enumNames);
QMap<int, QIcon> enumIcons = manager->enumIcons(property);
const int enumNamesCount = enumNames.count();
for (int i = 0; i < enumNamesCount; i++)
editor->setItemIcon(i, enumIcons.value(i));
editor->setCurrentIndex(manager->value(property));
connect(editor, SIGNAL(currentIndexChanged(int)), this, SLOT(slotSetValue(int)));
connect(editor, SIGNAL(destroyed(QObject *)),
this, SLOT(slotEditorDestroyed(QObject *)));
return editor;
}
/*!
\internal
Reimplemented from the QtAbstractEditorFactory class.
*/
void QtEnumEditorFactory::disconnectPropertyManager(QtEnumPropertyManager *manager)
{
disconnect(manager, SIGNAL(valueChanged(QtProperty *, int)),
this, SLOT(slotPropertyChanged(QtProperty *, int)));
disconnect(manager, SIGNAL(enumNamesChanged(QtProperty *, const QStringList &)),
this, SLOT(slotEnumNamesChanged(QtProperty *, const QStringList &)));
}
// QtCursorEditorFactory
Q_GLOBAL_STATIC(QtCursorDatabase, cursorDatabase)
class QtCursorEditorFactoryPrivate
{
QtCursorEditorFactory *q_ptr;
Q_DECLARE_PUBLIC(QtCursorEditorFactory)
public:
QtCursorEditorFactoryPrivate();
void slotPropertyChanged(QtProperty *property, const QCursor &cursor);
void slotEnumChanged(QtProperty *property, int value);
void slotEditorDestroyed(QObject *object);
QtEnumEditorFactory *m_enumEditorFactory;
QtEnumPropertyManager *m_enumPropertyManager;
QMap<QtProperty *, QtProperty *> m_propertyToEnum;
QMap<QtProperty *, QtProperty *> m_enumToProperty;
QMap<QtProperty *, QList<QWidget *> > m_enumToEditors;
QMap<QWidget *, QtProperty *> m_editorToEnum;
bool m_updatingEnum;
};
QtCursorEditorFactoryPrivate::QtCursorEditorFactoryPrivate()
: m_updatingEnum(false)
{
}
void QtCursorEditorFactoryPrivate::slotPropertyChanged(QtProperty *property, const QCursor &cursor)
{
// update enum property
QtProperty *enumProp = m_propertyToEnum.value(property);
if (!enumProp)
return;
m_updatingEnum = true;
m_enumPropertyManager->setValue(enumProp, cursorDatabase()->cursorToValue(cursor));
m_updatingEnum = false;
}
void QtCursorEditorFactoryPrivate::slotEnumChanged(QtProperty *property, int value)
{
if (m_updatingEnum)
return;
// update cursor property
QtProperty *prop = m_enumToProperty.value(property);
if (!prop)
return;
QtCursorPropertyManager *cursorManager = q_ptr->propertyManager(prop);
if (!cursorManager)
return;
#ifndef QT_NO_CURSOR
cursorManager->setValue(prop, QCursor(cursorDatabase()->valueToCursor(value)));
#endif
}
void QtCursorEditorFactoryPrivate::slotEditorDestroyed(QObject *object)
{
// remove from m_editorToEnum map;
// remove from m_enumToEditors map;
// if m_enumToEditors doesn't contains more editors delete enum property;
const QMap<QWidget *, QtProperty *>::ConstIterator ecend = m_editorToEnum.constEnd();
for (QMap<QWidget *, QtProperty *>::ConstIterator itEditor = m_editorToEnum.constBegin(); itEditor != ecend; ++itEditor)
if (itEditor.key() == object) {
QWidget *editor = itEditor.key();
QtProperty *enumProp = itEditor.value();
m_editorToEnum.remove(editor);
m_enumToEditors[enumProp].removeAll(editor);
if (m_enumToEditors[enumProp].isEmpty()) {
m_enumToEditors.remove(enumProp);
QtProperty *property = m_enumToProperty.value(enumProp);
m_enumToProperty.remove(enumProp);
m_propertyToEnum.remove(property);
delete enumProp;
}
return;
}
}
/*!
\class QtCursorEditorFactory
\brief The QtCursorEditorFactory class provides QComboBox widgets for
properties created by QtCursorPropertyManager objects.
\sa QtAbstractEditorFactory, QtCursorPropertyManager
*/
/*!
Creates a factory with the given \a parent.
*/
QtCursorEditorFactory::QtCursorEditorFactory(QObject *parent)
: QtAbstractEditorFactory<QtCursorPropertyManager>(parent)
{
d_ptr = new QtCursorEditorFactoryPrivate();
d_ptr->q_ptr = this;
d_ptr->m_enumEditorFactory = new QtEnumEditorFactory(this);
d_ptr->m_enumPropertyManager = new QtEnumPropertyManager(this);
connect(d_ptr->m_enumPropertyManager, SIGNAL(valueChanged(QtProperty *, int)),
this, SLOT(slotEnumChanged(QtProperty *, int)));
d_ptr->m_enumEditorFactory->addPropertyManager(d_ptr->m_enumPropertyManager);
}
/*!
Destroys this factory, and all the widgets it has created.
*/
QtCursorEditorFactory::~QtCursorEditorFactory()
{
delete d_ptr;
}
/*!
\internal
Reimplemented from the QtAbstractEditorFactory class.
*/
void QtCursorEditorFactory::connectPropertyManager(QtCursorPropertyManager *manager)
{
connect(manager, SIGNAL(valueChanged(QtProperty *, const QCursor &)),
this, SLOT(slotPropertyChanged(QtProperty *, const QCursor &)));
}
/*!
\internal
Reimplemented from the QtAbstractEditorFactory class.
*/
QWidget *QtCursorEditorFactory::createEditor(QtCursorPropertyManager *manager, QtProperty *property,
QWidget *parent)
{
QtProperty *enumProp = 0;
if (d_ptr->m_propertyToEnum.contains(property)) {
enumProp = d_ptr->m_propertyToEnum[property];
} else {
enumProp = d_ptr->m_enumPropertyManager->addProperty(property->propertyName());
d_ptr->m_enumPropertyManager->setEnumNames(enumProp, cursorDatabase()->cursorShapeNames());
d_ptr->m_enumPropertyManager->setEnumIcons(enumProp, cursorDatabase()->cursorShapeIcons());
#ifndef QT_NO_CURSOR
d_ptr->m_enumPropertyManager->setValue(enumProp, cursorDatabase()->cursorToValue(manager->value(property)));
#endif
d_ptr->m_propertyToEnum[property] = enumProp;
d_ptr->m_enumToProperty[enumProp] = property;
}
QtAbstractEditorFactoryBase *af = d_ptr->m_enumEditorFactory;
QWidget *editor = af->createEditor(enumProp, parent);
d_ptr->m_enumToEditors[enumProp].append(editor);
d_ptr->m_editorToEnum[editor] = enumProp;
connect(editor, SIGNAL(destroyed(QObject *)),
this, SLOT(slotEditorDestroyed(QObject *)));
return editor;
}
/*!
\internal
Reimplemented from the QtAbstractEditorFactory class.
*/
void QtCursorEditorFactory::disconnectPropertyManager(QtCursorPropertyManager *manager)
{
disconnect(manager, SIGNAL(valueChanged(QtProperty *, const QCursor &)),
this, SLOT(slotPropertyChanged(QtProperty *, const QCursor &)));
}
// QtColorEditWidget
class QtColorEditWidget : public QWidget {
Q_OBJECT
public:
QtColorEditWidget(QWidget *parent);
bool eventFilter(QObject *obj, QEvent *ev);
public Q_SLOTS:
void setValue(const QColor &value);
Q_SIGNALS:
void valueChanged(const QColor &value);
protected:
void paintEvent(QPaintEvent *);
private Q_SLOTS:
void buttonClicked();
private:
QColor m_color;
QLabel *m_pixmapLabel;
QLabel *m_label;
QToolButton *m_button;
};
QtColorEditWidget::QtColorEditWidget(QWidget *parent) :
QWidget(parent),
m_pixmapLabel(new QLabel),
m_label(new QLabel),
m_button(new QToolButton)
{
QHBoxLayout *lt = new QHBoxLayout(this);
setupTreeViewEditorMargin(lt);
lt->setSpacing(0);
lt->addWidget(m_pixmapLabel);
lt->addWidget(m_label);
lt->addItem(new QSpacerItem(0, 0, QSizePolicy::Expanding, QSizePolicy::Ignored));
m_button->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Ignored);
m_button->setFixedWidth(20);
setFocusProxy(m_button);
setFocusPolicy(m_button->focusPolicy());
m_button->setText(tr("..."));
m_button->installEventFilter(this);
connect(m_button, SIGNAL(clicked()), this, SLOT(buttonClicked()));
lt->addWidget(m_button);
m_pixmapLabel->setPixmap(QtPropertyBrowserUtils::brushValuePixmap(QBrush(m_color)));
m_label->setText(QtPropertyBrowserUtils::colorValueText(m_color));
}
void QtColorEditWidget::setValue(const QColor &c)
{
if (m_color != c) {
m_color = c;
m_pixmapLabel->setPixmap(QtPropertyBrowserUtils::brushValuePixmap(QBrush(c)));
m_label->setText(QtPropertyBrowserUtils::colorValueText(c));
}
}
void QtColorEditWidget::buttonClicked()
{
bool ok = false;
QRgb oldRgba = m_color.rgba();
QRgb newRgba = QColorDialog::getRgba(oldRgba, &ok, this);
if (ok && newRgba != oldRgba) {
setValue(QColor::fromRgba(newRgba));
emit valueChanged(m_color);
}
}
bool QtColorEditWidget::eventFilter(QObject *obj, QEvent *ev)
{
if (obj == m_button) {
switch (ev->type()) {
case QEvent::KeyPress:
case QEvent::KeyRelease: { // Prevent the QToolButton from handling Enter/Escape meant control the delegate
switch (static_cast<const QKeyEvent*>(ev)->key()) {
case Qt::Key_Escape:
case Qt::Key_Enter:
case Qt::Key_Return:
ev->ignore();
return true;
default:
break;
}
}
break;
default:
break;
}
}
return QWidget::eventFilter(obj, ev);
}
void QtColorEditWidget::paintEvent(QPaintEvent *)
{
QStyleOption opt;
opt.init(this);
QPainter p(this);
style()->drawPrimitive(QStyle::PE_Widget, &opt, &p, this);
}
// QtColorEditorFactoryPrivate
class QtColorEditorFactoryPrivate : public EditorFactoryPrivate<QtColorEditWidget>
{
QtColorEditorFactory *q_ptr;
Q_DECLARE_PUBLIC(QtColorEditorFactory)
public:
void slotPropertyChanged(QtProperty *property, const QColor &value);
void slotSetValue(const QColor &value);
};
void QtColorEditorFactoryPrivate::slotPropertyChanged(QtProperty *property,
const QColor &value)
{
const PropertyToEditorListMap::iterator it = m_createdEditors.find(property);
if (it == m_createdEditors.end())
return;
QListIterator<QtColorEditWidget *> itEditor(it.value());
while (itEditor.hasNext())
itEditor.next()->setValue(value);
}
void QtColorEditorFactoryPrivate::slotSetValue(const QColor &value)
{
QObject *object = q_ptr->sender();
const EditorToPropertyMap::ConstIterator ecend = m_editorToProperty.constEnd();
for (EditorToPropertyMap::ConstIterator itEditor = m_editorToProperty.constBegin(); itEditor != ecend; ++itEditor)
if (itEditor.key() == object) {
QtProperty *property = itEditor.value();
QtColorPropertyManager *manager = q_ptr->propertyManager(property);
if (!manager)
return;
manager->setValue(property, value);
return;
}
}
/*!
\class QtColorEditorFactory
\brief The QtColorEditorFactory class provides color editing for
properties created by QtColorPropertyManager objects.
\sa QtAbstractEditorFactory, QtColorPropertyManager
*/
/*!
Creates a factory with the given \a parent.
*/
QtColorEditorFactory::QtColorEditorFactory(QObject *parent) :
QtAbstractEditorFactory<QtColorPropertyManager>(parent),
d_ptr(new QtColorEditorFactoryPrivate())
{
d_ptr->q_ptr = this;
}
/*!
Destroys this factory, and all the widgets it has created.
*/
QtColorEditorFactory::~QtColorEditorFactory()
{
qDeleteAll(d_ptr->m_editorToProperty.keys());
delete d_ptr;
}
/*!
\internal
Reimplemented from the QtAbstractEditorFactory class.
*/
void QtColorEditorFactory::connectPropertyManager(QtColorPropertyManager *manager)
{
connect(manager, SIGNAL(valueChanged(QtProperty*,QColor)),
this, SLOT(slotPropertyChanged(QtProperty*,QColor)));
}
/*!
\internal
Reimplemented from the QtAbstractEditorFactory class.
*/
QWidget *QtColorEditorFactory::createEditor(QtColorPropertyManager *manager,
QtProperty *property, QWidget *parent)
{
QtColorEditWidget *editor = d_ptr->createEditor(property, parent);
editor->setValue(manager->value(property));
connect(editor, SIGNAL(valueChanged(QColor)), this, SLOT(slotSetValue(QColor)));
connect(editor, SIGNAL(destroyed(QObject *)), this, SLOT(slotEditorDestroyed(QObject *)));
return editor;
}
/*!
\internal
Reimplemented from the QtAbstractEditorFactory class.
*/
void QtColorEditorFactory::disconnectPropertyManager(QtColorPropertyManager *manager)
{
disconnect(manager, SIGNAL(valueChanged(QtProperty*,QColor)), this, SLOT(slotPropertyChanged(QtProperty*,QColor)));
}
// QtFontEditWidget
class QtFontEditWidget : public QWidget {
Q_OBJECT
public:
QtFontEditWidget(QWidget *parent);
bool eventFilter(QObject *obj, QEvent *ev);
public Q_SLOTS:
void setValue(const QFont &value);
Q_SIGNALS:
void valueChanged(const QFont &value);
protected:
void paintEvent(QPaintEvent *);
private Q_SLOTS:
void buttonClicked();
private:
QFont m_font;
QLabel *m_pixmapLabel;
QLabel *m_label;
QToolButton *m_button;
};
QtFontEditWidget::QtFontEditWidget(QWidget *parent) :
QWidget(parent),
m_pixmapLabel(new QLabel),
m_label(new QLabel),
m_button(new QToolButton)
{
QHBoxLayout *lt = new QHBoxLayout(this);
setupTreeViewEditorMargin(lt);
lt->setSpacing(0);
lt->addWidget(m_pixmapLabel);
lt->addWidget(m_label);
lt->addItem(new QSpacerItem(0, 0, QSizePolicy::Expanding, QSizePolicy::Ignored));
m_button->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Ignored);
m_button->setFixedWidth(20);
setFocusProxy(m_button);
setFocusPolicy(m_button->focusPolicy());
m_button->setText(tr("..."));
m_button->installEventFilter(this);
connect(m_button, SIGNAL(clicked()), this, SLOT(buttonClicked()));
lt->addWidget(m_button);
m_pixmapLabel->setPixmap(QtPropertyBrowserUtils::fontValuePixmap(m_font));
m_label->setText(QtPropertyBrowserUtils::fontValueText(m_font));
}
void QtFontEditWidget::setValue(const QFont &f)
{
if (m_font != f) {
m_font = f;
m_pixmapLabel->setPixmap(QtPropertyBrowserUtils::fontValuePixmap(f));
m_label->setText(QtPropertyBrowserUtils::fontValueText(f));
}
}
void QtFontEditWidget::buttonClicked()
{
bool ok = false;
QFont newFont = QFontDialog::getFont(&ok, m_font, this, tr("Select Font"));
if (ok && newFont != m_font) {
QFont f = m_font;
// prevent mask for unchanged attributes, don't change other attributes (like kerning, etc...)
if (m_font.family() != newFont.family())
f.setFamily(newFont.family());
if (m_font.pointSize() != newFont.pointSize())
f.setPointSize(newFont.pointSize());
if (m_font.bold() != newFont.bold())
f.setBold(newFont.bold());
if (m_font.italic() != newFont.italic())
f.setItalic(newFont.italic());
if (m_font.underline() != newFont.underline())
f.setUnderline(newFont.underline());
if (m_font.strikeOut() != newFont.strikeOut())
f.setStrikeOut(newFont.strikeOut());
setValue(f);
emit valueChanged(m_font);
}
}
bool QtFontEditWidget::eventFilter(QObject *obj, QEvent *ev)
{
if (obj == m_button) {
switch (ev->type()) {
case QEvent::KeyPress:
case QEvent::KeyRelease: { // Prevent the QToolButton from handling Enter/Escape meant control the delegate
switch (static_cast<const QKeyEvent*>(ev)->key()) {
case Qt::Key_Escape:
case Qt::Key_Enter:
case Qt::Key_Return:
ev->ignore();
return true;
default:
break;
}
}
break;
default:
break;
}
}
return QWidget::eventFilter(obj, ev);
}
void QtFontEditWidget::paintEvent(QPaintEvent *)
{
QStyleOption opt;
opt.init(this);
QPainter p(this);
style()->drawPrimitive(QStyle::PE_Widget, &opt, &p, this);
}
// QtFontEditorFactoryPrivate
class QtFontEditorFactoryPrivate : public EditorFactoryPrivate<QtFontEditWidget>
{
QtFontEditorFactory *q_ptr;
Q_DECLARE_PUBLIC(QtFontEditorFactory)
public:
void slotPropertyChanged(QtProperty *property, const QFont &value);
void slotSetValue(const QFont &value);
};
void QtFontEditorFactoryPrivate::slotPropertyChanged(QtProperty *property,
const QFont &value)
{
const PropertyToEditorListMap::iterator it = m_createdEditors.find(property);
if (it == m_createdEditors.end())
return;
QListIterator<QtFontEditWidget *> itEditor(it.value());
while (itEditor.hasNext())
itEditor.next()->setValue(value);
}
void QtFontEditorFactoryPrivate::slotSetValue(const QFont &value)
{
QObject *object = q_ptr->sender();
const EditorToPropertyMap::ConstIterator ecend = m_editorToProperty.constEnd();
for (EditorToPropertyMap::ConstIterator itEditor = m_editorToProperty.constBegin(); itEditor != ecend; ++itEditor)
if (itEditor.key() == object) {
QtProperty *property = itEditor.value();
QtFontPropertyManager *manager = q_ptr->propertyManager(property);
if (!manager)
return;
manager->setValue(property, value);
return;
}
}
/*!
\class QtFontEditorFactory
\brief The QtFontEditorFactory class provides font editing for
properties created by QtFontPropertyManager objects.
\sa QtAbstractEditorFactory, QtFontPropertyManager
*/
/*!
Creates a factory with the given \a parent.
*/
QtFontEditorFactory::QtFontEditorFactory(QObject *parent) :
QtAbstractEditorFactory<QtFontPropertyManager>(parent),
d_ptr(new QtFontEditorFactoryPrivate())
{
d_ptr->q_ptr = this;
}
/*!
Destroys this factory, and all the widgets it has created.
*/
QtFontEditorFactory::~QtFontEditorFactory()
{
qDeleteAll(d_ptr->m_editorToProperty.keys());
delete d_ptr;
}
/*!
\internal
Reimplemented from the QtAbstractEditorFactory class.
*/
void QtFontEditorFactory::connectPropertyManager(QtFontPropertyManager *manager)
{
connect(manager, SIGNAL(valueChanged(QtProperty*,QFont)),
this, SLOT(slotPropertyChanged(QtProperty*,QFont)));
}
/*!
\internal
Reimplemented from the QtAbstractEditorFactory class.
*/
QWidget *QtFontEditorFactory::createEditor(QtFontPropertyManager *manager,
QtProperty *property, QWidget *parent)
{
QtFontEditWidget *editor = d_ptr->createEditor(property, parent);
editor->setValue(manager->value(property));
connect(editor, SIGNAL(valueChanged(QFont)), this, SLOT(slotSetValue(QFont)));
connect(editor, SIGNAL(destroyed(QObject *)), this, SLOT(slotEditorDestroyed(QObject *)));
return editor;
}
/*!
\internal
Reimplemented from the QtAbstractEditorFactory class.
*/
void QtFontEditorFactory::disconnectPropertyManager(QtFontPropertyManager *manager)
{
disconnect(manager, SIGNAL(valueChanged(QtProperty*,QFont)), this, SLOT(slotPropertyChanged(QtProperty*,QFont)));
}
// QtMatrixFactoryPrivate
class QtMatrixEditorFactoryPrivate : public EditorFactoryPrivate<MatrixEditor>
{
QtMatrixEditorFactory *q_ptr;
Q_DECLARE_PUBLIC(QtMatrixEditorFactory)
public:
void slotPropertyChanged(QtProperty *property, const QMatrix4x4& value);
void slotDecimalsChanged(QtProperty *property, int prec);
void slotSetValue(const QMatrix4x4& value);
};
void QtMatrixEditorFactoryPrivate::slotPropertyChanged(QtProperty *property, const QMatrix4x4& value)
{
if (!m_createdEditors.contains(property))
return;
QListIterator<MatrixEditor *> itEditor(m_createdEditors[property]);
while (itEditor.hasNext()) {
MatrixEditor *editor = itEditor.next();
if (editor->value() != value) {
editor->blockSignals(true);
editor->setValue(value);
editor->blockSignals(false);
}
}
}
void QtMatrixEditorFactoryPrivate::slotDecimalsChanged(QtProperty *property, int prec)
{
if (!m_createdEditors.contains(property))
return;
QtMatrixPropertyManager *manager = q_ptr->propertyManager(property);
if (!manager)
return;
QList<MatrixEditor *> editors = m_createdEditors[property];
QListIterator<MatrixEditor *> itEditor(editors);
while (itEditor.hasNext()) {
MatrixEditor *editor = itEditor.next();
editor->blockSignals(true);
editor->setDecimals(prec);
editor->setValue(manager->value(property));
editor->blockSignals(false);
}
}
void QtMatrixEditorFactoryPrivate::slotSetValue(const QMatrix4x4& value)
{
QObject *object = q_ptr->sender();
const QMap<MatrixEditor *, QtProperty *>::ConstIterator ecend = m_editorToProperty.constEnd();
for (QMap<MatrixEditor *, QtProperty *>::ConstIterator itEditor = m_editorToProperty.constBegin(); itEditor != ecend; ++itEditor) {
if (itEditor.key() == object) {
QtProperty *property = itEditor.value();
QtMatrixPropertyManager *manager = q_ptr->propertyManager(property);
if (!manager)
return;
manager->setValue(property, value);
return;
}
}
}
/*!
Creates a factory with the given \a parent.
*/
QtMatrixEditorFactory::QtMatrixEditorFactory(QObject *parent)
: QtAbstractEditorFactory<QtMatrixPropertyManager>(parent)
{
d_ptr = new QtMatrixEditorFactoryPrivate();
d_ptr->q_ptr = this;
}
/*!
Destroys this factory, and all the widgets it has created.
*/
QtMatrixEditorFactory::~QtMatrixEditorFactory()
{
qDeleteAll(d_ptr->m_editorToProperty.keys());
delete d_ptr;
}
/*!
\internal
Reimplemented from the QtAbstractEditorFactory class.
*/
void QtMatrixEditorFactory::connectPropertyManager(QtMatrixPropertyManager *manager)
{
connect(manager, SIGNAL(valueChanged(QtProperty *, const QMatrix4x4&)),
this, SLOT(slotPropertyChanged(QtProperty *, const QMatrix4x4&)));
connect(manager, SIGNAL(decimalsChanged(QtProperty *, int)),
this, SLOT(slotDecimalsChanged(QtProperty *, int)));
}
/*!
\internal
Reimplemented from the QtAbstractEditorFactory class.
*/
QWidget *QtMatrixEditorFactory::createEditor(QtMatrixPropertyManager *manager, QtProperty *property,
QWidget *parent)
{
MatrixEditor *editor = d_ptr->createEditor(property, parent);
editor->setDecimals(manager->decimals(property));
editor->setValue(manager->value(property));
connect(editor, SIGNAL(valueChanged(const QMatrix4x4&)), this, SLOT(slotSetValue(const QMatrix4x4&)));
connect(editor, SIGNAL(destroyed(QObject *)),
this, SLOT(slotEditorDestroyed(QObject *)));
return editor;
}
/*!
\internal
Reimplemented from the QtAbstractEditorFactory class.
*/
void QtMatrixEditorFactory::disconnectPropertyManager(QtMatrixPropertyManager *manager)
{
disconnect(manager, SIGNAL(valueChanged(QtProperty *, const QMatrix4x4&)),
this, SLOT(slotPropertyChanged(QtProperty *, const QMatrix4x4&)));
disconnect(manager, SIGNAL(decimalsChanged(QtProperty *, int)),
this, SLOT(slotDecimalsChanged(QtProperty *, int)));
}
#if QT_VERSION >= 0x040400
QT_END_NAMESPACE
#endif
#include "moc_qteditorfactory.cpp"
#include "qteditorfactory.moc"
| [
"[email protected]"
] | |
73811e40a8af61b59c5d96f270291687ede4d60e | 2f6f4953d35e53d3d86ad4e959d9f032d4bb3c4c | /base_lib/LocalManBiz/ConfigureHelper.h | f4ff3b4883e347ce1dae6ca27da3916acf8a93be | [
"MIT"
] | permissive | xuepingiw/open_source_startalk | c9b6866b736d51798394486de2b6181a49f38466 | 44d962b04039f5660ec47a10313876a0754d3e72 | refs/heads/master | 2020-04-29T03:00:00.190179 | 2019-03-27T07:01:40 | 2019-03-27T07:01:40 | 175,791,902 | 0 | 0 | MIT | 2019-03-15T09:43:22 | 2019-03-15T09:43:18 | null | UTF-8 | C++ | false | false | 6,598 | h | #ifndef CONFIGUREHELPER_H
#define CONFIGUREHELPER_H
#include "CoreObject.h"
#include "ISerializeable.h"
#include <QIcon>
namespace Biz
{
class AccountData;
class UserSettingData;
class AccountList;
class GroupListData;
class SystemConfigData;
class AllUserSettingData;
class EmotionPackageListModule;
class EditableSettings;
class CheckConfigInfo;
class ImSelfPerson;
class LoginNavConfigInfo;
class AdverConfigInfo;
class DomainListInfo;
class LoginAccountConfigInfo;
class NavConfigInfo;
class ConfigureHelper : public QObject
{
public:
// 域列表存取
static DomainListInfo* loadDomainListConfigData();
static void saveDomainListConfigData(DomainListInfo& domainsinfo);
//广告信息存取
static AdverConfigInfo*loadAdvConfigureData(const QString&userID);
static void saveAdvConfigureData(const QString& userID, AdverConfigInfo& adverconfig);
// 获取配置信息
static CheckConfigInfo* loadCheckConfigureData( const QString& userID );
static void saveCheckConfigureData( const QString& userID, CheckConfigInfo& configure );
// 获取登陆导航,多账户共享,同accountdata
static LoginNavConfigInfo* loadNavConfigureData();
static void saveNavConfigureData( LoginNavConfigInfo& configure );
static void deleteNavConfigureFile();
static void deleteRsaPubKey();
//删除文件夹中的所有文件,不管后缀名了(只要是名称一样的,都必须给删掉)
static void user_DeleteAllPortraitPath(const QString& userID, const QString& peerID);
static void user_DeleteAllRawPortraitPath(const QString& userID, const QString& peerID);
// 最近使用过的表情
static QString getEmoticonsCachePath();
static QString getUserSLPath(const QString& userID);
static QString GetSettingConfigurePath();
static QString QuickReplyListConfigurePath(const QString& userID);
static QString user_DatabasePath(const QString&);
static QString user_PortraitPath(const QString& userID, const QString& peerID, const QString& strsuffer="");
static QString user_RawPortraitPath(const QString& userID, const QString& peerID, const QString& strsuffer="");
static QString user_ImagesPath( const QString& userID);
static void saveAccount(AccountData& accountData);
static AccountData* loadAccountData();
static void removeAccount();
static QString ThemePath();
static QString UserTempPath(const QString& userID);
static QString SystemTempPath();
static UserSettingData* loadConfigureData( const QString& userID );
static void saveConfigureData( const QString& userID, UserSettingData& configure );
static QString appVersionInfo();
static void saveAccountList(AccountList& accountData);
static AccountList* loadAccountList();
static void saveGroupList( const QString& userID, GroupListData& accountList);
static GroupListData* loadGroupList(const QString& userID);
static void saveSystemConfig( SystemConfigData& config);
static SystemConfigData* loadSystemConfig();
static SystemConfigData* loadSystemConfig(bool bBeta);
static AllUserSettingData* loadSettingConfig(int,int);
static void saveSettingConfig( AllUserSettingData& configData);
static EditableSettings* loadEditableSettings();
static void saveEditSettings(EditableSettings& data);
static QString getServerVersion();
static void setServerVersion(const QString& ver);
static QString GetBufferMD5(const QString& ver);
static QString GetFileMD5(const QString& strfilePath);
static bool IsPicFile(const QString& strfilePath);
static QIcon GetFileIcon(const QString& file_name);
static QString getLogsDir();
static QString getRootDir();
static QString getQunarDataDir();
static QString getDeskWindowPath();
static QString getRsaDataDir();
static QString getOrginFromPath(const QString&path,QString&fileName,QString& strFileFiler);
static void SaveEmotionList(const QString& userID, EmotionPackageListModule& emotionList);
static EmotionPackageListModule *loadEmotionList(const QString& userID);
static QString GetDebugOrReleasePath(const QString& path);
static void DeleteGroupLstPathFile(const QString&UserID);
static bool IsValidateEmail(const QString&stremail);
static bool IsValidateMobile(const QString&strmobile);
static QString getDisplayName(const QSharedPointer<Biz::ImSelfPerson>& person);
static bool IsFullPathFileorImage(const QString& url);
static QString getLocalSavePath(const QString & strLocalPath);
static void parseLoginNavInfo(const QString& value, bool bret=false);
static void parseLoginSecondNavInfo(const QString& value);
static QString makeFullUrl(const QString& strUrl);
static QString bubbleConfigPath(const QString& userID);
static void removeNavFile();
static QString getSufferfromImageUrl(const QString& url);
static QString getImageLocalSavePath(const QString& url,const QString& conversationId);
static QString getImageLocalSaveName(const QString& url);
static bool IsValidFile(const QString&filePath);
static QList<QSharedPointer<Biz::LoginAccountConfigInfo>> loadLoginAccountConfigInforList(bool bEncrypt);
static void saveLoginAccountConfigInforList(const QList<QSharedPointer<Biz::LoginAccountConfigInfo>>& loginAccountlist, bool bEncrypt);
static QList<QSharedPointer<Biz::NavConfigInfo>> loadNavConfigInforList(bool bEncrypt);
static void saveNavConfigInforList(const QList<QSharedPointer<Biz::NavConfigInfo>>& Navlist, bool bEncrypt);
static void WirteFile(const QString& fileName, const QString& Path, const QString&content);
private:
static void innerSaveData(const QString& path, ISerializeable& ,bool bEncrypt=false);
static void innerLoadData(const QString& path, ISerializeable** pData, bool bEncrypt = false);
static QString mServerVersion;
static QString getfileName( const QString& strfilename );
//在文件夹中根据id查找该文件
static QString getfileNameFromDir( const QString&userid, const QString& strfileDir);
//获取该文件夹中的所有文件信息
static QFileInfoList getFileListFromDir(const QString& strfileDir);
};
}
#endif // CONFIGUREHELPER_H
| [
"[email protected]"
] | |
57a4d802a96d646f5d6c8c5b1b45a6159cdab29f | 1a2a02df6ee42f8a97e975a8afc89e271016aad6 | /src/hog.h | 1576e82b79698fee4e9d7dfe93242be4ea3d1a6f | [] | no_license | netphoebus/mgraph02-pedestrians | 63838ecd1293b1b3a441d79f15c8ef167afb816c | 67d141b0d51861e1cf03f89882d0b897d3400829 | refs/heads/master | 2020-12-25T08:50:11.488314 | 2011-10-17T22:00:56 | 2011-10-17T22:00:56 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 400 | h | #ifndef HOG_H
#define HOG_H
#include "matrix.h"
#include "gradhistogram.h"
#include "gradient.h"
class HOG: public Matrix<GradHistogram>
{
public:
HOG(const Matrix<Polar> &gr, const QRect &rect);
HOG &normalize();
QVector<double> serialize() const { return serialize(0, 0, width(), height()); }
QVector<double> serialize(int x1, int y1, int w, int h) const;
};
#endif // HOG_H
| [
"[email protected]"
] | |
4d4fa9d5b439fe75638522c55dcca30245ba340a | 884095154dba2b000accf139cf6ae3518f58ff7d | /Pony_Class_Provider.h | 5ad088cfaf18252e9c1f339691f2e9e6e7d8499b | [
"MIT"
] | permissive | bielawb/LinPony | 7273526ecff98c72747d8ab7debb9121146f247e | eefd8fc3d7ddcde128591212e5b071b0333d52cf | refs/heads/master | 2021-01-15T11:48:49.402314 | 2016-12-16T10:27:14 | 2016-12-16T10:27:14 | 33,498,111 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,611 | h | /* @migen@ */
#ifndef _Pony_Class_Provider_h
#define _Pony_Class_Provider_h
#include "Pony.h"
#ifdef __cplusplus
# include <micxx/micxx.h>
# include "module.h"
MI_BEGIN_NAMESPACE
/*
**==============================================================================
**
** Pony provider class declaration
**
**==============================================================================
*/
class Pony_Class_Provider
{
/* @MIGEN.BEGIN@ CAUTION: PLEASE DO NOT EDIT OR DELETE THIS LINE. */
private:
Module* m_Module;
public:
Pony_Class_Provider(
Module* module);
~Pony_Class_Provider();
void Load(
Context& context);
void Unload(
Context& context);
void EnumerateInstances(
Context& context,
const String& nameSpace,
const PropertySet& propertySet,
bool keysOnly,
const MI_Filter* filter);
void GetInstance(
Context& context,
const String& nameSpace,
const Pony_Class& instance,
const PropertySet& propertySet);
void CreateInstance(
Context& context,
const String& nameSpace,
const Pony_Class& newInstance);
void ModifyInstance(
Context& context,
const String& nameSpace,
const Pony_Class& modifiedInstance,
const PropertySet& propertySet);
void DeleteInstance(
Context& context,
const String& nameSpace,
const Pony_Class& instance);
/* @MIGEN.END@ CAUTION: PLEASE DO NOT EDIT OR DELETE THIS LINE. */
};
MI_END_NAMESPACE
#endif /* __cplusplus */
#endif /* _Pony_Class_Provider_h */
| [
"[email protected]"
] | |
96dc9cbc2f143af9344be24c80da203123170734 | 8f2df8703d772fc435671d507756d350ad2ce252 | /externals/include/boost/fiber/detail/data.hpp | 268c86cbb236db859910ef102dae87176d2c7b86 | [
"MIT"
] | permissive | akamilkhan/cpp2python | 1108e2991db80c7356700a0dc9a07bd1f4346295 | ae384cc6e6cb89ed93679903549d91d61c708469 | refs/heads/master | 2020-04-23T12:05:20.033988 | 2020-01-24T11:22:20 | 2020-01-24T11:22:20 | 171,157,748 | 2 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,529 | hpp |
// Copyright Oliver Kowalke 2013.
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
#ifndef BOOST_FIBERS_DETAIL_DATA_H
#define BOOST_FIBERS_DETAIL_DATA_H
#include <boost/config.hpp>
#include <boost/fiber/detail/config.hpp>
#include <boost/fiber/detail/spinlock.hpp>
#ifdef BOOST_HAS_ABI_HEADERS
# include BOOST_ABI_PREFIX
#endif
namespace boost {
namespace fibers {
class context;
namespace detail {
#if (BOOST_EXECUTION_CONTEXT==1)
struct data_t {
spinlock_lock * lk{ nullptr };
context * ctx{ nullptr };
data_t() = default;
explicit data_t( spinlock_lock * lk_) noexcept :
lk{ lk_ } {
}
explicit data_t( context * ctx_) noexcept :
ctx{ ctx_ } {
}
};
#else
struct data_t {
spinlock_lock * lk{ nullptr };
context * ctx{ nullptr };
context * from;
explicit data_t( context * from_) noexcept :
from{ from_ } {
}
explicit data_t( spinlock_lock * lk_,
context * from_) noexcept :
lk{ lk_ },
from{ from_ } {
}
explicit data_t( context * ctx_,
context * from_) noexcept :
ctx{ ctx_ },
from{ from_ } {
}
};
#endif
}}}
#ifdef BOOST_HAS_ABI_HEADERS
# include BOOST_ABI_SUFFIX
#endif
#endif // BOOST_FIBERS_DETAIL_DATA_H
| [
"[email protected]"
] | |
0fa80a241e1717d539a9f060eeb3829bcb04a477 | f6444ed7644d96919e7adbca2938a7a69e0b28de | /cpp/10976.cpp | ff93eb3ee052849528967fb59cb6995f5a232237 | [] | no_license | jullytta/UVAOnlineJudge | 1a9ec1fb39ed394e30bef05c549acec647efd2d2 | 780995adaf748779011c4af7caa62d915fd93281 | refs/heads/master | 2021-06-24T08:19:53.166525 | 2017-03-21T21:31:23 | 2017-03-21T21:31:23 | 37,727,161 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 398 | cpp | #include<iostream>
using namespace std;
int main (void){
int k, x, y, pairs;
while(cin >> k){
pairs = 0;
for(y = k+1; y <= 2*k; y++){
if(((k*y)%(y-k)) == 0)
pairs++;
}
cout << pairs << endl;
for(y = k+1; y <= 2*k; y++){
if(((k*y)%(y-k)) == 0){
x = (k*y)/(y-k);
cout << "1/" << k << " = 1/" << x << " + 1/" << y << endl;
}
}
}
return 0;
}
| [
"[email protected]"
] | |
e0dfb06425a0ff2e4dbbd398f385a0913b102f33 | 3b9b4049a8e7d38b49e07bb752780b2f1d792851 | /src/ui/compositor/transform_recorder.cc | 5867a54b57ba54d38eeb6e9cec6effd94ad8f507 | [
"BSD-3-Clause",
"Apache-2.0"
] | permissive | webosce/chromium53 | f8e745e91363586aee9620c609aacf15b3261540 | 9171447efcf0bb393d41d1dc877c7c13c46d8e38 | refs/heads/webosce | 2020-03-26T23:08:14.416858 | 2018-08-23T08:35:17 | 2018-09-20T14:25:18 | 145,513,343 | 0 | 2 | Apache-2.0 | 2019-08-21T22:44:55 | 2018-08-21T05:52:31 | null | UTF-8 | C++ | false | false | 1,014 | cc | // Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "ui/compositor/transform_recorder.h"
#include "cc/playback/display_item_list.h"
#include "cc/playback/transform_display_item.h"
#include "ui/compositor/paint_context.h"
namespace ui {
TransformRecorder::TransformRecorder(const PaintContext& context)
: context_(context), transformed_(false) {}
TransformRecorder::~TransformRecorder() {
if (transformed_)
context_.list_->CreateAndAppendItem<cc::EndTransformDisplayItem>(
bounds_in_layer_);
}
void TransformRecorder::Transform(const gfx::Transform& transform,
const gfx::Size& size_in_context) {
DCHECK(!transformed_);
bounds_in_layer_ = context_.ToLayerSpaceBounds(size_in_context);
context_.list_->CreateAndAppendItem<cc::TransformDisplayItem>(
bounds_in_layer_, transform);
transformed_ = true;
}
} // namespace ui
| [
"[email protected]"
] | |
b255f55d1976255fd4e3f4565fa40754c5dd8e42 | 96a3c2e24fc632a02c254c59725e1db3de15d0ce | /01String/43MultiplyStrings.cpp | 028240c12af831635bacddfb7d09592177df703b | [] | no_license | ludandandan/LeetCode | d237e8da7857f6f0dafaa51e81a2f334e4d5d5f6 | b30b79f8ea9208624a1e0973ed21414d1943b487 | refs/heads/master | 2020-05-22T06:30:42.120050 | 2019-06-24T03:04:22 | 2019-06-24T03:04:22 | 186,255,433 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,677 | cpp | #include <cstdio>
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
using namespace std;
class Solution{
public:
//将两个字符串表示的整数相乘
string mulStrings(string num1, string num2)
{
if(num1.empty() || num2.empty()) return "";
string res;
int n1 = num1.size();
int n2 = num2.size();
//定义一个vector,大小为n1+n2,存放结果的从高位到低位
//索引越小,位数越高,只有0~9
vector<int> resV(n1+n2, 0);//初始化各个位都是0
//乘法要从低位开始算,所以要对num1和num2倒着取
for(int i=n1-1; i>=0; i--)
{
for(int j=n2-1; j>=0; j--)
{
int i0 = num1[i]-'0';
int j0 = num2[j]-'0';
int mul = i0*j0;
//乘积先加到低位上,除以10商加到高位上,余数留在低位上
int p1 = i+j;//高位
int p2 = i+j+1; //低位
resV[p2] += mul;
resV[p1] += resV[p2]/10;
resV[p2] = resV[p2]%10;
}
}
//从vector中取出来放到string里
for(int n: resV)
{
//先出高位再出低位,注意不要0开头
if(!(res.empty() && n==0))
{
char c = n+'0';
res += c;
}
}
return res.empty()?"0":res;//结果若是空的,那么返回0
}
};
int main()
{
Solution s;
string str1, str2;
cin >> str1;
cin >> str2;
string res = s.mulStrings(str1, str2);
cout << res << endl;
}
| [
"[email protected]"
] | |
f4911b76417db0c1f71f1e5fb84876dd5b491828 | eaa2c36f67b9a2d4089a406d21a4edfbfffab958 | /WM/SIP/TodayPlugin/WMPStatusPlugin/WMPStatusPlugin.cpp | e6f18d5c6afafc869eb9b7ba725ec6050c42292e | [] | no_license | span999/span-winceframework | adbcda722fe3cb2d52e9b02d5f5455c93b4e1dbf | 0b608d2a9c70665b142be9f014badfb2895f5047 | refs/heads/master | 2021-01-22T03:39:35.119871 | 2016-03-19T13:58:47 | 2016-03-19T13:58:47 | 32,636,707 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 15,797 | cpp | //
// Copyright (c) Microsoft Corporation. All rights reserved.
//
//
// Use of this sample source code is subject to the terms of the Microsoft
// license agreement under which you licensed this sample source code and is
// provided AS-IS. If you did not accept the terms of the license agreement, you
// are not authorized to use this sample source code. For the terms of the
// license, please see the license agreement between you and Microsoft.
//
//
// ****************************************************************************
// FILE: WMPStatusPlugin.cpp
// ABTRACT: Main implementation file for the today plug-in
// ****************************************************************************
//
#include "stdafx.h"
#define STATUS_STRING_LEN 500 // buffer size
#define NOTIFY_CNT 4 // number of notifications
//global variables
HICON g_hIcon;
UINT g_plugInHeight;
HINSTANCE g_hInst;
HWND g_hWnd;
BOOL g_WMPStatusChanged = FALSE; // WMP data has changed flag
HREGNOTIFY g_hNotify[NOTIFY_CNT]; // Handles to notifications
// forward function declarations
static INT InitializeClasses();
HRESULT RegisterNotifications();
HRESULT UnregisterNotifications();
/*************************************************************************/
/* Entry point for the dll */
/*************************************************************************/
BOOL APIENTRY DllMain( HANDLE hModule, DWORD ul_reason_for_call, LPVOID lpReserved)
{
switch (ul_reason_for_call)
{
case DLL_PROCESS_ATTACH:
// The DLL is being loaded for the first time by a given process.
// Perform per-process initialization here. If the initialization
// is successful, return TRUE; if unsuccessful, return FALSE.
g_hInst = (HINSTANCE)hModule;
//load the icon
g_hIcon = (HICON)LoadImage(g_hInst, MAKEINTRESOURCE(IDI_WMPSTATUSICON), IMAGE_ICON, DRA::SCALEX(16), DRA::SCALEY(16) ,LR_DEFAULTCOLOR);
//initilize the application class, and set the global window handle
UnregisterClass((LPCTSTR)LoadString(g_hInst, IDS_WMPSTATUS_APPNAME,0,0), g_hInst);
InitializeClasses();
g_hWnd = 0;
break;
case DLL_PROCESS_DETACH:
// The DLL is being unloaded by a given process. Do any
// per-process clean up here, such as undoing what was done in
// DLL_PROCESS_ATTACH. The return value is ignored.
DestroyIcon(g_hIcon);
UnregisterNotifications();
UnregisterClass((LPCTSTR)LoadString(g_hInst, IDS_WMPSTATUS_APPNAME,0,0), g_hInst);
g_hInst = NULL;
break;
}
return TRUE;
}
/*************************************************************************/
/* Handle any messages that may be needed for the plugin */
/* Handled messages: */
/* WM_TODAYCUSTOM_QUERYREFRESHCACHE */
/* WM_LBUTTONUP */
/* WM_PAINT */
/* */
/* State and Notification Broker Messages: */
/* WM_CHANGE_TRACKARTIST: */
/* WM_CHANGE_ALBUMTITLE: */
/* WM_CHANGE_TRACKNUMBER: */
/* WM_CHANGE_TRACKTITLE: */
/* */
/*************************************************************************/
LRESULT CALLBACK WndProc (HWND hwnd, UINT uimessage, WPARAM wParam, LPARAM lParam)
{
switch (uimessage)
{
//check to see if a refresh is required
case WM_TODAYCUSTOM_QUERYREFRESHCACHE:
{
TODAYLISTITEM *ptliItem;
BOOL bReturn = FALSE;
// get the pointer to the item from the Today screen
ptliItem = (TODAYLISTITEM*)wParam;
// make sure we have a TODAYLISTITEM and that the shell is ready to go
if ((NULL == ptliItem) || (WaitForSingleObject(SHELL_API_READY_EVENT, 0) == WAIT_TIMEOUT))
{
return FALSE;
}
// check to see if our WMP data flag has been set, then reset it
bReturn = g_WMPStatusChanged;
g_WMPStatusChanged = FALSE;
// if this is the first time this is called, we should set our height
if (0 == ptliItem->cyp)
{
ptliItem->cyp = DRA::SCALEY(40);
bReturn = TRUE;
}
return bReturn;
}
case WM_CREATE:
break;
case WM_LBUTTONUP:
// toggle between play/pause if the WMP window is found
HWND hwndComm;
// find the handle to the plug-in window
// find this value each time in case WMP has been restarted by the user and the handle has changed
hwndComm = FindWindow(SZ_MEDIAPLAYERPLUGIN_COMMWINDOW_CLASSNAME, SZ_MEDIAPLAYERPLUGIN_COMMWINDOW_WINDOWNAME);
if (NULL != hwndComm)
{
// send a message to the WMP plug-in to toggle the play/pause state
PostMessage(hwndComm, WM_WMPTOGGLE, 0, 0);
}
break;
case WM_PAINT:
PAINTSTRUCT ps;
RECT rcWindBounds;
RECT rcMyBounds;
HDC hDC;
HFONT hFontOld;
TCHAR szTextBuffer[STATUS_STRING_LEN];
TCHAR szRegBuffer[STATUS_STRING_LEN];
COLORREF crText;
size_t nLen;
HRESULT hr;
GetWindowRect( hwnd, &rcWindBounds);
hDC = BeginPaint(hwnd, &ps);
// create a custom rectangle relative to the client area
rcMyBounds.left = 0;
rcMyBounds.top = DRA::SCALEY(2);
rcMyBounds.right = rcWindBounds.right - rcWindBounds.left;
rcMyBounds.bottom = rcWindBounds.bottom - rcWindBounds.top;
// draw the icon on the screen
SetBkMode(hDC, TRANSPARENT);
DrawIcon(hDC, DRA::SCALEY(2), 0, g_hIcon);
BOOL bIsFarEast;
LOGFONT lf;
HFONT hSysFont;
HFONT hFont;
//determine if this is a Far East platform
switch (PRIMARYLANGID(LANGIDFROMLCID(GetSystemDefaultLCID())))
{
case LANG_CHINESE:
case LANG_KOREAN:
case LANG_JAPANESE:
bIsFarEast = TRUE;
break;
default:
bIsFarEast = FALSE;
break;
}
hSysFont = (HFONT) GetStockObject(SYSTEM_FONT);
GetObject(hSysFont, sizeof(LOGFONT), &lf);
// If it is far east, use a normal font at 9 points,
// otherwise use a bold font as 8 points
if (bIsFarEast)
{
lf.lfWeight = FW_NORMAL;
// Calculate the font size, making sure to round the result to the nearest integer
lf.lfHeight = (long) -((9.0 * (double)GetDeviceCaps(hDC, LOGPIXELSY) / 72.0)+.5);
}
else
{
lf.lfWeight = FW_BOLD;
// Calculate the font size, making sure to round the result to the nearest integer
lf.lfHeight = (long) -((8.0 * (double)GetDeviceCaps(hDC, LOGPIXELSY) / 72.0)+.5);
}
// create the font
hFont = CreateFontIndirect(&lf);
// Select the system font into the device context
hFontOld = (HFONT) SelectObject(hDC, hFont);
// determine the theme's current text color
// this color will change when the user picks a new theme,
// so get it each time the display needs to be painted
crText = SendMessage(GetParent(hwnd), TODAYM_GETCOLOR, (WPARAM) TODAYCOLOR_TEXT, NULL);
// set that color
SetTextColor(hDC, crText);
rcMyBounds.left = rcMyBounds.left + DRA::SCALEX(28);
// clear our strings
StringCchCopy(szRegBuffer, STATUS_STRING_LEN, L"");
StringCchCopy(szTextBuffer, STATUS_STRING_LEN, L"");
// Read the current data about the currently playing track
hr = RegistryGetString(SN_MEDIAPLAYERTRACKARTIST_ROOT, SN_MEDIAPLAYERTRACKARTIST_PATH, SN_MEDIAPLAYERTRACKARTIST_VALUE, szTextBuffer, STATUS_STRING_LEN);
hr = RegistryGetString(SN_MEDIAPLAYERALBUMTITLE_ROOT, SN_MEDIAPLAYERALBUMTITLE_PATH, SN_MEDIAPLAYERALBUMTITLE_VALUE, szRegBuffer, STATUS_STRING_LEN);
// form the first line of text and draw it
hr = StringCchLength(szTextBuffer, STATUS_STRING_LEN, &nLen);
if (nLen > 0)
{
StringCchCat(szTextBuffer, STATUS_STRING_LEN, L" : ");
}
StringCchCat(szTextBuffer, STATUS_STRING_LEN, szRegBuffer);
DrawText(hDC, szTextBuffer, -1, &rcMyBounds, DT_LEFT);
// start the 2nd line of text by clearing out our strings
StringCchCopy(szRegBuffer, STATUS_STRING_LEN, L"");
StringCchCopy(szTextBuffer, STATUS_STRING_LEN, L"");
// Read the current data about the currently playing track
hr = RegistryGetString(SN_MEDIAPLAYERTRACKNUMBER_ROOT, SN_MEDIAPLAYERTRACKNUMBER_PATH, SN_MEDIAPLAYERTRACKNUMBER_VALUE, szTextBuffer, STATUS_STRING_LEN);
hr = RegistryGetString(SN_MEDIAPLAYERTRACKTITLE_ROOT, SN_MEDIAPLAYERTRACKTITLE_PATH, SN_MEDIAPLAYERTRACKTITLE_VALUE, szRegBuffer, STATUS_STRING_LEN);
// form the 2nd line of text and draw it
hr = StringCchLength(szTextBuffer, STATUS_STRING_LEN, &nLen);
if (nLen > 0)
{
StringCchCat(szTextBuffer, STATUS_STRING_LEN, L" : ");
}
hr = StringCchLength(szTextBuffer, STATUS_STRING_LEN, &nLen);
if (nLen > 0)
{
StringCchCat(szTextBuffer, STATUS_STRING_LEN, szRegBuffer);
}
else
{
StringCchCat(szTextBuffer, STATUS_STRING_LEN, L"Windows Media Player Stopped");
}
//draw the program item text
rcMyBounds.top += DRA::SCALEX(20);
DrawText(hDC, szTextBuffer, -1, &rcMyBounds, DT_LEFT);
// Select the previous font back into the device context
SelectObject(hDC, hFontOld);
DeleteObject(hFont);
EndPaint(hwnd, &ps);
return 0;
case WM_DESTROY :
return 0;
// this fills in the background with the today screen image
case WM_ERASEBKGND:
TODAYDRAWWATERMARKINFO dwi;
dwi.hdc = (HDC)wParam;
GetClientRect(hwnd, &dwi.rc);
dwi.hwnd = hwnd;
SendMessage(GetParent(hwnd), TODAYM_DRAWWATERMARK, 0,(LPARAM)&dwi);
return TRUE;
// handle messages from the State and Notification Broker when WMP info has changed
case WM_CHANGE_TRACKARTIST:
case WM_CHANGE_ALBUMTITLE:
case WM_CHANGE_TRACKNUMBER:
case WM_CHANGE_TRACKTITLE:
g_WMPStatusChanged = TRUE;
break;
}
return DefWindowProc (hwnd, uimessage, wParam, lParam) ;
}
/*************************************************************************/
/* Create and register our window class for the today item */
/*************************************************************************/
INT InitializeClasses()
{
WNDCLASS wc;
memset(&wc, 0, sizeof(wc));
wc.style = 0;
wc.lpfnWndProc = (WNDPROC) WndProc;
wc.hInstance = g_hInst;
wc.hIcon = 0;
wc.hCursor = 0;
wc.hbrBackground = (HBRUSH) GetStockObject(WHITE_BRUSH);
wc.lpszClassName = (LPCTSTR)LoadString(g_hInst, IDS_WMPSTATUS_APPNAME,0,0);
//register our window
if(!RegisterClass(&wc))
{
return 0 ;
}
return 1;
}
/*************************************************************************/
/* Initialize the DLL by creating a new window */
/*************************************************************************/
HWND InitializeCustomItem(TODAYLISTITEM *ptli, HWND hwndParent)
{
long lNotifyIndx;
LPCTSTR appName = (LPCTSTR)LoadString(g_hInst,IDS_WMPSTATUS_APPNAME,0,0);
//create a new window
g_hWnd = CreateWindow(appName,appName,WS_VISIBLE | WS_CHILD,
CW_USEDEFAULT,CW_USEDEFAULT,0,0,hwndParent, NULL, g_hInst, NULL) ;
//display the window
ShowWindow (g_hWnd, SW_SHOWNORMAL);
UpdateWindow (g_hWnd) ;
// clear out our notification handles
for (lNotifyIndx=0; lNotifyIndx < NOTIFY_CNT; lNotifyIndx++)
{
g_hNotify[lNotifyIndx] = NULL;
}
// register our State and Notification Broker notifications
RegisterNotifications();
return g_hWnd;
}
/*************************************************************************/
/* Register our State and Notification Broker notifications for */
/* changes in the Windows Media Player Mobile */
/*************************************************************************/
HRESULT RegisterNotifications()
{
HRESULT hr;
// Make sure we aren't already registered.
UnregisterNotifications();
// Register track artist change notification.
hr = RegistryNotifyWindow(
SN_MEDIAPLAYERTRACKARTIST_ROOT,
SN_MEDIAPLAYERTRACKARTIST_PATH,
SN_MEDIAPLAYERTRACKARTIST_VALUE,
g_hWnd,
WM_CHANGE_TRACKARTIST,
0,
NULL,
&g_hNotify[0]
);
if (SUCCEEDED(hr))
{
// Register album title change notification.
hr = RegistryNotifyWindow(
SN_MEDIAPLAYERALBUMTITLE_ROOT,
SN_MEDIAPLAYERALBUMTITLE_PATH,
SN_MEDIAPLAYERALBUMTITLE_VALUE,
g_hWnd,
WM_CHANGE_ALBUMTITLE,
0,
NULL,
&g_hNotify[1]
);
}
if (SUCCEEDED(hr))
{
// Register track number change notification.
hr = RegistryNotifyWindow(
SN_MEDIAPLAYERTRACKNUMBER_ROOT,
SN_MEDIAPLAYERTRACKNUMBER_PATH,
SN_MEDIAPLAYERTRACKNUMBER_VALUE,
g_hWnd,
WM_CHANGE_TRACKNUMBER,
0,
NULL,
&g_hNotify[2]
);
}
if (SUCCEEDED(hr))
{
// Register track title change notification.
hr = RegistryNotifyWindow(
SN_MEDIAPLAYERTRACKTITLE_ROOT,
SN_MEDIAPLAYERTRACKTITLE_PATH,
SN_MEDIAPLAYERTRACKTITLE_VALUE,
g_hWnd,
WM_CHANGE_TRACKTITLE,
0,
NULL,
&g_hNotify[3]
);
}
return hr;
}
/*************************************************************************/
/* Un-register our notifications */
/*************************************************************************/
HRESULT UnregisterNotifications()
{
long lNotifyIndx;
// For each notification handle:
for (lNotifyIndx=0; lNotifyIndx < NOTIFY_CNT; lNotifyIndx++)
{
if (g_hNotify[lNotifyIndx] != NULL)
{
// Close off the notification.
RegistryCloseNotification(g_hNotify[lNotifyIndx]);
}
g_hNotify[lNotifyIndx] = 0;
}
return S_OK;
}
| [
"[email protected]@73576caf-b2a5-d423-0eb8-556077f83d5b"
] | [email protected]@73576caf-b2a5-d423-0eb8-556077f83d5b |
3f8f279866c6ff668e3e605b5d16487f77f96365 | acf2dad34dcabfad047b4c95d37b6167be33bf02 | /pool/poolfactory.h | 1bd0a1b8caaefe002e95501a6dd557abee753c36 | [] | no_license | drazovicfilip/ObjectOriented | 17608efff6b70d94b1440e2b2ce05e3143933ea6 | dafab420aeef68df67a8b129d6f4661d9819adde | refs/heads/master | 2021-04-06T16:53:42.361108 | 2018-06-07T08:45:07 | 2018-06-07T08:45:07 | 125,306,123 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 938 | h | #ifndef POOLFACTORY_H
#define POOLFACTORY_H
#include "abstractfactory.h"
/**
* @brief The PoolFactory is a concrete implementation of the abstract factory.
*
* @author Filip Drazovic
* @date April 2018
*
* It will make balls and a table.
* It will be called upon by the builder (and thus by the director) when creating the pool game.
*/
class PoolFactory : public AbstractFactory
{
public:
using AbstractFactory::createBall;
Ball* createBall(Coordinate coordinate, std::string color, float mass, float radius, float xVelocity, float yVelocity) override{
return new Ball(coordinate, color, mass, radius, xVelocity, yVelocity);
}
using AbstractFactory::createTable;
Table* createTable(float length, float height, float thickness, float space, float friction, std::string color) override{
return new Table(length, height, thickness, space, friction, color);
}
};
#endif // POOLFACTORY_H
| [
""
] | |
789b9ee0a55b298b34b2f248ce3fde5da0770d43 | 255eaad3f286c3d2e483d288e9d3ac39dc9a72f0 | /c++/cpp11/ch3/3.5/3.5.1/3-31.cpp | ef78989c09bf1e8a968f2ee213cd8e82f18d11cd | [] | no_license | worsun/study | 40a2f1b2894243a6dcde19ae4807620ae634fac9 | d85d8d13f792e38c6d4a9848319adfa99103a39c | refs/heads/master | 2022-07-23T17:15:51.146155 | 2022-07-10T03:12:27 | 2022-07-10T03:12:27 | 206,750,431 | 1 | 2 | null | null | null | null | UTF-8 | C++ | false | false | 238 | cpp | // Copyright (c) 2020 Tencent Inc. All rights reserved.
// Author: worsunwang
// Date: 2022-02-28 17:48:21
#include <initializer_list>
using namespace std;
void Fun(initializer_list<int> iv) {}
int main() {
Fun({1, 2});
Fun({});
} | [
"[email protected]"
] | |
82937e781689f7647ef88a0153fd184c53e205a5 | c348efe40b4afac1de31e1cf93b800510f9d52f6 | /Riverside Community College (RCC)/CIS-5/Data Files/Chapter 14/Source Code/Ch14_AddressOfOperator/testAdd.cpp | 0a4a9e079676239074d1ebb4f6a2b66f9d93241c | [] | no_license | acoustictime/CollegeCode | 5b57dc45459c35694e3df002a587bacc4f99f81a | a8ec647fa4b5a6a90f34f1c8715dfea88cefe6c6 | refs/heads/master | 2020-03-28T19:22:04.384018 | 2018-09-16T18:37:22 | 2018-09-16T18:37:22 | 148,968,472 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 268 | cpp | // Implementation file testAdd.cpp
#include <iostream>
#include "testAdd.h"
using namespace std;
void testAddress::setX(int inX)
{
x = inX;
}
void testAddress::printX() const
{
cout << x;
}
int& testAddress::addressOfX()
{
return x;
}
| [
"[email protected]"
] | |
5f8c6b891d2f04720bd0903c92d7d7db6070aa27 | a9ffc3e1824b1cf7bd3c50ef0ff40f58b1cde0e1 | /assignment linked lists/deleting duplicates.cpp | 3136b963f8edf8333cd6c81ff736994e692af092 | [] | no_license | Uma-Maheshwar-Reddy/Linear-Data-structures | 811153610d28ddf5fc8a52236a938848dc70db78 | b93bdf903f27839376a38eba2ad3aa78d59ca5f4 | refs/heads/master | 2021-01-13T10:19:34.085200 | 2016-12-16T07:27:25 | 2016-12-16T07:27:25 | 76,630,074 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,058 | cpp | #include<iostream>
using namespace std;
typedef
struct node
{
int data;
struct node *next;
} *lptr;
void addend(lptr l,int a)
{
lptr t=l;
while(t->next!=NULL)
{
t=t->next;
}
t->next=new node;
t=t->next;
t->data=a;
t->next=NULL;
}
lptr create()
{
lptr l;
int d;
cout<<"enter the elements -1 if you want to end ";
cin>>d;
if(d!=-1)
{
l=new node;
l->data=d;
l->next=NULL;
cout<<"enter element";
cin>>d;
while(d!=-1)
{
addend(l,d);
cout<<"enter element";
cin>>d;
}
}
return l;
}
void print(lptr l)
{
lptr t=l;
while(t!=NULL)
{
cout<<t->data<<" ";
t=t->next;
}
}
void delnode(lptr l,lptr t)
{
t->next=t->next->next;
}
lptr rem(lptr l)
{
lptr h,t;
h=l;
while(h->next!=NULL)
{
t=h;
while(t->next!=NULL)
{
if(t->next->data==h->data)
{
delnode(l,t);
if(t->next==NULL)
{
break;
}
}
else
t=t->next;
}
if(h->next==NULL)
break;
else
h=h->next;
}
return l;
}
int main()
{
lptr l,l1;
l=create();
print(l);
cout<<endl;
l1=rem(l);
print(l1);
return 0;
}
| [
"[email protected]"
] | |
00c79ca41736e6d4f9c20a4e62b6032c40aa3231 | 28cb75c35dfc1391f4cb22e5e729037dab191704 | /sources/libborc/felide/Version.cpp | 237fd58449a8279f40ee9c788e37bb5be61bcfe6 | [] | no_license | fapablazacl-old/felide.old | eeb9cd9abdebe67e87bc0963619ea1ee2616731f | 2fc7a118b68fb844b97f2e940a803a38bf2dfebb | refs/heads/master | 2021-08-26T06:59:03.461014 | 2017-05-17T17:49:15 | 2017-05-17T17:49:15 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 698 | cpp |
#include "Version.hpp"
namespace borc {
bool operator== (const Version &v1, const Version &v2) {
if (v1.major!=v2.major) {
return false;
}
if (v1.minor!=v2.minor) {
return false;
}
if (v1.build!=v2.build) {
return false;
}
return true;
}
bool operator< (const Version &v1, const Version &v2) {
if (v1.major>=v2.major) {
return false;
}
if (v1.minor>=v2.minor) {
return false;
}
if (v1.build>=v2.build) {
return false;
}
return true;
}
}
| [
"[email protected]"
] | |
dc5bb2c537d892666d82cf89378a774bacfc3ab4 | 8cf87b32ee554acecb889720fd26f1839b3f1652 | /echo_instance.h | 815ebe155739d60d0fff591873bdcc5c5288c219 | [] | no_license | ryan-becwar/StableMatching | 2383c9cd77d16037dd940b67e42f72426f6dbc8f | c3c035a1b187b30ecdebab8a91376214c8ba03db | refs/heads/master | 2021-04-30T16:06:00.588498 | 2017-04-27T17:00:41 | 2017-04-27T17:00:41 | 42,676,135 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,118 | h | #ifndef ECHO_INSTANCE__h
#define ECHO_INSTANCE__h
#include <vector>
#include <iostream>
#include <fstream>
#include <map>
#include <string>
#include <algorithm>
using namespace std;
typedef map<string, double> msd;
struct Node {
int allocation;
int size;
msd attrs;
};
struct Edge {
int start;
int end;
int allocation;
int size;
double value;
msd attrs;
bool operator<(const Edge& rhs) const{
return value > rhs.value;
}
};
struct Instance {
vector<Node> lhsnodes;
vector<Node> rhsnodes;
vector<Edge> edges;
};
struct order_edge{
bool operator()(const Edge &left, const Edge &right){
if(left.start == right.start){
return(left.end < right.end);
}
return left.start < right.start;
}
};
Instance read_instance(void);
Instance read_csv_instance(string path);
void print_instance(Instance &I);
void print_instance_csv(Instance &I);
double get_value(Instance &I);
void order_edges(Instance &I);
vector<vector<double> > get_value_matrix(Instance &I);
vector<vector<unsigned int> > get_allocation_matrix(Instance& I);
void reset_allocation(Instance &I);
#endif
| [
"[email protected]"
] | |
923fa9f846c1e1778fdf6baa21fdddc029c2c4f2 | ab94a47e84d2005934f4d0d75bdc99bda904dc6d | /kovalenko.alexey/B8/Shape.hpp | d004373b7f591152ff0d3d4decc29aca9e76b405 | [] | no_license | alexmustdie/cpp-labs-2nd-sem | a997249df968d266381e8e4002b930685eb7cc93 | f15a33a091eaa99dcbba2e4a8e275fafa883c430 | refs/heads/master | 2020-03-21T18:07:24.801972 | 2018-11-22T14:03:17 | 2018-11-22T14:03:17 | 138,873,632 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 311 | hpp | #ifndef SHAPE_HPP
#define SHAPE_HPP
#include <iostream>
class Shape {
public:
Shape(int x, int y);
virtual ~Shape() = default;
bool isMoreLeft(const Shape &tmp) const;
bool isUpper(const Shape &tmp) const;
virtual void draw(std::ostream &stream) const = 0;
protected:
int x_, y_;
};
#endif
| [
"[email protected]"
] | |
6d4115c3f9f03942310bef7ba725d10d10ce3702 | f3a9174535cd7e76d1c1e0f0fa1a3929751fb48d | /SDK/PVR_AudioPlatformConfiguration_structs.hpp | 7595849dd1f5e699ca4cc06df0c14fd7e931aaaf | [] | no_license | hinnie123/PavlovVRSDK | 9fcdf97e7ed2ad6c5cb485af16652a4c83266a2b | 503f8d9a6770046cc23f935f2df1f1dede4022a8 | refs/heads/master | 2020-03-31T05:30:40.125042 | 2020-01-28T20:16:11 | 2020-01-28T20:16:11 | 151,949,019 | 5 | 2 | null | null | null | null | UTF-8 | C++ | false | false | 1,852 | hpp | #pragma once
// PavlovVR (Dumped by Hinnie) SDK
#ifdef _MSC_VER
#pragma pack(push, 0x8)
#endif
namespace SDK
{
//---------------------------------------------------------------------------
//Enums
//---------------------------------------------------------------------------
// Enum AudioPlatformConfiguration.ESoundwaveSampleRateSettings
enum class ESoundwaveSampleRateSettings : uint8_t
{
Max = 0,
High = 1,
Medium = 2,
Low = 3,
Min = 4,
MatchDevice = 5
};
//---------------------------------------------------------------------------
//Script Structs
//---------------------------------------------------------------------------
// ScriptStruct AudioPlatformConfiguration.PlatformRuntimeAudioCompressionOverrides
// 0x0010
struct FPlatformRuntimeAudioCompressionOverrides
{
bool bOverrideCompressionTimes; // 0x0000(0x0001) (Edit, ZeroConstructor, IsPlainOldData)
unsigned char UnknownData00[0x3]; // 0x0001(0x0003) MISSED OFFSET
float DurationThreshold; // 0x0004(0x0004) (Edit, ZeroConstructor, IsPlainOldData)
int MaxNumRandomBranches; // 0x0008(0x0004) (Edit, ZeroConstructor, IsPlainOldData)
int SoundCueQualityIndex; // 0x000C(0x0004) (Edit, ZeroConstructor, IsPlainOldData)
};
}
#ifdef _MSC_VER
#pragma pack(pop)
#endif
| [
"[email protected]"
] | |
d678fc1cc3790fc15b0c008a3f4cb759f56da259 | beab9eb3b2ca83252d40d04b9ea8dbec10006a7c | /include/mlib/ipow.h | 72a977d6c6f921c1aabad71b276ab205b98e6eeb | [
"MIT"
] | permissive | XNerv/mlib | 309008b1c2b38d40039291a420b5ca7c0d40e34f | aa133c8e4c8e5a94376229b2960f6a5670c327c1 | refs/heads/master | 2022-11-20T14:09:27.749349 | 2020-07-21T00:46:28 | 2020-07-21T00:46:28 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 398 | h | #pragma once
/*!
\file ipow.h Integer exponentiation function template
(c) Mircea Neacsu 2019
*/
#if __has_include ("defs.h")
#include "defs.h"
#endif
namespace mlib {
///integer exponentiation function
template <typename T>
T ipow (T base, int exp)
{
T result = 1;
while (exp)
{
if (exp & 1)
result *= base;
exp >>= 1;
base *= base;
}
return result;
};
};
| [
"[email protected]"
] | |
01c2069e09a18e0ec7a0fd463996ca33f287dabf | d54916fe57f229a05361b822a22b881d15819c7f | /CONTEST/RANDOM/kick20_a_b.cpp | a906407ba7188a68d1ae82c4f640cf9b22ef50c3 | [] | no_license | ksb451/Cpp_DSA | 73dc8773fc4b5d896b133410809efce97437b9aa | 10544373f3e6558cf57d2270a30550b4761b0715 | refs/heads/master | 2023-06-25T10:48:04.473323 | 2021-07-22T17:04:31 | 2021-07-22T17:04:31 | 168,570,132 | 0 | 1 | null | 2020-10-26T15:03:34 | 2019-01-31T17:53:57 | C++ | UTF-8 | C++ | false | false | 3,620 | cpp | //**sn0wrus**//
#include <bits/stdc++.h>
#include <algorithm>
using namespace std;
//#pragma GCC optimize("Ofast")
//#pragma GCC optimization("unroll-loops, no-stack-protector")
//#pragma GCC target("avx,avx2,fma")
#define fast \
ios_base::sync_with_stdio(false); \
cout.tie(NULL); \
cin.tie(NULL);
#define write(a) \
for (auto x : a) \
{ \
cout << x << " "; \
} \
cout << endl;
#define read(a) \
for (auto &x : a) \
{ \
cin >> x; \
}
#define for0(i,n) for(int i=0;i<n;i++)
#define forn(i,n) for(int i=n-1;i>=0;i++)
#define IN cin >>
#define OUT cout <<
#define endl "\n"
#define all(a) (a).begin(), (a).end()
#define allr(a) (a).rbegin(), (a).rend()
#define pb push_back
#define fi first
#define se second
void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(long long x) {cerr << x ;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << x;}
void __print(unsigned long long x) {cerr << x;}
void __print(float x) {cerr << x;}
void __print(double x) {cerr << x;}
void __print(long double x) {cerr << x;}
void __print(char x) {cerr << '\'' << x << '\'';}
void __print(const char *x) {cerr << '\"' << x << '\"';}
void __print(const string &x) {cerr << '\"' << x << '\"';}
void __print(bool x) {cerr << (x ? "true" : "false");}
template<typename T, typename V>
void __print(const pair<T, V> &x) {cerr << '{'; __print(x.first); cerr << ','; __print(x.second); cerr << '}'<<endl;}
template<typename T>
void __print(const T &x) {int f = 0; cerr << '{'; for (auto &i: x) cerr << (f++ ? "," : ""), __print(i); cerr << "}"<<endl;}
template<typename T, typename... Args>
void __print(T t, Args... args) // recursive variadic function
{
cout << t <<" " ;
__print(args...) ;
}
void nl()
{
cout<<endl;
}
using ll = long long int;
using ld = long double;
using pll = pair<ll, ll>;
using pii = pair<int, int>;
using plll = pair<ll,pll>;
using vll = vector<ll>;
using vi = vector<int>;
const ll MOD = (ll)(1e9) + 7LL;
const ll MM = 998244353LL;
const ll INF = INT_MAX;
const int dir8[8][2]={{1,0},{0,1},{-1,0},{0,-1},{1,1},{1,-1},{-1,1},{-1,-1}};
const int dir4[4][2]={{1,0},{0,1},{-1,0},{0,-1}};
const ll MAXN = 200005;
/*
for(int i=0;i<n-1;i++)
{
int a,b;
cin>>a>>b;
a--,b--;
adj[a].push_back(b);
adj[b].push_back(a);
}
*/
ll dp[51][1505];
ll rec(ll curr, ll p, vector<vll>&arr)
{
ll n = arr.size();
ll k = arr[0].size();
if(p==0)
{
return 0;
}
if((curr >= n) && ( p > 0))
{
return INT_MIN;
}
if(dp[curr][p] == -1)
{
ll ans = 0;
ll sum= 0;
for(int i=0;i<=k;i++)
{
if(i>0)
sum+=arr[curr][i-1];
if(p-i >= 0)
{
ans = max(ans, sum+rec(curr+1, p-i,arr));
}
else{
break;
}
}
return dp[curr][p]=ans;
}
else{
return dp[curr][p];
}
}
void solve()
{
ll n,k,p;
cin>>n>>k>>p;
vector<vll>arr(n,vll(k));
for(int i=0;i<n;i++){
for(int j=0;j<k;j++)
{
cin>>arr[i][j];
}
}
memset(dp,-1,sizeof(dp));
cout<<rec(0,p, arr)<<endl;
}
/*
1.check for ll for all variables.
2.check brackets in all equation and order of conditions.
3.check custom compare funtions if any.
4.check logic carefully.
5.Dont get stuck on one approch.
*/
int main()
{
ios_base::sync_with_stdio(false);
cout.tie(NULL);
cin.tie(NULL);
ll tc = 1;
IN tc;
for (int i = 1; i <= tc; i++)
{
cout << "Case #" << i << ": ";
solve();
}
return 0;
} | [
"[email protected]"
] | |
78e5d0945c3aceb55f68419607e5456ce460619f | 23ce4d52dbdd220456d8ac0882ddddc4e63d038c | /src/Word.h | a079b366252630f17523fa01fd29fc2815014340 | [] | no_license | galsasson/Logic | 2e29d6dcb28ea18236e433598b44eb397efda10c | bff7f13d1bd43ecd76d3ccf3912913e165d45a6e | refs/heads/master | 2021-01-22T11:37:20.697218 | 2013-05-07T16:48:15 | 2013-05-07T16:48:15 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 747 | h | //
// Word.h
// Logic
//
// Created by Ryan Bartley on 5/1/13.
//
//
#pragma once
#include "ofMain.h"
#include "Letter.h"
#include "Button.h"
class Word {
vector<Letter*> letters;
string word;
ofPoint position;
ofPoint transform;
ofTrueTypeFont font;
float depth;
string fontTitle;
int fontsize;
Button* button;
int zAnimation;
int animationAmount;
bool isButton;
public:
Word(ofPoint position, string font, string word, float depth, int fontsize, bool button);
~Word();
void animate();
void setup();
void draw();
string getWord();
bool getIsButton();
Button* getButton();
ofRectangle getBoundingBox();
};
| [
"[email protected]"
] | |
61445b5c653ed50cd9de1078b1d3912c9321b53c | 5782b1f9a70f71b09018fd634f62f218df9c76a8 | /Functions.cpp | 209a77b914453d11db3a9c63d5b5f752f02c6afe | [] | no_license | RndmCodeGuy20/Competitive-Programming | e4e9ee8aad901127cbe525e9d4eb736e97f07d82 | 718979e838f7c4fd6c783b7bc75a095574c1cc9b | refs/heads/master | 2023-08-15T00:49:26.900414 | 2021-09-24T02:15:21 | 2021-09-24T02:15:21 | 392,888,120 | 2 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 494 | cpp | #include <bits/stdc++.h>
using namespace std;
int maxof(int a, int b, int c, int d)
{
int max;
if (a > b && a > c && a > d)
{
max = a;
}
else if (b > a && b > c && b > d)
{
max = b;
}
else if (c > a && c > b && c > d)
{
max = c;
}
else if (d > a && d > b && d > c)
{
max = d;
}
return max;
}
int main()
{
int a, b, c, d;
cin >> a >> b >> c >> d;
cout << maxof(a, b, c, d);
return 0;
} | [
"[email protected]"
] | |
e3dfa45ec2f84f55c7bb6a5ecd8f71ca122b4285 | 43ceae15dc2c9fa776a743e8e95db4f93e037448 | /audio/AudioOutput.cpp | 5250e838afd5acd0cff84a6f52b4f8ed7d499c7d | [
"Unlicense"
] | permissive | ibrashon/libtgvoip | d14e74be77ac83870280dc477a5a235046224999 | 88d22e82cfdcba47553df882ee18089b12357f4b | refs/heads/public | 2021-01-19T13:44:03.574608 | 2017-04-09T16:19:52 | 2017-04-09T16:19:52 | 88,104,049 | 1 | 0 | null | 2017-04-12T23:04:13 | 2017-04-12T23:04:13 | null | UTF-8 | C++ | false | false | 1,091 | cpp | //
// libtgvoip is free and unencumbered public domain software.
// For more information, see http://unlicense.org or the UNLICENSE file
// you should have received with this source code distribution.
//
#include "AudioOutput.h"
#if defined(__ANDROID__)
#include "../os/android/AudioOutputOpenSLES.h"
#include "../os/android/AudioOutputAndroid.h"
#elif defined(__APPLE__)
#include <TargetConditionals.h>
#if TARGET_OS_IPHONE
#include "../os/darwin/AudioOutputAudioUnit.h"
#else
#include "../os/darwin/AudioOutputAudioUnitOSX.h"
#endif
#else
#error "Unsupported operating system"
#endif
#if defined(__ANDROID__)
int CAudioOutput::systemVersion;
#endif
CAudioOutput *CAudioOutput::Create(){
#if defined(__ANDROID__)
if(systemVersion<21)
return new CAudioOutputAndroid();
return new CAudioOutputOpenSLES();
#elif defined(__APPLE__)
return new CAudioOutputAudioUnit();
#endif
}
CAudioOutput::~CAudioOutput(){
}
int32_t CAudioOutput::GetEstimatedDelay(){
#if defined(__ANDROID__)
return systemVersion<21 ? 150 : 50;
#endif
return 0;
}
float CAudioOutput::GetLevel(){
return 0;
}
| [
"[email protected]"
] | |
9634ad6f870a109200ecbbe4984ab9e3d6be32ce | 8e39f4709bfe050a64d6496ca41d402750f91944 | /code/02947_나무 조각.cpp14.cpp | 03c80fec24ac8bf1c241819730ea80be0b64d643 | [] | no_license | LeeJehwan/Baekjoon-Online-Judge | 66fd0799087082988ff1a77fd1fda836bd0d6953 | 681a2c937be7a774edc1b21bfed3617e0ba1018b | refs/heads/master | 2020-04-16T17:48:32.470045 | 2019-08-03T17:57:01 | 2019-08-03T17:57:01 | 165,789,670 | 2 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 404 | cpp | #include <iostream>
using namespace std;
void print();
int arr[5];
void swap(int &a, int &b) {
int t = a;
a = b;
b = t;
print();
}
void print() {
for (auto x : arr)
cout << x << " ";
cout << '\n';
}
int main() {
for (int i = 0; i < 5; i++)
cin >> arr[i];
for (int i = 0; i < 5; i++) {
for (int j = 0; j < 4 - i; j++) {
if (arr[j] > arr[j + 1])
swap(arr[j], arr[j + 1]);
}
}
} | [
"[email protected]"
] | |
2bdb772ef6f8afb61b7def7ebdbb2eeebc0b3eb6 | c1e54641a1e839f457783466cb5b66cab617d1b7 | /platformio/lib/MyWire/MyWire.h | e2c3e1fa255b61657445addfa191e9f85d576c1d | [] | no_license | iftachAvital/EasyCool | 2d00206aeed0de998c76b3ca6506c9240cc4e365 | 6a2cf7a3c450eddbf4902fe86b400c82dd2417c0 | refs/heads/master | 2021-05-11T14:03:50.115424 | 2018-01-16T14:28:28 | 2018-01-16T14:28:28 | 117,693,064 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 14,783 | h | #ifndef MyWire_h
#define MyWire_h
#include <inttypes.h>
#if defined(__AVR__)
#include <util/crc16.h>
#endif
#if ARDUINO >= 100
#include "Arduino.h" // for delayMicroseconds, digitalPinToBitMask, etc
#else
#include "WProgram.h" // for delayMicroseconds
#include "pins_arduino.h" // for digitalPinToBitMask, etc
#endif
// You can exclude certain features from OneWire. In theory, this
// might save some space. In practice, the compiler automatically
// removes unused code (technically, the linker, using -fdata-sections
// and -ffunction-sections when compiling, and Wl,--gc-sections
// when linking), so most of these will not result in any code size
// reduction. Well, unless you try to use the missing features
// and redesign your program to not need them! ONEWIRE_CRC8_TABLE
// is the exception, because it selects a fast but large algorithm
// or a small but slow algorithm.
// you can exclude onewire_search by defining that to 0
#ifndef ONEWIRE_SEARCH
#define ONEWIRE_SEARCH 1
#endif
// You can exclude CRC checks altogether by defining this to 0
#ifndef ONEWIRE_CRC
#define ONEWIRE_CRC 1
#endif
// Select the table-lookup method of computing the 8-bit CRC
// by setting this to 1. The lookup table enlarges code size by
// about 250 bytes. It does NOT consume RAM (but did in very
// old versions of OneWire). If you disable this, a slower
// but very compact algorithm is used.
#ifndef ONEWIRE_CRC8_TABLE
#define ONEWIRE_CRC8_TABLE 1
#endif
// You can allow 16-bit CRC checks by defining this to 1
// (Note that ONEWIRE_CRC must also be 1.)
#ifndef ONEWIRE_CRC16
#define ONEWIRE_CRC16 1
#endif
#ifndef FALSE
#define FALSE 0
#endif
#ifndef TRUE
#define TRUE 1
#endif
// Platform specific I/O definitions
#if defined(__AVR__)
#define PIN_TO_BASEREG(pin) (portInputRegister(digitalPinToPort(pin)))
#define PIN_TO_BITMASK(pin) (digitalPinToBitMask(pin))
#define IO_REG_TYPE uint8_t
#define IO_REG_ASM asm("r30")
#define DIRECT_READ(base, mask) (((*(base)) & (mask)) ? 1 : 0)
#define DIRECT_MODE_INPUT(base, mask) ((*((base)+1)) &= ~(mask))
#define DIRECT_MODE_OUTPUT(base, mask) ((*((base)+1)) |= (mask))
#define DIRECT_WRITE_LOW(base, mask) ((*((base)+2)) &= ~(mask))
#define DIRECT_WRITE_HIGH(base, mask) ((*((base)+2)) |= (mask))
#elif defined(__MK20DX128__) || defined(__MK20DX256__) || defined(__MK66FX1M0__) || defined(__MK64FX512__)
#define PIN_TO_BASEREG(pin) (portOutputRegister(pin))
#define PIN_TO_BITMASK(pin) (1)
#define IO_REG_TYPE uint8_t
#define IO_REG_ASM
#define DIRECT_READ(base, mask) (*((base)+512))
#define DIRECT_MODE_INPUT(base, mask) (*((base)+640) = 0)
#define DIRECT_MODE_OUTPUT(base, mask) (*((base)+640) = 1)
#define DIRECT_WRITE_LOW(base, mask) (*((base)+256) = 1)
#define DIRECT_WRITE_HIGH(base, mask) (*((base)+128) = 1)
#elif defined(__MKL26Z64__)
#define PIN_TO_BASEREG(pin) (portOutputRegister(pin))
#define PIN_TO_BITMASK(pin) (digitalPinToBitMask(pin))
#define IO_REG_TYPE uint8_t
#define IO_REG_ASM
#define DIRECT_READ(base, mask) ((*((base)+16) & (mask)) ? 1 : 0)
#define DIRECT_MODE_INPUT(base, mask) (*((base)+20) &= ~(mask))
#define DIRECT_MODE_OUTPUT(base, mask) (*((base)+20) |= (mask))
#define DIRECT_WRITE_LOW(base, mask) (*((base)+8) = (mask))
#define DIRECT_WRITE_HIGH(base, mask) (*((base)+4) = (mask))
#elif defined(__SAM3X8E__) || defined(__SAM3A8C__) || defined(__SAM3A4C__)
// Arduino 1.5.1 may have a bug in delayMicroseconds() on Arduino Due.
// http://arduino.cc/forum/index.php/topic,141030.msg1076268.html#msg1076268
// If you have trouble with OneWire on Arduino Due, please check the
// status of delayMicroseconds() before reporting a bug in OneWire!
#define PIN_TO_BASEREG(pin) (&(digitalPinToPort(pin)->PIO_PER))
#define PIN_TO_BITMASK(pin) (digitalPinToBitMask(pin))
#define IO_REG_TYPE uint32_t
#define IO_REG_ASM
#define DIRECT_READ(base, mask) (((*((base)+15)) & (mask)) ? 1 : 0)
#define DIRECT_MODE_INPUT(base, mask) ((*((base)+5)) = (mask))
#define DIRECT_MODE_OUTPUT(base, mask) ((*((base)+4)) = (mask))
#define DIRECT_WRITE_LOW(base, mask) ((*((base)+13)) = (mask))
#define DIRECT_WRITE_HIGH(base, mask) ((*((base)+12)) = (mask))
#ifndef PROGMEM
#define PROGMEM
#endif
#ifndef pgm_read_byte
#define pgm_read_byte(addr) (*(const uint8_t *)(addr))
#endif
#elif defined(__PIC32MX__)
#define PIN_TO_BASEREG(pin) (portModeRegister(digitalPinToPort(pin)))
#define PIN_TO_BITMASK(pin) (digitalPinToBitMask(pin))
#define IO_REG_TYPE uint32_t
#define IO_REG_ASM
#define DIRECT_READ(base, mask) (((*(base+4)) & (mask)) ? 1 : 0) //PORTX + 0x10
#define DIRECT_MODE_INPUT(base, mask) ((*(base+2)) = (mask)) //TRISXSET + 0x08
#define DIRECT_MODE_OUTPUT(base, mask) ((*(base+1)) = (mask)) //TRISXCLR + 0x04
#define DIRECT_WRITE_LOW(base, mask) ((*(base+8+1)) = (mask)) //LATXCLR + 0x24
#define DIRECT_WRITE_HIGH(base, mask) ((*(base+8+2)) = (mask)) //LATXSET + 0x28
#elif defined(ARDUINO_ARCH_ESP8266)
#define PIN_TO_BASEREG(pin) ((volatile uint32_t*) GPO)
#define PIN_TO_BITMASK(pin) (1 << pin)
#define IO_REG_TYPE uint32_t
#define IO_REG_ASM
#define DIRECT_READ(base, mask) ((GPI & (mask)) ? 1 : 0) //GPIO_IN_ADDRESS
#define DIRECT_MODE_INPUT(base, mask) (GPE &= ~(mask)) //GPIO_ENABLE_W1TC_ADDRESS
#define DIRECT_MODE_OUTPUT(base, mask) (GPE |= (mask)) //GPIO_ENABLE_W1TS_ADDRESS
#define DIRECT_WRITE_LOW(base, mask) (GPOC = (mask)) //GPIO_OUT_W1TC_ADDRESS
#define DIRECT_WRITE_HIGH(base, mask) (GPOS = (mask)) //GPIO_OUT_W1TS_ADDRESS
#elif defined(__SAMD21G18A__)
#define PIN_TO_BASEREG(pin) portModeRegister(digitalPinToPort(pin))
#define PIN_TO_BITMASK(pin) (digitalPinToBitMask(pin))
#define IO_REG_TYPE uint32_t
#define IO_REG_ASM
#define DIRECT_READ(base, mask) (((*((base)+8)) & (mask)) ? 1 : 0)
#define DIRECT_MODE_INPUT(base, mask) ((*((base)+1)) = (mask))
#define DIRECT_MODE_OUTPUT(base, mask) ((*((base)+2)) = (mask))
#define DIRECT_WRITE_LOW(base, mask) ((*((base)+5)) = (mask))
#define DIRECT_WRITE_HIGH(base, mask) ((*((base)+6)) = (mask))
#elif defined(RBL_NRF51822)
#define PIN_TO_BASEREG(pin) (0)
#define PIN_TO_BITMASK(pin) (pin)
#define IO_REG_TYPE uint32_t
#define IO_REG_ASM
#define DIRECT_READ(base, pin) nrf_gpio_pin_read(pin)
#define DIRECT_WRITE_LOW(base, pin) nrf_gpio_pin_clear(pin)
#define DIRECT_WRITE_HIGH(base, pin) nrf_gpio_pin_set(pin)
#define DIRECT_MODE_INPUT(base, pin) nrf_gpio_cfg_input(pin, NRF_GPIO_PIN_NOPULL)
#define DIRECT_MODE_OUTPUT(base, pin) nrf_gpio_cfg_output(pin)
#elif defined(__arc__) /* Arduino101/Genuino101 specifics */
#include "scss_registers.h"
#include "portable.h"
#include "avr/pgmspace.h"
#define GPIO_ID(pin) (g_APinDescription[pin].ulGPIOId)
#define GPIO_TYPE(pin) (g_APinDescription[pin].ulGPIOType)
#define GPIO_BASE(pin) (g_APinDescription[pin].ulGPIOBase)
#define DIR_OFFSET_SS 0x01
#define DIR_OFFSET_SOC 0x04
#define EXT_PORT_OFFSET_SS 0x0A
#define EXT_PORT_OFFSET_SOC 0x50
/* GPIO registers base address */
#define PIN_TO_BASEREG(pin) ((volatile uint32_t *)g_APinDescription[pin].ulGPIOBase)
#define PIN_TO_BITMASK(pin) pin
#define IO_REG_TYPE uint32_t
#define IO_REG_ASM
static inline __attribute__((always_inline))
IO_REG_TYPE directRead(volatile IO_REG_TYPE *base, IO_REG_TYPE pin)
{
IO_REG_TYPE ret;
if (SS_GPIO == GPIO_TYPE(pin)) {
ret = READ_ARC_REG(((IO_REG_TYPE)base + EXT_PORT_OFFSET_SS));
} else {
ret = MMIO_REG_VAL_FROM_BASE((IO_REG_TYPE)base, EXT_PORT_OFFSET_SOC);
}
return ((ret >> GPIO_ID(pin)) & 0x01);
}
static inline __attribute__((always_inline))
void directModeInput(volatile IO_REG_TYPE *base, IO_REG_TYPE pin)
{
if (SS_GPIO == GPIO_TYPE(pin)) {
WRITE_ARC_REG(READ_ARC_REG((((IO_REG_TYPE)base) + DIR_OFFSET_SS)) & ~(0x01 << GPIO_ID(pin)),
((IO_REG_TYPE)(base) + DIR_OFFSET_SS));
} else {
MMIO_REG_VAL_FROM_BASE((IO_REG_TYPE)base, DIR_OFFSET_SOC) &= ~(0x01 << GPIO_ID(pin));
}
}
static inline __attribute__((always_inline))
void directModeOutput(volatile IO_REG_TYPE *base, IO_REG_TYPE pin)
{
if (SS_GPIO == GPIO_TYPE(pin)) {
WRITE_ARC_REG(READ_ARC_REG(((IO_REG_TYPE)(base) + DIR_OFFSET_SS)) | (0x01 << GPIO_ID(pin)),
((IO_REG_TYPE)(base) + DIR_OFFSET_SS));
} else {
MMIO_REG_VAL_FROM_BASE((IO_REG_TYPE)base, DIR_OFFSET_SOC) |= (0x01 << GPIO_ID(pin));
}
}
static inline __attribute__((always_inline))
void directWriteLow(volatile IO_REG_TYPE *base, IO_REG_TYPE pin)
{
if (SS_GPIO == GPIO_TYPE(pin)) {
WRITE_ARC_REG(READ_ARC_REG(base) & ~(0x01 << GPIO_ID(pin)), base);
} else {
MMIO_REG_VAL(base) &= ~(0x01 << GPIO_ID(pin));
}
}
static inline __attribute__((always_inline))
void directWriteHigh(volatile IO_REG_TYPE *base, IO_REG_TYPE pin)
{
if (SS_GPIO == GPIO_TYPE(pin)) {
WRITE_ARC_REG(READ_ARC_REG(base) | (0x01 << GPIO_ID(pin)), base);
} else {
MMIO_REG_VAL(base) |= (0x01 << GPIO_ID(pin));
}
}
#define DIRECT_READ(base, pin) directRead(base, pin)
#define DIRECT_MODE_INPUT(base, pin) directModeInput(base, pin)
#define DIRECT_MODE_OUTPUT(base, pin) directModeOutput(base, pin)
#define DIRECT_WRITE_LOW(base, pin) directWriteLow(base, pin)
#define DIRECT_WRITE_HIGH(base, pin) directWriteHigh(base, pin)
#else
#define PIN_TO_BASEREG(pin) (0)
#define PIN_TO_BITMASK(pin) (pin)
#define IO_REG_TYPE unsigned int
#define IO_REG_ASM
#define DIRECT_READ(base, pin) digitalRead(pin)
#define DIRECT_WRITE_LOW(base, pin) digitalWrite(pin, LOW)
#define DIRECT_WRITE_HIGH(base, pin) digitalWrite(pin, HIGH)
#define DIRECT_MODE_INPUT(base, pin) pinMode(pin,INPUT)
#define DIRECT_MODE_OUTPUT(base, pin) pinMode(pin,OUTPUT)
#warning "OneWire. Fallback mode. Using API calls for pinMode,digitalRead and digitalWrite. Operation of this library is not guaranteed on this architecture."
#endif
class MyWire
{
private:
IO_REG_TYPE bitmask;
volatile IO_REG_TYPE *baseReg;
#if ONEWIRE_SEARCH
// global search state
unsigned char ROM_NO[8];
uint8_t LastDiscrepancy;
uint8_t LastFamilyDiscrepancy;
uint8_t LastDeviceFlag;
#endif
public:
MyWire( uint8_t pin);
// Perform a 1-Wire reset cycle. Returns 1 if a device responds
// with a presence pulse. Returns 0 if there is no device or the
// bus is shorted or otherwise held low for more than 250uS
uint8_t reset(void);
// Issue a 1-Wire rom select command, you do the reset first.
void select(const uint8_t rom[8]);
// Issue a 1-Wire rom skip command, to address all on bus.
void skip(void);
// Write a byte. If 'power' is one then the wire is held high at
// the end for parasitically powered devices. You are responsible
// for eventually depowering it by calling depower() or doing
// another read or write.
void write(uint8_t v, uint8_t power = 0);
void write_bytes(const uint8_t *buf, uint16_t count, bool power = 0);
// Read a byte.
uint8_t read(void);
void read_bytes(uint8_t *buf, uint16_t count);
// Write a bit. The bus is always left powered at the end, see
// note in write() about that.
void write_bit(uint8_t v);
// Read a bit.
uint8_t read_bit(void);
// Stop forcing power onto the bus. You only need to do this if
// you used the 'power' flag to write() or used a write_bit() call
// and aren't about to do another read or write. You would rather
// not leave this powered if you don't have to, just in case
// someone shorts your bus.
void depower(void);
#if ONEWIRE_SEARCH
// Clear the search state so that if will start from the beginning again.
void reset_search();
// Setup the search to find the device type 'family_code' on the next call
// to search(*newAddr) if it is present.
void target_search(uint8_t family_code);
// Look for the next device. Returns 1 if a new address has been
// returned. A zero might mean that the bus is shorted, there are
// no devices, or you have already retrieved all of them. It
// might be a good idea to check the CRC to make sure you didn't
// get garbage. The order is deterministic. You will always get
// the same devices in the same order.
uint8_t search(uint8_t *newAddr, bool search_mode = true);
#endif
#if ONEWIRE_CRC
// Compute a Dallas Semiconductor 8 bit CRC, these are used in the
// ROM and scratchpad registers.
static uint8_t crc8(const uint8_t *addr, uint8_t len);
#if ONEWIRE_CRC16
// Compute the 1-Wire CRC16 and compare it against the received CRC.
// Example usage (reading a DS2408):
// // Put everything in a buffer so we can compute the CRC easily.
// uint8_t buf[13];
// buf[0] = 0xF0; // Read PIO Registers
// buf[1] = 0x88; // LSB address
// buf[2] = 0x00; // MSB address
// WriteBytes(net, buf, 3); // Write 3 cmd bytes
// ReadBytes(net, buf+3, 10); // Read 6 data bytes, 2 0xFF, 2 CRC16
// if (!CheckCRC16(buf, 11, &buf[11])) {
// // Handle error.
// }
//
// @param input - Array of bytes to checksum.
// @param len - How many bytes to use.
// @param inverted_crc - The two CRC16 bytes in the received data.
// This should just point into the received data,
// *not* at a 16-bit integer.
// @param crc - The crc starting value (optional)
// @return True, iff the CRC matches.
static bool check_crc16(const uint8_t* input, uint16_t len, const uint8_t* inverted_crc, uint16_t crc = 0);
// Compute a Dallas Semiconductor 16 bit CRC. This is required to check
// the integrity of data received from many 1-Wire devices. Note that the
// CRC computed here is *not* what you'll get from the 1-Wire network,
// for two reasons:
// 1) The CRC is transmitted bitwise inverted.
// 2) Depending on the endian-ness of your processor, the binary
// representation of the two-byte return value may have a different
// byte order than the two bytes you get from 1-Wire.
// @param input - Array of bytes to checksum.
// @param len - How many bytes to use.
// @param crc - The crc starting value (optional)
// @return The CRC16, as defined by Dallas Semiconductor.
static uint16_t crc16(const uint8_t* input, uint16_t len, uint16_t crc = 0);
#endif
#endif
};
#endif
| [
"[email protected]"
] | |
3e257966f0301f2e5694a3f777b6fe37a328c7c9 | c33c4b75cfbe4b3cfa819ccc487ac2aef7f1ca76 | /Code/BrainSerialandBehaviorsPlusHeartPlusAud/ColorFunctions.ino | 7f48f11ab4d2843c2d22e7d42309dc9de1064a95 | [] | no_license | quitmeyer/BrainCraft | ccace5767452edce87db26d8e64729d56cb4bdd5 | e354510607b4b9e83ab646f33a9561539d6c77a0 | refs/heads/master | 2021-01-21T22:06:35.110716 | 2017-06-24T16:24:24 | 2017-06-24T16:24:24 | 95,171,576 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 6,244 | ino |
//Mapped Out areas of the brain + add a bit randomness to their borders
void areasoftheBrainAnimated() {
for (int i = 0; i < NUMPIXELS; i++) {
char* type = LLobe[i];
//External Brain
if (type[0] == 'f') {
// pixels.Color takes RGB values, from 0,0,0 up to 255,255,255
strip.setPixelColor(i, strip.Color(heartPWR, heartPWR, heartPWR));
}
//Internal Brain
else {
strip.setPixelColor(i, strip.Color(0, 100+random(30), 100+random(30)));
}
if (type[1] == 'v') {
// pixels.Color takes RGB values, from 0,0,0 up to 255,255,255
strip.setPixelColor(i+random(2), strip.Color(0, 150+random(40), random(10)));
}
//speech
if (type[1] == 's') {
// pixels.Color takes RGB values, from 0,0,0 up to 255,255,255
strip.setPixelColor(i, strip.Color(10, 200+random(20), 0));
}
//auditory
if (type[1] == 'a') {
// pixels.Color takes RGB values, from 0,0,0 up to 255,255,255
strip.setPixelColor(i, strip.Color(120, eegPWR, 200));
}
//thinking
if (type[1] == 't') {
// pixels.Color takes RGB values, from 0,0,0 up to 255,255,255
strip.setPixelColor(i, strip.Color(0, eegPWR-100+random(10), eegPWR));
}
//moving
if (type[1] == 'm') {
// pixels.Color takes RGB values, from 0,0,0 up to 255,255,255
strip.setPixelColor(i+random(1), strip.Color(0, random(20), heartPWR));
}
//coordination
if (type[1] == 'c') {
// pixels.Color takes RGB values, from 0,0,0 up to 255,255,255
strip.setPixelColor(i, strip.Color(0, 200, 200));
}
}
//Finally turn on the whole strip with the values
strip.show(); // This sends the updated pixel color to the hardware.
}
//Mapped Out areas of the brain
void areasoftheBrain() {
for (int i = 0; i < NUMPIXELS; i++) {
char* type = LLobe[i];
//External Brain
if (type[0] == 'f') {
// pixels.Color takes RGB values, from 0,0,0 up to 255,255,255
strip.setPixelColor(i, strip.Color(10, 10, 10));
}
//Internal Brain
else {
strip.setPixelColor(i, strip.Color(0, 100, 100));
}
/*
* Getting into the subtypes
*/
//Visual
if (type[1] == 'v') {
// pixels.Color takes RGB values, from 0,0,0 up to 255,255,255
strip.setPixelColor(i, strip.Color(0, 200, 0));
}
//speech
if (type[1] == 's') {
// pixels.Color takes RGB values, from 0,0,0 up to 255,255,255
strip.setPixelColor(i, strip.Color(200, 200, 0));
}
//auditory
if (type[1] == 'a') {
// pixels.Color takes RGB values, from 0,0,0 up to 255,255,255
strip.setPixelColor(i, strip.Color(200, 0, 200));
}
//thinking
if (type[1] == 't') {
// pixels.Color takes RGB values, from 0,0,0 up to 255,255,255
strip.setPixelColor(i, strip.Color(0, 00, 220));
}
//moving
if (type[1] == 'm') {
// pixels.Color takes RGB values, from 0,0,0 up to 255,255,255
strip.setPixelColor(i, strip.Color(0, 00, 200));
}
//coordination
if (type[1] == 'c') {
// pixels.Color takes RGB values, from 0,0,0 up to 255,255,255
strip.setPixelColor(i, strip.Color(0, 200, 200));
}
}
//Finally turn on the whole strip with the values
strip.show(); // This sends the updated pixel color to the hardware.
}
//Theatre-style crawling lights with rainbow effect
void theaterChaseRainbow(uint8_t wait) {
for (int j = 0; j < 256; j++) { // cycle all 256 colors in the wheel
for (int q = 0; q < 3; q++) {
for (uint16_t i = 0; i < strip.numPixels(); i = i + 3) {
strip.setPixelColor(i + q, Wheel( (i + j) % 255)); //turn every third pixel on
}
strip.show();
delay(wait);
for (uint16_t i = 0; i < strip.numPixels(); i = i + 3) {
strip.setPixelColor(i + q, 0); //turn every third pixel off
}
}
}
}
void pixAllBlack() {
for (int i = 0; i < NUMPIXELS; i++) {
// pixels.Color takes RGB values, from 0,0,0 up to 255,255,255
strip.setPixelColor(i, strip.Color(0, 0, 0));
}
strip.show(); // This sends the updated pixel color to the hardware.
}
void pixOnlyInside() {
for (int i = 0; i < NUMPIXELS; i++) {
char* type = LLobe[i];
if (type[0] == 'f') {
// pixels.Color takes RGB values, from 0,0,0 up to 255,255,255
strip.setPixelColor(i, strip.Color(0, 0, 0));
//Serial.println("foundoutsideepix ");
}
else {
strip.setPixelColor(i, strip.Color(0, 200, 200));
// Serial.println("foundinsidepix ");
}
strip.show(); // This sends the updated pixel color to the hardware.
}
}
void pixOnlyOutside() {
for (int i = 0; i < NUMPIXELS; i++) {
char* type = LLobe[i];
if (type[0] == 'f') {
// pixels.Color takes RGB values, from 0,0,0 up to 255,255,255
strip.setPixelColor(i, strip.Color(0, 200, 200));
//Serial.println("foundoutsideepix ");
}
else {
strip.setPixelColor(i, strip.Color(200, 0, 0));
//Serial.println("foundinsidepix ");
}
}
strip.show(); // This sends the updated pixel color to the hardware.
}
void pixAllRed() {
for (int i = 0; i < NUMPIXELS; i++) {
// pixels.Color takes RGB values, from 0,0,0 up to 255,255,255
strip.setPixelColor(i, strip.Color(10, 0, 0));
strip.show(); // This sends the updated pixel color to the hardware.
}
}
void pixAllSameColor(int r, int g, int b) {
for (int i = 0; i < NUMPIXELS; i++) {
strip.setPixelColor(i, strip.Color(r, g, b));
}
strip.show(); // This sends the updated pixel color to the hardware.
}
void pixAllSameColorWheel(uint32_t c) {
for (int i = 0; i < NUMPIXELS; i++) {
strip.setPixelColor(i, Wheel(c & 255));
strip.show(); // This sends the updated pixel color to the hardware.
}
}
// Input a value 0 to 255 to get a color value.
// The colours are a transition r - g - b - back to r.
uint32_t Wheel(byte WheelPos) {
WheelPos = 255 - WheelPos;
if (WheelPos < 85) {
return strip.Color(255 - WheelPos * 3, 0, WheelPos * 3);
}
if (WheelPos < 170) {
WheelPos -= 85;
return strip.Color(0, WheelPos * 3, 255 - WheelPos * 3);
}
WheelPos -= 170;
return strip.Color(WheelPos * 3, 255 - WheelPos * 3, 0);
}
| [
"[email protected]"
] | |
315b461a16fbe874b512c9ff6e2925a701085b3f | 5499e8b91353ef910d2514c8a57a80565ba6f05b | /src/ui/lib/escher/vk/impl/descriptor_set_allocator.cc | f1006762d85df36203b7fb1d45b54bc1a7723689 | [
"BSD-3-Clause"
] | permissive | winksaville/fuchsia | 410f451b8dfc671f6372cb3de6ff0165a2ef30ec | a0ec86f1d51ae8d2538ff3404dad46eb302f9b4f | refs/heads/master | 2022-11-01T11:57:38.343655 | 2019-11-01T17:06:19 | 2019-11-01T17:06:19 | 223,695,500 | 3 | 2 | BSD-3-Clause | 2022-10-13T13:47:02 | 2019-11-24T05:08:59 | C++ | UTF-8 | C++ | false | false | 6,815 | cc | // Copyright 2018 The Fuchsia Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "src/ui/lib/escher/vk/impl/descriptor_set_allocator.h"
#include "src/ui/lib/escher/impl/vulkan_utils.h"
#include "src/ui/lib/escher/vk/vulkan_limits.h"
namespace escher {
namespace impl {
DescriptorSetAllocator::DescriptorSetAllocator(vk::Device device, DescriptorSetLayout layout,
const SamplerPtr& immutable_sampler)
: cache_(device, layout, immutable_sampler) {}
DescriptorSetAllocator::PoolPolicy::PoolPolicy(vk::Device device, DescriptorSetLayout layout,
const SamplerPtr& immutable_sampler)
: vk_device_(device), layout_(layout), immutable_sampler_(immutable_sampler) {
FXL_DCHECK(layout.IsValid());
std::array<vk::DescriptorSetLayoutBinding, VulkanLimits::kNumBindings> bindings;
size_t num_bindings = 0;
bool has_sampled_image = false;
for (uint32_t i = 0; i < VulkanLimits::kNumBindings; i++) {
uint32_t index_mask = 1u << i;
if (index_mask & layout.sampled_image_mask) {
has_sampled_image = true;
bindings[num_bindings++] = {i, vk::DescriptorType::eCombinedImageSampler, 1, layout.stages,
immutable_sampler ? &(immutable_sampler->vk()) : nullptr};
pool_sizes_.push_back({vk::DescriptorType::eCombinedImageSampler, 0});
continue;
}
if (index_mask & layout.sampled_buffer_mask) {
bindings[num_bindings++] = {i, vk::DescriptorType::eUniformTexelBuffer, 1, layout.stages,
nullptr};
pool_sizes_.push_back({vk::DescriptorType::eUniformTexelBuffer, 0});
continue;
}
if (index_mask & layout.storage_image_mask) {
bindings[num_bindings++] = {i, vk::DescriptorType::eStorageImage, 1, layout.stages, nullptr};
pool_sizes_.push_back({vk::DescriptorType::eStorageImage, 0});
continue;
}
// TODO(SCN-699): Consider allowing both static and dynamic offsets for
// uniform buffers.
if (index_mask & layout.uniform_buffer_mask) {
bindings[num_bindings++] = {i, vk::DescriptorType::eUniformBufferDynamic, 1, layout.stages,
nullptr};
pool_sizes_.push_back({vk::DescriptorType::eUniformBufferDynamic, 0});
continue;
}
// TODO(SCN-699): Consider allowing both static and dynamic offsets for
// storage buffers.
if (index_mask & layout.storage_buffer_mask) {
bindings[num_bindings++] = {i, vk::DescriptorType::eStorageBuffer, 1, layout.stages, nullptr};
pool_sizes_.push_back({vk::DescriptorType::eStorageBuffer, 0});
continue;
}
if (index_mask & layout.input_attachment_mask) {
bindings[num_bindings++] = {i, vk::DescriptorType::eInputAttachment, 1, layout.stages,
nullptr};
pool_sizes_.push_back({vk::DescriptorType::eInputAttachment, 0});
continue;
}
}
if (immutable_sampler && has_sampled_image) {
// TODO(ES-199): Leaving this log in for now, so we can detect when systems
// are OOMing due to ES-199. For most use cases, this log will trigger once.
FXL_LOG(INFO) << "Allocating immutable descriptor set layout, sampler = "
<< immutable_sampler->vk();
}
vk::DescriptorSetLayoutCreateInfo info;
if (num_bindings) {
info.bindingCount = num_bindings;
info.pBindings = bindings.data();
}
vk_layout_ = ESCHER_CHECKED_VK_RESULT(device.createDescriptorSetLayout(info));
}
DescriptorSetAllocator::PoolPolicy::~PoolPolicy() {
FXL_DCHECK(pools_.empty());
vk_device_.destroyDescriptorSetLayout(vk_layout_);
}
void DescriptorSetAllocator::PoolPolicy::InitializePoolObjectBlock(CacheItem* objects,
size_t block_index,
size_t num_objects) {
vk::DescriptorPool pool = CreatePool(block_index, num_objects);
AllocateDescriptorSetBlock(pool, objects, num_objects);
}
vk::DescriptorPool DescriptorSetAllocator::PoolPolicy::CreatePool(size_t block_index,
size_t num_objects) {
FXL_DCHECK(!pools_[block_index]);
for (auto& sz : pool_sizes_) {
sz.descriptorCount = num_objects;
}
vk::DescriptorPoolCreateInfo info;
info.maxSets = num_objects;
if (!pool_sizes_.empty()) {
info.poolSizeCount = pool_sizes_.size();
info.pPoolSizes = pool_sizes_.data();
}
auto pool = ESCHER_CHECKED_VK_RESULT(vk_device_.createDescriptorPool(info));
pools_[block_index] = pool;
return pool;
}
void DescriptorSetAllocator::PoolPolicy::AllocateDescriptorSetBlock(vk::DescriptorPool pool,
CacheItem* objects,
size_t num_objects) {
constexpr size_t kSetsPerAllocation = 64;
std::array<vk::DescriptorSetLayout, kSetsPerAllocation> layouts;
for (auto& layout : layouts) {
layout = vk_layout_;
}
std::array<vk::DescriptorSet, kSetsPerAllocation> allocated_sets;
size_t remaining = num_objects;
vk::DescriptorSetAllocateInfo alloc_info;
alloc_info.descriptorPool = pool;
alloc_info.pSetLayouts = layouts.data();
while (remaining) {
alloc_info.descriptorSetCount = std::min(remaining, kSetsPerAllocation);
vk::Result result = vk_device_.allocateDescriptorSets(&alloc_info, allocated_sets.data());
FXL_CHECK(result == vk::Result::eSuccess) << "DescriptorSetAllocator failed to allocate block.";
for (size_t i = 0; i < alloc_info.descriptorSetCount; ++i) {
new (objects + i) CacheItem();
objects[i].set = allocated_sets[i];
}
remaining -= alloc_info.descriptorSetCount;
objects += alloc_info.descriptorSetCount;
}
}
void DescriptorSetAllocator::PoolPolicy::DestroyPoolObjectBlock(CacheItem* objects,
size_t block_index,
size_t num_objects) {
auto it = pools_.find(block_index);
if (it == pools_.end()) {
FXL_DCHECK(false) << "DescriptorSetAllocator could not find pool to destroy.";
return;
}
vk::DescriptorPool pool = it->second;
pools_.erase(it);
FXL_DCHECK(pool);
vk_device_.resetDescriptorPool(pool);
vk_device_.destroyDescriptorPool(pool);
// This isn't necessary, but do it anyway in case CacheItem is someday changed
// to include values that require destruction.
for (size_t i = 0; i < num_objects; ++i) {
objects[i].~CacheItem();
}
}
} // namespace impl
} // namespace escher
| [
"[email protected]"
] | |
e61b0444a26a84f94d84b911cc7cfae1049a09d0 | b15e1f7d336ee67a69440c976225382de5de9407 | /FrameworkSocket/FrameworkCommon/WorkItemQueue.cpp | cdfa09c179886db3a5cae42299195ef17d45f555 | [] | no_license | heinsteinh/FtsEngine | 5ef66c1a1ef443aee59caf953a04c66b52937088 | ea275f26ae0ff897f696a6ea1f82df3bde459f8f | refs/heads/master | 2021-05-28T22:40:25.919833 | 2015-05-11T05:55:52 | 2015-05-11T05:55:52 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 103 | cpp |
#include "WorkItemQueue.h"
WorkItemQueue::WorkItemQueue()
{
}
WorkItemQueue::~WorkItemQueue()
{
}
| [
"[email protected]"
] | |
2d2d966269d7e5636f5a364bf43d356130e82478 | d215ec7816200beb150e8e5590d11188efffbd24 | /examples/CBuilder/Simple/GUIControls/TreeView/TreeViewExampleClasses.cpp | ee79faf202b144790e2ac516bbf3abdc8f97aa88 | [
"MIT"
] | permissive | Embarcadero/BoldForDelphi | 73d44498361a7628c911c2dd43f3333f632049e6 | 7ed023288af627140fe2907bb6309eab170bd454 | refs/heads/master | 2023-08-31T00:05:57.363773 | 2022-04-28T10:37:26 | 2022-04-28T10:37:26 | 297,292,443 | 139 | 54 | MIT | 2022-08-14T14:19:28 | 2020-09-21T09:32:27 | Pascal | UTF-8 | C++ | false | false | 15,151 | cpp | /*****************************************/
/* This file is autogenerated */
/* Any manual changes will be LOST! */
/*****************************************/
/* Generated 2001-12-07 15:10:52 */
/*****************************************/
/* This file should be stored in the */
/* same directory as the form/datamodule */
/* with the corresponding model */
/*****************************************/
/* Copyright notice: */
/* */
/*****************************************/
#include <vcl.h>
#pragma hdrstop
#include "TreeViewExampleClasses.hpp"
// interface uses
// interface dependancies
// attribute dependancies
#pragma link "BoldAttributes"
#pragma link "BoldDefs"
#pragma link "BoldSubscription"
#pragma link "BoldDeriver"
#pragma link "BoldElements"
#pragma link "BoldDomainElement"
#pragma link "BoldSystemRT"
#pragma link "BoldSystem"
#pragma link "BoldGeneratedCodeDictionary"
// implementation uses
// implementation dependancies
#include "BoldGeneratedCodeDictionary.hpp"
// Includefiles for methodimplementations
#define BoldMemberAssertInvalidObjectType = "Object of singlelink (%s.%s) is of wrong type (is %s, should be %s)";
// TBusinessClassesRoot
void __fastcall TBusinessClassesRootList::Add(TBusinessClassesRoot *NewObject)
{
if (NewObject != NULL)
{
AddElement(NewObject);
}
}
int __fastcall TBusinessClassesRootList::IndexOf(TBusinessClassesRoot *anObject)
{
int result = IndexOfElement(anObject);
return result;
}
int __fastcall TBusinessClassesRootList::Includes(TBusinessClassesRoot *anObject) // boolean?
{
int result = IncludesElement(anObject);
return result;
}
TBusinessClassesRoot* __fastcall TBusinessClassesRootList::AddNew()
{
TBusinessClassesRoot *result = dynamic_cast<TBusinessClassesRoot*>(InternalAddNew());
return result;
}
void __fastcall TBusinessClassesRootList::Insert(int index, TBusinessClassesRoot *NewObject)
{
if (NewObject != NULL)
{
InsertElement(index, NewObject);
}
}
TBusinessClassesRoot* __fastcall TBusinessClassesRootList::GetBoldObject(int index)
{
TBusinessClassesRoot *result = dynamic_cast<TBusinessClassesRoot*>(GetElement(index));
return result;
}
void __fastcall TBusinessClassesRootList::SetBoldObject(int index, TBusinessClassesRoot *NewObject)
{
SetElement(index, NewObject);
}
// TBikeFrame
TBAString* __fastcall TBikeFrame::_Get_M_Name()
{
// assert(ValidateMember("TBikeFrame", "Name", 0, __classid(TBAString)));
TBAString *result = dynamic_cast<TBAString*>(BoldMembers[0]);
return result;
};
String __fastcall TBikeFrame::_GetName()
{
String result = M_Name->AsString;
return result;
}
void __fastcall TBikeFrame::_SetName(String NewValue)
{
M_Name->AsString = NewValue;
}
TBAInteger* __fastcall TBikeFrame::_Get_M_FrameSize()
{
// assert(ValidateMember("TBikeFrame", "FrameSize", 1, __classid(TBAInteger)));
TBAInteger *result = dynamic_cast<TBAInteger*>(BoldMembers[1]);
return result;
};
Integer __fastcall TBikeFrame::_GetFrameSize()
{
Integer result = M_FrameSize->AsInteger;
return result;
}
void __fastcall TBikeFrame::_SetFrameSize(Integer NewValue)
{
M_FrameSize->AsInteger = NewValue;
}
TMTBList* __fastcall TBikeFrame::_GetPartOf()
{
// assert(ValidateMember("TBikeFrame", "PartOf", 2, __classid(TMTBList)));
TMTBList *result = dynamic_cast<TMTBList*>(BoldMembers[2]);
return result;
}
void __fastcall TBikeFrameList::Add(TBikeFrame *NewObject)
{
if (NewObject != NULL)
{
AddElement(NewObject);
}
}
int __fastcall TBikeFrameList::IndexOf(TBikeFrame *anObject)
{
int result = IndexOfElement(anObject);
return result;
}
int __fastcall TBikeFrameList::Includes(TBikeFrame *anObject) // boolean?
{
int result = IncludesElement(anObject);
return result;
}
TBikeFrame* __fastcall TBikeFrameList::AddNew()
{
TBikeFrame *result = dynamic_cast<TBikeFrame*>(InternalAddNew());
return result;
}
void __fastcall TBikeFrameList::Insert(int index, TBikeFrame *NewObject)
{
if (NewObject != NULL)
{
InsertElement(index, NewObject);
}
}
TBikeFrame* __fastcall TBikeFrameList::GetBoldObject(int index)
{
TBikeFrame *result = dynamic_cast<TBikeFrame*>(GetElement(index));
return result;
}
void __fastcall TBikeFrameList::SetBoldObject(int index, TBikeFrame *NewObject)
{
SetElement(index, NewObject);
}
// TMTB
TBAString* __fastcall TMTB::_Get_M_Name()
{
// assert(ValidateMember("TMTB", "Name", 0, __classid(TBAString)));
TBAString *result = dynamic_cast<TBAString*>(BoldMembers[0]);
return result;
};
String __fastcall TMTB::_GetName()
{
String result = M_Name->AsString;
return result;
}
void __fastcall TMTB::_SetName(String NewValue)
{
M_Name->AsString = NewValue;
}
TPartsList* __fastcall TMTB::_GetConsistsOf()
{
// assert(ValidateMember("TMTB", "ConsistsOf", 1, __classid(TPartsList)));
TPartsList *result = dynamic_cast<TPartsList*>(BoldMembers[1]);
return result;
}
TMTB_CompsList* __fastcall TMTB::_GetMTB_Comps()
{
// assert(ValidateMember("TMTB", "MTB_Comps", 2, __classid(TMTB_CompsList)));
TMTB_CompsList *result = dynamic_cast<TMTB_CompsList*>(BoldMembers[2]);
return result;
}
TBoldObjectReference* __fastcall TMTB::_Get_M_BuiltAround()
{
// assert(ValidateMember("TMTB", "BuiltAround", 3, __classid(TBoldObjectReference)));
TBoldObjectReference *result = dynamic_cast<TBoldObjectReference*>(BoldMembers[3]);
return result;
}
TBikeFrame* _fastcall TMTB::_GetBuiltAround()
{
// assert(not assigned(M_BuiltAround->BoldObject) or (M_BuiltAround->BoldObject is TBikeFrame), SysUtils.format(BoldMemberAssertInvalidObjectType, [ClassName, BuiltAround, M_BuiltAround->BoldObject->ClassName, __classid(TBikeFrame)]));
TBikeFrame *result = dynamic_cast<TBikeFrame*>(M_BuiltAround->BoldObject);
return result;
}
void __fastcall TMTB::_SetBuiltAround(TBikeFrame *value)
{
M_BuiltAround->BoldObject = value;
}
void __fastcall TMTBList::Add(TMTB *NewObject)
{
if (NewObject != NULL)
{
AddElement(NewObject);
}
}
int __fastcall TMTBList::IndexOf(TMTB *anObject)
{
int result = IndexOfElement(anObject);
return result;
}
int __fastcall TMTBList::Includes(TMTB *anObject) // boolean?
{
int result = IncludesElement(anObject);
return result;
}
TMTB* __fastcall TMTBList::AddNew()
{
TMTB *result = dynamic_cast<TMTB*>(InternalAddNew());
return result;
}
void __fastcall TMTBList::Insert(int index, TMTB *NewObject)
{
if (NewObject != NULL)
{
InsertElement(index, NewObject);
}
}
TMTB* __fastcall TMTBList::GetBoldObject(int index)
{
TMTB *result = dynamic_cast<TMTB*>(GetElement(index));
return result;
}
void __fastcall TMTBList::SetBoldObject(int index, TMTB *NewObject)
{
SetElement(index, NewObject);
}
// TMTB_Comps
TBoldObjectReference* __fastcall TMTB_Comps::_Get_M_PartOf()
{
// assert(ValidateMember("TMTB_Comps", "PartOf", 0, __classid(TBoldObjectReference)));
TBoldObjectReference *result = dynamic_cast<TBoldObjectReference*>(BoldMembers[0]);
return result;
}
TMTB* _fastcall TMTB_Comps::_GetPartOf()
{
// assert(not assigned(M_PartOf->BoldObject) or (M_PartOf->BoldObject is TMTB), SysUtils.format(BoldMemberAssertInvalidObjectType, [ClassName, PartOf, M_PartOf->BoldObject->ClassName, __classid(TMTB)]));
TMTB *result = dynamic_cast<TMTB*>(M_PartOf->BoldObject);
return result;
}
TBoldObjectReference* __fastcall TMTB_Comps::_Get_M_ConsistsOf()
{
// assert(ValidateMember("TMTB_Comps", "ConsistsOf", 1, __classid(TBoldObjectReference)));
TBoldObjectReference *result = dynamic_cast<TBoldObjectReference*>(BoldMembers[1]);
return result;
}
TParts* _fastcall TMTB_Comps::_GetConsistsOf()
{
// assert(not assigned(M_ConsistsOf->BoldObject) or (M_ConsistsOf->BoldObject is TParts), SysUtils.format(BoldMemberAssertInvalidObjectType, [ClassName, ConsistsOf, M_ConsistsOf->BoldObject->ClassName, __classid(TParts)]));
TParts *result = dynamic_cast<TParts*>(M_ConsistsOf->BoldObject);
return result;
}
void __fastcall TMTB_CompsList::Add(TMTB_Comps *NewObject)
{
if (NewObject != NULL)
{
AddElement(NewObject);
}
}
int __fastcall TMTB_CompsList::IndexOf(TMTB_Comps *anObject)
{
int result = IndexOfElement(anObject);
return result;
}
int __fastcall TMTB_CompsList::Includes(TMTB_Comps *anObject) // boolean?
{
int result = IncludesElement(anObject);
return result;
}
TMTB_Comps* __fastcall TMTB_CompsList::AddNew()
{
TMTB_Comps *result = dynamic_cast<TMTB_Comps*>(InternalAddNew());
return result;
}
void __fastcall TMTB_CompsList::Insert(int index, TMTB_Comps *NewObject)
{
if (NewObject != NULL)
{
InsertElement(index, NewObject);
}
}
TMTB_Comps* __fastcall TMTB_CompsList::GetBoldObject(int index)
{
TMTB_Comps *result = dynamic_cast<TMTB_Comps*>(GetElement(index));
return result;
}
void __fastcall TMTB_CompsList::SetBoldObject(int index, TMTB_Comps *NewObject)
{
SetElement(index, NewObject);
}
// TParts
TBAString* __fastcall TParts::_Get_M_Model()
{
// assert(ValidateMember("TParts", "Model", 0, __classid(TBAString)));
TBAString *result = dynamic_cast<TBAString*>(BoldMembers[0]);
return result;
};
String __fastcall TParts::_GetModel()
{
String result = M_Model->AsString;
return result;
}
void __fastcall TParts::_SetModel(String NewValue)
{
M_Model->AsString = NewValue;
}
TMTBList* __fastcall TParts::_GetPartOf()
{
// assert(ValidateMember("TParts", "PartOf", 1, __classid(TMTBList)));
TMTBList *result = dynamic_cast<TMTBList*>(BoldMembers[1]);
return result;
}
TMTB_CompsList* __fastcall TParts::_GetMTB_Comps()
{
// assert(ValidateMember("TParts", "MTB_Comps", 2, __classid(TMTB_CompsList)));
TMTB_CompsList *result = dynamic_cast<TMTB_CompsList*>(BoldMembers[2]);
return result;
}
void __fastcall TPartsList::Add(TParts *NewObject)
{
if (NewObject != NULL)
{
AddElement(NewObject);
}
}
int __fastcall TPartsList::IndexOf(TParts *anObject)
{
int result = IndexOfElement(anObject);
return result;
}
int __fastcall TPartsList::Includes(TParts *anObject) // boolean?
{
int result = IncludesElement(anObject);
return result;
}
TParts* __fastcall TPartsList::AddNew()
{
TParts *result = dynamic_cast<TParts*>(InternalAddNew());
return result;
}
void __fastcall TPartsList::Insert(int index, TParts *NewObject)
{
if (NewObject != NULL)
{
InsertElement(index, NewObject);
}
}
TParts* __fastcall TPartsList::GetBoldObject(int index)
{
TParts *result = dynamic_cast<TParts*>(GetElement(index));
return result;
}
void __fastcall TPartsList::SetBoldObject(int index, TParts *NewObject)
{
SetElement(index, NewObject);
}
// TBrake
void __fastcall TBrakeList::Add(TBrake *NewObject)
{
if (NewObject != NULL)
{
AddElement(NewObject);
}
}
int __fastcall TBrakeList::IndexOf(TBrake *anObject)
{
int result = IndexOfElement(anObject);
return result;
}
int __fastcall TBrakeList::Includes(TBrake *anObject) // boolean?
{
int result = IncludesElement(anObject);
return result;
}
TBrake* __fastcall TBrakeList::AddNew()
{
TBrake *result = dynamic_cast<TBrake*>(InternalAddNew());
return result;
}
void __fastcall TBrakeList::Insert(int index, TBrake *NewObject)
{
if (NewObject != NULL)
{
InsertElement(index, NewObject);
}
}
TBrake* __fastcall TBrakeList::GetBoldObject(int index)
{
TBrake *result = dynamic_cast<TBrake*>(GetElement(index));
return result;
}
void __fastcall TBrakeList::SetBoldObject(int index, TBrake *NewObject)
{
SetElement(index, NewObject);
}
// TGear
void __fastcall TGearList::Add(TGear *NewObject)
{
if (NewObject != NULL)
{
AddElement(NewObject);
}
}
int __fastcall TGearList::IndexOf(TGear *anObject)
{
int result = IndexOfElement(anObject);
return result;
}
int __fastcall TGearList::Includes(TGear *anObject) // boolean?
{
int result = IncludesElement(anObject);
return result;
}
TGear* __fastcall TGearList::AddNew()
{
TGear *result = dynamic_cast<TGear*>(InternalAddNew());
return result;
}
void __fastcall TGearList::Insert(int index, TGear *NewObject)
{
if (NewObject != NULL)
{
InsertElement(index, NewObject);
}
}
TGear* __fastcall TGearList::GetBoldObject(int index)
{
TGear *result = dynamic_cast<TGear*>(GetElement(index));
return result;
}
void __fastcall TGearList::SetBoldObject(int index, TGear *NewObject)
{
SetElement(index, NewObject);
}
// TWheel
void __fastcall TWheelList::Add(TWheel *NewObject)
{
if (NewObject != NULL)
{
AddElement(NewObject);
}
}
int __fastcall TWheelList::IndexOf(TWheel *anObject)
{
int result = IndexOfElement(anObject);
return result;
}
int __fastcall TWheelList::Includes(TWheel *anObject) // boolean?
{
int result = IncludesElement(anObject);
return result;
}
TWheel* __fastcall TWheelList::AddNew()
{
TWheel *result = dynamic_cast<TWheel*>(InternalAddNew());
return result;
}
void __fastcall TWheelList::Insert(int index, TWheel *NewObject)
{
if (NewObject != NULL)
{
InsertElement(index, NewObject);
}
}
TWheel* __fastcall TWheelList::GetBoldObject(int index)
{
TWheel *result = dynamic_cast<TWheel*>(GetElement(index));
return result;
}
void __fastcall TWheelList::SetBoldObject(int index, TWheel *NewObject)
{
SetElement(index, NewObject);
}
char *GeneratedCodeCRC()
{
return "1108431894";
}
void __fastcall InstallObjectListClasses(TBoldGeneratedClassList *BoldObjectListClasses)
{
BoldObjectListClasses->AddObjectEntry("BusinessClassesRoot", __classid(TBusinessClassesRootList));
BoldObjectListClasses->AddObjectEntry("BikeFrame", __classid(TBikeFrameList));
BoldObjectListClasses->AddObjectEntry("MTB", __classid(TMTBList));
BoldObjectListClasses->AddObjectEntry("MTB_Comps", __classid(TMTB_CompsList));
BoldObjectListClasses->AddObjectEntry("Parts", __classid(TPartsList));
BoldObjectListClasses->AddObjectEntry("Brake", __classid(TBrakeList));
BoldObjectListClasses->AddObjectEntry("Gear", __classid(TGearList));
BoldObjectListClasses->AddObjectEntry("Wheel", __classid(TWheelList));
}
void __fastcall InstallBusinessClasses(TBoldGeneratedClassList *BoldObjectClasses)
{
BoldObjectClasses->AddObjectEntry("BusinessClassesRoot", __classid(TBusinessClassesRoot));
BoldObjectClasses->AddObjectEntry("BikeFrame", __classid(TBikeFrame));
BoldObjectClasses->AddObjectEntry("MTB", __classid(TMTB));
BoldObjectClasses->AddObjectEntry("MTB_Comps", __classid(TMTB_Comps));
BoldObjectClasses->AddObjectEntry("Parts", __classid(TParts));
BoldObjectClasses->AddObjectEntry("Brake", __classid(TBrake));
BoldObjectClasses->AddObjectEntry("Gear", __classid(TGear));
BoldObjectClasses->AddObjectEntry("Wheel", __classid(TWheel));
}
// the codedestricptor is initialized automatically
TBoldGeneratedCodeDescriptor *CodeDescriptor = GeneratedCodes()->AddGeneratedCodeDescriptorWithFunc("TreeViewExampleClasses", &InstallBusinessClasses, &InstallObjectListClasses, GeneratedCodeCRC());
// but should be unloaded manually when it is not needed anymore
void unregisterCode()
{
if (CodeDescriptor != NULL)
{
GeneratedCodes()->Remove(CodeDescriptor);
}
}
| [
"[email protected]"
] | |
bdd299cc29ec4ce8dd458d3fe6aac8ef8d5d1b1f | 38b075556c708bec24396fadb9e619f203f98809 | /src/Sound/timpani_samples.cpp | 12d09ce16820babbaa6ef647b69d62b857ba0441 | [] | no_license | quantograph/QG_Music | 78a0ca91ba50ea37d1b0f7e67f50efee9a780e7d | cdab6e285cc7548ce53881e3af5d5d7fde9c10b2 | refs/heads/master | 2023-04-18T19:29:39.651494 | 2021-04-28T02:55:10 | 2021-04-28T02:55:10 | 362,332,392 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 136,363 | cpp | #include <QG_Devices.h>
#include "timpani_samples.h"
const AudioSynthWavetable::sample_data timpani_samples[3] = {
{
(int16_t*)sample_0_timpani_timpani, // sample
true, // LOOP
13, // LENGTH_BITS
(1 << (32 - 13)) * WAVETABLE_CENTS_SHIFT(0) * 44100.0 / WAVETABLE_NOTE_TO_FREQUENCY(60) / AUDIO_SAMPLE_RATE_EXACT + 0.5, // PER_HERTZ_PHASE_INCREMENT
((uint32_t)7698 - 1) << (32 - 13), // MAX_PHASE
((uint32_t)7695 - 1) << (32 - 13), // LOOP_PHASE_END
(((uint32_t)7695 - 1) << (32 - 13)) - (((uint32_t)7079 - 1) << (32 - 13)), // LOOP_PHASE_LENGTH
uint16_t(UINT16_MAX * WAVETABLE_DECIBEL_SHIFT(-12.7)), // INITIAL_ATTENUATION_SCALAR
uint32_t(0.00 * AudioSynthWavetable::SAMPLES_PER_MSEC / AudioSynthWavetable::ENVELOPE_PERIOD + 0.5), // DELAY_COUNT
uint32_t(6.20 * AudioSynthWavetable::SAMPLES_PER_MSEC / AudioSynthWavetable::ENVELOPE_PERIOD + 0.5), // ATTACK_COUNT
uint32_t(540.24 * AudioSynthWavetable::SAMPLES_PER_MSEC / AudioSynthWavetable::ENVELOPE_PERIOD + 0.5), // HOLD_COUNT
uint32_t(3398.74 * AudioSynthWavetable::SAMPLES_PER_MSEC / AudioSynthWavetable::ENVELOPE_PERIOD + 0.5), // DECAY_COUNT
uint32_t(2353.81 * AudioSynthWavetable::SAMPLES_PER_MSEC / AudioSynthWavetable::ENVELOPE_PERIOD + 0.5), // RELEASE_COUNT
int32_t((1.0 - WAVETABLE_DECIBEL_SHIFT(-100.0)) * AudioSynthWavetable::UNITY_GAIN), // SUSTAIN_MULT
uint32_t(0.00 * AudioSynthWavetable::SAMPLES_PER_MSEC / (2 * AudioSynthWavetable::LFO_PERIOD)), // VIBRATO_DELAY
uint32_t(0.1 * AudioSynthWavetable::LFO_PERIOD * (UINT32_MAX / AUDIO_SAMPLE_RATE_EXACT)), // VIBRATO_INCREMENT
(WAVETABLE_CENTS_SHIFT(0) - 1.0) * 4, // VIBRATO_PITCH_COEFFICIENT_INITIAL
(1.0 - WAVETABLE_CENTS_SHIFT(0)) * 4, // VIBRATO_COEFFICIENT_SECONDARY
uint32_t(0.00 * AudioSynthWavetable::SAMPLES_PER_MSEC / (2 * AudioSynthWavetable::LFO_PERIOD)), // MODULATION_DELAY
uint32_t(5.4 * AudioSynthWavetable::LFO_PERIOD * (UINT32_MAX / AUDIO_SAMPLE_RATE_EXACT)), // MODULATION_INCREMENT
(WAVETABLE_CENTS_SHIFT(0) - 1.0) * 4, // MODULATION_PITCH_COEFFICIENT_INITIAL
(1.0 - WAVETABLE_CENTS_SHIFT(0)) * 4, // MODULATION_PITCH_COEFFICIENT_SECOND
int32_t(UINT16_MAX * (WAVETABLE_DECIBEL_SHIFT(0) - 1.0)) * 4, // MODULATION_AMPLITUDE_INITIAL_GAIN
int32_t(UINT16_MAX * (1.0 - WAVETABLE_DECIBEL_SHIFT(0))) * 4, // MODULATION_AMPLITUDE_FINAL_GAIN
},
{
(int16_t*)sample_1_timpani_timpani, // sample
true, // LOOP
13, // LENGTH_BITS
(1 << (32 - 13)) * WAVETABLE_CENTS_SHIFT(0) * 44100.0 / WAVETABLE_NOTE_TO_FREQUENCY(60) / AUDIO_SAMPLE_RATE_EXACT + 0.5, // PER_HERTZ_PHASE_INCREMENT
((uint32_t)7698 - 1) << (32 - 13), // MAX_PHASE
((uint32_t)7695 - 1) << (32 - 13), // LOOP_PHASE_END
(((uint32_t)7695 - 1) << (32 - 13)) - (((uint32_t)7079 - 1) << (32 - 13)), // LOOP_PHASE_LENGTH
uint16_t(UINT16_MAX * WAVETABLE_DECIBEL_SHIFT(-12.7)), // INITIAL_ATTENUATION_SCALAR
uint32_t(0.00 * AudioSynthWavetable::SAMPLES_PER_MSEC / AudioSynthWavetable::ENVELOPE_PERIOD + 0.5), // DELAY_COUNT
uint32_t(6.20 * AudioSynthWavetable::SAMPLES_PER_MSEC / AudioSynthWavetable::ENVELOPE_PERIOD + 0.5), // ATTACK_COUNT
uint32_t(540.24 * AudioSynthWavetable::SAMPLES_PER_MSEC / AudioSynthWavetable::ENVELOPE_PERIOD + 0.5), // HOLD_COUNT
uint32_t(3198.73 * AudioSynthWavetable::SAMPLES_PER_MSEC / AudioSynthWavetable::ENVELOPE_PERIOD + 0.5), // DECAY_COUNT
uint32_t(918.06 * AudioSynthWavetable::SAMPLES_PER_MSEC / AudioSynthWavetable::ENVELOPE_PERIOD + 0.5), // RELEASE_COUNT
int32_t((1.0 - WAVETABLE_DECIBEL_SHIFT(-100.0)) * AudioSynthWavetable::UNITY_GAIN), // SUSTAIN_MULT
uint32_t(0.00 * AudioSynthWavetable::SAMPLES_PER_MSEC / (2 * AudioSynthWavetable::LFO_PERIOD)), // VIBRATO_DELAY
uint32_t(0.1 * AudioSynthWavetable::LFO_PERIOD * (UINT32_MAX / AUDIO_SAMPLE_RATE_EXACT)), // VIBRATO_INCREMENT
(WAVETABLE_CENTS_SHIFT(0) - 1.0) * 4, // VIBRATO_PITCH_COEFFICIENT_INITIAL
(1.0 - WAVETABLE_CENTS_SHIFT(0)) * 4, // VIBRATO_COEFFICIENT_SECONDARY
uint32_t(0.00 * AudioSynthWavetable::SAMPLES_PER_MSEC / (2 * AudioSynthWavetable::LFO_PERIOD)), // MODULATION_DELAY
uint32_t(5.4 * AudioSynthWavetable::LFO_PERIOD * (UINT32_MAX / AUDIO_SAMPLE_RATE_EXACT)), // MODULATION_INCREMENT
(WAVETABLE_CENTS_SHIFT(0) - 1.0) * 4, // MODULATION_PITCH_COEFFICIENT_INITIAL
(1.0 - WAVETABLE_CENTS_SHIFT(0)) * 4, // MODULATION_PITCH_COEFFICIENT_SECOND
int32_t(UINT16_MAX * (WAVETABLE_DECIBEL_SHIFT(0) - 1.0)) * 4, // MODULATION_AMPLITUDE_INITIAL_GAIN
int32_t(UINT16_MAX * (1.0 - WAVETABLE_DECIBEL_SHIFT(0))) * 4, // MODULATION_AMPLITUDE_FINAL_GAIN
},
{
(int16_t*)sample_2_timpani_timpani, // sample
true, // LOOP
13, // LENGTH_BITS
(1 << (32 - 13)) * WAVETABLE_CENTS_SHIFT(0) * 44100.0 / WAVETABLE_NOTE_TO_FREQUENCY(60) / AUDIO_SAMPLE_RATE_EXACT + 0.5, // PER_HERTZ_PHASE_INCREMENT
((uint32_t)7698 - 1) << (32 - 13), // MAX_PHASE
((uint32_t)7695 - 1) << (32 - 13), // LOOP_PHASE_END
(((uint32_t)7695 - 1) << (32 - 13)) - (((uint32_t)7079 - 1) << (32 - 13)), // LOOP_PHASE_LENGTH
uint16_t(UINT16_MAX * WAVETABLE_DECIBEL_SHIFT(-12.7)), // INITIAL_ATTENUATION_SCALAR
uint32_t(0.00 * AudioSynthWavetable::SAMPLES_PER_MSEC / AudioSynthWavetable::ENVELOPE_PERIOD + 0.5), // DELAY_COUNT
uint32_t(6.20 * AudioSynthWavetable::SAMPLES_PER_MSEC / AudioSynthWavetable::ENVELOPE_PERIOD + 0.5), // ATTACK_COUNT
uint32_t(540.24 * AudioSynthWavetable::SAMPLES_PER_MSEC / AudioSynthWavetable::ENVELOPE_PERIOD + 0.5), // HOLD_COUNT
uint32_t(2599.68 * AudioSynthWavetable::SAMPLES_PER_MSEC / AudioSynthWavetable::ENVELOPE_PERIOD + 0.5), // DECAY_COUNT
uint32_t(918.06 * AudioSynthWavetable::SAMPLES_PER_MSEC / AudioSynthWavetable::ENVELOPE_PERIOD + 0.5), // RELEASE_COUNT
int32_t((1.0 - WAVETABLE_DECIBEL_SHIFT(-100.0)) * AudioSynthWavetable::UNITY_GAIN), // SUSTAIN_MULT
uint32_t(0.00 * AudioSynthWavetable::SAMPLES_PER_MSEC / (2 * AudioSynthWavetable::LFO_PERIOD)), // VIBRATO_DELAY
uint32_t(0.1 * AudioSynthWavetable::LFO_PERIOD * (UINT32_MAX / AUDIO_SAMPLE_RATE_EXACT)), // VIBRATO_INCREMENT
(WAVETABLE_CENTS_SHIFT(0) - 1.0) * 4, // VIBRATO_PITCH_COEFFICIENT_INITIAL
(1.0 - WAVETABLE_CENTS_SHIFT(0)) * 4, // VIBRATO_COEFFICIENT_SECONDARY
uint32_t(0.00 * AudioSynthWavetable::SAMPLES_PER_MSEC / (2 * AudioSynthWavetable::LFO_PERIOD)), // MODULATION_DELAY
uint32_t(5.4 * AudioSynthWavetable::LFO_PERIOD * (UINT32_MAX / AUDIO_SAMPLE_RATE_EXACT)), // MODULATION_INCREMENT
(WAVETABLE_CENTS_SHIFT(0) - 1.0) * 4, // MODULATION_PITCH_COEFFICIENT_INITIAL
(1.0 - WAVETABLE_CENTS_SHIFT(0)) * 4, // MODULATION_PITCH_COEFFICIENT_SECOND
int32_t(UINT16_MAX * (WAVETABLE_DECIBEL_SHIFT(0) - 1.0)) * 4, // MODULATION_AMPLITUDE_INITIAL_GAIN
int32_t(UINT16_MAX * (1.0 - WAVETABLE_DECIBEL_SHIFT(0))) * 4, // MODULATION_AMPLITUDE_FINAL_GAIN
},
};
const uint32_t sample_0_timpani_timpani[3968] = {
0x00000000,0xfff9fff5,0xfff9fff5,0x0004fff5,0x004fffd7,0x010dff91,0x0f21fd95,0x4fbb460b,
0x598a625b,0x40225439,0x1dc43113,0xcebe1dfc,0xa00faa38,0x8dee95d9,0xa37e9a5c,0xc251ae3d,
0xce93bae0,0x0511d76d,0x3eb12a28,0x4c583de2,0x57c249d3,0x71fb4441,0x23dd71fb,0xe630f1b5,
0xe648e7ed,0xeec9ef46,0xcda5dd06,0xb7a1c669,0x8ede8dee,0x8dee8dee,0x8dee8dee,0xc0548ff3,
0x0a45edec,0x71fb5de5,0x71fb71fb,0x71fb71fb,0x71fb71fb,0x71fb71fb,0x63ea65a4,0x1d0f436b,
0xee5d0f5a,0xe57305f9,0xb625c17f,0x8deeaa98,0x8dee8dee,0x8dee8dee,0x8dee8dee,0x8dee8dee,
0xc0a68dee,0xfbd5dff8,0x3d3529ab,0x55755d07,0x67ae6ddf,0x71fb71fb,0x4f7e71fb,0x13161b8c,
0x1d472442,0xfa441de7,0xcf52e857,0xd173e353,0xe3c8e00a,0x0295e5f9,0x0f271317,0x2b7b286d,
0x22d1246c,0xa55de909,0xd89caf6a,0x38f2130d,0x53b04e5a,0x3fcc54bc,0x0adb2513,0xf0652688,
0xd155e5e1,0xfba9dd25,0xf8551268,0x9d19b5bf,0x9acea20f,0xad5bb3e4,0xed96daf5,0xf3e2f0de,
0x10511045,0x4bf33ede,0x2b5b3d9b,0x29bb3343,0xffc50b15,0x0027ebe8,0xfec7f3a9,0x10b60585,
0x2b5f16fb,0x11ff1190,0xdf53f16d,0xeca9de8c,0xd533d6a4,0xcb59bbe0,0x0a3cd75a,0x2ffe10b0,
0x51a051c1,0x4d464a90,0x71fb558f,0x4c346c85,0xe693195c,0xc947d26b,0xb29bcfe6,0xd9cfc45b,
0x05d9e1d2,0xf35a17dc,0xe47fe2b5,0x9e06a4c7,0xc216b13e,0x004bdab5,0x14061d0b,0x00cafd35,
0xff13ef19,0x288f131d,0x3ce019c6,0x2b4f3101,0x04c10d54,0xc8fbea58,0xa9669f86,0x8deeb3ed,
0xc2fba7ce,0xf0a8ce3f,0x0d69f6ef,0x41e33da6,0x48ae4ae9,0x5d2c3a27,0x65f8634d,0x4b764493,
0x5810406f,0x4a9b649b,0x4343455f,0x2c0c4275,0xe114030a,0xb1e6cd24,0xc151b261,0xa540ac33,
0x8dee8fcc,0x8dee8dee,0x8dee8dee,0x91fb8dee,0xe178bead,0x15e3f073,0x063211a2,0x20a40606,
0x4ae02a5e,0x662c5d72,0x4da64ee4,0x3b7d34a9,0x29b54196,0x42eb351b,0x491b4bf0,0x599d6206,
0x2c094a20,0xed231a6f,0xcd85ea5b,0xe852d9a6,0xf8adfc73,0x1b280bb1,0x22ad224f,0x1562130a,
0x0ecc125f,0xf0b70311,0xbec9f2c8,0x909eaec4,0x8dee8dee,0x8dee8dee,0xc16f9eb2,0xa6ffb95f,
0xdb97b77b,0xf408db2f,0xf6abfaf8,0x058501cb,0xfbd80c9c,0x0ea10add,0x36792da4,0x67ac4ba2,
0x71fb71fb,0x71fb71fb,0x71fb71fb,0x4ca36dc4,0x3e9f3f5b,0x067e1bcb,0x085afcfa,0x01461670,
0xe891fff2,0xe74aecef,0xfc92f08b,0xf4d7f80c,0x987dc84c,0x8dee8dee,0x8dee8dee,0x8dee8dee,
0xb84c9a36,0xbb70c776,0xc9b5cbaa,0xc9ebd25d,0xfaa7d65b,0x31b420a0,0x36262852,0x3a6e340e,
0x37cd3a0b,0x5a4b49e5,0x71fb6b6a,0x71fb71fb,0x71fb71fb,0x6bf96d27,0x34275100,0x2c1831b4,
0xeb3d2305,0xe341e747,0xd083cb12,0xe01dc9e5,0xea3adc7d,0xcc09dcd0,0xc3c9cab1,0x93e4a51c,
0x8dee8dee,0x8dee8dee,0x9c468dee,0xaef2a646,0xc838b98a,0x1a70ef95,0x11b4ffec,0x28fe19ea,
0x0a971634,0xff680f97,0xff8602d1,0x18930661,0x3bc82224,0x650c6590,0x5b8162af,0x66bf59b8,
0x71fb71fb,0x715f71fb,0x5a586b92,0x282e37d9,0x09631b2b,0x0930fe19,0x05541030,0xf2a0f255,
0xce93eefc,0x943d9f37,0x8dee8dee,0x8dee8dee,0x8dee8dee,0x8dee8dee,0x8dee8dee,0xabd58ecb,
0xf6e2ccf0,0x14d40bb6,0x308c1fd4,0x3cc83642,0x4d1441cb,0x58a454ef,0x54f55933,0x6aab5d25,
0x71fb71fb,0x71fb71fb,0x71fb71fb,0x4dff6b8e,0x273825fc,0x1d5131ad,0xe9ae0de2,0xcb9ddd3e,
0xc6e9c6dd,0x9e7eab38,0xcb85af2d,0xc1a3bb94,0xad7db412,0x9b3daf10,0x93f193cf,0x900b938e,
0x8dee8f27,0xb6319605,0x17e8f839,0x23232783,0x1f56235e,0xfdc91211,0x0a31f343,0x103f09a2,
0x23d41d97,0x1fcd26b7,0x43003222,0x603e588b,0x6e406635,0x6c526a3b,0x6ee871fb,0x613c68f3,
0x44e551be,0x1c9d290b,0x0b85134a,0x11270d1c,0x09ad1dc6,0xf4bb03c8,0xa06ecc52,0x8dee92a4,
0x8dee8dee,0x8dee8dee,0x8dee8dee,0x8dee8dee,0xa2ac8dee,0xcb33c27f,0xdbfcd848,0xe91edd0b,
0x19bb024c,0x5a023657,0x627b61be,0x4ac44f22,0x71fb4e69,0x71fb71fb,0x71fb71fb,0x71fb71fb,
0x4bac646a,0x3460374a,0x15141ac5,0xf4c108e7,0xe3b6fd3b,0xdc99dba0,0xae51b249,0xb0cab142,
0xdc46c25a,0xe4b0e258,0xca7ddfcb,0xc81dc1bf,0xc85ed0b7,0x9c7e9bdf,0xa5719cdd,0xbcf2a722,
0xe7a6e365,0xf0c3fc49,0xf5cbf135,0xf9f7fb00,0xef710010,0xff91f2d9,0x054ef957,0x34e02252,
0x53354cae,0x5ad14d72,0x71fb71fb,0x71fb71fb,0x6f3871fb,0x39a058a2,0x29e3309e,0x121f1c60,
0x113b1e47,0x1d881a32,0x0f9a1928,0xfcd4febe,0xc87ce08b,0x8f00a429,0x98c38dee,0x8dee8dee,
0x8e178dee,0x8dee8dee,0x90c88dee,0xc201b78f,0xc9f5c20d,0xf88ae686,0xfb42f39e,0x17da1b73,
0x17ed1155,0x2a750ca7,0x71fb45f3,0x71fb71fb,0x71fb71fb,0x71fb71fb,0x4e0871fb,0x28a93e22,
0x0e341dfe,0x18280ebe,0x18301cc3,0x039015b6,0xdb97e75b,0xcb0fd9c7,0xcb33c14c,0xccafcb4f,
0xb0b8cb7a,0xb53eb409,0xafecb29b,0x91d6a409,0xcf3db0ae,0xe1d2ec38,0xdcedd1ca,0xd951e49f,
0xef96e106,0xfa88fb3c,0xea75e9f4,0xfda2f975,0x1a3a0203,0x35f92d77,0x2be02f48,0x4b9a3949,
0x58a151eb,0x71fb6f95,0x650667d0,0x42355a2f,0x40443b7b,0x40d134c8,0x2d564336,0x408939cf,
0x2d9a3875,0xef4106b1,0xc38edeea,0x95d7ab99,0x8dee8dee,0x8dee8dee,0x8dee8dee,0x8dee8dee,
0x8dee8dee,0xc804aa74,0xc589c984,0xe8f4dd31,0x0e73f788,0x01540a20,0x2de20e8f,0x4c283918,
0x67d35439,0x71fb7038,0x71fb71fb,0x71fb71fb,0x6ae471fb,0x2d433cae,0x10ed19eb,0x1c3e1a8e,
0x0a5d1401,0xe8b5fbd8,0xe63be7ac,0x093f02ae,0xdc35facc,0xc536ca7a,0xaab8c1b6,0xa2519cb2,
0xa7a4ad63,0xbdf7ad7f,0xcae8c7cb,0xd885ce7c,0xc219cc6c,0xf091d575,0xf232f7bf,0x099ef61e,
0xe0c5f447,0xe92ae38e,0x0a69f805,0x30071977,0x367133b3,0x64ee4ad7,0x71fb71fb,0x641971fb,
0x414e4b25,0x35e03489,0x374134ff,0x44c13c88,0x3bcf4669,0x31503829,0x16fa31d5,0xe45a02da,
0xcbfdd5b2,0xaa30c075,0x94f799c7,0x8dee8dee,0x8dee8dee,0x943e8dee,0xb4fba87b,0xb038b474,
0xbe6bb283,0xd2e6c6c9,0xff87e844,0x0a1406d0,0x258314c9,0x46db2963,0x4af25722,0x71fb5275,
0x71fb71fb,0x71fb71fb,0x53aa71fb,0x35ce396c,0x2ab23295,0x1eb02bfb,0xf9a80b3f,0xee36ee36,
0xf4a5f487,0xede9fc15,0xdee4e4f9,0xb698ca86,0xbf37bc59,0xb69db8ae,0xcdedb760,0xd733d7d2,
0xb98ac90f,0xd349c196,0xd264ceff,0xdb7cdd82,0xf2b5e40f,0xf686ee56,0xf633f816,0xf169ecdf,
0x0c40fbaa,0x0e940d16,0x30a21e62,0x3fd93ce0,0x6314519c,0x546361a1,0x513a4a63,0x64d15f52,
0x32355255,0x2206225d,0x16212090,0x2bc2229d,0x1b4b291c,0x059e10df,0xeed5059e,0xc3b7d989,
0x8dee9c7e,0x8dee8dee,0x95898dee,0xb1a1a4f8,0xaacba7a6,0xadc5aa68,0xc15ab142,0xd545cf62,
0xe7a0d904,0x0874f0dc,0x1e87151d,0x41592fff,0x4a2543f2,0x5f2954da,0x61266823,0x5f7b5e92,
0x71fb678b,0x592f6f74,0x25c142ce,0x03761141,0xffcbfc45,0x111b0957,0x190820b9,0xe699f7bf,
0xd2d1e2a0,0xc669c88e,0xaf97c3b8,0xc0edb1d2,0xc6febcf2,0xf229e9e2,0xe975e9b3,0xd2b9e13f,
0xb88fc0cb,0xd635c866,0xf8d9eac0,0xddd0ea3d,0xeceae827,0xf7aaef85,0x12570078,0x1c212356,
0x1b471658,0x26162538,0x2d6f2987,0x425f3122,0x525c4c83,0x60055e8f,0x40c559c2,0x34792cc5,
0x461a453d,0x1b8c3816,0xfe9d0a92,0xf5d6f1e0,0x02a30ace,0xe190ef72,0xb9cfcdd0,0x8dee93b8,
0x919992d7,0x9d4192ea,0xba17b0a6,0xb167b97a,0xb606af81,0xbe84be14,0xd530c5cc,0x02e0e7bc,
0x2aba15dd,0x2b263246,0x3f272f39,0x48373db3,0x580b52ee,0x63e45b8a,0x6ac16f06,0x3a8e552a,
0x1e9e264c,0x24e81ed6,0x1f9220d6,0x0afb1682,0x017d0468,0xe8c2fa63,0xe7dce3d8,0xecf8f513,
0xc975d71e,0xafd3b7e2,0xcf6fc276,0xde94d472,0xec44ea02,0xd37edb4a,0xe072dcc9,0xdce2dff7,
0xdd19e21f,0xbb50cbfe,0xcbcbc024,0xf84bdc24,0x116702c5,0x2d6127d3,0x2b5b30dc,0x240f2677,
0x18fb20a0,0x24ca1a9f,0x4f653cc0,0x41cb4bad,0x5d4a4c6d,0x50a861e9,0x37543d77,0x110e2ac1,
0x152d047c,0x20fb27b3,0xfbff0e5e,0xe0dbf390,0xa6d4bbcd,0xa911a405,0xb858b109,0xbe30bf04,
0xb988c035,0x9cb2ab27,0x96c5958b,0xbdeba69d,0xdd77cec4,0xf702e607,0x0ab20256,0x2c4d1632,
0x46433df5,0x53ed4692,0x4c4b5690,0x3df53c75,0x4b944548,0x54e756fe,0x3e0c4681,0x280c33b3,
0x23452400,0x083714ef,0x07930af7,0x04a30565,0xeb51fad6,0xd97cde70,0xd246d2d9,0xd354cce9,
0xdceadc22,0xcb65d743,0xc3e9c397,0xccc6c4d2,0xef84deea,0xe7f4f2e3,0xd610d7e5,0xd728ded1,
0xcefacdc1,0xe820dc15,0xf46cecaf,0x1aac04af,0x1b2820e8,0x24931f19,0x363b2eea,0x275f2c8d,
0x34352bc7,0x41203baa,0x442b463d,0x4e97491e,0x3d744977,0x3a183580,0x1f4a328a,0x108c14ed,
0xf0a7055a,0xeb5bea1b,0xd2dce595,0xa58cb79e,0xa207a039,0xaca4a6af,0xacc1abbf,0xbe40b236,
0xcbe1cc7f,0xc531c4b7,0xc8f9c807,0xd3cace23,0xf3a5e044,0x16a0061c,0x4cb3326d,0x45384e67,
0x54d04b49,0x47314f13,0x40cb4176,0x40154410,0x27e930de,0x38382ae8,0x3f344294,0x2883356d,
0x0c221c8f,0xed29f960,0xe20ce954,0xe488dcea,0xe888e7b5,0xd164e0ce,0xb9b4c228,0xce4ebf72,
0xe571d76d,0xed4df1f5,0xce6cdc2b,0xdc03d3df,0xe906e5bc,0xe5cfead2,0xcc97d669,0xdc7dce63,
0xfcbaedd7,0x080002c6,0x1f1c1582,0x0fd7192b,0x23f712b7,0x377f33d4,0x31013322,0x4af73cac,
0x3d104a01,0x47913bf6,0x47754bff,0x30984204,0x119e1993,0x07590cb8,0x08700777,0xf7bf0492,
0xd4a3e4d2,0xc7cecd00,0xb541bd13,0xb7fcb39b,0xa91fb346,0xadcca73a,0xc3b6b815,0xd998cc11,
0xdc40de8e,0xd8cedbfd,0xe06bd98a,0xfba5ef80,0x15db0768,0x3c052973,0x4ab0456e,0x62ef57c4,
0x4f375cae,0x3cb3453c,0x3f9d3722,0x32fc3fcb,0x1ab525ac,0x05330df9,0x0f4208cf,0x0f7514fd,
0xf5a80474,0xe879eb08,0xd86ce2d4,0xd442d332,0xd8eed47e,0xe3f4dfb8,0xe184e7ab,0xcdeed7e1,
0xce4ecbcf,0xe3c6d579,0xea00eb3d,0xdc34e195,0xdc8cdae0,0xee27e733,0xe5daebb2,0xebc0e330,
0x0787f802,0x298318b1,0x365331e8,0x39443988,0x262f314a,0x18641b15,0x33a62212,0x547148c5,
0x51c35433,0x34724abf,0x0c961b41,0x01f50611,0x07d30660,0x0068017b,0xf06efe32,0xdf89e428,
0xd4b4dd64,0xc04fc699,0xa856b55d,0x9fa7a0fd,0xb6dca861,0xcd8bc393,0xd0ccd3d0,0xd3c7cf43,
0xf571e246,0x09e70107,0x1b0614af,0x28421d76,0x394c34d1,0x326d32e0,0x43a13bb1,0x48ec46bd,
0x5234502a,0x31c7447a,0x1810243a,0x12a2120d,0x0f4e13d2,0x0ace0bbd,0x0370077a,0xf3b5fe97,
0xe75dede0,0xd6faddb1,0xe298dbe2,0xe49fe5a4,0xd830dfa0,0xd3ccd3f4,0xd28ed239,0xd29bd5b2,
0xd25dcf35,0xe48ddaf3,0x0096f46d,0xef40fdf9,0xe667e5b7,0xe8b0e6fb,0x0806f478,0x20491a21,
0x17e91d4e,0x1c4613c9,0x25942709,0x2b9725fa,0x34942fd2,0x338334ed,0x3bdd384a,0x3ccb39a3,
0x39313d65,0x2917344b,0x0b5219b3,0xee91fbb0,0xe780e8e3,0xd837dfac,0xda21d7ad,0xc3ddd376,
0xbb54b9dc,0xbea6bf22,0xc0f4bdcf,0xb41abd3c,0xbc8ab395,0xe1a9cd24,0xf2c7ed68,0x07b1fa6c,
0x16971272,0x1f9c1a66,0x1e961ebd,0x2341232c,0x34ad26e4,0x495141a9,0x432b49bd,0x2e3f3a18,
0x30e129af,0x2e2b34ba,0x20a52414,0x190f1e6b,0xfeff0ca5,0xeccaf9a3,0xce78da18,0xdb19cee3,
0xe260e2a1,0xeb8ce45b,0xe9abed09,0xdee9e38c,0xd54bdab3,0xce85d249,0xd3a6d031,0xe43adb17,
0xf74aeb81,0xf788fcba,0xe8c5ee92,0xf2b5ebac,0x01fcf8cb,0xfc2702a7,0x0951004a,0x1b6111b6,
0x2a8f25fb,0x26ef2b1f,0x2d20265b,0x3c2c3492,0x508046ff,0x425a501a,0x1fd02e4b,0x15a41956,
0x109812c0,0x036c0b94,0xf826fed7,0xdd74eb6e,0xc1eece9d,0xca5fc19c,0xdaced49d,0xdcb9de22,
0xc275d187,0xbb29b94b,0xc21fbec4,0xcf2ac65e,0xd61bd546,0xe747daee,0x0b00f851,0x1ec81883,
0x23a61f96,0x2b0d291a,0x364e2e2b,0x3ce03a4e,0x47744428,0x38244383,0x25fc2b12,0x1efa22ca,
0x282d227f,0x1ba02434,0x10211925,0xf71200e0,0xe01aee72,0xcdced15e,0xcfa7cf10,0xd901d200,
0xed86e2b1,0xfc5ef82b,0xf690fa8d,0xe370ed5f,0xd8e3dceb,0xcd47d44d,0xcf36c8bc,0xde51d9e0,
0xeac4e28f,0xfda9f1d0,0x0f330af0,0x091907e4,0x12911214,0x17291077,0x18281c7d,0x1c34172d,
0x33b62440,0x44b443b1,0x2318339c,0x23be206c,0x2f1d28e6,0x2ea030fa,0x24682c5b,0x01561436,
0xef77f566,0xec5cecf6,0xe8a7eca9,0xdcb0e10b,0xd9bbdbc1,0xc92dd25d,0xb80fbe7e,0xc384bbad,
0xccb5c9e2,0xc265c741,0xd26ec67c,0xee88e318,0xf9c1f2e9,0x161406dc,0x29eb2356,0x26ae2902,
0x2bdf26ae,0x367e3427,0x41c13b57,0x3dde4172,0x27203534,0x175d1a9c,0x1ed91ca0,0x1c901cd4,
0x0e161a10,0xf9e901ba,0xf708f54d,0xfca4fc1e,0xeab4f52e,0xd1c9dff6,0xc33cc406,0xde12ce31,
0xf53cebd2,0xf0a8f425,0xe02feb63,0xd6d9d66b,0xdd7ddc99,0xdfc5dc5f,0xe8ede71d,0xf136e75a,
0x0870000e,0x13840d02,0x1b491af8,0x0f6b15da,0x0d160cd6,0x17bf1244,0x169b1634,0x1a141814,
0x27fd2132,0x34ed2cb2,0x47144120,0x2f453e8a,0x1acb2305,0x0e2a1356,0x0b1f0beb,0x023b0a0e,
0xdb17f0f9,0xc9d6cc05,0xca00ca68,0xd1b3cd38,0xd32dd381,0xcfa2d390,0xc3bfc7d9,0xcbcdc7b8,
0xd261cd61,0xe365dafb,0xef5fe9a7,0x0eedfd0a,0x280c1ef7,0x1ea52580,0x18951a5b,0x27891c48,
0x36c432b9,0x30d53522,0x319c2f88,0x346933c0,0x27672f8f,0x1caf2368,0x09b80fe9,0x0e850ceb,
0x05a30a9a,0xf48efeda,0xd811e68e,0xcf1dcfdf,0xd6c9d292,0xdf40da38,0xe550e2ff,0xe543e629,
0xe26fe2af,0xedeae83f,0xf33ceef7,0xfa90fa11,0xe9c6f30b,0xe7c4e5ed,0xee36ea0c,0xfb28f63e,
0xff81fbc9,0x0a2d045b,0x18ea115a,0x24e520c2,0x1d4721e6,0x1adb1b6a,0x2a621fd9,0x36843451,
0x2a4a309c,0x2b3d2991,0x219d279c,0x16dc1c8b,0x0a301003,0xfcee054e,0xeca0f382,0xe181e590,
0xdd74e16f,0xc7f0d487,0xc49ec12a,0xd4cbccc2,0xdb17d96f,0xe06ade1b,0xd52cdced,0xc9d2cc0e,
0xdac7cffa,0xfc8beacf,0x14130a6d,0x18b21861,0x145c1579,0x2a0d1d9a,0x368d3163,0x3ad63a70,
0x38dd39b5,0x35e937ed,0x2e363237,0x20bd29f2,0x0cdf15e6,0x01a80653,0xf826fe0a,0xe5c3ed8d,
0xe7abe4da,0xe34ce713,0xded2e029,0xe817e1c7,0xef77ec13,0xed20f1c8,0xe008e571,0xe3dadfac,
0xe51ee609,0xe3f9e3a4,0xf03ae936,0xed69efd5,0xf903f1dd,0xfeb6fe32,0x015dfdb5,0x075305fb,
0x0ead09ea,0x12a91225,0x14061207,0x203d197d,0x33d22969,0x30ee3758,0x29302a13,0x21f92a31,
0x0fd115dd,0x08a40c9c,0x0dd807f1,0x107f1372,0x0dd80cd3,0xf8cd07db,0xe720ec13,0xd671e2e1,
0xc3dec87e,0xcde2c83f,0xccdbcebc,0xcd7dcbfe,0xc8b5cd24,0xcdc1c788,0xeab9da0d,0x035ffa2d,
0x0162046c,0x01c2ffd9,0x1c9a0b7d,0x359c2cbd,0x38cf381c,0x365e38cf,0x2ed7328a,0x2415291a,
0x21ad22e6,0x1e7e203d,0x1bae1d2f,0x10761825,0x026a07be,0xf9b5fd5b,0xef12f56d,0xe5f3ea3a,
0xdc6ee051,0xe660de9b,0xf1e9eee5,0xe5c3edcf,0xd3eadb45,0xdc9ed419,0xef1ce862,0xeccbef5f,
0xecbbeb29,0xf174ef0f,0xf709f353,0x08dfffc4,0x0d1c0d5f,0x09570ad5,0x07dc0927,0x04aa0472,
0x02e00502,0x0ce50472,0x173a14f9,0x21a319e0,0x39f92d17,0x429f443b,0x228e34fb,0x0a5e1247,
0x092d0926,0x0d1c0a24,0x01db0a9d,0xf908faf8,0xf951f9f8,0xf37ef6ee,0xd69fe9f0,0xbf60c61b,
0xb95cbc30,0xbad2b8f7,0xcdc2c10d,0xe3d4db37,0xec1be79a,0xfc9ef483,0x02c80107,0x0aa6057c,
0x184d12a5,0x10b315a1,0x14a20f6c,0x28f71e8d,0x32cb307a,0x347d32a8,0x36bc3774,0x284530a8,
0x1ebb21cb,0x115c1984,0x0a270c81,0xffe804e9,0xf26bfb7c,0xdd25e61f,0xd951d94a,0xdf5adb7a,
0xe43be28c,0xe1d0e3c6,0xe946e341,0xf071ee33,0xeefdf04e,0xed16ee3b,0xeb5deac0,0xf94cf08a,
0xfdb8ff50,0xf971f89b,0x03530013,0xfb43ffcf,0x01a2fc31,0x054004e6,0x0b970674,0x0c3f0f9a,
0x09880842,0x1c031091,0x3384294f,0x35a2385b,0x2f1d3130,0x25c02b66,0x1e8d2258,0x06f41555,
0xec47f767,0xeafae971,0xf518ef46,0xf38cf75a,0xe9cbede6,0xe239e584,0xdeeae1d2,0xcb4fd6fd,
0xbd3cc068,0xcc5fc254,0xda10d4f3,0xe65bdf57,0xf758ef95,0x05acfd42,0x150e0f75,0x148815a1,
0x19fa1551,0x2c84222a,0x321c337b,0x2dbd2e4a,0x33802ff5,0x30da34f6,0x220628c2,0x1ac91e4c,
0x0a1e1406,0xf3c7fea5,0xea50ed51,0xe5fce807,0xe393e2ff,0xe990e7bc,0xe126e65b,0xe405df2f,
0xf3d9ec9a,0xf58ff6eb,0xe84ef022,0xe45ae2c4,0xf353ebc6,0xfb0ef8f1,0xf4bdf8bb,0xedc2efd2,
0xfab5f238,0x07f40309,0xfdfb04b1,0x0328fd4f,0x0ca208f0,0x10c50ec5,0x13f51365,0x175f1447,
0x1a5e1a7d,0x21b81c2a,0x295d270a,0x26332939,0x17ed2037,0x04920d54,0x06b70317,0x0fdb0c6f,
0x023b0be2,0xef2ff7ac,0xe842ea8c,0xe39ee529,0xdef3e32b,0xcc6cd6bb,0xc0b1c2ef,0xce68c63e,
0xd69dd560,0xcf10d1fd,0xe491d530,0x02eaf42b,0x1ba1125a,0x1fae1f1b,0x1f0d1f74,0x231b1f99,
0x2d282883,0x2dfc2ed0,0x30ab2e3c,0x281c306a,0x13c11c8f,0x0f0a0eb0,0x161213a5,0x0b6712da,
0xfafb0207,0xf519f752,0xe722efce,0xd9c1df23,0xdba3d8c7,0xeca6e2aa,0xf5d8f3d0,0xedddf3ce,
0xe53de6dc,0xe7cae7af,0xe967e625,0xf5dbf0da,0xfb80f847,0x0196feb5,0x04e10397,0x03c50524,
0xfb23ffc5,0x0181fb09,0x0e0a0a82,0x0095088c,0x01c2fe8e,0x083105bd,0x126c0ba5,0x25411c16,
0x28d229a1,0x25b82764,0x1c9b2133,0x1b471b0f,0x19ba1b35,0x11f816e0,0xff540a0e,0xeeebf568,
0xefc9edd4,0xe71fee9c,0xd170dc92,0xc39ec8fd,0xc999c34c,0xda8ad2ce,0xda60dd6b,0xda24d75f,
0xeb64e0e6,0x00fbf753,0x024c04db,0x0449003d,0x10f90aa7,0x1ff7186c,0x2dc326df,0x37fe3417,
0x340e3846,0x25322da3,0x18a81d22,0x17fc1724,0x1320181f,0x05480b5c,0xff8e0216,0xfde6fd55,
0xf814fe57,0xe232ecd1,0xdbc8dc62,0xdc56dcde,0xd8d0da0a,0xe2ccdbf3,0xef18e936,0xfd49f5fc,
0xff100076,0xfd52fbc6,0x01660218,0xf7ccfae5,0xfaecf988,0xfc31faee,0xfddefddd,0xfeb5fd29,
0xfcdbff97,0xf6fdf944,0xfb08f739,0x1027044e,0x1a1317ed,0x1a0919c0,0x267e1e7e,0x301d2e1d,
0x232a2bdf,0x14791afd,0x111010ec,0x0ab50fc8,0x018904c6,0x001f00fe,0xf727fc1e,0xef0bf3b5,
0xdbb1e605,0xd65ed63e,0xd5dbd704,0xd1f7d3e4,0xcd72d03d,0xd0e4cc73,0xe63cd9bb,0xfe42f4ad,
0x027f015f,0x01cb0291,0x03760195,0x0fea08dc,0x2121175d,0x35c72c5c,0x3bb23acc,0x38f33ac5,
0x30933505,0x23b92b79,0x0ac3188d,0xf25afd0c,0xef34ecf1,0xfe07f794,0xf6bdfc92,0xe99bf0a8,
0xe393e346,0xeb3fe818,0xed63ec42,0xea0ced84,0xe374e5a2,0xe6ffe3b4,0xf94dee77,0x08e0030a,
0x068909b0,0xff5602d5,0xf7eafb40,0xf662f6a7,0xf26bf4ec,0xf4dcf20d,0xff90f9e6,0x06e5041d,
0x0b7b09d2,0x0c020b93,0x08000bd4,0x08d00478,0x1fa21495,0x266c25d2,0x19a12118,0x158b157d,
0x1ba617a4,0x1dde1f28,0x0c28165b,0xfc73028f,0xfe23fc27,0xf8a7fd03,0xef61f3c9,0xdd39e7e6,
0xcb6bd30d,0xc957c82a,0xd0b3cd30,0xd22dd1de,0xd788d381,0xe748de68,0xfe35f27c,0x0718055f,
0x0e730919,0x17d01455,0x21901be0,0x2a91262f,0x2c402d04,0x299529ec,0x2ce82b1f,0x2c312daa,
0x1b7026c3,0xfcb60ba8,0xef8af2e7,0xf587f1ea,0xf468f712,0xe87fed88,0xeec9ea30,0xf47af1bc,
0xf712f79c,0xe818f073,0xe246e2f7,0xe8dee4f9,0xee6beb8a,0xf8d1f379,0xfd18fc7c,0xfb6cfb49,
0x071e003a,0x10580cd9,0x098b101a,0xf13cfd69,0xf1a8ed29,0xf6c9f630,0xfb0ef801,0xff51fcf7,
0x07d40395,0x0f150b8d,0x1869131c,0x19441b9a,0x1af11708,0x2266205c,0x27ba249f,0x1b702510,
0x0ec812d6,0x08e20b7d,0x08fa08f6,0xfefb05af,0xe813f480,0xd4e2dcca,0xd36ed1c3,0xd920d7bb,
0xcefbd4c5,0xca49cb19,0xd8b2cf3f,0xe8abe120,0xf995f160,0x0521ffc3,0x0ea00a7c,0x0c3a0e75,
0x14500d53,0x25f51e47,0x2b31295d,0x28172b40,0x251c24ca,0x299f2859,0x1e892676,0x08b01300,
0x070a0589,0x0107060a,0xf881fbeb,0xeb88f343,0xdf40e3cf,0xe146ded7,0xe64ee3e8,0xef3aea63,
0xf260f1a6,0xf3b9f2c5,0xf561f4ec,0xf88ff658,0xffecfc2f,0x010401c6,0x03cd0113,0x05bb0678,
0xfc79014d,0xf95df9e5,0xf790f8a5,0xf808f76d,0xf737f823,0xfaa1f764,0xfb23fc80,0xff10fb4d,
0x0eb40572,0x23f71a3b,0x29c42965,0x236326fc,0x1f9920e0,0x1b1e1e6c,0x0df1145c,0x0eab0c9c,
0x0a890e96,0xfbe903f7,0xeb29f319,0xe6cce6d6,0xe76ae801,0xdabee334,0xc84ed028,0xcbdbc6e3,
0xdd74d454,0xe6eae418,0xe586e5ed,0xf359e9e7,0x060afdd6,0x0f910b65,0x16671389,0x1b8c18bb,
0x21a71ec6,0x2add24e3,0x37783244,0x316437a5,0x1bf126c3,0x0c0d1301,0x01c006f4,0xfac1fd35,
0xf3eef830,0xf046f0fa,0xebd6eefd,0xe85be955,0xe486e6e5,0xe6e3e455,0xee61ea2e,0xf674f314,
0xfeb0f98a,0x07ac0454,0x04c406f4,0xfea90288,0xf580f951,0xfba7f698,0x0001004b,0xf6f7fb28,
0xf50df5ed,0xf441f356,0x0084f9c1,0x05e60513,0x0004031b,0xfbe9fe5c,0xffd9fb2f,0x106d0882,
0x1adc1664,0x1e9e1d40,0x24262132,0x252b25c9,0x212f23bf,0x11d01b25,0x05bb0995,0x022d04bb,
0xf566fbd4,0xf3aef32c,0xeacff09e,0xddb8e4aa,0xd142d60c,0xd107d0e3,0xcc4ecea5,0xce7ccc11,
0xdee7d478,0xfa53ec91,0x08c903e6,0x0cdc0b00,0x12f20f15,0x1c69183e,0x20f61e4e,0x2a4d25c9,
0x2e862d1f,0x27df2cc4,0x1d6322bd,0x124e179a,0x07300cf7,0x007e02c0,0xf5c9fcf7,0xeb54ee95,
0xecb9eb4c,0xf2e3f01e,0xeed7f1c2,0xebf5ed08,0xec41eb00,0xf2fff054,0xf11cf25e,0xf798f277,
0x041bfebb,0x07be06d3,0x0724079c,0x0553069d,0xfe8702e0,0xef22f739,0xecacea64,0xfdb0f561,
0xfc5eff3d,0xfb53fabc,0xfa22fafe,0xfd1efa76,0x0681018f,0x0b1e09d1,0x0c440bba,0x103f0d4f,
0x1c7c159b,0x291d2393,0x2bb62c6e,0x22fd2731,0x1be7202e,0x0bc41542,0xf3a20038,0xe2f0e88f,
0xe649e3fa,0xe108e517,0xd72edbfa,0xd5bbd439,0xda85d9c8,0xd1cbd5e6,0xd948d350,0xebcbe19e,
0xfbcff577,0x06550044,0x183f0ee4,0x20441e9b,0x1c4c1ec0,0x1be51a40,0x27972221,0x254a27ba,
0x221e23cc,0x18a51deb,0x11301450,0x086d0de6,0xf8130076,0xf083f2b9,0xf244f0bf,0xf0ccf30b,
0xe884ec76,0xe51be5ba,0xea19e726,0xf136ed0b,0xfbb4f6eb,0xfea0fda7,0x035500ef,0x03340386,
0x05fb0435,0x04b5062c,0x01fd02ae,0x01c6024c,0xf7d1fe1a,0xedc6f1c7,0xe850eaa8,0xed8fe895,
0xfe2ff670,0xff7400cd,0xfed7fe1d,0x078601c4,0x16860f30,0x1b771ab9,0x184a19b6,0x1ab118fa,
0x1ec71c8b,0x226420e2,0x208d22b8,0x12ae1b29,0x017d08d7,0xfc30fe5c,0xeed0f737,0xda7fe509,
0xca49d070,0xd3b3cbe0,0xe184dc74,0xdef0e1ba,0xdabfdbf3,0xe2aedcab,0xf232eac2,0xfeb5f8b9,
0x093f0497,0x0def0bab,0x1c4513c5,0x286a233d,0x2d152c17,0x26fd2b2f,0x1d1821c1,0x1c211b73,
0x16141b16,0x06ef0ece,0xf7acfee0,0xf1d4f37b,0xf13af15a,0xf05af131,0xeb7bee16,0xea08e9fc,
0xee9febd2,0xf343f17d,0xf42cf3b0,0xfba1f6f9,0x04a10034,0x0ce208ff,0x0b5a0e08,0x03860737,
0xfd280050,0xf694f9f1,0xf43cf4bb,0xf0c3f2da,0xf437f0d9,0xf86ff7f5,0xf5eef6ee,0xf460f551,
0xf574f367,0x05affc21,0x16580f3f,0x175f18e1,0x159e1598,0x1a211732,0x247b1f0f,0x22d1265b,
0x16de1cd8,0x0fcb128a,0x0cf10e76,0x09b70b3d,0x00f40713,0xe488f4b7,0xd177d758,0xd834d2d2,
0xd95fdbaa,0xcc41d2bb,0xcd23c989,0xe3a3d6e3,0xf8b8ef61,0x01baff04,0x03860272,0x0bdc069c,
0x185d11fb,0x23681ee8,0x237f245a,0x22ff22f8,0x22c022dd,0x22a222e1,0x1d6a2147,0x06c714cb,
0xf1a1f901,0xf168f0b0,0xf43af20f,0xf808f758,0xf1fef56e,0xec41eefa,0xec96ead8,0xf57df0cb,
0xf8c2f889,0xf76df788,0xfdd5f9bb,0x0597024d,0x067706b5,0x07cc067a,0x09850936,0x00ac06ec,
0xf47af96c,0xef6bf1b6,0xeb5becd1,0xef2eec4a,0xf5f6f282,0xfc4ef9d6,0xfa0afbe5,0xfb6df9ac,
0x0189fe7b,0x09130490,0x1a5510c7,0x25ec222a,0x24a8264f,0x21082288,0x1cb61f72,0x172019ae,
0x100613f8,0x08520bdc,0xff8704b5,0xee8cf808,0xdc86e483,0xd9f2d8dc,0xdd07dcab,0xd1cbd8f8,
0xc9aacadf,0xdb89d05b,0xed68e641,0xf420f0ff,0x0376fa4b,0x15e70dd1,0x1a3319d4,0x1bf51a84,
0x1c821ce4,0x19d31b3c,0x1b1a1977,0x20241e1c,0x1e322029,0x14b01aa2,0x04d30cc4,0xfa3bfef3,
0xf1c2f5b0,0xec69eeea,0xe8f0ea2b,0xedb9ea1a,0xf3b0f136,0xf9a0f621,0xfca5fca1,0xf6d7f9da,
0xf806f5a5,0x0355fdcf,0x07f90674,0x0ac8099e,0x0a1a0b13,0x034f073a,0xf9ecff4b,0xf016f393,
0xf16df098,0xec0aef18,0xede6ebd3,0xf098efa2,0xf4acf204,0xfc4ef871,0x04cb000e,0x0f0c0a4e,
0x14071234,0x17df1592,0x1cdd1a82,0x252b1fa2,0x2e692c04,0x1e3628f9,0x0a391256,0x077e0755,
0x033406f5,0xf41ffc1d,0xe75ced6d,0xddc0e1af,0xddbddd08,0xdae0dd67,0xd2add676,0xd616d23a,
0xe46fdd21,0xeec0e9d8,0xf9a0f42f,0x03b8fe94,0x0f55093f,0x1d5515dd,0x2cb225f5,0x268d2d09,
0x17da1de7,0x16db15cf,0x1a411944,0x12811826,0x025e0a9e,0xfb3cfc83,0x01ebfe8d,0xfc64018f,
0xeb26f463,0xe048e388,0xe995e299,0xf93bf29a,0xf9c8fb16,0xfd6cf9d1,0x05650258,0x05dc05c8,
0x05c1064a,0x02a203b5,0x050f03d1,0x019903c5,0xfee70044,0xf93bfc7d,0xefeef489,0xedecede6,
0xeb30ece0,0xecb9eacf,0xf3caf012,0xf7eff646,0xff63fab3,0x08360417,0x0f270bc3,0x17141272,
0x23391d30,0x27fd270f,0x1f86256f,0x142018d1,0x14cc12d3,0x19d918b5,0x0cb215d4,0xf50800ea,
0xe891ec66,0xe90be863,0xe221e7c7,0xd0b7d926,0xcf5acd58,0xdb5cd4d9,0xe5c4e13a,0xea43e86c,
0xf121ecb5,0x0066f82f,0x0df007e2,0x17ed1332,0x1e6b1bcb,0x1efa1f43,0x1e791e79,0x21131f4a,
0x239a233f,0x13801ed3,0xfb3005a3,0xf88df72b,0xff74fc31,0xfa92ff38,0xeefdf3d3,0xf09eee23,
0xf66af3f0,0xf5abf718,0xf18af344,0xf18cf0c2,0xfcb6f58b,0x093d0400,0x0e760c62,0x0e620f3f,
0x08940bfd,0xff130405,0xf69efa4c,0xf449f4c1,0xf443f47a,0xf1dbf337,0xeffaf0cf,0xedbfeea1,
0xf32eef5e,0xf72cf667,0xf7a1f6cc,0xfe1dfa15,0x081502df,0x11640cfd,0x1c391619,0x29b023ed,
0x27852a67,0x22112468,0x1d3b1fd9,0x12e519b3,0x00d00972,0xf823faee,0xf928f811,0xf3bdf863,
0xe346ec34,0xd360da50,0xd2add099,0xdceed7c0,0xe12de011,0xe2a0e166,0xee3ce687,0x0026f7f3,
0x086c0558,0x0d840ad1,0x17431190,0x1f991cbf,0x1eb01fa5,0x1e9f1e29,0x1f4d1f78,0x18031d03,
0x0a361117,0x02700576,0xfbcefffe,0xefbcf5e4,0xec9bec1b,0xf650f0f1,0xf733f8d3,0xf1a9f392,
0xfa02f456,0x00ddfee7,0xfbfcff75,0xfa63f95f,0x02aafe60,0x099b066b,0x0bd70b7d,0x0a550b6d,
0x049207cc,0xfcc300df,0xf2c9f7b0,0xe618eca3,0xe296e1bb,0xeea4e7e6,0xf7adf463,0xf71bf840,
0xf7dff67f,0xff69fb51,0x05730324,0x095406ef,0x15870e6a,0x20491c33,0x236d2224,0x251c24b8,
0x238b24b8,0x1b3520c9,0x0b60139e,0xfe8e03e6,0xfa49fc15,0xedb8f5b0,0xdf4ee4fa,0xe18dde71,
0xe434e478,0xdb87e084,0xd6f4d7ba,0xddd6d960,0xe95ee321,0xf7ddf0a9,0x04fefe6c,0x10600b23,
0x16bf145c,0x185717d2,0x17691830,0x1b6a1823,0x21d71fe0,0x1ac01ffb,0x0d8313f0,0x05e50913,
0xffc502fc,0xf5edfb37,0xef8cf119,0xf2ecf0e8,0xf145f302,0xf1edf012,0xfb42f658,0x0087ff05,
0xfce8ffb5,0xfc97fb18,0x065c00cb,0x0e210b73,0x08700ca8,0xff990340,0xff81fe31,0x01fe015b,
0xfc2e001a,0xf1c6f700,0xe77cec56,0xe722e586,0xed0dea7d,0xf0c2eecc,0xf80df3d3,0x0019fc9b,
0x04c8025a,0x0c620867,0x11040f27,0x148b12b1,0x197d16b9,0x24651e68,0x27c0282a,0x1fe2246e,
0x14641a95,0x085a0dde,0xfebc03b5,0xf285f8d0,0xe4a9ebb2,0xda29de1f,0xda23d929,0xddfedbee,
0xe391e0ab,0xe7d3e611,0xe9bde91b,0xed8feab0,0xf938f2c8,0x0680ffdd,0x11330c9c,0x14fd13a4,
0x1a16170d,0x1df21ca3,0x1e8d1e9e,0x18831caf,0x0e2812e5,0x0bf00be8,0x08430bb6,0xf92f0178,
0xee6ef220,0xf176eeb0,0xf27cf31a,0xf14af0e0,0xf9f7f4d0,0xfe53fd98,0xfda9fd83,0x0195ff42,
0x050f03a1,0x05c605af,0x074a0611,0x08e40899,0x06370849,0xffa90305,0xf823fc4c,0xf0dcf3a5,
0xefa2f02b,0xe9f3ed48,0xeb83e8bc,0xf393f025,0xf399f4a5,0xf169f1d4,0xfac5f45a,0x0c22030e,
0x18691412,0x181618d3,0x1ab818cc,0x1f2c1cf9,0x217920f9,0x1b9a1fb7,0x11481655,0x0d210df7,
0x0ada0d16,0xfdf90576,0xed1df594,0xe096e5d1,0xdd0fdded,0xdededdbf,0xde1edf0e,0xdcf9dce2,
0xe32aded2,0xf2e8e9ee,0x0385fc46,0x05a5069c,0x03d103d5,0x0a6f062c,0x15620fa3,0x1dd91a8a,
0x1a841d97,0x17021788,0x188d1810,0x14181777,0x06e80e44,0xf8a6ff4a,0xf342f480,0xf4c6f3fb,
0xf2acf47a,0xee69eff4,0xf5eaf071,0x012ffc97,0xffa301df,0xfdb0fd44,0x043500e8,0x05e70594,
0x0a49073a,0x0df40d58,0x05560ad7,0xfd5e0050,0xfb49fbf9,0xf7aafa3a,0xececf2d0,0xe4e7e7ef,
0xe832e4cf,0xf424ee51,0xf774f737,0xf600f64f,0xfe67f8ad,0x081c0492,0x07130838,0x09510727,
0x139e0d58,0x23f11bb0,0x2c242a46,0x217f28db,0x10bf1883,0x0adb0c2b,0x0bff0ba2,0x04470a0b,
0xf226fb79,0xe793eb3a,0xe600e64e,0xe306e52d,0xdc5edfc4,0xd9c1d9f5,0xe05adc13,0xed4ae636,
0xf98bf46e,0xfda1fc11,0x05900082,0x14250c83,0x1ba619eb,0x140018e6,0x0e150fa0,0x112a0f2a,
0x15931313,0x15ea173a,0x0cc11165,0x074a09bf,0xfd6a034a,0xf1cff6f9,0xeb67eddf,0xec7aead3,
0xf62df07a,0x0086fc39,0x01bb0250,0xfedafff5,0x0478004d,0x0b2008f2,0x068a09f3,0x008f02e3,
0x00ccfff5,0x05350317,0x049905d7,0xfbb70151,0xee7cf4b6,0xe897ea64,0xec11e938,0xf02eef06,
0xef4ceff4,0xf0c7ef34,0xfb83f55a,0x04e900f4,0x076f0709,0x09940787,0x12fe0e0e,0x1bbf17aa,
0x20241ee0,0x1fb6200d,0x1ee01f72,0x19661d1d,0x0c7c135b,0x0066063b,0xf4c3fa6e,0xeb58efc6,
0xe6a5e80d,0xe774e6fb,0xe585e732,0xdf32e26c,0xdfd2ddd5,0xe918e46d,0xeff8ecb2,0xf763f3aa,
0x0159fb9c,0x0e53085c,0x15541253,0x183e179a,0x15f91708,0x14d415c4,0x0e21120d,0x0a0e0b6d,
0x07e20930,0x064306d1,0x05f70667,0x01380435,0xf9b2fd80,0xf335f664,0xeef3f072,0xf1b6ef67,
0xf7ccf4c6,0xfeddfb27,0x046c021a,0x08b7066c,0x0ad70a8f,0x092f0a0c,0x07550886,0x020f04ff,
0xff320002,0xfc77fe54,0xf5c2f960,0xedecf1a3,0xeaa2eb9a,0xea9bea77,0xeb12eab4,0xf034ec69,
0xfb8ef5c4,0x03bc0039,0x05db057e,0x078b062c,0x0e530a49,0x188313a4,0x1d4c1baa,0x1f321e73,
0x1d101f04,0x15aa198e,0x0f481231,0x097b0c66,0x00fd0629,0xf15df972,0xe690eac0,0xe5dce4e7,
0xe6d9e741,0xe2f1e4ba,0xe37fe284,0xea03e605,0xf1faee8a,0xf472f3be,0xf69ef540,0xfe4ef965,
0x0dfd0594,0x1a6f1548,0x1a831c30,0x127b1670,0x11241098,0x12f2125b,0x0fc5124d,0x03950a83,
0xfad4fdaa,0xfcf4fb37,0xfeb2fe7a,0xfa8dfd1d,0xf5dbf7fc,0xf577f4d0,0xf9ccf7cc,0xf910fa05,
0xfb8ef91a,0x0448ffcb,0x0bd70882,0x0e650e03,0x0a940d10,0x05210799,0x012f0331,0xfbbafed5,
0xf3a9f816,0xeca6ef90,0xebb2eb83,0xee33ecc7,0xf054ef96,0xf04ff058,0xf571f1d4,0xff79fa90,
0x03e302b0,0x054d0438,0x09f90735,0x12190dbb,0x19e81656,0x1da31c70,0x1ad31cd1,0x18121911,
0x16fd17d3,0x0eea1424,0x004b07db,0xf3a9f91f,0xf118f125,0xf1acf220,0xe8e4ee56,0xdf80e35a,
0xe096de62,0xe781e45b,0xec4be9b1,0xf215ef1c,0xf8cdf513,0x009cfcc0,0x07f4043f,0x0ef60bc6,
0x121c10b5,0x16bd1442,0x18321832,0x146e170a,0x0bab106c,0x04c207ac,0xff870251,0xfc00fd33,
0xfb11fbb0,0xf764f95f,0xf76bf65e,0xfe59fa77,0x01f50129,0xfe4e00ba,0xfb37fbd8,0xff38fc97,
0x01b9011b,0x019f017f,0x050d02f3,0x0a1707d0,0x09fb0b1a,0x034f071e,0xfc27ff8b,0xf40ef863,
0xeccbefc3,0xe94aeabe,0xe8efe895,0xebdee9f4,0xf52eef7d,0x00fefba3,0x03aa03bc,0x01b50222,
0x07d403c5,0x0ee60c13,0x11201030,0x161212fe,0x1d3919ea,0x1e341ec4,0x19df1c66,0x128a16dc,
0x06470cf1,0xfb2c003e,0xf3aef72f,0xed79f093,0xe78eea52,0xe4aae595,0xe75be534,0xebebea34,
0xea4beb92,0xeb59e9a1,0xf526ef7d,0xff63facc,0x058e02c2,0x0b740855,0x11090e96,0x11d6121d,
0x108b1141,0x0cfa0f28,0x0b8a0b5e,0x0df20cf4,0x0c200db8,0x024c0831,0xf9bffce7,0xf92cf8f5,
0xfb24fa11,0xf9a7fb24,0xf6a1f7d2,0xf9f0f742,0x0291fe60,0x057c0519,0x032a04d3,0x000a010f,
0x04170127,0x05db0629,0x01f103da,0x00c600eb,0x023b012f,0x005d025d,0xf74ffc65,0xee16f277,
0xe7edeaad,0xe6a9e673,0xec1ce8bc,0xf45af00e,0xfcc9f878,0x0613014d,0x0dd30a32,0x13351130,
0x112912f4,0x10700fe0,0x158f12a5,0x1984181a,0x185c1974,0x13c4168d,0x0bb9100e,0x02bf072e,
0xfa78fe90,0xf1e6f64f,0xebdaee25,0xe9b1ea7d,0xe84ee8e3,0xe7b2e7b7,0xebc6e912,0xf197eee5,
0xf4dcf39a,0xf48df4f1,0xf800f510,0x03ccfd4c,0x0edf0a0e,0x13951225,0x121d1325,0x11ce11ad,
0x104c1147,0x0cea0f0e,0x05a50995,0x01e702f3,0x00fe01b5,0xff04ffef,0xfca9fe79,0xf650f977,
0xf558f4be,0xfb11f7b3,0x0078fe42,0x01950176,0x001600b2,0x04e9012d,0x0c840952,0x0a920cea,
0xff8d057e,0xf9a9fafb,0xfd09fb35,0xfcc3fda2,0xf8fffb37,0xf47af66a,0xf2e3f392,0xf086f1c2,
0xee04ef4d,0xed9aed28,0xf260ef83,0xfd03f6e6,0x091103a7,0x0e2c0c53,0x119e0fde,0x15c913ab,
0x185c1775,0x155417a4,0x0fba123b,0x0ef40ede,0x0eff0f52,0x0a760d72,0x0234066e,0xfb2ffe53,
0xf508f86a,0xec31f093,0xe75ae8f7,0xe72ce6e0,0xe859e7c4,0xeb44e96b,0xef47ed6d,0xf307f0e6,
0xfb53f676,0x058b00ba,0x0ac008c8,0x0d160c0e,0x0e4e0dd6,0x0fec0f1e,0x107f109a,0x0dab0f5f,
0x09e70bf6,0x02f60699,0xffd4008f,0xfe1eff54,0xfc39fcab,0xfe39fd05,0xfd06fe47,0xfaf3fb8f,
0xfb8efb21,0xfdcffc70,0x00caff8e,0x03aa021b,0x074c05b8,0x06ae07a3,0x033a04e6,0x01b1024d,
0xfe91008d,0xf9f7fc52,0xf5f5f782,0xf58ff5ad,0xf3b7f4a9,0xf535f401,0xf679f614,0xf6c9f6c9,
0xf34bf556,0xf22cf1c6,0xf9f0f4bf,0x04a9ffec,0x0907076f,0x0fd70bb8,0x1a7c153d,0x20bb1ee2,
0x1b341f61,0x117715f2,0x0bc30e2f,0x06870920,0x018603de,0xfcc9ff26,0xf753fa38,0xf266f478,
0xeffaf12a,0xebecee3c,0xe8b7e9e7,0xe918e86e,0xee32ead5,0xf4dcf1f5,0xf6eff627,0xfc70f8d1,
0x04c700c1,0x0b490822,0x10ea0e41,0x104611c1,0x0a3f0d06,0x097208ed,0x0b5e0aa5,0x088d0ab9,
0x023b0551,0x01fe0104,0x03f303ba,0xfe5001c0,0xf8a5fb09,0xf89df7b8,0x0002fbd8,0x021402b9,
0xfa4cfe69,0xfa65f893,0x0317fea0,0x093906fd,0x087909bc,0x02fd0607,0xfdf9001c,0xfdd4fd3b,
0xffa0ff14,0xf9a6fdd6,0xefc3f458,0xee11ed4a,0xf51bf160,0xf5bff6a5,0xf331f406,0xf630f400,
0xfde2f9af,0x04e6020d,0x04210585,0x02ea0270,0x0eb90717,0x1d1616f6,0x1ec61f7b,0x181f1bd1,
0x12c714f4,0x0d4c1088,0x039808c8,0xf8ddfe59,0xf206f468,0xf3d0f238,0xf6dbf5d7,0xf3dcf64b,
0xeec3f0cf,0xef2fee6e,0xf07ef037,0xed9def83,0xecbfec36,0xf359ef25,0xff47f8b5,0x0a8305d7,
0x0bc40c31,0x0ae40ac0,0x0f550c76,0x13e0123b,0x0e151290,0x03a3084f,0x01290170,0x03a40230,
0x054804f3,0x0116040f,0xfa4bfd3a,0xfb9cf9c4,0xfefbfe0c,0xfb30fdde,0xf782f87e,0xfe31f975,
0x07c7039b,0x0830092b,0x03ef0605,0x025802ba,0x02df028c,0x016202d1,0xfb9cfeb8,0xf62df8d8,
0xf320f42b,0xf457f35c,0xf64ff576,0xf4bef626,0xf1faf320,0xf600f2f0,0xfe3dfa57,0x024000c1,
0x033a02d2,0x055803bc,0x0bdc0830,0x10bf0f0c,0x109110fb,0x12ab10f9,0x170a1530,0x16621780,
0x0fb913c2,0x05bb0a97,0xfd52018d,0xf3d3f896,0xee96f04f,0xed9cedf1,0xed54ed83,0xef3eedd5,
0xf400f193,0xf55bf53e,0xf2b5f456,0xf12bf155,0xf42bf222,0xfc6ef792,0x06f401f5,0x0c720a5c,
0x113c0e9a,0x14b713c9,0x0f8c1329,0x07a50b28,0x055405c8,0x045d0526,0x00060280,0xfc28fdb7,
0xfbcffb7d,0x0094fd80,0x05a10408,0xff9703b1,0xf948fb58,0xfc25f9c8,0x006efeca,0xffa90050,
0x01d4ffc9,0x072404ec,0x044906db,0xff320158,0xfc24fdb7,0xf95ffa92,0xf8ddf8e1,0xf8bff8dd,
0xf7fdf881,0xf589f6d9,0xf2eef40e,0xf3d9f2a9,0xf9e8f680,0xfe05fcca,0xfd86fdd2,0x01e7feec,
0x096f05e7,0x0d900c13,0x10450ecc,0x146d1259,0x160f15ed,0x11591460,0x0cfb0e78,0x0c200ca5,
0x06aa0a24,0xfd99025f,0xf4cff8d8,0xef9bf1db,0xeb58ed8a,0xe7fee946,0xea0ce802,0xf279edea,
0xf870f632,0xf9caf984,0xfb71fa54,0xfdc7fcfa,0xfe42fdfc,0x00f4ff56,0x04380271,0x0a6f06ca,
0x11760e4d,0x12a31319,0x0ca6102e,0x080009bf,0x053b06e2,0xfffd02d1,0xfc40fd95,0xfcb4fc1c,
0xff14fdda,0xffc3ffdd,0xfdbefeb5,0xfe98fdc3,0xfe84ff07,0xfd33fd84,0xfffbfe30,0x0236018e,
0x013801e0,0x01df0127,0x056c03b3,0x012d04ee,0xf764fbd5,0xf5dff587,0xf956f7aa,0xf965fa15,
0xf4a8f77c,0xf1f8f262,0xf59bf367,0xf98df7c1,0xfd73fb53,0x01b8ff75,0x0743044e,0x0cfa0a5d,
0x10c70f22,0x1185117a,0x107c1111,0x0f710fcf,0x0fb00f85,0x0db40f4d,0x070c0ad7,0x0074035b,
0xfd13fe98,0xf8a5fb55,0xf269f599,0xed23ef8c,0xeb52ebad,0xed0bebdf,0xeef8ee01,0xf0a8efb4,
0xf6e2f2d7,0x008ffc09,0x039a0327,0x02de0303,0x04b3039c,0x04e50507,0x0649050f,0x09bc07f9,
0x0dbd0ba6,0x10b50fa9,0x0f8510c8,0x09290cdf,0x002c04b1,0xf9b8fc55,0xf82df88a,0xf981f896,
0xfc60fb04,0xfd1dfd1c,0xfe34fd29,0x013dffc2,0x042c02e8,0x03530473,0x0056014d,0x00fd0071,
0x001f00e2,0xfcfefed5,0xf9dafb4c,0xfb4ef9db,0xfda2fd1e,0xf935fc45,0xf24df55a,0xf387f193,
0xf9f0f6d2,0xfb4afb97,0xf881f9cd,0xfbb3f910,0x0336ff7e,0x085e0637,0x0c160a4b,0x0f3c0df1,
0x0ff00ff3,0x0fd80fdb,0x0f880fde,0x0d100e95,0x09700b56,0x061c07ae,0x039e04e1,0xfee901ac,
0xf6a1fafc,0xef5ff26d,0xed54edcd,0xecdeed3b,0xea80ebcd,0xec72ea58,0xf3d9f00e,0xf815f65d,
0xfc4ef9b8,0x0403ffa9,0x0b650839,0x0ca70cf1,0x08b20b04,0x062f06b7,0x07ee06f1,0x095008d7,
0x08860948,0x078d079f,0x0a3908b2,0x09fb0afb,0x024706de,0xf80dfce1,0xf506f550,0xf8dff68e,
0xfca5fb2a,0xfe11fd8c,0x000efeca,0x043301ed,0x062905d4,0x036704ff,0xffbe0195,0xfb6cfd78,
0xfa2bfa54,0xfad6fa83,0xfb35faf9,0xfc5bfbae,0xfd6ffcfa,0xfce0fd7c,0xf8b1fb28,0xf33bf5c6,
0xf2d1f20c,0xf95af587,0x008dfd8f,0x0358027c,0x07b104e4,0x0ef10b70,0x1191110e,0x103a10f2,
0x0f9a0fc5,0x0ebf0f4c,0x0d3e0df9,0x0a360c0e,0x03bf071e,0xfe8200bd,0xfaa1fca7,0xf5edf871,
0xf086f32e,0xebf9ee20,0xeb03eab9,0xef3aeccc,0xf1bcf10f,0xf18af1aa,0xf602f2b9,0x01d4fb9e,
0x08870693,0x06e0082b,0x075f0654,0x0bc10999,0x0c810ce6,0x097a0b26,0x069e07c1,0x056105da,
0x063e0572,0x07ee077a,0x04cb06de,0x022802fd,0x017801eb,0xfdc90028,0xf6abfa7b,0xf17ff34b,
0xf4b1f1ea,0xfe39f947,0x05b80288,0x06ef0738,0x0458058b,0x03e603eb,0x01f10367,0xfd3dffe9,
0xf76afa47,0xf55cf586,0xf951f6f5,0xfc5efb6d,0xfaa8fc11,0xf89ff938,0xf9f5f90a,0xfa6ffa9e,
0xf7b9f956,0xf8aff702,0x031afd0c,0x0e080944,0x11b410de,0x110e1164,0x10ec1105,0x0ed1102e,
0x0b820d40,0x083809bc,0x06920718,0x04f8060a,0xffec02c8,0xf920fc9e,0xf28df5b4,0xeeeaf03a,
0xee85ee72,0xef4feed7,0xef0aef6a,0xeeb4ee7c,0xf39af079,0xfb35f76f,0x0057fe26,0x032101e9,
0x07d3050b,0x0d690ae6,0x0f4b0ed3,0x0d890eb9,0x0a0e0bba,0x08c8090e,0x08e608df,0x066e081d,
0x01ba0424,0xfe1affac,0xfe60fdbc,0xff22ff1f,0xfde6fe97,0xfc78fd67,0xf8edfabf,0xf7d1f7c8,
0xfabff8df,0xff7cfd33,0x03360186,0x062504a1,0x07610731,0x03550605,0xfd4e0019,0xfa24fb5e,
0xf78ef901,0xf659f69b,0xf75cf6cc,0xf8bbf808,0xf9dff94b,0xfc06fab8,0xfe3dfd46,0xfe99fea3,
0xfe8bfe7a,0x0086ff19,0x05c102b4,0x0cab092d,0x11b40f83,0x133e130b,0x10cc125c,0x0ddd0f70,
0x09320bb6,0x052b070a,0x01af0376,0xfd6affd7,0xf7d8fac0,0xf24df508,0xeebaf00b,0xede5ee1c,
0xecd3ed5a,0xecbbec84,0xf0a5edfa,0xf7fcf460,0xfc40faa5,0x0002fdd5,0x06770333,0x0b310949,
0x0cfd0c44,0x0f330e0a,0x0f350ff6,0x0abb0d38,0x079208a5,0x065006f8,0x027d04da,0xfdb8ffe3,
0xfcf9fcb9,0x0034fe53,0x00a00122,0xfba5fe67,0xf85ff975,0xfaf1f8e6,0xffe2fde0,0xfe48fff9,
0xfa38fbcc,0xfc5efa5f,0x0200ff47,0x05a30452,0x057f0619,0x02cd0445,0xff8d0127,0xfbd8fdb0,
0xf73ef9ae,0xf350f4e9,0xf2f4f294,0xf6bdf456,0xfc98f9b2,0xfed0fe72,0xfe17fe48,0x0172ff10,
0x081304e5,0x0aad0a31,0x09140a12,0x095408ac,0x0ed30b88,0x14731222,0x133714e5,0x0bbd0fc8,
0x060c0855,0x00e603da,0xf7dbfcb4,0xef85f329,0xed39ed78,0xf00bee6e,0xf130f13a,0xeed5f025,
0xef04ee48,0xf4fbf17d,0xfafef887,0xfce4fc34,0xfff9fdf9,0x05f802c5,0x0c380957,0x0ee70e34,
0x0e230eba,0x0ca60d5f,0x0cc40c62,0x0ce80d4c,0x06d50ac4,0xfe3101fe,0xfcabfc58,0xfea2fdce,
0xfce1fe2c,0xf960fb11,0xf8cdf87d,0xfc64fa4b,0xfebbfe14,0xfd44fe55,0xfc03fc28,0x0002fd80,
0x03a4027d,0x01a20316,0xff1d0013,0xff41fea5,0x02ba007d,0x063204ec,0x01b40526,0xf78ffcd3,
0xf14af377,0xf1ccf106,0xf42bf2d5,0xf670f55a,0xfa49f7ea,0x0264fddd,0x0aac0723,0x0c810c66,
0x0a9b0ba0,0x0a690a08,0x0cef0b85,0x0d830dcc,0x0abb0c38,0x0ad10a14,0x0e0a0c7b,0x0bae0e16,
0x01220703,0xf627fb3b,0xefeef27b,0xec42eddf,0xea94eb1e,0xebfeeadc,0xf0c6ee01,0xf614f3aa,
0xf875f7c1,0xf92ff8c4,0xfbc3fa1c,0x016afe44,0x08b2052f,0x0db40b9b,0x0ef00ed8,0x0f350ebf,
0x11fb1088,0x1055123b,0x07670c86,0xfe82024c,0xfd35fcc7,0xff1ffe6c,0xfc33fe4e,0xf7e6f9be,
0xf7fcf745,0xfb1cf968,0xfcfafc67,0xfd15fd02,0xfea9fd89,0x00e8ffe9,0x01df019f,0x02110215,
0x026a0233,0x01c6027d,0xff7000a2,0xfe8dfea2,0x001fff62,0xfee20019,0xfb41fcf3,0xf868f9b4,
0xf64bf745,0xf36cf4f6,0xf289f23e,0xf7e6f44a,0x019dfc8b,0x0a1e0672,0x0dfd0c9b,0x0f8b0eeb,
0x0f2f0fb5,0x0beb0dd1,0x09f90a70,0x0b9b0aa4,0x0c2d0c3f,0x09670b41,0x055f074e,0x016203a1,
0xf9f5fe23,0xf0dcf56b,0xe9f9ecde,0xe825e875,0xe925e863,0xed53ead3,0xf3e9f08c,0xfb4df771,
0x0211ff11,0x044103bc,0x0492044e,0x07050574,0x0b74093d,0x0ead0d65,0x10640fa1,0x10b410da,
0x0ca80f2c,0x074a09e3,0x020304d1,0xfc7dff50,0xf863fa35,0xf6e2f727,0xf8edf789,0xfb0cfa44,
0xfb0ffb28,0xfbf2fb42,0xfd83fca7,0x0028feb2,0x02ea0199,0x045f03c8,0x03550436,0x000f019d,
0xff27ff1e,0x01d80046,0x02e30309,0xfe910138,0xf953fb84,0xf91af87e,0xfa1cf9e8,0xf86cf981,
0xf55cf6fd,0xf37ff3f5,0xf7a7f4b8,0x000efbd8,0x06ae03b8,0x0be90954,0x11110ea0,0x142012ff,
0x13a41458,0x0f5811f6,0x09390c3f,0x05d206fd,0x0517055f,0x02bc0473,0xfb4cff92,0xf3acf6de,
0xf10df1fe,0xef77f03d,0xed65ee8a,0xeb10ebfd,0xed10eb5d,0xf273ef85,0xf932f5bd,0xffcffc97,
0x06ae0327,0x0ceb0a30,0x0dbb0e06,0x0cd30d16,0x0d960d2e,0x0d5d0dc4,0x0c0e0cc1,0x09f50b49,
0x06050815,0x014403b1,0xfc67febc,0xf8b5fa6f,0xf658f74f,0xf63df612,0xf758f6b7,0xf9c8f85c,
0xfcdcfb57,0xff4efe23,0x020c007a,0x051603a4,0x05c105e0,0x03a404db,0x028802b4,0x034302c4,
0x015102f6,0xfbe1fec1,0xfa1cfa3a,0xfc9ffb46,0xfb43fcc0,0xf568f870,0xf2b6f33e,0xf5d8f3cd,
0xfa69f848,0xfdb2fc2e,0x0164ff59,0x06c103ec,0x0c4109a7,0x0f670e26,0x110c1058,0x125611c1,
0x11bc1262,0x0e5f105e,0x089c0bb4,0x015f0504,0xfa9afdcc,0xf550f7d6,0xf1c4f323,0xeff9f0da,
0xee14eeeb,0xee8aedf6,0xf001ef58,0xf1b6f0c2,0xf3d3f2d4,0xf811f53d,0xffddfbdc,0x06610367,
0x0c530955,0x12460f67,0x15b11499,0x122f14e2,0x0b260e9a,0x079408ba,0x058e06d3,0x01410395,
0xfe17ff92,0xfbc0fcfa,0xf9aefab3,0xf833f8dd,0xf66ef776,0xf4bff54d,0xf7aaf587,0xfddefaa5,
0x028e0069,0x05ca0445,0x076306ef,0x06900741,0x04b5058b,0x03aa0417,0x00f502ac,0xfd1cfeff,
0xfb68fc06,0xfa47fb01,0xf920f989,0xf89af8e3,0xf813f85f,0xf763f7ca,0xf65df6c6,0xf78ef65d,
0xfdc9fa2f,0x04d10150,0x09c4078d,0x0d040b6f,0x0ffc0e8f,0x11841110,0x10b01155,0x0f780ffe,
0x0def0ee4,0x0a1a0c62,0x033e072b,0xf896fe60,0xee04f2e9,0xe9f9eaef,0xec63ead8,0xee7ced9d,
0xf04eef5c,0xf1e3f10b,0xf5ebf37b,0xfad3f8a3,0xfc4cfbfd,0xfd1cfc65,0x03e1ff68,0x0f8b09d2,
0x1523137e,0x143d1506,0x12fb1377,0x10881222,0x09890dba,0xfef3045b,0xf77dfa47,0xf792f6d7,
0xfa78f903,0xfc37fbce,0xf9fefb7c,0xf782f888,0xf81df768,0xfadff98d,0xfc1efbb3,0xfeeffcfe,
0x049901a6,0x08cf0700,0x0ac40a17,0x08e90a76,0x03970669,0xfece00de,0xfc00fd12,0xfa31fb16,
0xf81df914,0xf798f785,0xf813f80d,0xf60ff75e,0xf4d7f4ee,0xf8d6f646,0xfe8bfbcc,0x01780056,
0x02ec0214,0x08cb0511,0x11440d43,0x13db1393,0x10bb128d,0x0e580f33,0x0e0f0e19,0x0ca80dd9,
0x070e0a60,0xfe9e030f,0xf630fa1c,0xf108f34b,0xec7feee4,0xe7a4e9de,0xe766e699,0xee1dea0c,
0xf687f26b,0xfd1efa17,0xfef2fec1,0xfe6cfe60,0x02c0ffed,0x09e20662,0x0dfb0cb2,0x0e6a0e42,
0x117e0f63,0x14c913af,0x10f213db,0x07c30cb1,0xfed002e4,0xf916fb83,0xf613f75e,0xf4c1f531,
0xf4b7f49b,0xf69df549,0xfb1ff8af,0xfe1afd18,0xfe30fe5a,0xfe8dfe2c,0x0059ff4a,0x044e0221,
0x086e0690,0x09760951,0x07e208d2,0x059c06e0,0x01c80408,0xfb35fed0,0xf50df7b8,0xf2d1f36c,
0xf493f345,0xf7b1f640,0xf826f853,0xf76df797,0xf9baf823,0xfe7efc03,0x036a00dd,0x088005f9,
0x0cae0ac0,0x0ec80e0a,0x0f700f0a,0x112e102d,0x11171188,0x0e530fe4,0x09cb0c41,0x02850687,
0xf9bbfe2c,0xf35cf61c,0xef37f14c,0xeb07ed08,0xe912e9ba,0xeb12e992,0xf023ed70,0xf55af2d4,
0xfa77f7d0,0xff9ffd05,0x05a3025f,0x0b2808e8,0x0bfa0c08,0x0ceb0c26,0x100f0e71,0x122911a5,
0x0ffc11c3,0x0aca0da8,0x043a07b5,0xfd02007a,0xf8f1fa65,0xf7bff835,0xf5acf6ea,0xf2a9f420,
0xf226f1c2,0xf87df486,0x0028fce5,0x02a201f7,0x032202c9,0x059d041f,0x08380735,0x075f0843,
0x047805e0,0x037c03af,0x035a037e,0x01c002cc,0xfdd50028,0xf7b1fac1,0xf310f4f4,0xf219f20c,
0xf31af2a3,0xf3ebf345,0xf884f594,0xffb0fc2a,0x0449027d,0x0637054d,0x09a20799,0x0e0d0bcf,
0x11350fd5,0x114611d5,0x0df40fdb,0x0be50c66,0x0c930c32,0x09af0bf4,0x009005aa,0xf680fb1b,
0xf1b5f37b,0xeda1f00b,0xe7c9ea99,0xe699e647,0xecaee8e7,0xf510f122,0xf94cf7cb,0xfb3cfa2b,
0x003dfd37,0x08b5045a,0x0e6f0c65,0x0ec10eea,0x0fcb0efd,0x10e5109e,0x0fcb1097,0x0c0a0e67,
0x04c108b9,0xfe47011f,0xfbb6fc85,0xfa8bfb58,0xf709f925,0xf3f7f51d,0xf4c1f3ec,0xf73ff5e1,
0xf972f87b,0xfa8dfa0d,0xfe60fbce,0x06ae0229,0x0d310aa9,0x0cc70dc5,0x08690ab7,0x046e0636,
0x01e00329,0xfee3007d,0xfb33fcf6,0xf7eef943,0xf75df740,0xf7a8f7d0,0xf4b5f6b5,0xf0dcf273,
0xf257f0bf,0xf7c1f4e2,0xfd53fa93,0x0473008b,0x0c92089a,0x11500f8e,0x1091116d,0x0e600f5e,
0x0d4e0db7,0x0d780d41,0x0d650db3,0x09950c18,0x029c0629,0xfd54ffa8,0xf91bfb65,0xf264f61e,
0xeb78ee99,0xe9f7e9d0,0xedc0eb87,0xf1deeffc,0xf5a3f3b4,0xfa59f7b6,0x0157fd99,0x079904fc,
0x09670902,0x09530962,0x0b0009cb,0x0f0e0cdb,0x10691084,0x0af30e70,0x031806de,0xfe5c003a,
0xfbc6fcfb,0xf8abfa4e,0xf596f6ec,0xf4e0f4d6,0xf746f5c7,0xfa83f910,0xfbdffb68,0xfd75fc73,
0x01a3ff39,0x06ce043f,0x0a8908ed,0x0c9d0bb2,0x0dd10d5e,0x0ce10dcb,0x084c0b08,0x016204ed,
0xfb03fe09,0xf647f879,0xf35af47f,0xf2f4f2f0,0xf34ff331,0xf387f373,0xf3edf3a4,0xf568f47a,
0xf798f678,0xfb68f906,0x0299fea0,0x0a10068b,0x0ff00d29,0x1436125a,0x14dc1531,0x1017131b,
0x09b80cc6,0x065007a1,0x044d0567,0x012302e2,0xfd0bff45,0xf7defa90,0xf397f574,0xf186f256,
0xeff2f0c1,0xef4cef58,0xf2bff06a,0xf9ecf614,0x0072fd6f,0x051602f0,0x081b06d0,0x09bc0912,
0x0a580a24,0x0a020a41,0x08750966,0x05bd0741,0x029e0434,0xff46010a,0xfc2ffda7,0xf959fac5,
0xf6a6f7f3,0xf508f5a9,0xf519f4c4,0xf7ebf613,0xfd24fa76,0x00f6ff3c,0x0389023f,0x06d90500,
0x0b1a08f4,0x0df70cdf,0x0e2c0e5f,0x0d470dc2,0x0c080cc5,0x09230ae6,0x031806a6,0xf98bfeae,
0xf0b7f4ba,0xed43ee2f,0xeeceedc3,0xf039efa2,0xf1b1f0d3,0xf42af2c5,0xf849f606,0xfc74fa96,
0xfea3fdc9,0x00c2ff7f,0x069302fa,0x0fb40b2e,0x14971310,0x13d514a2,0x121912ee,0x0f611111,
0x08980ca2,0xfe71039b,0xf74af9ff,0xf6d5f674,0xf864f7ad,0xf875f8c0,0xf607f764,0xf451f4e4,
0xf578f48c,0xf8a7f709,0xfb09fa00,0xfe88fc58,0x04ca0174,0x09e807ac,0x0c370b65,0x0b140c21,
0x0756094e,0x03d9056b,0x00900229,0xfd18fed4,0xfa05fb61,0xf8c8f919,0xf851f8b5,0xf602f75c,
0xf4a9f4e5,0xf7b1f5af,0xfca0fa2c,0xffc8fe79,0x0190009f,0x06de0390,0x0e750ada,0x112d10ae,
0x0eeb104c,0x0d190db8,0x0d270d0d,0x0c0d0d15,0x06ae09ea,0xfe7502be,0xf6a4fa31,0xf223f416,
0xee01f039,0xe971eb89,0xe927e873,0xef43eb93,0xf6ebf335,0xfcf6fa25,0xff7dfec7,0x0033ffa7,
0x047401d7,0x0ac307ad,0x0e850d4b,0x0ed10ec8,0x10e20f68,0x13451281,0x0fcb1263,0x07790bff,
0xfee902e3,0xf8e1fb86,0xf541f6dd,0xf393f425,0xf3a0f372,0xf573f438,0xf997f758,0xfcb4fb8a,
0xfd72fd3c,0xfe5cfdc2,0x005cff34,0x0466022d,0x089e06af,0x0a1f09af,0x095909ea,0x0754088c,
0x035b05ac,0xfcdb005d,0xf6bdf974,0xf3f4f4e8,0xf4bef3f1,0xf736f602,0xf7b9f7cc,0xf74ef753,
0xf9acf819,0xfe1efbd4,0x029e0047,0x076d0502,0x0bae09ae,0x0e1d0d33,0x0efb0e85,0x10a70fb6,
0x109110fd,0x0de70f6c,0x09710be0,0x025a063e,0xf9e0fe2a,0xf3acf65e,0xef95f1a1,0xeb89ed75,
0xe9baea51,0xeb9fea37,0xf06eedda,0xf58ef30b,0xfabcf80c,0xffedfd54,0x05d102a5,0x0b490904,
0x0c580c43,0x0d470c90,0x10070e9e,0x11d51169,0x0fa81164,0x0a8c0d5e,0x0412077e,0xfcf10060,
0xf8d5fa53,0xf78af80c,0xf56ff6af,0xf267f3e2,0xf1d2f176,0xf81ff42b,0xffe9fc8e,0x028801cb,
0x031702bc,0x058e0410,0x0839072a,0x07860858,0x04b80614,0x03c703f6,0x03ab03cd,0x021b0323,
0xfe260082,0xf7e8fb07,0xf32df51d,0xf227f221,0xf31bf2ab,0xf3e0f340,0xf86df582,0xff92fc11,
0x042f0261,0x06210536,0x09830780,0x0de50bad,0x110d0fac,0x112a11b2,0x0dea0fc8,0x0be10c61,
0x0c8a0c2f,0x09a30be9,0x008b05a0,0xf684fb1b,0xf1b9f37f,0xedaaf00f,0xe7dceaa7,0xe6abe65b,
0xecb7e8f5,0xf514f128,0xf951f7ce,0xfb41fa2e,0x003ffd3a,0x08b6045b,0x0e710c67,0x0ec30eec,
0x0fcb0eff,0x10e3109e,0x0fcb1096,0x0c080e65,0x04bf08b6,0xfe46011e,0xfbb6fc84,0xfa8afb57,
0xf708f925,0xf3f7f51d,0xf4c0f3eb,0xf73ef5e0,0xf971f87a,0xfa8dfa0c,0xfe60fbcd,0x071e0229,
0x00000513,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,
0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,
0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,
0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,
};
const uint32_t sample_1_timpani_timpani[3968] = {
0x00000000,0xfff9fff5,0xfff9fff5,0x0004fff5,0x004fffd7,0x010dff91,0x0f21fd95,0x4fbb460b,
0x598a625b,0x40225439,0x1dc43113,0xcebe1dfc,0xa00faa38,0x8dee95d9,0xa37e9a5c,0xc251ae3d,
0xce93bae0,0x0511d76d,0x3eb12a28,0x4c583de2,0x57c249d3,0x71fb4441,0x23dd71fb,0xe630f1b5,
0xe648e7ed,0xeec9ef46,0xcda5dd06,0xb7a1c669,0x8ede8dee,0x8dee8dee,0x8dee8dee,0xc0548ff3,
0x0a45edec,0x71fb5de5,0x71fb71fb,0x71fb71fb,0x71fb71fb,0x71fb71fb,0x63ea65a4,0x1d0f436b,
0xee5d0f5a,0xe57305f9,0xb625c17f,0x8deeaa98,0x8dee8dee,0x8dee8dee,0x8dee8dee,0x8dee8dee,
0xc0a68dee,0xfbd5dff8,0x3d3529ab,0x55755d07,0x67ae6ddf,0x71fb71fb,0x4f7e71fb,0x13161b8c,
0x1d472442,0xfa441de7,0xcf52e857,0xd173e353,0xe3c8e00a,0x0295e5f9,0x0f271317,0x2b7b286d,
0x22d1246c,0xa55de909,0xd89caf6a,0x38f2130d,0x53b04e5a,0x3fcc54bc,0x0adb2513,0xf0652688,
0xd155e5e1,0xfba9dd25,0xf8551268,0x9d19b5bf,0x9acea20f,0xad5bb3e4,0xed96daf5,0xf3e2f0de,
0x10511045,0x4bf33ede,0x2b5b3d9b,0x29bb3343,0xffc50b15,0x0027ebe8,0xfec7f3a9,0x10b60585,
0x2b5f16fb,0x11ff1190,0xdf53f16d,0xeca9de8c,0xd533d6a4,0xcb59bbe0,0x0a3cd75a,0x2ffe10b0,
0x51a051c1,0x4d464a90,0x71fb558f,0x4c346c85,0xe693195c,0xc947d26b,0xb29bcfe6,0xd9cfc45b,
0x05d9e1d2,0xf35a17dc,0xe47fe2b5,0x9e06a4c7,0xc216b13e,0x004bdab5,0x14061d0b,0x00cafd35,
0xff13ef19,0x288f131d,0x3ce019c6,0x2b4f3101,0x04c10d54,0xc8fbea58,0xa9669f86,0x8deeb3ed,
0xc2fba7ce,0xf0a8ce3f,0x0d69f6ef,0x41e33da6,0x48ae4ae9,0x5d2c3a27,0x65f8634d,0x4b764493,
0x5810406f,0x4a9b649b,0x4343455f,0x2c0c4275,0xe114030a,0xb1e6cd24,0xc151b261,0xa540ac33,
0x8dee8fcc,0x8dee8dee,0x8dee8dee,0x91fb8dee,0xe178bead,0x15e3f073,0x063211a2,0x20a40606,
0x4ae02a5e,0x662c5d72,0x4da64ee4,0x3b7d34a9,0x29b54196,0x42eb351b,0x491b4bf0,0x599d6206,
0x2c094a20,0xed231a6f,0xcd85ea5b,0xe852d9a6,0xf8adfc73,0x1b280bb1,0x22ad224f,0x1562130a,
0x0ecc125f,0xf0b70311,0xbec9f2c8,0x909eaec4,0x8dee8dee,0x8dee8dee,0xc16f9eb2,0xa6ffb95f,
0xdb97b77b,0xf408db2f,0xf6abfaf8,0x058501cb,0xfbd80c9c,0x0ea10add,0x36792da4,0x67ac4ba2,
0x71fb71fb,0x71fb71fb,0x71fb71fb,0x4ca36dc4,0x3e9f3f5b,0x067e1bcb,0x085afcfa,0x01461670,
0xe891fff2,0xe74aecef,0xfc92f08b,0xf4d7f80c,0x987dc84c,0x8dee8dee,0x8dee8dee,0x8dee8dee,
0xb84c9a36,0xbb70c776,0xc9b5cbaa,0xc9ebd25d,0xfaa7d65b,0x31b420a0,0x36262852,0x3a6e340e,
0x37cd3a0b,0x5a4b49e5,0x71fb6b6a,0x71fb71fb,0x71fb71fb,0x6bf96d27,0x34275100,0x2c1831b4,
0xeb3d2305,0xe341e747,0xd083cb12,0xe01dc9e5,0xea3adc7d,0xcc09dcd0,0xc3c9cab1,0x93e4a51c,
0x8dee8dee,0x8dee8dee,0x9c468dee,0xaef2a646,0xc838b98a,0x1a70ef95,0x11b4ffec,0x28fe19ea,
0x0a971634,0xff680f97,0xff8602d1,0x18930661,0x3bc82224,0x650c6590,0x5b8162af,0x66bf59b8,
0x71fb71fb,0x715f71fb,0x5a586b92,0x282e37d9,0x09631b2b,0x0930fe19,0x05541030,0xf2a0f255,
0xce93eefc,0x943d9f37,0x8dee8dee,0x8dee8dee,0x8dee8dee,0x8dee8dee,0x8dee8dee,0xabd58ecb,
0xf6e2ccf0,0x14d40bb6,0x308c1fd4,0x3cc83642,0x4d1441cb,0x58a454ef,0x54f55933,0x6aab5d25,
0x71fb71fb,0x71fb71fb,0x71fb71fb,0x4dff6b8e,0x273825fc,0x1d5131ad,0xe9ae0de2,0xcb9ddd3e,
0xc6e9c6dd,0x9e7eab38,0xcb85af2d,0xc1a3bb94,0xad7db412,0x9b3daf10,0x93f193cf,0x900b938e,
0x8dee8f27,0xb6319605,0x17e8f839,0x23232783,0x1f56235e,0xfdc91211,0x0a31f343,0x103f09a2,
0x23d41d97,0x1fcd26b7,0x43003222,0x603e588b,0x6e406635,0x6c526a3b,0x6ee871fb,0x613c68f3,
0x44e551be,0x1c9d290b,0x0b85134a,0x11270d1c,0x09ad1dc6,0xf4bb03c8,0xa06ecc52,0x8dee92a4,
0x8dee8dee,0x8dee8dee,0x8dee8dee,0x8dee8dee,0xa2ac8dee,0xcb33c27f,0xdbfcd848,0xe91edd0b,
0x19bb024c,0x5a023657,0x627b61be,0x4ac44f22,0x71fb4e69,0x71fb71fb,0x71fb71fb,0x71fb71fb,
0x4bac646a,0x3460374a,0x15141ac5,0xf4c108e7,0xe3b6fd3b,0xdc99dba0,0xae51b249,0xb0cab142,
0xdc46c25a,0xe4b0e258,0xca7ddfcb,0xc81dc1bf,0xc85ed0b7,0x9c7e9bdf,0xa5719cdd,0xbcf2a722,
0xe7a6e365,0xf0c3fc49,0xf5cbf135,0xf9f7fb00,0xef710010,0xff91f2d9,0x054ef957,0x34e02252,
0x53354cae,0x5ad14d72,0x71fb71fb,0x71fb71fb,0x6f3871fb,0x39a058a2,0x29e3309e,0x121f1c60,
0x113b1e47,0x1d881a32,0x0f9a1928,0xfcd4febe,0xc87ce08b,0x8f00a429,0x98c38dee,0x8dee8dee,
0x8e178dee,0x8dee8dee,0x90c88dee,0xc201b78f,0xc9f5c20d,0xf88ae686,0xfb42f39e,0x17da1b73,
0x17ed1155,0x2a750ca7,0x71fb45f3,0x71fb71fb,0x71fb71fb,0x71fb71fb,0x4e0871fb,0x28a93e22,
0x0e341dfe,0x18280ebe,0x18301cc3,0x039015b6,0xdb97e75b,0xcb0fd9c7,0xcb33c14c,0xccafcb4f,
0xb0b8cb7a,0xb53eb409,0xafecb29b,0x91d6a409,0xcf3db0ae,0xe1d2ec38,0xdcedd1ca,0xd951e49f,
0xef96e106,0xfa88fb3c,0xea75e9f4,0xfda2f975,0x1a3a0203,0x35f92d77,0x2be02f48,0x4b9a3949,
0x58a151eb,0x71fb6f95,0x650667d0,0x42355a2f,0x40443b7b,0x40d134c8,0x2d564336,0x408939cf,
0x2d9a3875,0xef4106b1,0xc38edeea,0x95d7ab99,0x8dee8dee,0x8dee8dee,0x8dee8dee,0x8dee8dee,
0x8dee8dee,0xc804aa74,0xc589c984,0xe8f4dd31,0x0e73f788,0x01540a20,0x2de20e8f,0x4c283918,
0x67d35439,0x71fb7038,0x71fb71fb,0x71fb71fb,0x6ae471fb,0x2d433cae,0x10ed19eb,0x1c3e1a8e,
0x0a5d1401,0xe8b5fbd8,0xe63be7ac,0x093f02ae,0xdc35facc,0xc536ca7a,0xaab8c1b6,0xa2519cb2,
0xa7a4ad63,0xbdf7ad7f,0xcae8c7cb,0xd885ce7c,0xc219cc6c,0xf091d575,0xf232f7bf,0x099ef61e,
0xe0c5f447,0xe92ae38e,0x0a69f805,0x30071977,0x367133b3,0x64ee4ad7,0x71fb71fb,0x641971fb,
0x414e4b25,0x35e03489,0x374134ff,0x44c13c88,0x3bcf4669,0x31503829,0x16fa31d5,0xe45a02da,
0xcbfdd5b2,0xaa30c075,0x94f799c7,0x8dee8dee,0x8dee8dee,0x943e8dee,0xb4fba87b,0xb038b474,
0xbe6bb283,0xd2e6c6c9,0xff87e844,0x0a1406d0,0x258314c9,0x46db2963,0x4af25722,0x71fb5275,
0x71fb71fb,0x71fb71fb,0x53aa71fb,0x35ce396c,0x2ab23295,0x1eb02bfb,0xf9a80b3f,0xee36ee36,
0xf4a5f487,0xede9fc15,0xdee4e4f9,0xb698ca86,0xbf37bc59,0xb69db8ae,0xcdedb760,0xd733d7d2,
0xb98ac90f,0xd349c196,0xd264ceff,0xdb7cdd82,0xf2b5e40f,0xf686ee56,0xf633f816,0xf169ecdf,
0x0c40fbaa,0x0e940d16,0x30a21e62,0x3fd93ce0,0x6314519c,0x546361a1,0x513a4a63,0x64d15f52,
0x32355255,0x2206225d,0x16212090,0x2bc2229d,0x1b4b291c,0x059e10df,0xeed5059e,0xc3b7d989,
0x8dee9c7e,0x8dee8dee,0x95898dee,0xb1a1a4f8,0xaacba7a6,0xadc5aa68,0xc15ab142,0xd545cf62,
0xe7a0d904,0x0874f0dc,0x1e87151d,0x41592fff,0x4a2543f2,0x5f2954da,0x61266823,0x5f7b5e92,
0x71fb678b,0x592f6f74,0x25c142ce,0x03761141,0xffcbfc45,0x111b0957,0x190820b9,0xe699f7bf,
0xd2d1e2a0,0xc669c88e,0xaf97c3b8,0xc0edb1d2,0xc6febcf2,0xf229e9e2,0xe975e9b3,0xd2b9e13f,
0xb88fc0cb,0xd635c866,0xf8d9eac0,0xddd0ea3d,0xeceae827,0xf7aaef85,0x12570078,0x1c212356,
0x1b471658,0x26162538,0x2d6f2987,0x425f3122,0x525c4c83,0x60055e8f,0x40c559c2,0x34792cc5,
0x461a453d,0x1b8c3816,0xfe9d0a92,0xf5d6f1e0,0x02a30ace,0xe190ef72,0xb9cfcdd0,0x8dee93b8,
0x919992d7,0x9d4192ea,0xba17b0a6,0xb167b97a,0xb606af81,0xbe84be14,0xd530c5cc,0x02e0e7bc,
0x2aba15dd,0x2b263246,0x3f272f39,0x48373db3,0x580b52ee,0x63e45b8a,0x6ac16f06,0x3a8e552a,
0x1e9e264c,0x24e81ed6,0x1f9220d6,0x0afb1682,0x017d0468,0xe8c2fa63,0xe7dce3d8,0xecf8f513,
0xc975d71e,0xafd3b7e2,0xcf6fc276,0xde94d472,0xec44ea02,0xd37edb4a,0xe072dcc9,0xdce2dff7,
0xdd19e21f,0xbb50cbfe,0xcbcbc024,0xf84bdc24,0x116702c5,0x2d6127d3,0x2b5b30dc,0x240f2677,
0x18fb20a0,0x24ca1a9f,0x4f653cc0,0x41cb4bad,0x5d4a4c6d,0x50a861e9,0x37543d77,0x110e2ac1,
0x152d047c,0x20fb27b3,0xfbff0e5e,0xe0dbf390,0xa6d4bbcd,0xa911a405,0xb858b109,0xbe30bf04,
0xb988c035,0x9cb2ab27,0x96c5958b,0xbdeba69d,0xdd77cec4,0xf702e607,0x0ab20256,0x2c4d1632,
0x46433df5,0x53ed4692,0x4c4b5690,0x3df53c75,0x4b944548,0x54e756fe,0x3e0c4681,0x280c33b3,
0x23452400,0x083714ef,0x07930af7,0x04a30565,0xeb51fad6,0xd97cde70,0xd246d2d9,0xd354cce9,
0xdceadc22,0xcb65d743,0xc3e9c397,0xccc6c4d2,0xef84deea,0xe7f4f2e3,0xd610d7e5,0xd728ded1,
0xcefacdc1,0xe820dc15,0xf46cecaf,0x1aac04af,0x1b2820e8,0x24931f19,0x363b2eea,0x275f2c8d,
0x34352bc7,0x41203baa,0x442b463d,0x4e97491e,0x3d744977,0x3a183580,0x1f4a328a,0x108c14ed,
0xf0a7055a,0xeb5bea1b,0xd2dce595,0xa58cb79e,0xa207a039,0xaca4a6af,0xacc1abbf,0xbe40b236,
0xcbe1cc7f,0xc531c4b7,0xc8f9c807,0xd3cace23,0xf3a5e044,0x16a0061c,0x4cb3326d,0x45384e67,
0x54d04b49,0x47314f13,0x40cb4176,0x40154410,0x27e930de,0x38382ae8,0x3f344294,0x2883356d,
0x0c221c8f,0xed29f960,0xe20ce954,0xe488dcea,0xe888e7b5,0xd164e0ce,0xb9b4c228,0xce4ebf72,
0xe571d76d,0xed4df1f5,0xce6cdc2b,0xdc03d3df,0xe906e5bc,0xe5cfead2,0xcc97d669,0xdc7dce63,
0xfcbaedd7,0x080002c6,0x1f1c1582,0x0fd7192b,0x23f712b7,0x377f33d4,0x31013322,0x4af73cac,
0x3d104a01,0x47913bf6,0x47754bff,0x30984204,0x119e1993,0x07590cb8,0x08700777,0xf7bf0492,
0xd4a3e4d2,0xc7cecd00,0xb541bd13,0xb7fcb39b,0xa91fb346,0xadcca73a,0xc3b6b815,0xd998cc11,
0xdc40de8e,0xd8cedbfd,0xe06bd98a,0xfba5ef80,0x15db0768,0x3c052973,0x4ab0456e,0x62ef57c4,
0x4f375cae,0x3cb3453c,0x3f9d3722,0x32fc3fcb,0x1ab525ac,0x05330df9,0x0f4208cf,0x0f7514fd,
0xf5a80474,0xe879eb08,0xd86ce2d4,0xd442d332,0xd8eed47e,0xe3f4dfb8,0xe184e7ab,0xcdeed7e1,
0xce4ecbcf,0xe3c6d579,0xea00eb3d,0xdc34e195,0xdc8cdae0,0xee27e733,0xe5daebb2,0xebc0e330,
0x0787f802,0x298318b1,0x365331e8,0x39443988,0x262f314a,0x18641b15,0x33a62212,0x547148c5,
0x51c35433,0x34724abf,0x0c961b41,0x01f50611,0x07d30660,0x0068017b,0xf06efe32,0xdf89e428,
0xd4b4dd64,0xc04fc699,0xa856b55d,0x9fa7a0fd,0xb6dca861,0xcd8bc393,0xd0ccd3d0,0xd3c7cf43,
0xf571e246,0x09e70107,0x1b0614af,0x28421d76,0x394c34d1,0x326d32e0,0x43a13bb1,0x48ec46bd,
0x5234502a,0x31c7447a,0x1810243a,0x12a2120d,0x0f4e13d2,0x0ace0bbd,0x0370077a,0xf3b5fe97,
0xe75dede0,0xd6faddb1,0xe298dbe2,0xe49fe5a4,0xd830dfa0,0xd3ccd3f4,0xd28ed239,0xd29bd5b2,
0xd25dcf35,0xe48ddaf3,0x0096f46d,0xef40fdf9,0xe667e5b7,0xe8b0e6fb,0x0806f478,0x20491a21,
0x17e91d4e,0x1c4613c9,0x25942709,0x2b9725fa,0x34942fd2,0x338334ed,0x3bdd384a,0x3ccb39a3,
0x39313d65,0x2917344b,0x0b5219b3,0xee91fbb0,0xe780e8e3,0xd837dfac,0xda21d7ad,0xc3ddd376,
0xbb54b9dc,0xbea6bf22,0xc0f4bdcf,0xb41abd3c,0xbc8ab395,0xe1a9cd24,0xf2c7ed68,0x07b1fa6c,
0x16971272,0x1f9c1a66,0x1e961ebd,0x2341232c,0x34ad26e4,0x495141a9,0x432b49bd,0x2e3f3a18,
0x30e129af,0x2e2b34ba,0x20a52414,0x190f1e6b,0xfeff0ca5,0xeccaf9a3,0xce78da18,0xdb19cee3,
0xe260e2a1,0xeb8ce45b,0xe9abed09,0xdee9e38c,0xd54bdab3,0xce85d249,0xd3a6d031,0xe43adb17,
0xf74aeb81,0xf788fcba,0xe8c5ee92,0xf2b5ebac,0x01fcf8cb,0xfc2702a7,0x0951004a,0x1b6111b6,
0x2a8f25fb,0x26ef2b1f,0x2d20265b,0x3c2c3492,0x508046ff,0x425a501a,0x1fd02e4b,0x15a41956,
0x109812c0,0x036c0b94,0xf826fed7,0xdd74eb6e,0xc1eece9d,0xca5fc19c,0xdaced49d,0xdcb9de22,
0xc275d187,0xbb29b94b,0xc21fbec4,0xcf2ac65e,0xd61bd546,0xe747daee,0x0b00f851,0x1ec81883,
0x23a61f96,0x2b0d291a,0x364e2e2b,0x3ce03a4e,0x47744428,0x38244383,0x25fc2b12,0x1efa22ca,
0x282d227f,0x1ba02434,0x10211925,0xf71200e0,0xe01aee72,0xcdced15e,0xcfa7cf10,0xd901d200,
0xed86e2b1,0xfc5ef82b,0xf690fa8d,0xe370ed5f,0xd8e3dceb,0xcd47d44d,0xcf36c8bc,0xde51d9e0,
0xeac4e28f,0xfda9f1d0,0x0f330af0,0x091907e4,0x12911214,0x17291077,0x18281c7d,0x1c34172d,
0x33b62440,0x44b443b1,0x2318339c,0x23be206c,0x2f1d28e6,0x2ea030fa,0x24682c5b,0x01561436,
0xef77f566,0xec5cecf6,0xe8a7eca9,0xdcb0e10b,0xd9bbdbc1,0xc92dd25d,0xb80fbe7e,0xc384bbad,
0xccb5c9e2,0xc265c741,0xd26ec67c,0xee88e318,0xf9c1f2e9,0x161406dc,0x29eb2356,0x26ae2902,
0x2bdf26ae,0x367e3427,0x41c13b57,0x3dde4172,0x27203534,0x175d1a9c,0x1ed91ca0,0x1c901cd4,
0x0e161a10,0xf9e901ba,0xf708f54d,0xfca4fc1e,0xeab4f52e,0xd1c9dff6,0xc33cc406,0xde12ce31,
0xf53cebd2,0xf0a8f425,0xe02feb63,0xd6d9d66b,0xdd7ddc99,0xdfc5dc5f,0xe8ede71d,0xf136e75a,
0x0870000e,0x13840d02,0x1b491af8,0x0f6b15da,0x0d160cd6,0x17bf1244,0x169b1634,0x1a141814,
0x27fd2132,0x34ed2cb2,0x47144120,0x2f453e8a,0x1acb2305,0x0e2a1356,0x0b1f0beb,0x023b0a0e,
0xdb17f0f9,0xc9d6cc05,0xca00ca68,0xd1b3cd38,0xd32dd381,0xcfa2d390,0xc3bfc7d9,0xcbcdc7b8,
0xd261cd61,0xe365dafb,0xef5fe9a7,0x0eedfd0a,0x280c1ef7,0x1ea52580,0x18951a5b,0x27891c48,
0x36c432b9,0x30d53522,0x319c2f88,0x346933c0,0x27672f8f,0x1caf2368,0x09b80fe9,0x0e850ceb,
0x05a30a9a,0xf48efeda,0xd811e68e,0xcf1dcfdf,0xd6c9d292,0xdf40da38,0xe550e2ff,0xe543e629,
0xe26fe2af,0xedeae83f,0xf33ceef7,0xfa90fa11,0xe9c6f30b,0xe7c4e5ed,0xee36ea0c,0xfb28f63e,
0xff81fbc9,0x0a2d045b,0x18ea115a,0x24e520c2,0x1d4721e6,0x1adb1b6a,0x2a621fd9,0x36843451,
0x2a4a309c,0x2b3d2991,0x219d279c,0x16dc1c8b,0x0a301003,0xfcee054e,0xeca0f382,0xe181e590,
0xdd74e16f,0xc7f0d487,0xc49ec12a,0xd4cbccc2,0xdb17d96f,0xe06ade1b,0xd52cdced,0xc9d2cc0e,
0xdac7cffa,0xfc8beacf,0x14130a6d,0x18b21861,0x145c1579,0x2a0d1d9a,0x368d3163,0x3ad63a70,
0x38dd39b5,0x35e937ed,0x2e363237,0x20bd29f2,0x0cdf15e6,0x01a80653,0xf826fe0a,0xe5c3ed8d,
0xe7abe4da,0xe34ce713,0xded2e029,0xe817e1c7,0xef77ec13,0xed20f1c8,0xe008e571,0xe3dadfac,
0xe51ee609,0xe3f9e3a4,0xf03ae936,0xed69efd5,0xf903f1dd,0xfeb6fe32,0x015dfdb5,0x075305fb,
0x0ead09ea,0x12a91225,0x14061207,0x203d197d,0x33d22969,0x30ee3758,0x29302a13,0x21f92a31,
0x0fd115dd,0x08a40c9c,0x0dd807f1,0x107f1372,0x0dd80cd3,0xf8cd07db,0xe720ec13,0xd671e2e1,
0xc3dec87e,0xcde2c83f,0xccdbcebc,0xcd7dcbfe,0xc8b5cd24,0xcdc1c788,0xeab9da0d,0x035ffa2d,
0x0162046c,0x01c2ffd9,0x1c9a0b7d,0x359c2cbd,0x38cf381c,0x365e38cf,0x2ed7328a,0x2415291a,
0x21ad22e6,0x1e7e203d,0x1bae1d2f,0x10761825,0x026a07be,0xf9b5fd5b,0xef12f56d,0xe5f3ea3a,
0xdc6ee051,0xe660de9b,0xf1e9eee5,0xe5c3edcf,0xd3eadb45,0xdc9ed419,0xef1ce862,0xeccbef5f,
0xecbbeb29,0xf174ef0f,0xf709f353,0x08dfffc4,0x0d1c0d5f,0x09570ad5,0x07dc0927,0x04aa0472,
0x02e00502,0x0ce50472,0x173a14f9,0x21a319e0,0x39f92d17,0x429f443b,0x228e34fb,0x0a5e1247,
0x092d0926,0x0d1c0a24,0x01db0a9d,0xf908faf8,0xf951f9f8,0xf37ef6ee,0xd69fe9f0,0xbf60c61b,
0xb95cbc30,0xbad2b8f7,0xcdc2c10d,0xe3d4db37,0xec1be79a,0xfc9ef483,0x02c80107,0x0aa6057c,
0x184d12a5,0x10b315a1,0x14a20f6c,0x28f71e8d,0x32cb307a,0x347d32a8,0x36bc3774,0x284530a8,
0x1ebb21cb,0x115c1984,0x0a270c81,0xffe804e9,0xf26bfb7c,0xdd25e61f,0xd951d94a,0xdf5adb7a,
0xe43be28c,0xe1d0e3c6,0xe946e341,0xf071ee33,0xeefdf04e,0xed16ee3b,0xeb5deac0,0xf94cf08a,
0xfdb8ff50,0xf971f89b,0x03530013,0xfb43ffcf,0x01a2fc31,0x054004e6,0x0b970674,0x0c3f0f9a,
0x09880842,0x1c031091,0x3384294f,0x35a2385b,0x2f1d3130,0x25c02b66,0x1e8d2258,0x06f41555,
0xec47f767,0xeafae971,0xf518ef46,0xf38cf75a,0xe9cbede6,0xe239e584,0xdeeae1d2,0xcb4fd6fd,
0xbd3cc068,0xcc5fc254,0xda10d4f3,0xe65bdf57,0xf758ef95,0x05acfd42,0x150e0f75,0x148815a1,
0x19fa1551,0x2c84222a,0x321c337b,0x2dbd2e4a,0x33802ff5,0x30da34f6,0x220628c2,0x1ac91e4c,
0x0a1e1406,0xf3c7fea5,0xea50ed51,0xe5fce807,0xe393e2ff,0xe990e7bc,0xe126e65b,0xe405df2f,
0xf3d9ec9a,0xf58ff6eb,0xe84ef022,0xe45ae2c4,0xf353ebc6,0xfb0ef8f1,0xf4bdf8bb,0xedc2efd2,
0xfab5f238,0x07f40309,0xfdfb04b1,0x0328fd4f,0x0ca208f0,0x10c50ec5,0x13f51365,0x175f1447,
0x1a5e1a7d,0x21b81c2a,0x295d270a,0x26332939,0x17ed2037,0x04920d54,0x06b70317,0x0fdb0c6f,
0x023b0be2,0xef2ff7ac,0xe842ea8c,0xe39ee529,0xdef3e32b,0xcc6cd6bb,0xc0b1c2ef,0xce68c63e,
0xd69dd560,0xcf10d1fd,0xe491d530,0x02eaf42b,0x1ba1125a,0x1fae1f1b,0x1f0d1f74,0x231b1f99,
0x2d282883,0x2dfc2ed0,0x30ab2e3c,0x281c306a,0x13c11c8f,0x0f0a0eb0,0x161213a5,0x0b6712da,
0xfafb0207,0xf519f752,0xe722efce,0xd9c1df23,0xdba3d8c7,0xeca6e2aa,0xf5d8f3d0,0xedddf3ce,
0xe53de6dc,0xe7cae7af,0xe967e625,0xf5dbf0da,0xfb80f847,0x0196feb5,0x04e10397,0x03c50524,
0xfb23ffc5,0x0181fb09,0x0e0a0a82,0x0095088c,0x01c2fe8e,0x083105bd,0x126c0ba5,0x25411c16,
0x28d229a1,0x25b82764,0x1c9b2133,0x1b471b0f,0x19ba1b35,0x11f816e0,0xff540a0e,0xeeebf568,
0xefc9edd4,0xe71fee9c,0xd170dc92,0xc39ec8fd,0xc999c34c,0xda8ad2ce,0xda60dd6b,0xda24d75f,
0xeb64e0e6,0x00fbf753,0x024c04db,0x0449003d,0x10f90aa7,0x1ff7186c,0x2dc326df,0x37fe3417,
0x340e3846,0x25322da3,0x18a81d22,0x17fc1724,0x1320181f,0x05480b5c,0xff8e0216,0xfde6fd55,
0xf814fe57,0xe232ecd1,0xdbc8dc62,0xdc56dcde,0xd8d0da0a,0xe2ccdbf3,0xef18e936,0xfd49f5fc,
0xff100076,0xfd52fbc6,0x01660218,0xf7ccfae5,0xfaecf988,0xfc31faee,0xfddefddd,0xfeb5fd29,
0xfcdbff97,0xf6fdf944,0xfb08f739,0x1027044e,0x1a1317ed,0x1a0919c0,0x267e1e7e,0x301d2e1d,
0x232a2bdf,0x14791afd,0x111010ec,0x0ab50fc8,0x018904c6,0x001f00fe,0xf727fc1e,0xef0bf3b5,
0xdbb1e605,0xd65ed63e,0xd5dbd704,0xd1f7d3e4,0xcd72d03d,0xd0e4cc73,0xe63cd9bb,0xfe42f4ad,
0x027f015f,0x01cb0291,0x03760195,0x0fea08dc,0x2121175d,0x35c72c5c,0x3bb23acc,0x38f33ac5,
0x30933505,0x23b92b79,0x0ac3188d,0xf25afd0c,0xef34ecf1,0xfe07f794,0xf6bdfc92,0xe99bf0a8,
0xe393e346,0xeb3fe818,0xed63ec42,0xea0ced84,0xe374e5a2,0xe6ffe3b4,0xf94dee77,0x08e0030a,
0x068909b0,0xff5602d5,0xf7eafb40,0xf662f6a7,0xf26bf4ec,0xf4dcf20d,0xff90f9e6,0x06e5041d,
0x0b7b09d2,0x0c020b93,0x08000bd4,0x08d00478,0x1fa21495,0x266c25d2,0x19a12118,0x158b157d,
0x1ba617a4,0x1dde1f28,0x0c28165b,0xfc73028f,0xfe23fc27,0xf8a7fd03,0xef61f3c9,0xdd39e7e6,
0xcb6bd30d,0xc957c82a,0xd0b3cd30,0xd22dd1de,0xd788d381,0xe748de68,0xfe35f27c,0x0718055f,
0x0e730919,0x17d01455,0x21901be0,0x2a91262f,0x2c402d04,0x299529ec,0x2ce82b1f,0x2c312daa,
0x1b7026c3,0xfcb60ba8,0xef8af2e7,0xf587f1ea,0xf468f712,0xe87fed88,0xeec9ea30,0xf47af1bc,
0xf712f79c,0xe818f073,0xe246e2f7,0xe8dee4f9,0xee6beb8a,0xf8d1f379,0xfd18fc7c,0xfb6cfb49,
0x071e003a,0x10580cd9,0x098b101a,0xf13cfd69,0xf1a8ed29,0xf6c9f630,0xfb0ef801,0xff51fcf7,
0x07d40395,0x0f150b8d,0x1869131c,0x19441b9a,0x1af11708,0x2266205c,0x27ba249f,0x1b702510,
0x0ec812d6,0x08e20b7d,0x08fa08f6,0xfefb05af,0xe813f480,0xd4e2dcca,0xd36ed1c3,0xd920d7bb,
0xcefbd4c5,0xca49cb19,0xd8b2cf3f,0xe8abe120,0xf995f160,0x0521ffc3,0x0ea00a7c,0x0c3a0e75,
0x14500d53,0x25f51e47,0x2b31295d,0x28172b40,0x251c24ca,0x299f2859,0x1e892676,0x08b01300,
0x070a0589,0x0107060a,0xf881fbeb,0xeb88f343,0xdf40e3cf,0xe146ded7,0xe64ee3e8,0xef3aea63,
0xf260f1a6,0xf3b9f2c5,0xf561f4ec,0xf88ff658,0xffecfc2f,0x010401c6,0x03cd0113,0x05bb0678,
0xfc79014d,0xf95df9e5,0xf790f8a5,0xf808f76d,0xf737f823,0xfaa1f764,0xfb23fc80,0xff10fb4d,
0x0eb40572,0x23f71a3b,0x29c42965,0x236326fc,0x1f9920e0,0x1b1e1e6c,0x0df1145c,0x0eab0c9c,
0x0a890e96,0xfbe903f7,0xeb29f319,0xe6cce6d6,0xe76ae801,0xdabee334,0xc84ed028,0xcbdbc6e3,
0xdd74d454,0xe6eae418,0xe586e5ed,0xf359e9e7,0x060afdd6,0x0f910b65,0x16671389,0x1b8c18bb,
0x21a71ec6,0x2add24e3,0x37783244,0x316437a5,0x1bf126c3,0x0c0d1301,0x01c006f4,0xfac1fd35,
0xf3eef830,0xf046f0fa,0xebd6eefd,0xe85be955,0xe486e6e5,0xe6e3e455,0xee61ea2e,0xf674f314,
0xfeb0f98a,0x07ac0454,0x04c406f4,0xfea90288,0xf580f951,0xfba7f698,0x0001004b,0xf6f7fb28,
0xf50df5ed,0xf441f356,0x0084f9c1,0x05e60513,0x0004031b,0xfbe9fe5c,0xffd9fb2f,0x106d0882,
0x1adc1664,0x1e9e1d40,0x24262132,0x252b25c9,0x212f23bf,0x11d01b25,0x05bb0995,0x022d04bb,
0xf566fbd4,0xf3aef32c,0xeacff09e,0xddb8e4aa,0xd142d60c,0xd107d0e3,0xcc4ecea5,0xce7ccc11,
0xdee7d478,0xfa53ec91,0x08c903e6,0x0cdc0b00,0x12f20f15,0x1c69183e,0x20f61e4e,0x2a4d25c9,
0x2e862d1f,0x27df2cc4,0x1d6322bd,0x124e179a,0x07300cf7,0x007e02c0,0xf5c9fcf7,0xeb54ee95,
0xecb9eb4c,0xf2e3f01e,0xeed7f1c2,0xebf5ed08,0xec41eb00,0xf2fff054,0xf11cf25e,0xf798f277,
0x041bfebb,0x07be06d3,0x0724079c,0x0553069d,0xfe8702e0,0xef22f739,0xecacea64,0xfdb0f561,
0xfc5eff3d,0xfb53fabc,0xfa22fafe,0xfd1efa76,0x0681018f,0x0b1e09d1,0x0c440bba,0x103f0d4f,
0x1c7c159b,0x291d2393,0x2bb62c6e,0x22fd2731,0x1be7202e,0x0bc41542,0xf3a20038,0xe2f0e88f,
0xe649e3fa,0xe108e517,0xd72edbfa,0xd5bbd439,0xda85d9c8,0xd1cbd5e6,0xd948d350,0xebcbe19e,
0xfbcff577,0x06550044,0x183f0ee4,0x20441e9b,0x1c4c1ec0,0x1be51a40,0x27972221,0x254a27ba,
0x221e23cc,0x18a51deb,0x11301450,0x086d0de6,0xf8130076,0xf083f2b9,0xf244f0bf,0xf0ccf30b,
0xe884ec76,0xe51be5ba,0xea19e726,0xf136ed0b,0xfbb4f6eb,0xfea0fda7,0x035500ef,0x03340386,
0x05fb0435,0x04b5062c,0x01fd02ae,0x01c6024c,0xf7d1fe1a,0xedc6f1c7,0xe850eaa8,0xed8fe895,
0xfe2ff670,0xff7400cd,0xfed7fe1d,0x078601c4,0x16860f30,0x1b771ab9,0x184a19b6,0x1ab118fa,
0x1ec71c8b,0x226420e2,0x208d22b8,0x12ae1b29,0x017d08d7,0xfc30fe5c,0xeed0f737,0xda7fe509,
0xca49d070,0xd3b3cbe0,0xe184dc74,0xdef0e1ba,0xdabfdbf3,0xe2aedcab,0xf232eac2,0xfeb5f8b9,
0x093f0497,0x0def0bab,0x1c4513c5,0x286a233d,0x2d152c17,0x26fd2b2f,0x1d1821c1,0x1c211b73,
0x16141b16,0x06ef0ece,0xf7acfee0,0xf1d4f37b,0xf13af15a,0xf05af131,0xeb7bee16,0xea08e9fc,
0xee9febd2,0xf343f17d,0xf42cf3b0,0xfba1f6f9,0x04a10034,0x0ce208ff,0x0b5a0e08,0x03860737,
0xfd280050,0xf694f9f1,0xf43cf4bb,0xf0c3f2da,0xf437f0d9,0xf86ff7f5,0xf5eef6ee,0xf460f551,
0xf574f367,0x05affc21,0x16580f3f,0x175f18e1,0x159e1598,0x1a211732,0x247b1f0f,0x22d1265b,
0x16de1cd8,0x0fcb128a,0x0cf10e76,0x09b70b3d,0x00f40713,0xe488f4b7,0xd177d758,0xd834d2d2,
0xd95fdbaa,0xcc41d2bb,0xcd23c989,0xe3a3d6e3,0xf8b8ef61,0x01baff04,0x03860272,0x0bdc069c,
0x185d11fb,0x23681ee8,0x237f245a,0x22ff22f8,0x22c022dd,0x22a222e1,0x1d6a2147,0x06c714cb,
0xf1a1f901,0xf168f0b0,0xf43af20f,0xf808f758,0xf1fef56e,0xec41eefa,0xec96ead8,0xf57df0cb,
0xf8c2f889,0xf76df788,0xfdd5f9bb,0x0597024d,0x067706b5,0x07cc067a,0x09850936,0x00ac06ec,
0xf47af96c,0xef6bf1b6,0xeb5becd1,0xef2eec4a,0xf5f6f282,0xfc4ef9d6,0xfa0afbe5,0xfb6df9ac,
0x0189fe7b,0x09130490,0x1a5510c7,0x25ec222a,0x24a8264f,0x21082288,0x1cb61f72,0x172019ae,
0x100613f8,0x08520bdc,0xff8704b5,0xee8cf808,0xdc86e483,0xd9f2d8dc,0xdd07dcab,0xd1cbd8f8,
0xc9aacadf,0xdb89d05b,0xed68e641,0xf420f0ff,0x0376fa4b,0x15e70dd1,0x1a3319d4,0x1bf51a84,
0x1c821ce4,0x19d31b3c,0x1b1a1977,0x20241e1c,0x1e322029,0x14b01aa2,0x04d30cc4,0xfa3bfef3,
0xf1c2f5b0,0xec69eeea,0xe8f0ea2b,0xedb9ea1a,0xf3b0f136,0xf9a0f621,0xfca5fca1,0xf6d7f9da,
0xf806f5a5,0x0355fdcf,0x07f90674,0x0ac8099e,0x0a1a0b13,0x034f073a,0xf9ecff4b,0xf016f393,
0xf16df098,0xec0aef18,0xede6ebd3,0xf098efa2,0xf4acf204,0xfc4ef871,0x04cb000e,0x0f0c0a4e,
0x14071234,0x17df1592,0x1cdd1a82,0x252b1fa2,0x2e692c04,0x1e3628f9,0x0a391256,0x077e0755,
0x033406f5,0xf41ffc1d,0xe75ced6d,0xddc0e1af,0xddbddd08,0xdae0dd67,0xd2add676,0xd616d23a,
0xe46fdd21,0xeec0e9d8,0xf9a0f42f,0x03b8fe94,0x0f55093f,0x1d5515dd,0x2cb225f5,0x268d2d09,
0x17da1de7,0x16db15cf,0x1a411944,0x12811826,0x025e0a9e,0xfb3cfc83,0x01ebfe8d,0xfc64018f,
0xeb26f463,0xe048e388,0xe995e299,0xf93bf29a,0xf9c8fb16,0xfd6cf9d1,0x05650258,0x05dc05c8,
0x05c1064a,0x02a203b5,0x050f03d1,0x019903c5,0xfee70044,0xf93bfc7d,0xefeef489,0xedecede6,
0xeb30ece0,0xecb9eacf,0xf3caf012,0xf7eff646,0xff63fab3,0x08360417,0x0f270bc3,0x17141272,
0x23391d30,0x27fd270f,0x1f86256f,0x142018d1,0x14cc12d3,0x19d918b5,0x0cb215d4,0xf50800ea,
0xe891ec66,0xe90be863,0xe221e7c7,0xd0b7d926,0xcf5acd58,0xdb5cd4d9,0xe5c4e13a,0xea43e86c,
0xf121ecb5,0x0066f82f,0x0df007e2,0x17ed1332,0x1e6b1bcb,0x1efa1f43,0x1e791e79,0x21131f4a,
0x239a233f,0x13801ed3,0xfb3005a3,0xf88df72b,0xff74fc31,0xfa92ff38,0xeefdf3d3,0xf09eee23,
0xf66af3f0,0xf5abf718,0xf18af344,0xf18cf0c2,0xfcb6f58b,0x093d0400,0x0e760c62,0x0e620f3f,
0x08940bfd,0xff130405,0xf69efa4c,0xf449f4c1,0xf443f47a,0xf1dbf337,0xeffaf0cf,0xedbfeea1,
0xf32eef5e,0xf72cf667,0xf7a1f6cc,0xfe1dfa15,0x081502df,0x11640cfd,0x1c391619,0x29b023ed,
0x27852a67,0x22112468,0x1d3b1fd9,0x12e519b3,0x00d00972,0xf823faee,0xf928f811,0xf3bdf863,
0xe346ec34,0xd360da50,0xd2add099,0xdceed7c0,0xe12de011,0xe2a0e166,0xee3ce687,0x0026f7f3,
0x086c0558,0x0d840ad1,0x17431190,0x1f991cbf,0x1eb01fa5,0x1e9f1e29,0x1f4d1f78,0x18031d03,
0x0a361117,0x02700576,0xfbcefffe,0xefbcf5e4,0xec9bec1b,0xf650f0f1,0xf733f8d3,0xf1a9f392,
0xfa02f456,0x00ddfee7,0xfbfcff75,0xfa63f95f,0x02aafe60,0x099b066b,0x0bd70b7d,0x0a550b6d,
0x049207cc,0xfcc300df,0xf2c9f7b0,0xe618eca3,0xe296e1bb,0xeea4e7e6,0xf7adf463,0xf71bf840,
0xf7dff67f,0xff69fb51,0x05730324,0x095406ef,0x15870e6a,0x20491c33,0x236d2224,0x251c24b8,
0x238b24b8,0x1b3520c9,0x0b60139e,0xfe8e03e6,0xfa49fc15,0xedb8f5b0,0xdf4ee4fa,0xe18dde71,
0xe434e478,0xdb87e084,0xd6f4d7ba,0xddd6d960,0xe95ee321,0xf7ddf0a9,0x04fefe6c,0x10600b23,
0x16bf145c,0x185717d2,0x17691830,0x1b6a1823,0x21d71fe0,0x1ac01ffb,0x0d8313f0,0x05e50913,
0xffc502fc,0xf5edfb37,0xef8cf119,0xf2ecf0e8,0xf145f302,0xf1edf012,0xfb42f658,0x0087ff05,
0xfce8ffb5,0xfc97fb18,0x065c00cb,0x0e210b73,0x08700ca8,0xff990340,0xff81fe31,0x01fe015b,
0xfc2e001a,0xf1c6f700,0xe77cec56,0xe722e586,0xed0dea7d,0xf0c2eecc,0xf80df3d3,0x0019fc9b,
0x04c8025a,0x0c620867,0x11040f27,0x148b12b1,0x197d16b9,0x24651e68,0x27c0282a,0x1fe2246e,
0x14641a95,0x085a0dde,0xfebc03b5,0xf285f8d0,0xe4a9ebb2,0xda29de1f,0xda23d929,0xddfedbee,
0xe391e0ab,0xe7d3e611,0xe9bde91b,0xed8feab0,0xf938f2c8,0x0680ffdd,0x11330c9c,0x14fd13a4,
0x1a16170d,0x1df21ca3,0x1e8d1e9e,0x18831caf,0x0e2812e5,0x0bf00be8,0x08430bb6,0xf92f0178,
0xee6ef220,0xf176eeb0,0xf27cf31a,0xf14af0e0,0xf9f7f4d0,0xfe53fd98,0xfda9fd83,0x0195ff42,
0x050f03a1,0x05c605af,0x074a0611,0x08e40899,0x06370849,0xffa90305,0xf823fc4c,0xf0dcf3a5,
0xefa2f02b,0xe9f3ed48,0xeb83e8bc,0xf393f025,0xf399f4a5,0xf169f1d4,0xfac5f45a,0x0c22030e,
0x18691412,0x181618d3,0x1ab818cc,0x1f2c1cf9,0x217920f9,0x1b9a1fb7,0x11481655,0x0d210df7,
0x0ada0d16,0xfdf90576,0xed1df594,0xe096e5d1,0xdd0fdded,0xdededdbf,0xde1edf0e,0xdcf9dce2,
0xe32aded2,0xf2e8e9ee,0x0385fc46,0x05a5069c,0x03d103d5,0x0a6f062c,0x15620fa3,0x1dd91a8a,
0x1a841d97,0x17021788,0x188d1810,0x14181777,0x06e80e44,0xf8a6ff4a,0xf342f480,0xf4c6f3fb,
0xf2acf47a,0xee69eff4,0xf5eaf071,0x012ffc97,0xffa301df,0xfdb0fd44,0x043500e8,0x05e70594,
0x0a49073a,0x0df40d58,0x05560ad7,0xfd5e0050,0xfb49fbf9,0xf7aafa3a,0xececf2d0,0xe4e7e7ef,
0xe832e4cf,0xf424ee51,0xf774f737,0xf600f64f,0xfe67f8ad,0x081c0492,0x07130838,0x09510727,
0x139e0d58,0x23f11bb0,0x2c242a46,0x217f28db,0x10bf1883,0x0adb0c2b,0x0bff0ba2,0x04470a0b,
0xf226fb79,0xe793eb3a,0xe600e64e,0xe306e52d,0xdc5edfc4,0xd9c1d9f5,0xe05adc13,0xed4ae636,
0xf98bf46e,0xfda1fc11,0x05900082,0x14250c83,0x1ba619eb,0x140018e6,0x0e150fa0,0x112a0f2a,
0x15931313,0x15ea173a,0x0cc11165,0x074a09bf,0xfd6a034a,0xf1cff6f9,0xeb67eddf,0xec7aead3,
0xf62df07a,0x0086fc39,0x01bb0250,0xfedafff5,0x0478004d,0x0b2008f2,0x068a09f3,0x008f02e3,
0x00ccfff5,0x05350317,0x049905d7,0xfbb70151,0xee7cf4b6,0xe897ea64,0xec11e938,0xf02eef06,
0xef4ceff4,0xf0c7ef34,0xfb83f55a,0x04e900f4,0x076f0709,0x09940787,0x12fe0e0e,0x1bbf17aa,
0x20241ee0,0x1fb6200d,0x1ee01f72,0x19661d1d,0x0c7c135b,0x0066063b,0xf4c3fa6e,0xeb58efc6,
0xe6a5e80d,0xe774e6fb,0xe585e732,0xdf32e26c,0xdfd2ddd5,0xe918e46d,0xeff8ecb2,0xf763f3aa,
0x0159fb9c,0x0e53085c,0x15541253,0x183e179a,0x15f91708,0x14d415c4,0x0e21120d,0x0a0e0b6d,
0x07e20930,0x064306d1,0x05f70667,0x01380435,0xf9b2fd80,0xf335f664,0xeef3f072,0xf1b6ef67,
0xf7ccf4c6,0xfeddfb27,0x046c021a,0x08b7066c,0x0ad70a8f,0x092f0a0c,0x07550886,0x020f04ff,
0xff320002,0xfc77fe54,0xf5c2f960,0xedecf1a3,0xeaa2eb9a,0xea9bea77,0xeb12eab4,0xf034ec69,
0xfb8ef5c4,0x03bc0039,0x05db057e,0x078b062c,0x0e530a49,0x188313a4,0x1d4c1baa,0x1f321e73,
0x1d101f04,0x15aa198e,0x0f481231,0x097b0c66,0x00fd0629,0xf15df972,0xe690eac0,0xe5dce4e7,
0xe6d9e741,0xe2f1e4ba,0xe37fe284,0xea03e605,0xf1faee8a,0xf472f3be,0xf69ef540,0xfe4ef965,
0x0dfd0594,0x1a6f1548,0x1a831c30,0x127b1670,0x11241098,0x12f2125b,0x0fc5124d,0x03950a83,
0xfad4fdaa,0xfcf4fb37,0xfeb2fe7a,0xfa8dfd1d,0xf5dbf7fc,0xf577f4d0,0xf9ccf7cc,0xf910fa05,
0xfb8ef91a,0x0448ffcb,0x0bd70882,0x0e650e03,0x0a940d10,0x05210799,0x012f0331,0xfbbafed5,
0xf3a9f816,0xeca6ef90,0xebb2eb83,0xee33ecc7,0xf054ef96,0xf04ff058,0xf571f1d4,0xff79fa90,
0x03e302b0,0x054d0438,0x09f90735,0x12190dbb,0x19e81656,0x1da31c70,0x1ad31cd1,0x18121911,
0x16fd17d3,0x0eea1424,0x004b07db,0xf3a9f91f,0xf118f125,0xf1acf220,0xe8e4ee56,0xdf80e35a,
0xe096de62,0xe781e45b,0xec4be9b1,0xf215ef1c,0xf8cdf513,0x009cfcc0,0x07f4043f,0x0ef60bc6,
0x121c10b5,0x16bd1442,0x18321832,0x146e170a,0x0bab106c,0x04c207ac,0xff870251,0xfc00fd33,
0xfb11fbb0,0xf764f95f,0xf76bf65e,0xfe59fa77,0x01f50129,0xfe4e00ba,0xfb37fbd8,0xff38fc97,
0x01b9011b,0x019f017f,0x050d02f3,0x0a1707d0,0x09fb0b1a,0x034f071e,0xfc27ff8b,0xf40ef863,
0xeccbefc3,0xe94aeabe,0xe8efe895,0xebdee9f4,0xf52eef7d,0x00fefba3,0x03aa03bc,0x01b50222,
0x07d403c5,0x0ee60c13,0x11201030,0x161212fe,0x1d3919ea,0x1e341ec4,0x19df1c66,0x128a16dc,
0x06470cf1,0xfb2c003e,0xf3aef72f,0xed79f093,0xe78eea52,0xe4aae595,0xe75be534,0xebebea34,
0xea4beb92,0xeb59e9a1,0xf526ef7d,0xff63facc,0x058e02c2,0x0b740855,0x11090e96,0x11d6121d,
0x108b1141,0x0cfa0f28,0x0b8a0b5e,0x0df20cf4,0x0c200db8,0x024c0831,0xf9bffce7,0xf92cf8f5,
0xfb24fa11,0xf9a7fb24,0xf6a1f7d2,0xf9f0f742,0x0291fe60,0x057c0519,0x032a04d3,0x000a010f,
0x04170127,0x05db0629,0x01f103da,0x00c600eb,0x023b012f,0x005d025d,0xf74ffc65,0xee16f277,
0xe7edeaad,0xe6a9e673,0xec1ce8bc,0xf45af00e,0xfcc9f878,0x0613014d,0x0dd30a32,0x13351130,
0x112912f4,0x10700fe0,0x158f12a5,0x1984181a,0x185c1974,0x13c4168d,0x0bb9100e,0x02bf072e,
0xfa78fe90,0xf1e6f64f,0xebdaee25,0xe9b1ea7d,0xe84ee8e3,0xe7b2e7b7,0xebc6e912,0xf197eee5,
0xf4dcf39a,0xf48df4f1,0xf800f510,0x03ccfd4c,0x0edf0a0e,0x13951225,0x121d1325,0x11ce11ad,
0x104c1147,0x0cea0f0e,0x05a50995,0x01e702f3,0x00fe01b5,0xff04ffef,0xfca9fe79,0xf650f977,
0xf558f4be,0xfb11f7b3,0x0078fe42,0x01950176,0x001600b2,0x04e9012d,0x0c840952,0x0a920cea,
0xff8d057e,0xf9a9fafb,0xfd09fb35,0xfcc3fda2,0xf8fffb37,0xf47af66a,0xf2e3f392,0xf086f1c2,
0xee04ef4d,0xed9aed28,0xf260ef83,0xfd03f6e6,0x091103a7,0x0e2c0c53,0x119e0fde,0x15c913ab,
0x185c1775,0x155417a4,0x0fba123b,0x0ef40ede,0x0eff0f52,0x0a760d72,0x0234066e,0xfb2ffe53,
0xf508f86a,0xec31f093,0xe75ae8f7,0xe72ce6e0,0xe859e7c4,0xeb44e96b,0xef47ed6d,0xf307f0e6,
0xfb53f676,0x058b00ba,0x0ac008c8,0x0d160c0e,0x0e4e0dd6,0x0fec0f1e,0x107f109a,0x0dab0f5f,
0x09e70bf6,0x02f60699,0xffd4008f,0xfe1eff54,0xfc39fcab,0xfe39fd05,0xfd06fe47,0xfaf3fb8f,
0xfb8efb21,0xfdcffc70,0x00caff8e,0x03aa021b,0x074c05b8,0x06ae07a3,0x033a04e6,0x01b1024d,
0xfe91008d,0xf9f7fc52,0xf5f5f782,0xf58ff5ad,0xf3b7f4a9,0xf535f401,0xf679f614,0xf6c9f6c9,
0xf34bf556,0xf22cf1c6,0xf9f0f4bf,0x04a9ffec,0x0907076f,0x0fd70bb8,0x1a7c153d,0x20bb1ee2,
0x1b341f61,0x117715f2,0x0bc30e2f,0x06870920,0x018603de,0xfcc9ff26,0xf753fa38,0xf266f478,
0xeffaf12a,0xebecee3c,0xe8b7e9e7,0xe918e86e,0xee32ead5,0xf4dcf1f5,0xf6eff627,0xfc70f8d1,
0x04c700c1,0x0b490822,0x10ea0e41,0x104611c1,0x0a3f0d06,0x097208ed,0x0b5e0aa5,0x088d0ab9,
0x023b0551,0x01fe0104,0x03f303ba,0xfe5001c0,0xf8a5fb09,0xf89df7b8,0x0002fbd8,0x021402b9,
0xfa4cfe69,0xfa65f893,0x0317fea0,0x093906fd,0x087909bc,0x02fd0607,0xfdf9001c,0xfdd4fd3b,
0xffa0ff14,0xf9a6fdd6,0xefc3f458,0xee11ed4a,0xf51bf160,0xf5bff6a5,0xf331f406,0xf630f400,
0xfde2f9af,0x04e6020d,0x04210585,0x02ea0270,0x0eb90717,0x1d1616f6,0x1ec61f7b,0x181f1bd1,
0x12c714f4,0x0d4c1088,0x039808c8,0xf8ddfe59,0xf206f468,0xf3d0f238,0xf6dbf5d7,0xf3dcf64b,
0xeec3f0cf,0xef2fee6e,0xf07ef037,0xed9def83,0xecbfec36,0xf359ef25,0xff47f8b5,0x0a8305d7,
0x0bc40c31,0x0ae40ac0,0x0f550c76,0x13e0123b,0x0e151290,0x03a3084f,0x01290170,0x03a40230,
0x054804f3,0x0116040f,0xfa4bfd3a,0xfb9cf9c4,0xfefbfe0c,0xfb30fdde,0xf782f87e,0xfe31f975,
0x07c7039b,0x0830092b,0x03ef0605,0x025802ba,0x02df028c,0x016202d1,0xfb9cfeb8,0xf62df8d8,
0xf320f42b,0xf457f35c,0xf64ff576,0xf4bef626,0xf1faf320,0xf600f2f0,0xfe3dfa57,0x024000c1,
0x033a02d2,0x055803bc,0x0bdc0830,0x10bf0f0c,0x109110fb,0x12ab10f9,0x170a1530,0x16621780,
0x0fb913c2,0x05bb0a97,0xfd52018d,0xf3d3f896,0xee96f04f,0xed9cedf1,0xed54ed83,0xef3eedd5,
0xf400f193,0xf55bf53e,0xf2b5f456,0xf12bf155,0xf42bf222,0xfc6ef792,0x06f401f5,0x0c720a5c,
0x113c0e9a,0x14b713c9,0x0f8c1329,0x07a50b28,0x055405c8,0x045d0526,0x00060280,0xfc28fdb7,
0xfbcffb7d,0x0094fd80,0x05a10408,0xff9703b1,0xf948fb58,0xfc25f9c8,0x006efeca,0xffa90050,
0x01d4ffc9,0x072404ec,0x044906db,0xff320158,0xfc24fdb7,0xf95ffa92,0xf8ddf8e1,0xf8bff8dd,
0xf7fdf881,0xf589f6d9,0xf2eef40e,0xf3d9f2a9,0xf9e8f680,0xfe05fcca,0xfd86fdd2,0x01e7feec,
0x096f05e7,0x0d900c13,0x10450ecc,0x146d1259,0x160f15ed,0x11591460,0x0cfb0e78,0x0c200ca5,
0x06aa0a24,0xfd99025f,0xf4cff8d8,0xef9bf1db,0xeb58ed8a,0xe7fee946,0xea0ce802,0xf279edea,
0xf870f632,0xf9caf984,0xfb71fa54,0xfdc7fcfa,0xfe42fdfc,0x00f4ff56,0x04380271,0x0a6f06ca,
0x11760e4d,0x12a31319,0x0ca6102e,0x080009bf,0x053b06e2,0xfffd02d1,0xfc40fd95,0xfcb4fc1c,
0xff14fdda,0xffc3ffdd,0xfdbefeb5,0xfe98fdc3,0xfe84ff07,0xfd33fd84,0xfffbfe30,0x0236018e,
0x013801e0,0x01df0127,0x056c03b3,0x012d04ee,0xf764fbd5,0xf5dff587,0xf956f7aa,0xf965fa15,
0xf4a8f77c,0xf1f8f262,0xf59bf367,0xf98df7c1,0xfd73fb53,0x01b8ff75,0x0743044e,0x0cfa0a5d,
0x10c70f22,0x1185117a,0x107c1111,0x0f710fcf,0x0fb00f85,0x0db40f4d,0x070c0ad7,0x0074035b,
0xfd13fe98,0xf8a5fb55,0xf269f599,0xed23ef8c,0xeb52ebad,0xed0bebdf,0xeef8ee01,0xf0a8efb4,
0xf6e2f2d7,0x008ffc09,0x039a0327,0x02de0303,0x04b3039c,0x04e50507,0x0649050f,0x09bc07f9,
0x0dbd0ba6,0x10b50fa9,0x0f8510c8,0x09290cdf,0x002c04b1,0xf9b8fc55,0xf82df88a,0xf981f896,
0xfc60fb04,0xfd1dfd1c,0xfe34fd29,0x013dffc2,0x042c02e8,0x03530473,0x0056014d,0x00fd0071,
0x001f00e2,0xfcfefed5,0xf9dafb4c,0xfb4ef9db,0xfda2fd1e,0xf935fc45,0xf24df55a,0xf387f193,
0xf9f0f6d2,0xfb4afb97,0xf881f9cd,0xfbb3f910,0x0336ff7e,0x085e0637,0x0c160a4b,0x0f3c0df1,
0x0ff00ff3,0x0fd80fdb,0x0f880fde,0x0d100e95,0x09700b56,0x061c07ae,0x039e04e1,0xfee901ac,
0xf6a1fafc,0xef5ff26d,0xed54edcd,0xecdeed3b,0xea80ebcd,0xec72ea58,0xf3d9f00e,0xf815f65d,
0xfc4ef9b8,0x0403ffa9,0x0b650839,0x0ca70cf1,0x08b20b04,0x062f06b7,0x07ee06f1,0x095008d7,
0x08860948,0x078d079f,0x0a3908b2,0x09fb0afb,0x024706de,0xf80dfce1,0xf506f550,0xf8dff68e,
0xfca5fb2a,0xfe11fd8c,0x000efeca,0x043301ed,0x062905d4,0x036704ff,0xffbe0195,0xfb6cfd78,
0xfa2bfa54,0xfad6fa83,0xfb35faf9,0xfc5bfbae,0xfd6ffcfa,0xfce0fd7c,0xf8b1fb28,0xf33bf5c6,
0xf2d1f20c,0xf95af587,0x008dfd8f,0x0358027c,0x07b104e4,0x0ef10b70,0x1191110e,0x103a10f2,
0x0f9a0fc5,0x0ebf0f4c,0x0d3e0df9,0x0a360c0e,0x03bf071e,0xfe8200bd,0xfaa1fca7,0xf5edf871,
0xf086f32e,0xebf9ee20,0xeb03eab9,0xef3aeccc,0xf1bcf10f,0xf18af1aa,0xf602f2b9,0x01d4fb9e,
0x08870693,0x06e0082b,0x075f0654,0x0bc10999,0x0c810ce6,0x097a0b26,0x069e07c1,0x056105da,
0x063e0572,0x07ee077a,0x04cb06de,0x022802fd,0x017801eb,0xfdc90028,0xf6abfa7b,0xf17ff34b,
0xf4b1f1ea,0xfe39f947,0x05b80288,0x06ef0738,0x0458058b,0x03e603eb,0x01f10367,0xfd3dffe9,
0xf76afa47,0xf55cf586,0xf951f6f5,0xfc5efb6d,0xfaa8fc11,0xf89ff938,0xf9f5f90a,0xfa6ffa9e,
0xf7b9f956,0xf8aff702,0x031afd0c,0x0e080944,0x11b410de,0x110e1164,0x10ec1105,0x0ed1102e,
0x0b820d40,0x083809bc,0x06920718,0x04f8060a,0xffec02c8,0xf920fc9e,0xf28df5b4,0xeeeaf03a,
0xee85ee72,0xef4feed7,0xef0aef6a,0xeeb4ee7c,0xf39af079,0xfb35f76f,0x0057fe26,0x032101e9,
0x07d3050b,0x0d690ae6,0x0f4b0ed3,0x0d890eb9,0x0a0e0bba,0x08c8090e,0x08e608df,0x066e081d,
0x01ba0424,0xfe1affac,0xfe60fdbc,0xff22ff1f,0xfde6fe97,0xfc78fd67,0xf8edfabf,0xf7d1f7c8,
0xfabff8df,0xff7cfd33,0x03360186,0x062504a1,0x07610731,0x03550605,0xfd4e0019,0xfa24fb5e,
0xf78ef901,0xf659f69b,0xf75cf6cc,0xf8bbf808,0xf9dff94b,0xfc06fab8,0xfe3dfd46,0xfe99fea3,
0xfe8bfe7a,0x0086ff19,0x05c102b4,0x0cab092d,0x11b40f83,0x133e130b,0x10cc125c,0x0ddd0f70,
0x09320bb6,0x052b070a,0x01af0376,0xfd6affd7,0xf7d8fac0,0xf24df508,0xeebaf00b,0xede5ee1c,
0xecd3ed5a,0xecbbec84,0xf0a5edfa,0xf7fcf460,0xfc40faa5,0x0002fdd5,0x06770333,0x0b310949,
0x0cfd0c44,0x0f330e0a,0x0f350ff6,0x0abb0d38,0x079208a5,0x065006f8,0x027d04da,0xfdb8ffe3,
0xfcf9fcb9,0x0034fe53,0x00a00122,0xfba5fe67,0xf85ff975,0xfaf1f8e6,0xffe2fde0,0xfe48fff9,
0xfa38fbcc,0xfc5efa5f,0x0200ff47,0x05a30452,0x057f0619,0x02cd0445,0xff8d0127,0xfbd8fdb0,
0xf73ef9ae,0xf350f4e9,0xf2f4f294,0xf6bdf456,0xfc98f9b2,0xfed0fe72,0xfe17fe48,0x0172ff10,
0x081304e5,0x0aad0a31,0x09140a12,0x095408ac,0x0ed30b88,0x14731222,0x133714e5,0x0bbd0fc8,
0x060c0855,0x00e603da,0xf7dbfcb4,0xef85f329,0xed39ed78,0xf00bee6e,0xf130f13a,0xeed5f025,
0xef04ee48,0xf4fbf17d,0xfafef887,0xfce4fc34,0xfff9fdf9,0x05f802c5,0x0c380957,0x0ee70e34,
0x0e230eba,0x0ca60d5f,0x0cc40c62,0x0ce80d4c,0x06d50ac4,0xfe3101fe,0xfcabfc58,0xfea2fdce,
0xfce1fe2c,0xf960fb11,0xf8cdf87d,0xfc64fa4b,0xfebbfe14,0xfd44fe55,0xfc03fc28,0x0002fd80,
0x03a4027d,0x01a20316,0xff1d0013,0xff41fea5,0x02ba007d,0x063204ec,0x01b40526,0xf78ffcd3,
0xf14af377,0xf1ccf106,0xf42bf2d5,0xf670f55a,0xfa49f7ea,0x0264fddd,0x0aac0723,0x0c810c66,
0x0a9b0ba0,0x0a690a08,0x0cef0b85,0x0d830dcc,0x0abb0c38,0x0ad10a14,0x0e0a0c7b,0x0bae0e16,
0x01220703,0xf627fb3b,0xefeef27b,0xec42eddf,0xea94eb1e,0xebfeeadc,0xf0c6ee01,0xf614f3aa,
0xf875f7c1,0xf92ff8c4,0xfbc3fa1c,0x016afe44,0x08b2052f,0x0db40b9b,0x0ef00ed8,0x0f350ebf,
0x11fb1088,0x1055123b,0x07670c86,0xfe82024c,0xfd35fcc7,0xff1ffe6c,0xfc33fe4e,0xf7e6f9be,
0xf7fcf745,0xfb1cf968,0xfcfafc67,0xfd15fd02,0xfea9fd89,0x00e8ffe9,0x01df019f,0x02110215,
0x026a0233,0x01c6027d,0xff7000a2,0xfe8dfea2,0x001fff62,0xfee20019,0xfb41fcf3,0xf868f9b4,
0xf64bf745,0xf36cf4f6,0xf289f23e,0xf7e6f44a,0x019dfc8b,0x0a1e0672,0x0dfd0c9b,0x0f8b0eeb,
0x0f2f0fb5,0x0beb0dd1,0x09f90a70,0x0b9b0aa4,0x0c2d0c3f,0x09670b41,0x055f074e,0x016203a1,
0xf9f5fe23,0xf0dcf56b,0xe9f9ecde,0xe825e875,0xe925e863,0xed53ead3,0xf3e9f08c,0xfb4df771,
0x0211ff11,0x044103bc,0x0492044e,0x07050574,0x0b74093d,0x0ead0d65,0x10640fa1,0x10b410da,
0x0ca80f2c,0x074a09e3,0x020304d1,0xfc7dff50,0xf863fa35,0xf6e2f727,0xf8edf789,0xfb0cfa44,
0xfb0ffb28,0xfbf2fb42,0xfd83fca7,0x0028feb2,0x02ea0199,0x045f03c8,0x03550436,0x000f019d,
0xff27ff1e,0x01d80046,0x02e30309,0xfe910138,0xf953fb84,0xf91af87e,0xfa1cf9e8,0xf86cf981,
0xf55cf6fd,0xf37ff3f5,0xf7a7f4b8,0x000efbd8,0x06ae03b8,0x0be90954,0x11110ea0,0x142012ff,
0x13a41458,0x0f5811f6,0x09390c3f,0x05d206fd,0x0517055f,0x02bc0473,0xfb4cff92,0xf3acf6de,
0xf10df1fe,0xef77f03d,0xed65ee8a,0xeb10ebfd,0xed10eb5d,0xf273ef85,0xf932f5bd,0xffcffc97,
0x06ae0327,0x0ceb0a30,0x0dbb0e06,0x0cd30d16,0x0d960d2e,0x0d5d0dc4,0x0c0e0cc1,0x09f50b49,
0x06050815,0x014403b1,0xfc67febc,0xf8b5fa6f,0xf658f74f,0xf63df612,0xf758f6b7,0xf9c8f85c,
0xfcdcfb57,0xff4efe23,0x020c007a,0x051603a4,0x05c105e0,0x03a404db,0x028802b4,0x034302c4,
0x015102f6,0xfbe1fec1,0xfa1cfa3a,0xfc9ffb46,0xfb43fcc0,0xf568f870,0xf2b6f33e,0xf5d8f3cd,
0xfa69f848,0xfdb2fc2e,0x0164ff59,0x06c103ec,0x0c4109a7,0x0f670e26,0x110c1058,0x125611c1,
0x11bc1262,0x0e5f105e,0x089c0bb4,0x015f0504,0xfa9afdcc,0xf550f7d6,0xf1c4f323,0xeff9f0da,
0xee14eeeb,0xee8aedf6,0xf001ef58,0xf1b6f0c2,0xf3d3f2d4,0xf811f53d,0xffddfbdc,0x06610367,
0x0c530955,0x12460f67,0x15b11499,0x122f14e2,0x0b260e9a,0x079408ba,0x058e06d3,0x01410395,
0xfe17ff92,0xfbc0fcfa,0xf9aefab3,0xf833f8dd,0xf66ef776,0xf4bff54d,0xf7aaf587,0xfddefaa5,
0x028e0069,0x05ca0445,0x076306ef,0x06900741,0x04b5058b,0x03aa0417,0x00f502ac,0xfd1cfeff,
0xfb68fc06,0xfa47fb01,0xf920f989,0xf89af8e3,0xf813f85f,0xf763f7ca,0xf65df6c6,0xf78ef65d,
0xfdc9fa2f,0x04d10150,0x09c4078d,0x0d040b6f,0x0ffc0e8f,0x11841110,0x10b01155,0x0f780ffe,
0x0def0ee4,0x0a1a0c62,0x033e072b,0xf896fe60,0xee04f2e9,0xe9f9eaef,0xec63ead8,0xee7ced9d,
0xf04eef5c,0xf1e3f10b,0xf5ebf37b,0xfad3f8a3,0xfc4cfbfd,0xfd1cfc65,0x03e1ff68,0x0f8b09d2,
0x1523137e,0x143d1506,0x12fb1377,0x10881222,0x09890dba,0xfef3045b,0xf77dfa47,0xf792f6d7,
0xfa78f903,0xfc37fbce,0xf9fefb7c,0xf782f888,0xf81df768,0xfadff98d,0xfc1efbb3,0xfeeffcfe,
0x049901a6,0x08cf0700,0x0ac40a17,0x08e90a76,0x03970669,0xfece00de,0xfc00fd12,0xfa31fb16,
0xf81df914,0xf798f785,0xf813f80d,0xf60ff75e,0xf4d7f4ee,0xf8d6f646,0xfe8bfbcc,0x01780056,
0x02ec0214,0x08cb0511,0x11440d43,0x13db1393,0x10bb128d,0x0e580f33,0x0e0f0e19,0x0ca80dd9,
0x070e0a60,0xfe9e030f,0xf630fa1c,0xf108f34b,0xec7feee4,0xe7a4e9de,0xe766e699,0xee1dea0c,
0xf687f26b,0xfd1efa17,0xfef2fec1,0xfe6cfe60,0x02c0ffed,0x09e20662,0x0dfb0cb2,0x0e6a0e42,
0x117e0f63,0x14c913af,0x10f213db,0x07c30cb1,0xfed002e4,0xf916fb83,0xf613f75e,0xf4c1f531,
0xf4b7f49b,0xf69df549,0xfb1ff8af,0xfe1afd18,0xfe30fe5a,0xfe8dfe2c,0x0059ff4a,0x044e0221,
0x086e0690,0x09760951,0x07e208d2,0x059c06e0,0x01c80408,0xfb35fed0,0xf50df7b8,0xf2d1f36c,
0xf493f345,0xf7b1f640,0xf826f853,0xf76df797,0xf9baf823,0xfe7efc03,0x036a00dd,0x088005f9,
0x0cae0ac0,0x0ec80e0a,0x0f700f0a,0x112e102d,0x11171188,0x0e530fe4,0x09cb0c41,0x02850687,
0xf9bbfe2c,0xf35cf61c,0xef37f14c,0xeb07ed08,0xe912e9ba,0xeb12e992,0xf023ed70,0xf55af2d4,
0xfa77f7d0,0xff9ffd05,0x05a3025f,0x0b2808e8,0x0bfa0c08,0x0ceb0c26,0x100f0e71,0x122911a5,
0x0ffc11c3,0x0aca0da8,0x043a07b5,0xfd02007a,0xf8f1fa65,0xf7bff835,0xf5acf6ea,0xf2a9f420,
0xf226f1c2,0xf87df486,0x0028fce5,0x02a201f7,0x032202c9,0x059d041f,0x08380735,0x075f0843,
0x047805e0,0x037c03af,0x035a037e,0x01c002cc,0xfdd50028,0xf7b1fac1,0xf310f4f4,0xf219f20c,
0xf31af2a3,0xf3ebf345,0xf884f594,0xffb0fc2a,0x0449027d,0x0637054d,0x09a20799,0x0e0d0bcf,
0x11350fd5,0x114611d5,0x0df40fdb,0x0be50c66,0x0c930c32,0x09af0bf4,0x009005aa,0xf680fb1b,
0xf1b5f37b,0xeda1f00b,0xe7c9ea99,0xe699e647,0xecaee8e7,0xf510f122,0xf94cf7cb,0xfb3cfa2b,
0x003dfd37,0x08b5045a,0x0e6f0c65,0x0ec10eea,0x0fcb0efd,0x10e5109e,0x0fcb1097,0x0c0a0e67,
0x04c108b9,0xfe47011f,0xfbb6fc85,0xfa8bfb58,0xf709f925,0xf3f7f51d,0xf4c1f3ec,0xf73ff5e1,
0xf972f87b,0xfa8dfa0d,0xfe60fbce,0x06ae0229,0x0d310aa9,0x0cc70dc5,0x08690ab7,0x046e0636,
0x01e00329,0xfee3007d,0xfb33fcf6,0xf7eef943,0xf75df740,0xf7a8f7d0,0xf4b5f6b5,0xf0dcf273,
0xf257f0bf,0xf7c1f4e2,0xfd53fa93,0x0473008b,0x0c92089a,0x11500f8e,0x1091116d,0x0e600f5e,
0x0d4e0db7,0x0d780d41,0x0d650db3,0x09950c18,0x029c0629,0xfd54ffa8,0xf91bfb65,0xf264f61e,
0xeb78ee99,0xe9f7e9d0,0xedc0eb87,0xf1deeffc,0xf5a3f3b4,0xfa59f7b6,0x0157fd99,0x079904fc,
0x09670902,0x09530962,0x0b0009cb,0x0f0e0cdb,0x10691084,0x0af30e70,0x031806de,0xfe5c003a,
0xfbc6fcfb,0xf8abfa4e,0xf596f6ec,0xf4e0f4d6,0xf746f5c7,0xfa83f910,0xfbdffb68,0xfd75fc73,
0x01a3ff39,0x06ce043f,0x0a8908ed,0x0c9d0bb2,0x0dd10d5e,0x0ce10dcb,0x084c0b08,0x016204ed,
0xfb03fe09,0xf647f879,0xf35af47f,0xf2f4f2f0,0xf34ff331,0xf387f373,0xf3edf3a4,0xf568f47a,
0xf798f678,0xfb68f906,0x0299fea0,0x0a10068b,0x0ff00d29,0x1436125a,0x14dc1531,0x1017131b,
0x09b80cc6,0x065007a1,0x044d0567,0x012302e2,0xfd0bff45,0xf7defa90,0xf397f574,0xf186f256,
0xeff2f0c1,0xef4cef58,0xf2bff06a,0xf9ecf614,0x0072fd6f,0x051602f0,0x081b06d0,0x09bc0912,
0x0a580a24,0x0a020a41,0x08750966,0x05bd0741,0x029e0434,0xff46010a,0xfc2ffda7,0xf959fac5,
0xf6a6f7f3,0xf508f5a9,0xf519f4c4,0xf7ebf613,0xfd24fa76,0x00f6ff3c,0x0389023f,0x06d90500,
0x0b1a08f4,0x0df70cdf,0x0e2c0e5f,0x0d470dc2,0x0c080cc5,0x09230ae6,0x031806a6,0xf98bfeae,
0xf0b7f4ba,0xed43ee2f,0xeeceedc3,0xf039efa2,0xf1b1f0d3,0xf42af2c5,0xf849f606,0xfc74fa96,
0xfea3fdc9,0x00c2ff7f,0x069302fa,0x0fb40b2e,0x14971310,0x13d514a2,0x121912ee,0x0f611111,
0x08980ca2,0xfe71039b,0xf74af9ff,0xf6d5f674,0xf864f7ad,0xf875f8c0,0xf607f764,0xf451f4e4,
0xf578f48c,0xf8a7f709,0xfb09fa00,0xfe88fc58,0x04ca0174,0x09e807ac,0x0c370b65,0x0b140c21,
0x0756094e,0x03d9056b,0x00900229,0xfd18fed4,0xfa05fb61,0xf8c8f919,0xf851f8b5,0xf602f75c,
0xf4a9f4e5,0xf7b1f5af,0xfca0fa2c,0xffc8fe79,0x0190009f,0x06de0390,0x0e750ada,0x112d10ae,
0x0eeb104c,0x0d190db8,0x0d270d0d,0x0c0d0d15,0x06ae09ea,0xfe7502be,0xf6a4fa31,0xf223f416,
0xee01f039,0xe971eb89,0xe927e873,0xef43eb93,0xf6ebf335,0xfcf6fa25,0xff7dfec7,0x0033ffa7,
0x047401d7,0x0ac307ad,0x0e850d4b,0x0ed10ec8,0x10e20f68,0x13451281,0x0fcb1263,0x07790bff,
0xfee902e3,0xf8e1fb86,0xf541f6dd,0xf393f425,0xf3a0f372,0xf573f438,0xf997f758,0xfcb4fb8a,
0xfd72fd3c,0xfe5cfdc2,0x005cff34,0x0466022d,0x089e06af,0x0a1f09af,0x095909ea,0x0754088c,
0x035b05ac,0xfcdb005d,0xf6bdf974,0xf3f4f4e8,0xf4bef3f1,0xf736f602,0xf7b9f7cc,0xf74ef753,
0xf9acf819,0xfe1efbd4,0x029e0047,0x076d0502,0x0bae09ae,0x0e1d0d33,0x0efb0e85,0x10a70fb6,
0x109110fd,0x0de70f6c,0x09710be0,0x025a063e,0xf9e0fe2a,0xf3acf65e,0xef95f1a1,0xeb89ed75,
0xe9baea51,0xeb9fea37,0xf06eedda,0xf58ef30b,0xfabcf80c,0xffedfd54,0x05d102a5,0x0b490904,
0x0c580c43,0x0d470c90,0x10070e9e,0x11d51169,0x0fa81164,0x0a8c0d5e,0x0412077e,0xfcf10060,
0xf8d5fa53,0xf78af80c,0xf56ff6af,0xf267f3e2,0xf1d2f176,0xf81ff42b,0xffe9fc8e,0x028801cb,
0x031702bc,0x058e0410,0x0839072a,0x07860858,0x04b80614,0x03c703f6,0x03ab03cd,0x021b0323,
0xfe260082,0xf7e8fb07,0xf32df51d,0xf227f221,0xf31bf2ab,0xf3e0f340,0xf86df582,0xff92fc11,
0x042f0261,0x06210536,0x09830780,0x0de50bad,0x110d0fac,0x112a11b2,0x0dea0fc8,0x0be10c61,
0x0c8a0c2f,0x09a30be9,0x008b05a0,0xf684fb1b,0xf1b9f37f,0xedaaf00f,0xe7dceaa7,0xe6abe65b,
0xecb7e8f5,0xf514f128,0xf951f7ce,0xfb41fa2e,0x003ffd3a,0x08b6045b,0x0e710c67,0x0ec30eec,
0x0fcb0eff,0x10e3109e,0x0fcb1096,0x0c080e65,0x04bf08b6,0xfe46011e,0xfbb6fc84,0xfa8afb57,
0xf708f925,0xf3f7f51d,0xf4c0f3eb,0xf73ef5e0,0xf971f87a,0xfa8dfa0c,0xfe60fbcd,0x071e0229,
0x00000513,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,
0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,
0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,
0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,
};
const uint32_t sample_2_timpani_timpani[3968] = {
0x00000000,0xfff9fff5,0xfff9fff5,0x0004fff5,0x004fffd7,0x010dff91,0x0f21fd95,0x4fbb460b,
0x598a625b,0x40225439,0x1dc43113,0xcebe1dfc,0xa00faa38,0x8dee95d9,0xa37e9a5c,0xc251ae3d,
0xce93bae0,0x0511d76d,0x3eb12a28,0x4c583de2,0x57c249d3,0x71fb4441,0x23dd71fb,0xe630f1b5,
0xe648e7ed,0xeec9ef46,0xcda5dd06,0xb7a1c669,0x8ede8dee,0x8dee8dee,0x8dee8dee,0xc0548ff3,
0x0a45edec,0x71fb5de5,0x71fb71fb,0x71fb71fb,0x71fb71fb,0x71fb71fb,0x63ea65a4,0x1d0f436b,
0xee5d0f5a,0xe57305f9,0xb625c17f,0x8deeaa98,0x8dee8dee,0x8dee8dee,0x8dee8dee,0x8dee8dee,
0xc0a68dee,0xfbd5dff8,0x3d3529ab,0x55755d07,0x67ae6ddf,0x71fb71fb,0x4f7e71fb,0x13161b8c,
0x1d472442,0xfa441de7,0xcf52e857,0xd173e353,0xe3c8e00a,0x0295e5f9,0x0f271317,0x2b7b286d,
0x22d1246c,0xa55de909,0xd89caf6a,0x38f2130d,0x53b04e5a,0x3fcc54bc,0x0adb2513,0xf0652688,
0xd155e5e1,0xfba9dd25,0xf8551268,0x9d19b5bf,0x9acea20f,0xad5bb3e4,0xed96daf5,0xf3e2f0de,
0x10511045,0x4bf33ede,0x2b5b3d9b,0x29bb3343,0xffc50b15,0x0027ebe8,0xfec7f3a9,0x10b60585,
0x2b5f16fb,0x11ff1190,0xdf53f16d,0xeca9de8c,0xd533d6a4,0xcb59bbe0,0x0a3cd75a,0x2ffe10b0,
0x51a051c1,0x4d464a90,0x71fb558f,0x4c346c85,0xe693195c,0xc947d26b,0xb29bcfe6,0xd9cfc45b,
0x05d9e1d2,0xf35a17dc,0xe47fe2b5,0x9e06a4c7,0xc216b13e,0x004bdab5,0x14061d0b,0x00cafd35,
0xff13ef19,0x288f131d,0x3ce019c6,0x2b4f3101,0x04c10d54,0xc8fbea58,0xa9669f86,0x8deeb3ed,
0xc2fba7ce,0xf0a8ce3f,0x0d69f6ef,0x41e33da6,0x48ae4ae9,0x5d2c3a27,0x65f8634d,0x4b764493,
0x5810406f,0x4a9b649b,0x4343455f,0x2c0c4275,0xe114030a,0xb1e6cd24,0xc151b261,0xa540ac33,
0x8dee8fcc,0x8dee8dee,0x8dee8dee,0x91fb8dee,0xe178bead,0x15e3f073,0x063211a2,0x20a40606,
0x4ae02a5e,0x662c5d72,0x4da64ee4,0x3b7d34a9,0x29b54196,0x42eb351b,0x491b4bf0,0x599d6206,
0x2c094a20,0xed231a6f,0xcd85ea5b,0xe852d9a6,0xf8adfc73,0x1b280bb1,0x22ad224f,0x1562130a,
0x0ecc125f,0xf0b70311,0xbec9f2c8,0x909eaec4,0x8dee8dee,0x8dee8dee,0xc16f9eb2,0xa6ffb95f,
0xdb97b77b,0xf408db2f,0xf6abfaf8,0x058501cb,0xfbd80c9c,0x0ea10add,0x36792da4,0x67ac4ba2,
0x71fb71fb,0x71fb71fb,0x71fb71fb,0x4ca36dc4,0x3e9f3f5b,0x067e1bcb,0x085afcfa,0x01461670,
0xe891fff2,0xe74aecef,0xfc92f08b,0xf4d7f80c,0x987dc84c,0x8dee8dee,0x8dee8dee,0x8dee8dee,
0xb84c9a36,0xbb70c776,0xc9b5cbaa,0xc9ebd25d,0xfaa7d65b,0x31b420a0,0x36262852,0x3a6e340e,
0x37cd3a0b,0x5a4b49e5,0x71fb6b6a,0x71fb71fb,0x71fb71fb,0x6bf96d27,0x34275100,0x2c1831b4,
0xeb3d2305,0xe341e747,0xd083cb12,0xe01dc9e5,0xea3adc7d,0xcc09dcd0,0xc3c9cab1,0x93e4a51c,
0x8dee8dee,0x8dee8dee,0x9c468dee,0xaef2a646,0xc838b98a,0x1a70ef95,0x11b4ffec,0x28fe19ea,
0x0a971634,0xff680f97,0xff8602d1,0x18930661,0x3bc82224,0x650c6590,0x5b8162af,0x66bf59b8,
0x71fb71fb,0x715f71fb,0x5a586b92,0x282e37d9,0x09631b2b,0x0930fe19,0x05541030,0xf2a0f255,
0xce93eefc,0x943d9f37,0x8dee8dee,0x8dee8dee,0x8dee8dee,0x8dee8dee,0x8dee8dee,0xabd58ecb,
0xf6e2ccf0,0x14d40bb6,0x308c1fd4,0x3cc83642,0x4d1441cb,0x58a454ef,0x54f55933,0x6aab5d25,
0x71fb71fb,0x71fb71fb,0x71fb71fb,0x4dff6b8e,0x273825fc,0x1d5131ad,0xe9ae0de2,0xcb9ddd3e,
0xc6e9c6dd,0x9e7eab38,0xcb85af2d,0xc1a3bb94,0xad7db412,0x9b3daf10,0x93f193cf,0x900b938e,
0x8dee8f27,0xb6319605,0x17e8f839,0x23232783,0x1f56235e,0xfdc91211,0x0a31f343,0x103f09a2,
0x23d41d97,0x1fcd26b7,0x43003222,0x603e588b,0x6e406635,0x6c526a3b,0x6ee871fb,0x613c68f3,
0x44e551be,0x1c9d290b,0x0b85134a,0x11270d1c,0x09ad1dc6,0xf4bb03c8,0xa06ecc52,0x8dee92a4,
0x8dee8dee,0x8dee8dee,0x8dee8dee,0x8dee8dee,0xa2ac8dee,0xcb33c27f,0xdbfcd848,0xe91edd0b,
0x19bb024c,0x5a023657,0x627b61be,0x4ac44f22,0x71fb4e69,0x71fb71fb,0x71fb71fb,0x71fb71fb,
0x4bac646a,0x3460374a,0x15141ac5,0xf4c108e7,0xe3b6fd3b,0xdc99dba0,0xae51b249,0xb0cab142,
0xdc46c25a,0xe4b0e258,0xca7ddfcb,0xc81dc1bf,0xc85ed0b7,0x9c7e9bdf,0xa5719cdd,0xbcf2a722,
0xe7a6e365,0xf0c3fc49,0xf5cbf135,0xf9f7fb00,0xef710010,0xff91f2d9,0x054ef957,0x34e02252,
0x53354cae,0x5ad14d72,0x71fb71fb,0x71fb71fb,0x6f3871fb,0x39a058a2,0x29e3309e,0x121f1c60,
0x113b1e47,0x1d881a32,0x0f9a1928,0xfcd4febe,0xc87ce08b,0x8f00a429,0x98c38dee,0x8dee8dee,
0x8e178dee,0x8dee8dee,0x90c88dee,0xc201b78f,0xc9f5c20d,0xf88ae686,0xfb42f39e,0x17da1b73,
0x17ed1155,0x2a750ca7,0x71fb45f3,0x71fb71fb,0x71fb71fb,0x71fb71fb,0x4e0871fb,0x28a93e22,
0x0e341dfe,0x18280ebe,0x18301cc3,0x039015b6,0xdb97e75b,0xcb0fd9c7,0xcb33c14c,0xccafcb4f,
0xb0b8cb7a,0xb53eb409,0xafecb29b,0x91d6a409,0xcf3db0ae,0xe1d2ec38,0xdcedd1ca,0xd951e49f,
0xef96e106,0xfa88fb3c,0xea75e9f4,0xfda2f975,0x1a3a0203,0x35f92d77,0x2be02f48,0x4b9a3949,
0x58a151eb,0x71fb6f95,0x650667d0,0x42355a2f,0x40443b7b,0x40d134c8,0x2d564336,0x408939cf,
0x2d9a3875,0xef4106b1,0xc38edeea,0x95d7ab99,0x8dee8dee,0x8dee8dee,0x8dee8dee,0x8dee8dee,
0x8dee8dee,0xc804aa74,0xc589c984,0xe8f4dd31,0x0e73f788,0x01540a20,0x2de20e8f,0x4c283918,
0x67d35439,0x71fb7038,0x71fb71fb,0x71fb71fb,0x6ae471fb,0x2d433cae,0x10ed19eb,0x1c3e1a8e,
0x0a5d1401,0xe8b5fbd8,0xe63be7ac,0x093f02ae,0xdc35facc,0xc536ca7a,0xaab8c1b6,0xa2519cb2,
0xa7a4ad63,0xbdf7ad7f,0xcae8c7cb,0xd885ce7c,0xc219cc6c,0xf091d575,0xf232f7bf,0x099ef61e,
0xe0c5f447,0xe92ae38e,0x0a69f805,0x30071977,0x367133b3,0x64ee4ad7,0x71fb71fb,0x641971fb,
0x414e4b25,0x35e03489,0x374134ff,0x44c13c88,0x3bcf4669,0x31503829,0x16fa31d5,0xe45a02da,
0xcbfdd5b2,0xaa30c075,0x94f799c7,0x8dee8dee,0x8dee8dee,0x943e8dee,0xb4fba87b,0xb038b474,
0xbe6bb283,0xd2e6c6c9,0xff87e844,0x0a1406d0,0x258314c9,0x46db2963,0x4af25722,0x71fb5275,
0x71fb71fb,0x71fb71fb,0x53aa71fb,0x35ce396c,0x2ab23295,0x1eb02bfb,0xf9a80b3f,0xee36ee36,
0xf4a5f487,0xede9fc15,0xdee4e4f9,0xb698ca86,0xbf37bc59,0xb69db8ae,0xcdedb760,0xd733d7d2,
0xb98ac90f,0xd349c196,0xd264ceff,0xdb7cdd82,0xf2b5e40f,0xf686ee56,0xf633f816,0xf169ecdf,
0x0c40fbaa,0x0e940d16,0x30a21e62,0x3fd93ce0,0x6314519c,0x546361a1,0x513a4a63,0x64d15f52,
0x32355255,0x2206225d,0x16212090,0x2bc2229d,0x1b4b291c,0x059e10df,0xeed5059e,0xc3b7d989,
0x8dee9c7e,0x8dee8dee,0x95898dee,0xb1a1a4f8,0xaacba7a6,0xadc5aa68,0xc15ab142,0xd545cf62,
0xe7a0d904,0x0874f0dc,0x1e87151d,0x41592fff,0x4a2543f2,0x5f2954da,0x61266823,0x5f7b5e92,
0x71fb678b,0x592f6f74,0x25c142ce,0x03761141,0xffcbfc45,0x111b0957,0x190820b9,0xe699f7bf,
0xd2d1e2a0,0xc669c88e,0xaf97c3b8,0xc0edb1d2,0xc6febcf2,0xf229e9e2,0xe975e9b3,0xd2b9e13f,
0xb88fc0cb,0xd635c866,0xf8d9eac0,0xddd0ea3d,0xeceae827,0xf7aaef85,0x12570078,0x1c212356,
0x1b471658,0x26162538,0x2d6f2987,0x425f3122,0x525c4c83,0x60055e8f,0x40c559c2,0x34792cc5,
0x461a453d,0x1b8c3816,0xfe9d0a92,0xf5d6f1e0,0x02a30ace,0xe190ef72,0xb9cfcdd0,0x8dee93b8,
0x919992d7,0x9d4192ea,0xba17b0a6,0xb167b97a,0xb606af81,0xbe84be14,0xd530c5cc,0x02e0e7bc,
0x2aba15dd,0x2b263246,0x3f272f39,0x48373db3,0x580b52ee,0x63e45b8a,0x6ac16f06,0x3a8e552a,
0x1e9e264c,0x24e81ed6,0x1f9220d6,0x0afb1682,0x017d0468,0xe8c2fa63,0xe7dce3d8,0xecf8f513,
0xc975d71e,0xafd3b7e2,0xcf6fc276,0xde94d472,0xec44ea02,0xd37edb4a,0xe072dcc9,0xdce2dff7,
0xdd19e21f,0xbb50cbfe,0xcbcbc024,0xf84bdc24,0x116702c5,0x2d6127d3,0x2b5b30dc,0x240f2677,
0x18fb20a0,0x24ca1a9f,0x4f653cc0,0x41cb4bad,0x5d4a4c6d,0x50a861e9,0x37543d77,0x110e2ac1,
0x152d047c,0x20fb27b3,0xfbff0e5e,0xe0dbf390,0xa6d4bbcd,0xa911a405,0xb858b109,0xbe30bf04,
0xb988c035,0x9cb2ab27,0x96c5958b,0xbdeba69d,0xdd77cec4,0xf702e607,0x0ab20256,0x2c4d1632,
0x46433df5,0x53ed4692,0x4c4b5690,0x3df53c75,0x4b944548,0x54e756fe,0x3e0c4681,0x280c33b3,
0x23452400,0x083714ef,0x07930af7,0x04a30565,0xeb51fad6,0xd97cde70,0xd246d2d9,0xd354cce9,
0xdceadc22,0xcb65d743,0xc3e9c397,0xccc6c4d2,0xef84deea,0xe7f4f2e3,0xd610d7e5,0xd728ded1,
0xcefacdc1,0xe820dc15,0xf46cecaf,0x1aac04af,0x1b2820e8,0x24931f19,0x363b2eea,0x275f2c8d,
0x34352bc7,0x41203baa,0x442b463d,0x4e97491e,0x3d744977,0x3a183580,0x1f4a328a,0x108c14ed,
0xf0a7055a,0xeb5bea1b,0xd2dce595,0xa58cb79e,0xa207a039,0xaca4a6af,0xacc1abbf,0xbe40b236,
0xcbe1cc7f,0xc531c4b7,0xc8f9c807,0xd3cace23,0xf3a5e044,0x16a0061c,0x4cb3326d,0x45384e67,
0x54d04b49,0x47314f13,0x40cb4176,0x40154410,0x27e930de,0x38382ae8,0x3f344294,0x2883356d,
0x0c221c8f,0xed29f960,0xe20ce954,0xe488dcea,0xe888e7b5,0xd164e0ce,0xb9b4c228,0xce4ebf72,
0xe571d76d,0xed4df1f5,0xce6cdc2b,0xdc03d3df,0xe906e5bc,0xe5cfead2,0xcc97d669,0xdc7dce63,
0xfcbaedd7,0x080002c6,0x1f1c1582,0x0fd7192b,0x23f712b7,0x377f33d4,0x31013322,0x4af73cac,
0x3d104a01,0x47913bf6,0x47754bff,0x30984204,0x119e1993,0x07590cb8,0x08700777,0xf7bf0492,
0xd4a3e4d2,0xc7cecd00,0xb541bd13,0xb7fcb39b,0xa91fb346,0xadcca73a,0xc3b6b815,0xd998cc11,
0xdc40de8e,0xd8cedbfd,0xe06bd98a,0xfba5ef80,0x15db0768,0x3c052973,0x4ab0456e,0x62ef57c4,
0x4f375cae,0x3cb3453c,0x3f9d3722,0x32fc3fcb,0x1ab525ac,0x05330df9,0x0f4208cf,0x0f7514fd,
0xf5a80474,0xe879eb08,0xd86ce2d4,0xd442d332,0xd8eed47e,0xe3f4dfb8,0xe184e7ab,0xcdeed7e1,
0xce4ecbcf,0xe3c6d579,0xea00eb3d,0xdc34e195,0xdc8cdae0,0xee27e733,0xe5daebb2,0xebc0e330,
0x0787f802,0x298318b1,0x365331e8,0x39443988,0x262f314a,0x18641b15,0x33a62212,0x547148c5,
0x51c35433,0x34724abf,0x0c961b41,0x01f50611,0x07d30660,0x0068017b,0xf06efe32,0xdf89e428,
0xd4b4dd64,0xc04fc699,0xa856b55d,0x9fa7a0fd,0xb6dca861,0xcd8bc393,0xd0ccd3d0,0xd3c7cf43,
0xf571e246,0x09e70107,0x1b0614af,0x28421d76,0x394c34d1,0x326d32e0,0x43a13bb1,0x48ec46bd,
0x5234502a,0x31c7447a,0x1810243a,0x12a2120d,0x0f4e13d2,0x0ace0bbd,0x0370077a,0xf3b5fe97,
0xe75dede0,0xd6faddb1,0xe298dbe2,0xe49fe5a4,0xd830dfa0,0xd3ccd3f4,0xd28ed239,0xd29bd5b2,
0xd25dcf35,0xe48ddaf3,0x0096f46d,0xef40fdf9,0xe667e5b7,0xe8b0e6fb,0x0806f478,0x20491a21,
0x17e91d4e,0x1c4613c9,0x25942709,0x2b9725fa,0x34942fd2,0x338334ed,0x3bdd384a,0x3ccb39a3,
0x39313d65,0x2917344b,0x0b5219b3,0xee91fbb0,0xe780e8e3,0xd837dfac,0xda21d7ad,0xc3ddd376,
0xbb54b9dc,0xbea6bf22,0xc0f4bdcf,0xb41abd3c,0xbc8ab395,0xe1a9cd24,0xf2c7ed68,0x07b1fa6c,
0x16971272,0x1f9c1a66,0x1e961ebd,0x2341232c,0x34ad26e4,0x495141a9,0x432b49bd,0x2e3f3a18,
0x30e129af,0x2e2b34ba,0x20a52414,0x190f1e6b,0xfeff0ca5,0xeccaf9a3,0xce78da18,0xdb19cee3,
0xe260e2a1,0xeb8ce45b,0xe9abed09,0xdee9e38c,0xd54bdab3,0xce85d249,0xd3a6d031,0xe43adb17,
0xf74aeb81,0xf788fcba,0xe8c5ee92,0xf2b5ebac,0x01fcf8cb,0xfc2702a7,0x0951004a,0x1b6111b6,
0x2a8f25fb,0x26ef2b1f,0x2d20265b,0x3c2c3492,0x508046ff,0x425a501a,0x1fd02e4b,0x15a41956,
0x109812c0,0x036c0b94,0xf826fed7,0xdd74eb6e,0xc1eece9d,0xca5fc19c,0xdaced49d,0xdcb9de22,
0xc275d187,0xbb29b94b,0xc21fbec4,0xcf2ac65e,0xd61bd546,0xe747daee,0x0b00f851,0x1ec81883,
0x23a61f96,0x2b0d291a,0x364e2e2b,0x3ce03a4e,0x47744428,0x38244383,0x25fc2b12,0x1efa22ca,
0x282d227f,0x1ba02434,0x10211925,0xf71200e0,0xe01aee72,0xcdced15e,0xcfa7cf10,0xd901d200,
0xed86e2b1,0xfc5ef82b,0xf690fa8d,0xe370ed5f,0xd8e3dceb,0xcd47d44d,0xcf36c8bc,0xde51d9e0,
0xeac4e28f,0xfda9f1d0,0x0f330af0,0x091907e4,0x12911214,0x17291077,0x18281c7d,0x1c34172d,
0x33b62440,0x44b443b1,0x2318339c,0x23be206c,0x2f1d28e6,0x2ea030fa,0x24682c5b,0x01561436,
0xef77f566,0xec5cecf6,0xe8a7eca9,0xdcb0e10b,0xd9bbdbc1,0xc92dd25d,0xb80fbe7e,0xc384bbad,
0xccb5c9e2,0xc265c741,0xd26ec67c,0xee88e318,0xf9c1f2e9,0x161406dc,0x29eb2356,0x26ae2902,
0x2bdf26ae,0x367e3427,0x41c13b57,0x3dde4172,0x27203534,0x175d1a9c,0x1ed91ca0,0x1c901cd4,
0x0e161a10,0xf9e901ba,0xf708f54d,0xfca4fc1e,0xeab4f52e,0xd1c9dff6,0xc33cc406,0xde12ce31,
0xf53cebd2,0xf0a8f425,0xe02feb63,0xd6d9d66b,0xdd7ddc99,0xdfc5dc5f,0xe8ede71d,0xf136e75a,
0x0870000e,0x13840d02,0x1b491af8,0x0f6b15da,0x0d160cd6,0x17bf1244,0x169b1634,0x1a141814,
0x27fd2132,0x34ed2cb2,0x47144120,0x2f453e8a,0x1acb2305,0x0e2a1356,0x0b1f0beb,0x023b0a0e,
0xdb17f0f9,0xc9d6cc05,0xca00ca68,0xd1b3cd38,0xd32dd381,0xcfa2d390,0xc3bfc7d9,0xcbcdc7b8,
0xd261cd61,0xe365dafb,0xef5fe9a7,0x0eedfd0a,0x280c1ef7,0x1ea52580,0x18951a5b,0x27891c48,
0x36c432b9,0x30d53522,0x319c2f88,0x346933c0,0x27672f8f,0x1caf2368,0x09b80fe9,0x0e850ceb,
0x05a30a9a,0xf48efeda,0xd811e68e,0xcf1dcfdf,0xd6c9d292,0xdf40da38,0xe550e2ff,0xe543e629,
0xe26fe2af,0xedeae83f,0xf33ceef7,0xfa90fa11,0xe9c6f30b,0xe7c4e5ed,0xee36ea0c,0xfb28f63e,
0xff81fbc9,0x0a2d045b,0x18ea115a,0x24e520c2,0x1d4721e6,0x1adb1b6a,0x2a621fd9,0x36843451,
0x2a4a309c,0x2b3d2991,0x219d279c,0x16dc1c8b,0x0a301003,0xfcee054e,0xeca0f382,0xe181e590,
0xdd74e16f,0xc7f0d487,0xc49ec12a,0xd4cbccc2,0xdb17d96f,0xe06ade1b,0xd52cdced,0xc9d2cc0e,
0xdac7cffa,0xfc8beacf,0x14130a6d,0x18b21861,0x145c1579,0x2a0d1d9a,0x368d3163,0x3ad63a70,
0x38dd39b5,0x35e937ed,0x2e363237,0x20bd29f2,0x0cdf15e6,0x01a80653,0xf826fe0a,0xe5c3ed8d,
0xe7abe4da,0xe34ce713,0xded2e029,0xe817e1c7,0xef77ec13,0xed20f1c8,0xe008e571,0xe3dadfac,
0xe51ee609,0xe3f9e3a4,0xf03ae936,0xed69efd5,0xf903f1dd,0xfeb6fe32,0x015dfdb5,0x075305fb,
0x0ead09ea,0x12a91225,0x14061207,0x203d197d,0x33d22969,0x30ee3758,0x29302a13,0x21f92a31,
0x0fd115dd,0x08a40c9c,0x0dd807f1,0x107f1372,0x0dd80cd3,0xf8cd07db,0xe720ec13,0xd671e2e1,
0xc3dec87e,0xcde2c83f,0xccdbcebc,0xcd7dcbfe,0xc8b5cd24,0xcdc1c788,0xeab9da0d,0x035ffa2d,
0x0162046c,0x01c2ffd9,0x1c9a0b7d,0x359c2cbd,0x38cf381c,0x365e38cf,0x2ed7328a,0x2415291a,
0x21ad22e6,0x1e7e203d,0x1bae1d2f,0x10761825,0x026a07be,0xf9b5fd5b,0xef12f56d,0xe5f3ea3a,
0xdc6ee051,0xe660de9b,0xf1e9eee5,0xe5c3edcf,0xd3eadb45,0xdc9ed419,0xef1ce862,0xeccbef5f,
0xecbbeb29,0xf174ef0f,0xf709f353,0x08dfffc4,0x0d1c0d5f,0x09570ad5,0x07dc0927,0x04aa0472,
0x02e00502,0x0ce50472,0x173a14f9,0x21a319e0,0x39f92d17,0x429f443b,0x228e34fb,0x0a5e1247,
0x092d0926,0x0d1c0a24,0x01db0a9d,0xf908faf8,0xf951f9f8,0xf37ef6ee,0xd69fe9f0,0xbf60c61b,
0xb95cbc30,0xbad2b8f7,0xcdc2c10d,0xe3d4db37,0xec1be79a,0xfc9ef483,0x02c80107,0x0aa6057c,
0x184d12a5,0x10b315a1,0x14a20f6c,0x28f71e8d,0x32cb307a,0x347d32a8,0x36bc3774,0x284530a8,
0x1ebb21cb,0x115c1984,0x0a270c81,0xffe804e9,0xf26bfb7c,0xdd25e61f,0xd951d94a,0xdf5adb7a,
0xe43be28c,0xe1d0e3c6,0xe946e341,0xf071ee33,0xeefdf04e,0xed16ee3b,0xeb5deac0,0xf94cf08a,
0xfdb8ff50,0xf971f89b,0x03530013,0xfb43ffcf,0x01a2fc31,0x054004e6,0x0b970674,0x0c3f0f9a,
0x09880842,0x1c031091,0x3384294f,0x35a2385b,0x2f1d3130,0x25c02b66,0x1e8d2258,0x06f41555,
0xec47f767,0xeafae971,0xf518ef46,0xf38cf75a,0xe9cbede6,0xe239e584,0xdeeae1d2,0xcb4fd6fd,
0xbd3cc068,0xcc5fc254,0xda10d4f3,0xe65bdf57,0xf758ef95,0x05acfd42,0x150e0f75,0x148815a1,
0x19fa1551,0x2c84222a,0x321c337b,0x2dbd2e4a,0x33802ff5,0x30da34f6,0x220628c2,0x1ac91e4c,
0x0a1e1406,0xf3c7fea5,0xea50ed51,0xe5fce807,0xe393e2ff,0xe990e7bc,0xe126e65b,0xe405df2f,
0xf3d9ec9a,0xf58ff6eb,0xe84ef022,0xe45ae2c4,0xf353ebc6,0xfb0ef8f1,0xf4bdf8bb,0xedc2efd2,
0xfab5f238,0x07f40309,0xfdfb04b1,0x0328fd4f,0x0ca208f0,0x10c50ec5,0x13f51365,0x175f1447,
0x1a5e1a7d,0x21b81c2a,0x295d270a,0x26332939,0x17ed2037,0x04920d54,0x06b70317,0x0fdb0c6f,
0x023b0be2,0xef2ff7ac,0xe842ea8c,0xe39ee529,0xdef3e32b,0xcc6cd6bb,0xc0b1c2ef,0xce68c63e,
0xd69dd560,0xcf10d1fd,0xe491d530,0x02eaf42b,0x1ba1125a,0x1fae1f1b,0x1f0d1f74,0x231b1f99,
0x2d282883,0x2dfc2ed0,0x30ab2e3c,0x281c306a,0x13c11c8f,0x0f0a0eb0,0x161213a5,0x0b6712da,
0xfafb0207,0xf519f752,0xe722efce,0xd9c1df23,0xdba3d8c7,0xeca6e2aa,0xf5d8f3d0,0xedddf3ce,
0xe53de6dc,0xe7cae7af,0xe967e625,0xf5dbf0da,0xfb80f847,0x0196feb5,0x04e10397,0x03c50524,
0xfb23ffc5,0x0181fb09,0x0e0a0a82,0x0095088c,0x01c2fe8e,0x083105bd,0x126c0ba5,0x25411c16,
0x28d229a1,0x25b82764,0x1c9b2133,0x1b471b0f,0x19ba1b35,0x11f816e0,0xff540a0e,0xeeebf568,
0xefc9edd4,0xe71fee9c,0xd170dc92,0xc39ec8fd,0xc999c34c,0xda8ad2ce,0xda60dd6b,0xda24d75f,
0xeb64e0e6,0x00fbf753,0x024c04db,0x0449003d,0x10f90aa7,0x1ff7186c,0x2dc326df,0x37fe3417,
0x340e3846,0x25322da3,0x18a81d22,0x17fc1724,0x1320181f,0x05480b5c,0xff8e0216,0xfde6fd55,
0xf814fe57,0xe232ecd1,0xdbc8dc62,0xdc56dcde,0xd8d0da0a,0xe2ccdbf3,0xef18e936,0xfd49f5fc,
0xff100076,0xfd52fbc6,0x01660218,0xf7ccfae5,0xfaecf988,0xfc31faee,0xfddefddd,0xfeb5fd29,
0xfcdbff97,0xf6fdf944,0xfb08f739,0x1027044e,0x1a1317ed,0x1a0919c0,0x267e1e7e,0x301d2e1d,
0x232a2bdf,0x14791afd,0x111010ec,0x0ab50fc8,0x018904c6,0x001f00fe,0xf727fc1e,0xef0bf3b5,
0xdbb1e605,0xd65ed63e,0xd5dbd704,0xd1f7d3e4,0xcd72d03d,0xd0e4cc73,0xe63cd9bb,0xfe42f4ad,
0x027f015f,0x01cb0291,0x03760195,0x0fea08dc,0x2121175d,0x35c72c5c,0x3bb23acc,0x38f33ac5,
0x30933505,0x23b92b79,0x0ac3188d,0xf25afd0c,0xef34ecf1,0xfe07f794,0xf6bdfc92,0xe99bf0a8,
0xe393e346,0xeb3fe818,0xed63ec42,0xea0ced84,0xe374e5a2,0xe6ffe3b4,0xf94dee77,0x08e0030a,
0x068909b0,0xff5602d5,0xf7eafb40,0xf662f6a7,0xf26bf4ec,0xf4dcf20d,0xff90f9e6,0x06e5041d,
0x0b7b09d2,0x0c020b93,0x08000bd4,0x08d00478,0x1fa21495,0x266c25d2,0x19a12118,0x158b157d,
0x1ba617a4,0x1dde1f28,0x0c28165b,0xfc73028f,0xfe23fc27,0xf8a7fd03,0xef61f3c9,0xdd39e7e6,
0xcb6bd30d,0xc957c82a,0xd0b3cd30,0xd22dd1de,0xd788d381,0xe748de68,0xfe35f27c,0x0718055f,
0x0e730919,0x17d01455,0x21901be0,0x2a91262f,0x2c402d04,0x299529ec,0x2ce82b1f,0x2c312daa,
0x1b7026c3,0xfcb60ba8,0xef8af2e7,0xf587f1ea,0xf468f712,0xe87fed88,0xeec9ea30,0xf47af1bc,
0xf712f79c,0xe818f073,0xe246e2f7,0xe8dee4f9,0xee6beb8a,0xf8d1f379,0xfd18fc7c,0xfb6cfb49,
0x071e003a,0x10580cd9,0x098b101a,0xf13cfd69,0xf1a8ed29,0xf6c9f630,0xfb0ef801,0xff51fcf7,
0x07d40395,0x0f150b8d,0x1869131c,0x19441b9a,0x1af11708,0x2266205c,0x27ba249f,0x1b702510,
0x0ec812d6,0x08e20b7d,0x08fa08f6,0xfefb05af,0xe813f480,0xd4e2dcca,0xd36ed1c3,0xd920d7bb,
0xcefbd4c5,0xca49cb19,0xd8b2cf3f,0xe8abe120,0xf995f160,0x0521ffc3,0x0ea00a7c,0x0c3a0e75,
0x14500d53,0x25f51e47,0x2b31295d,0x28172b40,0x251c24ca,0x299f2859,0x1e892676,0x08b01300,
0x070a0589,0x0107060a,0xf881fbeb,0xeb88f343,0xdf40e3cf,0xe146ded7,0xe64ee3e8,0xef3aea63,
0xf260f1a6,0xf3b9f2c5,0xf561f4ec,0xf88ff658,0xffecfc2f,0x010401c6,0x03cd0113,0x05bb0678,
0xfc79014d,0xf95df9e5,0xf790f8a5,0xf808f76d,0xf737f823,0xfaa1f764,0xfb23fc80,0xff10fb4d,
0x0eb40572,0x23f71a3b,0x29c42965,0x236326fc,0x1f9920e0,0x1b1e1e6c,0x0df1145c,0x0eab0c9c,
0x0a890e96,0xfbe903f7,0xeb29f319,0xe6cce6d6,0xe76ae801,0xdabee334,0xc84ed028,0xcbdbc6e3,
0xdd74d454,0xe6eae418,0xe586e5ed,0xf359e9e7,0x060afdd6,0x0f910b65,0x16671389,0x1b8c18bb,
0x21a71ec6,0x2add24e3,0x37783244,0x316437a5,0x1bf126c3,0x0c0d1301,0x01c006f4,0xfac1fd35,
0xf3eef830,0xf046f0fa,0xebd6eefd,0xe85be955,0xe486e6e5,0xe6e3e455,0xee61ea2e,0xf674f314,
0xfeb0f98a,0x07ac0454,0x04c406f4,0xfea90288,0xf580f951,0xfba7f698,0x0001004b,0xf6f7fb28,
0xf50df5ed,0xf441f356,0x0084f9c1,0x05e60513,0x0004031b,0xfbe9fe5c,0xffd9fb2f,0x106d0882,
0x1adc1664,0x1e9e1d40,0x24262132,0x252b25c9,0x212f23bf,0x11d01b25,0x05bb0995,0x022d04bb,
0xf566fbd4,0xf3aef32c,0xeacff09e,0xddb8e4aa,0xd142d60c,0xd107d0e3,0xcc4ecea5,0xce7ccc11,
0xdee7d478,0xfa53ec91,0x08c903e6,0x0cdc0b00,0x12f20f15,0x1c69183e,0x20f61e4e,0x2a4d25c9,
0x2e862d1f,0x27df2cc4,0x1d6322bd,0x124e179a,0x07300cf7,0x007e02c0,0xf5c9fcf7,0xeb54ee95,
0xecb9eb4c,0xf2e3f01e,0xeed7f1c2,0xebf5ed08,0xec41eb00,0xf2fff054,0xf11cf25e,0xf798f277,
0x041bfebb,0x07be06d3,0x0724079c,0x0553069d,0xfe8702e0,0xef22f739,0xecacea64,0xfdb0f561,
0xfc5eff3d,0xfb53fabc,0xfa22fafe,0xfd1efa76,0x0681018f,0x0b1e09d1,0x0c440bba,0x103f0d4f,
0x1c7c159b,0x291d2393,0x2bb62c6e,0x22fd2731,0x1be7202e,0x0bc41542,0xf3a20038,0xe2f0e88f,
0xe649e3fa,0xe108e517,0xd72edbfa,0xd5bbd439,0xda85d9c8,0xd1cbd5e6,0xd948d350,0xebcbe19e,
0xfbcff577,0x06550044,0x183f0ee4,0x20441e9b,0x1c4c1ec0,0x1be51a40,0x27972221,0x254a27ba,
0x221e23cc,0x18a51deb,0x11301450,0x086d0de6,0xf8130076,0xf083f2b9,0xf244f0bf,0xf0ccf30b,
0xe884ec76,0xe51be5ba,0xea19e726,0xf136ed0b,0xfbb4f6eb,0xfea0fda7,0x035500ef,0x03340386,
0x05fb0435,0x04b5062c,0x01fd02ae,0x01c6024c,0xf7d1fe1a,0xedc6f1c7,0xe850eaa8,0xed8fe895,
0xfe2ff670,0xff7400cd,0xfed7fe1d,0x078601c4,0x16860f30,0x1b771ab9,0x184a19b6,0x1ab118fa,
0x1ec71c8b,0x226420e2,0x208d22b8,0x12ae1b29,0x017d08d7,0xfc30fe5c,0xeed0f737,0xda7fe509,
0xca49d070,0xd3b3cbe0,0xe184dc74,0xdef0e1ba,0xdabfdbf3,0xe2aedcab,0xf232eac2,0xfeb5f8b9,
0x093f0497,0x0def0bab,0x1c4513c5,0x286a233d,0x2d152c17,0x26fd2b2f,0x1d1821c1,0x1c211b73,
0x16141b16,0x06ef0ece,0xf7acfee0,0xf1d4f37b,0xf13af15a,0xf05af131,0xeb7bee16,0xea08e9fc,
0xee9febd2,0xf343f17d,0xf42cf3b0,0xfba1f6f9,0x04a10034,0x0ce208ff,0x0b5a0e08,0x03860737,
0xfd280050,0xf694f9f1,0xf43cf4bb,0xf0c3f2da,0xf437f0d9,0xf86ff7f5,0xf5eef6ee,0xf460f551,
0xf574f367,0x05affc21,0x16580f3f,0x175f18e1,0x159e1598,0x1a211732,0x247b1f0f,0x22d1265b,
0x16de1cd8,0x0fcb128a,0x0cf10e76,0x09b70b3d,0x00f40713,0xe488f4b7,0xd177d758,0xd834d2d2,
0xd95fdbaa,0xcc41d2bb,0xcd23c989,0xe3a3d6e3,0xf8b8ef61,0x01baff04,0x03860272,0x0bdc069c,
0x185d11fb,0x23681ee8,0x237f245a,0x22ff22f8,0x22c022dd,0x22a222e1,0x1d6a2147,0x06c714cb,
0xf1a1f901,0xf168f0b0,0xf43af20f,0xf808f758,0xf1fef56e,0xec41eefa,0xec96ead8,0xf57df0cb,
0xf8c2f889,0xf76df788,0xfdd5f9bb,0x0597024d,0x067706b5,0x07cc067a,0x09850936,0x00ac06ec,
0xf47af96c,0xef6bf1b6,0xeb5becd1,0xef2eec4a,0xf5f6f282,0xfc4ef9d6,0xfa0afbe5,0xfb6df9ac,
0x0189fe7b,0x09130490,0x1a5510c7,0x25ec222a,0x24a8264f,0x21082288,0x1cb61f72,0x172019ae,
0x100613f8,0x08520bdc,0xff8704b5,0xee8cf808,0xdc86e483,0xd9f2d8dc,0xdd07dcab,0xd1cbd8f8,
0xc9aacadf,0xdb89d05b,0xed68e641,0xf420f0ff,0x0376fa4b,0x15e70dd1,0x1a3319d4,0x1bf51a84,
0x1c821ce4,0x19d31b3c,0x1b1a1977,0x20241e1c,0x1e322029,0x14b01aa2,0x04d30cc4,0xfa3bfef3,
0xf1c2f5b0,0xec69eeea,0xe8f0ea2b,0xedb9ea1a,0xf3b0f136,0xf9a0f621,0xfca5fca1,0xf6d7f9da,
0xf806f5a5,0x0355fdcf,0x07f90674,0x0ac8099e,0x0a1a0b13,0x034f073a,0xf9ecff4b,0xf016f393,
0xf16df098,0xec0aef18,0xede6ebd3,0xf098efa2,0xf4acf204,0xfc4ef871,0x04cb000e,0x0f0c0a4e,
0x14071234,0x17df1592,0x1cdd1a82,0x252b1fa2,0x2e692c04,0x1e3628f9,0x0a391256,0x077e0755,
0x033406f5,0xf41ffc1d,0xe75ced6d,0xddc0e1af,0xddbddd08,0xdae0dd67,0xd2add676,0xd616d23a,
0xe46fdd21,0xeec0e9d8,0xf9a0f42f,0x03b8fe94,0x0f55093f,0x1d5515dd,0x2cb225f5,0x268d2d09,
0x17da1de7,0x16db15cf,0x1a411944,0x12811826,0x025e0a9e,0xfb3cfc83,0x01ebfe8d,0xfc64018f,
0xeb26f463,0xe048e388,0xe995e299,0xf93bf29a,0xf9c8fb16,0xfd6cf9d1,0x05650258,0x05dc05c8,
0x05c1064a,0x02a203b5,0x050f03d1,0x019903c5,0xfee70044,0xf93bfc7d,0xefeef489,0xedecede6,
0xeb30ece0,0xecb9eacf,0xf3caf012,0xf7eff646,0xff63fab3,0x08360417,0x0f270bc3,0x17141272,
0x23391d30,0x27fd270f,0x1f86256f,0x142018d1,0x14cc12d3,0x19d918b5,0x0cb215d4,0xf50800ea,
0xe891ec66,0xe90be863,0xe221e7c7,0xd0b7d926,0xcf5acd58,0xdb5cd4d9,0xe5c4e13a,0xea43e86c,
0xf121ecb5,0x0066f82f,0x0df007e2,0x17ed1332,0x1e6b1bcb,0x1efa1f43,0x1e791e79,0x21131f4a,
0x239a233f,0x13801ed3,0xfb3005a3,0xf88df72b,0xff74fc31,0xfa92ff38,0xeefdf3d3,0xf09eee23,
0xf66af3f0,0xf5abf718,0xf18af344,0xf18cf0c2,0xfcb6f58b,0x093d0400,0x0e760c62,0x0e620f3f,
0x08940bfd,0xff130405,0xf69efa4c,0xf449f4c1,0xf443f47a,0xf1dbf337,0xeffaf0cf,0xedbfeea1,
0xf32eef5e,0xf72cf667,0xf7a1f6cc,0xfe1dfa15,0x081502df,0x11640cfd,0x1c391619,0x29b023ed,
0x27852a67,0x22112468,0x1d3b1fd9,0x12e519b3,0x00d00972,0xf823faee,0xf928f811,0xf3bdf863,
0xe346ec34,0xd360da50,0xd2add099,0xdceed7c0,0xe12de011,0xe2a0e166,0xee3ce687,0x0026f7f3,
0x086c0558,0x0d840ad1,0x17431190,0x1f991cbf,0x1eb01fa5,0x1e9f1e29,0x1f4d1f78,0x18031d03,
0x0a361117,0x02700576,0xfbcefffe,0xefbcf5e4,0xec9bec1b,0xf650f0f1,0xf733f8d3,0xf1a9f392,
0xfa02f456,0x00ddfee7,0xfbfcff75,0xfa63f95f,0x02aafe60,0x099b066b,0x0bd70b7d,0x0a550b6d,
0x049207cc,0xfcc300df,0xf2c9f7b0,0xe618eca3,0xe296e1bb,0xeea4e7e6,0xf7adf463,0xf71bf840,
0xf7dff67f,0xff69fb51,0x05730324,0x095406ef,0x15870e6a,0x20491c33,0x236d2224,0x251c24b8,
0x238b24b8,0x1b3520c9,0x0b60139e,0xfe8e03e6,0xfa49fc15,0xedb8f5b0,0xdf4ee4fa,0xe18dde71,
0xe434e478,0xdb87e084,0xd6f4d7ba,0xddd6d960,0xe95ee321,0xf7ddf0a9,0x04fefe6c,0x10600b23,
0x16bf145c,0x185717d2,0x17691830,0x1b6a1823,0x21d71fe0,0x1ac01ffb,0x0d8313f0,0x05e50913,
0xffc502fc,0xf5edfb37,0xef8cf119,0xf2ecf0e8,0xf145f302,0xf1edf012,0xfb42f658,0x0087ff05,
0xfce8ffb5,0xfc97fb18,0x065c00cb,0x0e210b73,0x08700ca8,0xff990340,0xff81fe31,0x01fe015b,
0xfc2e001a,0xf1c6f700,0xe77cec56,0xe722e586,0xed0dea7d,0xf0c2eecc,0xf80df3d3,0x0019fc9b,
0x04c8025a,0x0c620867,0x11040f27,0x148b12b1,0x197d16b9,0x24651e68,0x27c0282a,0x1fe2246e,
0x14641a95,0x085a0dde,0xfebc03b5,0xf285f8d0,0xe4a9ebb2,0xda29de1f,0xda23d929,0xddfedbee,
0xe391e0ab,0xe7d3e611,0xe9bde91b,0xed8feab0,0xf938f2c8,0x0680ffdd,0x11330c9c,0x14fd13a4,
0x1a16170d,0x1df21ca3,0x1e8d1e9e,0x18831caf,0x0e2812e5,0x0bf00be8,0x08430bb6,0xf92f0178,
0xee6ef220,0xf176eeb0,0xf27cf31a,0xf14af0e0,0xf9f7f4d0,0xfe53fd98,0xfda9fd83,0x0195ff42,
0x050f03a1,0x05c605af,0x074a0611,0x08e40899,0x06370849,0xffa90305,0xf823fc4c,0xf0dcf3a5,
0xefa2f02b,0xe9f3ed48,0xeb83e8bc,0xf393f025,0xf399f4a5,0xf169f1d4,0xfac5f45a,0x0c22030e,
0x18691412,0x181618d3,0x1ab818cc,0x1f2c1cf9,0x217920f9,0x1b9a1fb7,0x11481655,0x0d210df7,
0x0ada0d16,0xfdf90576,0xed1df594,0xe096e5d1,0xdd0fdded,0xdededdbf,0xde1edf0e,0xdcf9dce2,
0xe32aded2,0xf2e8e9ee,0x0385fc46,0x05a5069c,0x03d103d5,0x0a6f062c,0x15620fa3,0x1dd91a8a,
0x1a841d97,0x17021788,0x188d1810,0x14181777,0x06e80e44,0xf8a6ff4a,0xf342f480,0xf4c6f3fb,
0xf2acf47a,0xee69eff4,0xf5eaf071,0x012ffc97,0xffa301df,0xfdb0fd44,0x043500e8,0x05e70594,
0x0a49073a,0x0df40d58,0x05560ad7,0xfd5e0050,0xfb49fbf9,0xf7aafa3a,0xececf2d0,0xe4e7e7ef,
0xe832e4cf,0xf424ee51,0xf774f737,0xf600f64f,0xfe67f8ad,0x081c0492,0x07130838,0x09510727,
0x139e0d58,0x23f11bb0,0x2c242a46,0x217f28db,0x10bf1883,0x0adb0c2b,0x0bff0ba2,0x04470a0b,
0xf226fb79,0xe793eb3a,0xe600e64e,0xe306e52d,0xdc5edfc4,0xd9c1d9f5,0xe05adc13,0xed4ae636,
0xf98bf46e,0xfda1fc11,0x05900082,0x14250c83,0x1ba619eb,0x140018e6,0x0e150fa0,0x112a0f2a,
0x15931313,0x15ea173a,0x0cc11165,0x074a09bf,0xfd6a034a,0xf1cff6f9,0xeb67eddf,0xec7aead3,
0xf62df07a,0x0086fc39,0x01bb0250,0xfedafff5,0x0478004d,0x0b2008f2,0x068a09f3,0x008f02e3,
0x00ccfff5,0x05350317,0x049905d7,0xfbb70151,0xee7cf4b6,0xe897ea64,0xec11e938,0xf02eef06,
0xef4ceff4,0xf0c7ef34,0xfb83f55a,0x04e900f4,0x076f0709,0x09940787,0x12fe0e0e,0x1bbf17aa,
0x20241ee0,0x1fb6200d,0x1ee01f72,0x19661d1d,0x0c7c135b,0x0066063b,0xf4c3fa6e,0xeb58efc6,
0xe6a5e80d,0xe774e6fb,0xe585e732,0xdf32e26c,0xdfd2ddd5,0xe918e46d,0xeff8ecb2,0xf763f3aa,
0x0159fb9c,0x0e53085c,0x15541253,0x183e179a,0x15f91708,0x14d415c4,0x0e21120d,0x0a0e0b6d,
0x07e20930,0x064306d1,0x05f70667,0x01380435,0xf9b2fd80,0xf335f664,0xeef3f072,0xf1b6ef67,
0xf7ccf4c6,0xfeddfb27,0x046c021a,0x08b7066c,0x0ad70a8f,0x092f0a0c,0x07550886,0x020f04ff,
0xff320002,0xfc77fe54,0xf5c2f960,0xedecf1a3,0xeaa2eb9a,0xea9bea77,0xeb12eab4,0xf034ec69,
0xfb8ef5c4,0x03bc0039,0x05db057e,0x078b062c,0x0e530a49,0x188313a4,0x1d4c1baa,0x1f321e73,
0x1d101f04,0x15aa198e,0x0f481231,0x097b0c66,0x00fd0629,0xf15df972,0xe690eac0,0xe5dce4e7,
0xe6d9e741,0xe2f1e4ba,0xe37fe284,0xea03e605,0xf1faee8a,0xf472f3be,0xf69ef540,0xfe4ef965,
0x0dfd0594,0x1a6f1548,0x1a831c30,0x127b1670,0x11241098,0x12f2125b,0x0fc5124d,0x03950a83,
0xfad4fdaa,0xfcf4fb37,0xfeb2fe7a,0xfa8dfd1d,0xf5dbf7fc,0xf577f4d0,0xf9ccf7cc,0xf910fa05,
0xfb8ef91a,0x0448ffcb,0x0bd70882,0x0e650e03,0x0a940d10,0x05210799,0x012f0331,0xfbbafed5,
0xf3a9f816,0xeca6ef90,0xebb2eb83,0xee33ecc7,0xf054ef96,0xf04ff058,0xf571f1d4,0xff79fa90,
0x03e302b0,0x054d0438,0x09f90735,0x12190dbb,0x19e81656,0x1da31c70,0x1ad31cd1,0x18121911,
0x16fd17d3,0x0eea1424,0x004b07db,0xf3a9f91f,0xf118f125,0xf1acf220,0xe8e4ee56,0xdf80e35a,
0xe096de62,0xe781e45b,0xec4be9b1,0xf215ef1c,0xf8cdf513,0x009cfcc0,0x07f4043f,0x0ef60bc6,
0x121c10b5,0x16bd1442,0x18321832,0x146e170a,0x0bab106c,0x04c207ac,0xff870251,0xfc00fd33,
0xfb11fbb0,0xf764f95f,0xf76bf65e,0xfe59fa77,0x01f50129,0xfe4e00ba,0xfb37fbd8,0xff38fc97,
0x01b9011b,0x019f017f,0x050d02f3,0x0a1707d0,0x09fb0b1a,0x034f071e,0xfc27ff8b,0xf40ef863,
0xeccbefc3,0xe94aeabe,0xe8efe895,0xebdee9f4,0xf52eef7d,0x00fefba3,0x03aa03bc,0x01b50222,
0x07d403c5,0x0ee60c13,0x11201030,0x161212fe,0x1d3919ea,0x1e341ec4,0x19df1c66,0x128a16dc,
0x06470cf1,0xfb2c003e,0xf3aef72f,0xed79f093,0xe78eea52,0xe4aae595,0xe75be534,0xebebea34,
0xea4beb92,0xeb59e9a1,0xf526ef7d,0xff63facc,0x058e02c2,0x0b740855,0x11090e96,0x11d6121d,
0x108b1141,0x0cfa0f28,0x0b8a0b5e,0x0df20cf4,0x0c200db8,0x024c0831,0xf9bffce7,0xf92cf8f5,
0xfb24fa11,0xf9a7fb24,0xf6a1f7d2,0xf9f0f742,0x0291fe60,0x057c0519,0x032a04d3,0x000a010f,
0x04170127,0x05db0629,0x01f103da,0x00c600eb,0x023b012f,0x005d025d,0xf74ffc65,0xee16f277,
0xe7edeaad,0xe6a9e673,0xec1ce8bc,0xf45af00e,0xfcc9f878,0x0613014d,0x0dd30a32,0x13351130,
0x112912f4,0x10700fe0,0x158f12a5,0x1984181a,0x185c1974,0x13c4168d,0x0bb9100e,0x02bf072e,
0xfa78fe90,0xf1e6f64f,0xebdaee25,0xe9b1ea7d,0xe84ee8e3,0xe7b2e7b7,0xebc6e912,0xf197eee5,
0xf4dcf39a,0xf48df4f1,0xf800f510,0x03ccfd4c,0x0edf0a0e,0x13951225,0x121d1325,0x11ce11ad,
0x104c1147,0x0cea0f0e,0x05a50995,0x01e702f3,0x00fe01b5,0xff04ffef,0xfca9fe79,0xf650f977,
0xf558f4be,0xfb11f7b3,0x0078fe42,0x01950176,0x001600b2,0x04e9012d,0x0c840952,0x0a920cea,
0xff8d057e,0xf9a9fafb,0xfd09fb35,0xfcc3fda2,0xf8fffb37,0xf47af66a,0xf2e3f392,0xf086f1c2,
0xee04ef4d,0xed9aed28,0xf260ef83,0xfd03f6e6,0x091103a7,0x0e2c0c53,0x119e0fde,0x15c913ab,
0x185c1775,0x155417a4,0x0fba123b,0x0ef40ede,0x0eff0f52,0x0a760d72,0x0234066e,0xfb2ffe53,
0xf508f86a,0xec31f093,0xe75ae8f7,0xe72ce6e0,0xe859e7c4,0xeb44e96b,0xef47ed6d,0xf307f0e6,
0xfb53f676,0x058b00ba,0x0ac008c8,0x0d160c0e,0x0e4e0dd6,0x0fec0f1e,0x107f109a,0x0dab0f5f,
0x09e70bf6,0x02f60699,0xffd4008f,0xfe1eff54,0xfc39fcab,0xfe39fd05,0xfd06fe47,0xfaf3fb8f,
0xfb8efb21,0xfdcffc70,0x00caff8e,0x03aa021b,0x074c05b8,0x06ae07a3,0x033a04e6,0x01b1024d,
0xfe91008d,0xf9f7fc52,0xf5f5f782,0xf58ff5ad,0xf3b7f4a9,0xf535f401,0xf679f614,0xf6c9f6c9,
0xf34bf556,0xf22cf1c6,0xf9f0f4bf,0x04a9ffec,0x0907076f,0x0fd70bb8,0x1a7c153d,0x20bb1ee2,
0x1b341f61,0x117715f2,0x0bc30e2f,0x06870920,0x018603de,0xfcc9ff26,0xf753fa38,0xf266f478,
0xeffaf12a,0xebecee3c,0xe8b7e9e7,0xe918e86e,0xee32ead5,0xf4dcf1f5,0xf6eff627,0xfc70f8d1,
0x04c700c1,0x0b490822,0x10ea0e41,0x104611c1,0x0a3f0d06,0x097208ed,0x0b5e0aa5,0x088d0ab9,
0x023b0551,0x01fe0104,0x03f303ba,0xfe5001c0,0xf8a5fb09,0xf89df7b8,0x0002fbd8,0x021402b9,
0xfa4cfe69,0xfa65f893,0x0317fea0,0x093906fd,0x087909bc,0x02fd0607,0xfdf9001c,0xfdd4fd3b,
0xffa0ff14,0xf9a6fdd6,0xefc3f458,0xee11ed4a,0xf51bf160,0xf5bff6a5,0xf331f406,0xf630f400,
0xfde2f9af,0x04e6020d,0x04210585,0x02ea0270,0x0eb90717,0x1d1616f6,0x1ec61f7b,0x181f1bd1,
0x12c714f4,0x0d4c1088,0x039808c8,0xf8ddfe59,0xf206f468,0xf3d0f238,0xf6dbf5d7,0xf3dcf64b,
0xeec3f0cf,0xef2fee6e,0xf07ef037,0xed9def83,0xecbfec36,0xf359ef25,0xff47f8b5,0x0a8305d7,
0x0bc40c31,0x0ae40ac0,0x0f550c76,0x13e0123b,0x0e151290,0x03a3084f,0x01290170,0x03a40230,
0x054804f3,0x0116040f,0xfa4bfd3a,0xfb9cf9c4,0xfefbfe0c,0xfb30fdde,0xf782f87e,0xfe31f975,
0x07c7039b,0x0830092b,0x03ef0605,0x025802ba,0x02df028c,0x016202d1,0xfb9cfeb8,0xf62df8d8,
0xf320f42b,0xf457f35c,0xf64ff576,0xf4bef626,0xf1faf320,0xf600f2f0,0xfe3dfa57,0x024000c1,
0x033a02d2,0x055803bc,0x0bdc0830,0x10bf0f0c,0x109110fb,0x12ab10f9,0x170a1530,0x16621780,
0x0fb913c2,0x05bb0a97,0xfd52018d,0xf3d3f896,0xee96f04f,0xed9cedf1,0xed54ed83,0xef3eedd5,
0xf400f193,0xf55bf53e,0xf2b5f456,0xf12bf155,0xf42bf222,0xfc6ef792,0x06f401f5,0x0c720a5c,
0x113c0e9a,0x14b713c9,0x0f8c1329,0x07a50b28,0x055405c8,0x045d0526,0x00060280,0xfc28fdb7,
0xfbcffb7d,0x0094fd80,0x05a10408,0xff9703b1,0xf948fb58,0xfc25f9c8,0x006efeca,0xffa90050,
0x01d4ffc9,0x072404ec,0x044906db,0xff320158,0xfc24fdb7,0xf95ffa92,0xf8ddf8e1,0xf8bff8dd,
0xf7fdf881,0xf589f6d9,0xf2eef40e,0xf3d9f2a9,0xf9e8f680,0xfe05fcca,0xfd86fdd2,0x01e7feec,
0x096f05e7,0x0d900c13,0x10450ecc,0x146d1259,0x160f15ed,0x11591460,0x0cfb0e78,0x0c200ca5,
0x06aa0a24,0xfd99025f,0xf4cff8d8,0xef9bf1db,0xeb58ed8a,0xe7fee946,0xea0ce802,0xf279edea,
0xf870f632,0xf9caf984,0xfb71fa54,0xfdc7fcfa,0xfe42fdfc,0x00f4ff56,0x04380271,0x0a6f06ca,
0x11760e4d,0x12a31319,0x0ca6102e,0x080009bf,0x053b06e2,0xfffd02d1,0xfc40fd95,0xfcb4fc1c,
0xff14fdda,0xffc3ffdd,0xfdbefeb5,0xfe98fdc3,0xfe84ff07,0xfd33fd84,0xfffbfe30,0x0236018e,
0x013801e0,0x01df0127,0x056c03b3,0x012d04ee,0xf764fbd5,0xf5dff587,0xf956f7aa,0xf965fa15,
0xf4a8f77c,0xf1f8f262,0xf59bf367,0xf98df7c1,0xfd73fb53,0x01b8ff75,0x0743044e,0x0cfa0a5d,
0x10c70f22,0x1185117a,0x107c1111,0x0f710fcf,0x0fb00f85,0x0db40f4d,0x070c0ad7,0x0074035b,
0xfd13fe98,0xf8a5fb55,0xf269f599,0xed23ef8c,0xeb52ebad,0xed0bebdf,0xeef8ee01,0xf0a8efb4,
0xf6e2f2d7,0x008ffc09,0x039a0327,0x02de0303,0x04b3039c,0x04e50507,0x0649050f,0x09bc07f9,
0x0dbd0ba6,0x10b50fa9,0x0f8510c8,0x09290cdf,0x002c04b1,0xf9b8fc55,0xf82df88a,0xf981f896,
0xfc60fb04,0xfd1dfd1c,0xfe34fd29,0x013dffc2,0x042c02e8,0x03530473,0x0056014d,0x00fd0071,
0x001f00e2,0xfcfefed5,0xf9dafb4c,0xfb4ef9db,0xfda2fd1e,0xf935fc45,0xf24df55a,0xf387f193,
0xf9f0f6d2,0xfb4afb97,0xf881f9cd,0xfbb3f910,0x0336ff7e,0x085e0637,0x0c160a4b,0x0f3c0df1,
0x0ff00ff3,0x0fd80fdb,0x0f880fde,0x0d100e95,0x09700b56,0x061c07ae,0x039e04e1,0xfee901ac,
0xf6a1fafc,0xef5ff26d,0xed54edcd,0xecdeed3b,0xea80ebcd,0xec72ea58,0xf3d9f00e,0xf815f65d,
0xfc4ef9b8,0x0403ffa9,0x0b650839,0x0ca70cf1,0x08b20b04,0x062f06b7,0x07ee06f1,0x095008d7,
0x08860948,0x078d079f,0x0a3908b2,0x09fb0afb,0x024706de,0xf80dfce1,0xf506f550,0xf8dff68e,
0xfca5fb2a,0xfe11fd8c,0x000efeca,0x043301ed,0x062905d4,0x036704ff,0xffbe0195,0xfb6cfd78,
0xfa2bfa54,0xfad6fa83,0xfb35faf9,0xfc5bfbae,0xfd6ffcfa,0xfce0fd7c,0xf8b1fb28,0xf33bf5c6,
0xf2d1f20c,0xf95af587,0x008dfd8f,0x0358027c,0x07b104e4,0x0ef10b70,0x1191110e,0x103a10f2,
0x0f9a0fc5,0x0ebf0f4c,0x0d3e0df9,0x0a360c0e,0x03bf071e,0xfe8200bd,0xfaa1fca7,0xf5edf871,
0xf086f32e,0xebf9ee20,0xeb03eab9,0xef3aeccc,0xf1bcf10f,0xf18af1aa,0xf602f2b9,0x01d4fb9e,
0x08870693,0x06e0082b,0x075f0654,0x0bc10999,0x0c810ce6,0x097a0b26,0x069e07c1,0x056105da,
0x063e0572,0x07ee077a,0x04cb06de,0x022802fd,0x017801eb,0xfdc90028,0xf6abfa7b,0xf17ff34b,
0xf4b1f1ea,0xfe39f947,0x05b80288,0x06ef0738,0x0458058b,0x03e603eb,0x01f10367,0xfd3dffe9,
0xf76afa47,0xf55cf586,0xf951f6f5,0xfc5efb6d,0xfaa8fc11,0xf89ff938,0xf9f5f90a,0xfa6ffa9e,
0xf7b9f956,0xf8aff702,0x031afd0c,0x0e080944,0x11b410de,0x110e1164,0x10ec1105,0x0ed1102e,
0x0b820d40,0x083809bc,0x06920718,0x04f8060a,0xffec02c8,0xf920fc9e,0xf28df5b4,0xeeeaf03a,
0xee85ee72,0xef4feed7,0xef0aef6a,0xeeb4ee7c,0xf39af079,0xfb35f76f,0x0057fe26,0x032101e9,
0x07d3050b,0x0d690ae6,0x0f4b0ed3,0x0d890eb9,0x0a0e0bba,0x08c8090e,0x08e608df,0x066e081d,
0x01ba0424,0xfe1affac,0xfe60fdbc,0xff22ff1f,0xfde6fe97,0xfc78fd67,0xf8edfabf,0xf7d1f7c8,
0xfabff8df,0xff7cfd33,0x03360186,0x062504a1,0x07610731,0x03550605,0xfd4e0019,0xfa24fb5e,
0xf78ef901,0xf659f69b,0xf75cf6cc,0xf8bbf808,0xf9dff94b,0xfc06fab8,0xfe3dfd46,0xfe99fea3,
0xfe8bfe7a,0x0086ff19,0x05c102b4,0x0cab092d,0x11b40f83,0x133e130b,0x10cc125c,0x0ddd0f70,
0x09320bb6,0x052b070a,0x01af0376,0xfd6affd7,0xf7d8fac0,0xf24df508,0xeebaf00b,0xede5ee1c,
0xecd3ed5a,0xecbbec84,0xf0a5edfa,0xf7fcf460,0xfc40faa5,0x0002fdd5,0x06770333,0x0b310949,
0x0cfd0c44,0x0f330e0a,0x0f350ff6,0x0abb0d38,0x079208a5,0x065006f8,0x027d04da,0xfdb8ffe3,
0xfcf9fcb9,0x0034fe53,0x00a00122,0xfba5fe67,0xf85ff975,0xfaf1f8e6,0xffe2fde0,0xfe48fff9,
0xfa38fbcc,0xfc5efa5f,0x0200ff47,0x05a30452,0x057f0619,0x02cd0445,0xff8d0127,0xfbd8fdb0,
0xf73ef9ae,0xf350f4e9,0xf2f4f294,0xf6bdf456,0xfc98f9b2,0xfed0fe72,0xfe17fe48,0x0172ff10,
0x081304e5,0x0aad0a31,0x09140a12,0x095408ac,0x0ed30b88,0x14731222,0x133714e5,0x0bbd0fc8,
0x060c0855,0x00e603da,0xf7dbfcb4,0xef85f329,0xed39ed78,0xf00bee6e,0xf130f13a,0xeed5f025,
0xef04ee48,0xf4fbf17d,0xfafef887,0xfce4fc34,0xfff9fdf9,0x05f802c5,0x0c380957,0x0ee70e34,
0x0e230eba,0x0ca60d5f,0x0cc40c62,0x0ce80d4c,0x06d50ac4,0xfe3101fe,0xfcabfc58,0xfea2fdce,
0xfce1fe2c,0xf960fb11,0xf8cdf87d,0xfc64fa4b,0xfebbfe14,0xfd44fe55,0xfc03fc28,0x0002fd80,
0x03a4027d,0x01a20316,0xff1d0013,0xff41fea5,0x02ba007d,0x063204ec,0x01b40526,0xf78ffcd3,
0xf14af377,0xf1ccf106,0xf42bf2d5,0xf670f55a,0xfa49f7ea,0x0264fddd,0x0aac0723,0x0c810c66,
0x0a9b0ba0,0x0a690a08,0x0cef0b85,0x0d830dcc,0x0abb0c38,0x0ad10a14,0x0e0a0c7b,0x0bae0e16,
0x01220703,0xf627fb3b,0xefeef27b,0xec42eddf,0xea94eb1e,0xebfeeadc,0xf0c6ee01,0xf614f3aa,
0xf875f7c1,0xf92ff8c4,0xfbc3fa1c,0x016afe44,0x08b2052f,0x0db40b9b,0x0ef00ed8,0x0f350ebf,
0x11fb1088,0x1055123b,0x07670c86,0xfe82024c,0xfd35fcc7,0xff1ffe6c,0xfc33fe4e,0xf7e6f9be,
0xf7fcf745,0xfb1cf968,0xfcfafc67,0xfd15fd02,0xfea9fd89,0x00e8ffe9,0x01df019f,0x02110215,
0x026a0233,0x01c6027d,0xff7000a2,0xfe8dfea2,0x001fff62,0xfee20019,0xfb41fcf3,0xf868f9b4,
0xf64bf745,0xf36cf4f6,0xf289f23e,0xf7e6f44a,0x019dfc8b,0x0a1e0672,0x0dfd0c9b,0x0f8b0eeb,
0x0f2f0fb5,0x0beb0dd1,0x09f90a70,0x0b9b0aa4,0x0c2d0c3f,0x09670b41,0x055f074e,0x016203a1,
0xf9f5fe23,0xf0dcf56b,0xe9f9ecde,0xe825e875,0xe925e863,0xed53ead3,0xf3e9f08c,0xfb4df771,
0x0211ff11,0x044103bc,0x0492044e,0x07050574,0x0b74093d,0x0ead0d65,0x10640fa1,0x10b410da,
0x0ca80f2c,0x074a09e3,0x020304d1,0xfc7dff50,0xf863fa35,0xf6e2f727,0xf8edf789,0xfb0cfa44,
0xfb0ffb28,0xfbf2fb42,0xfd83fca7,0x0028feb2,0x02ea0199,0x045f03c8,0x03550436,0x000f019d,
0xff27ff1e,0x01d80046,0x02e30309,0xfe910138,0xf953fb84,0xf91af87e,0xfa1cf9e8,0xf86cf981,
0xf55cf6fd,0xf37ff3f5,0xf7a7f4b8,0x000efbd8,0x06ae03b8,0x0be90954,0x11110ea0,0x142012ff,
0x13a41458,0x0f5811f6,0x09390c3f,0x05d206fd,0x0517055f,0x02bc0473,0xfb4cff92,0xf3acf6de,
0xf10df1fe,0xef77f03d,0xed65ee8a,0xeb10ebfd,0xed10eb5d,0xf273ef85,0xf932f5bd,0xffcffc97,
0x06ae0327,0x0ceb0a30,0x0dbb0e06,0x0cd30d16,0x0d960d2e,0x0d5d0dc4,0x0c0e0cc1,0x09f50b49,
0x06050815,0x014403b1,0xfc67febc,0xf8b5fa6f,0xf658f74f,0xf63df612,0xf758f6b7,0xf9c8f85c,
0xfcdcfb57,0xff4efe23,0x020c007a,0x051603a4,0x05c105e0,0x03a404db,0x028802b4,0x034302c4,
0x015102f6,0xfbe1fec1,0xfa1cfa3a,0xfc9ffb46,0xfb43fcc0,0xf568f870,0xf2b6f33e,0xf5d8f3cd,
0xfa69f848,0xfdb2fc2e,0x0164ff59,0x06c103ec,0x0c4109a7,0x0f670e26,0x110c1058,0x125611c1,
0x11bc1262,0x0e5f105e,0x089c0bb4,0x015f0504,0xfa9afdcc,0xf550f7d6,0xf1c4f323,0xeff9f0da,
0xee14eeeb,0xee8aedf6,0xf001ef58,0xf1b6f0c2,0xf3d3f2d4,0xf811f53d,0xffddfbdc,0x06610367,
0x0c530955,0x12460f67,0x15b11499,0x122f14e2,0x0b260e9a,0x079408ba,0x058e06d3,0x01410395,
0xfe17ff92,0xfbc0fcfa,0xf9aefab3,0xf833f8dd,0xf66ef776,0xf4bff54d,0xf7aaf587,0xfddefaa5,
0x028e0069,0x05ca0445,0x076306ef,0x06900741,0x04b5058b,0x03aa0417,0x00f502ac,0xfd1cfeff,
0xfb68fc06,0xfa47fb01,0xf920f989,0xf89af8e3,0xf813f85f,0xf763f7ca,0xf65df6c6,0xf78ef65d,
0xfdc9fa2f,0x04d10150,0x09c4078d,0x0d040b6f,0x0ffc0e8f,0x11841110,0x10b01155,0x0f780ffe,
0x0def0ee4,0x0a1a0c62,0x033e072b,0xf896fe60,0xee04f2e9,0xe9f9eaef,0xec63ead8,0xee7ced9d,
0xf04eef5c,0xf1e3f10b,0xf5ebf37b,0xfad3f8a3,0xfc4cfbfd,0xfd1cfc65,0x03e1ff68,0x0f8b09d2,
0x1523137e,0x143d1506,0x12fb1377,0x10881222,0x09890dba,0xfef3045b,0xf77dfa47,0xf792f6d7,
0xfa78f903,0xfc37fbce,0xf9fefb7c,0xf782f888,0xf81df768,0xfadff98d,0xfc1efbb3,0xfeeffcfe,
0x049901a6,0x08cf0700,0x0ac40a17,0x08e90a76,0x03970669,0xfece00de,0xfc00fd12,0xfa31fb16,
0xf81df914,0xf798f785,0xf813f80d,0xf60ff75e,0xf4d7f4ee,0xf8d6f646,0xfe8bfbcc,0x01780056,
0x02ec0214,0x08cb0511,0x11440d43,0x13db1393,0x10bb128d,0x0e580f33,0x0e0f0e19,0x0ca80dd9,
0x070e0a60,0xfe9e030f,0xf630fa1c,0xf108f34b,0xec7feee4,0xe7a4e9de,0xe766e699,0xee1dea0c,
0xf687f26b,0xfd1efa17,0xfef2fec1,0xfe6cfe60,0x02c0ffed,0x09e20662,0x0dfb0cb2,0x0e6a0e42,
0x117e0f63,0x14c913af,0x10f213db,0x07c30cb1,0xfed002e4,0xf916fb83,0xf613f75e,0xf4c1f531,
0xf4b7f49b,0xf69df549,0xfb1ff8af,0xfe1afd18,0xfe30fe5a,0xfe8dfe2c,0x0059ff4a,0x044e0221,
0x086e0690,0x09760951,0x07e208d2,0x059c06e0,0x01c80408,0xfb35fed0,0xf50df7b8,0xf2d1f36c,
0xf493f345,0xf7b1f640,0xf826f853,0xf76df797,0xf9baf823,0xfe7efc03,0x036a00dd,0x088005f9,
0x0cae0ac0,0x0ec80e0a,0x0f700f0a,0x112e102d,0x11171188,0x0e530fe4,0x09cb0c41,0x02850687,
0xf9bbfe2c,0xf35cf61c,0xef37f14c,0xeb07ed08,0xe912e9ba,0xeb12e992,0xf023ed70,0xf55af2d4,
0xfa77f7d0,0xff9ffd05,0x05a3025f,0x0b2808e8,0x0bfa0c08,0x0ceb0c26,0x100f0e71,0x122911a5,
0x0ffc11c3,0x0aca0da8,0x043a07b5,0xfd02007a,0xf8f1fa65,0xf7bff835,0xf5acf6ea,0xf2a9f420,
0xf226f1c2,0xf87df486,0x0028fce5,0x02a201f7,0x032202c9,0x059d041f,0x08380735,0x075f0843,
0x047805e0,0x037c03af,0x035a037e,0x01c002cc,0xfdd50028,0xf7b1fac1,0xf310f4f4,0xf219f20c,
0xf31af2a3,0xf3ebf345,0xf884f594,0xffb0fc2a,0x0449027d,0x0637054d,0x09a20799,0x0e0d0bcf,
0x11350fd5,0x114611d5,0x0df40fdb,0x0be50c66,0x0c930c32,0x09af0bf4,0x009005aa,0xf680fb1b,
0xf1b5f37b,0xeda1f00b,0xe7c9ea99,0xe699e647,0xecaee8e7,0xf510f122,0xf94cf7cb,0xfb3cfa2b,
0x003dfd37,0x08b5045a,0x0e6f0c65,0x0ec10eea,0x0fcb0efd,0x10e5109e,0x0fcb1097,0x0c0a0e67,
0x04c108b9,0xfe47011f,0xfbb6fc85,0xfa8bfb58,0xf709f925,0xf3f7f51d,0xf4c1f3ec,0xf73ff5e1,
0xf972f87b,0xfa8dfa0d,0xfe60fbce,0x06ae0229,0x0d310aa9,0x0cc70dc5,0x08690ab7,0x046e0636,
0x01e00329,0xfee3007d,0xfb33fcf6,0xf7eef943,0xf75df740,0xf7a8f7d0,0xf4b5f6b5,0xf0dcf273,
0xf257f0bf,0xf7c1f4e2,0xfd53fa93,0x0473008b,0x0c92089a,0x11500f8e,0x1091116d,0x0e600f5e,
0x0d4e0db7,0x0d780d41,0x0d650db3,0x09950c18,0x029c0629,0xfd54ffa8,0xf91bfb65,0xf264f61e,
0xeb78ee99,0xe9f7e9d0,0xedc0eb87,0xf1deeffc,0xf5a3f3b4,0xfa59f7b6,0x0157fd99,0x079904fc,
0x09670902,0x09530962,0x0b0009cb,0x0f0e0cdb,0x10691084,0x0af30e70,0x031806de,0xfe5c003a,
0xfbc6fcfb,0xf8abfa4e,0xf596f6ec,0xf4e0f4d6,0xf746f5c7,0xfa83f910,0xfbdffb68,0xfd75fc73,
0x01a3ff39,0x06ce043f,0x0a8908ed,0x0c9d0bb2,0x0dd10d5e,0x0ce10dcb,0x084c0b08,0x016204ed,
0xfb03fe09,0xf647f879,0xf35af47f,0xf2f4f2f0,0xf34ff331,0xf387f373,0xf3edf3a4,0xf568f47a,
0xf798f678,0xfb68f906,0x0299fea0,0x0a10068b,0x0ff00d29,0x1436125a,0x14dc1531,0x1017131b,
0x09b80cc6,0x065007a1,0x044d0567,0x012302e2,0xfd0bff45,0xf7defa90,0xf397f574,0xf186f256,
0xeff2f0c1,0xef4cef58,0xf2bff06a,0xf9ecf614,0x0072fd6f,0x051602f0,0x081b06d0,0x09bc0912,
0x0a580a24,0x0a020a41,0x08750966,0x05bd0741,0x029e0434,0xff46010a,0xfc2ffda7,0xf959fac5,
0xf6a6f7f3,0xf508f5a9,0xf519f4c4,0xf7ebf613,0xfd24fa76,0x00f6ff3c,0x0389023f,0x06d90500,
0x0b1a08f4,0x0df70cdf,0x0e2c0e5f,0x0d470dc2,0x0c080cc5,0x09230ae6,0x031806a6,0xf98bfeae,
0xf0b7f4ba,0xed43ee2f,0xeeceedc3,0xf039efa2,0xf1b1f0d3,0xf42af2c5,0xf849f606,0xfc74fa96,
0xfea3fdc9,0x00c2ff7f,0x069302fa,0x0fb40b2e,0x14971310,0x13d514a2,0x121912ee,0x0f611111,
0x08980ca2,0xfe71039b,0xf74af9ff,0xf6d5f674,0xf864f7ad,0xf875f8c0,0xf607f764,0xf451f4e4,
0xf578f48c,0xf8a7f709,0xfb09fa00,0xfe88fc58,0x04ca0174,0x09e807ac,0x0c370b65,0x0b140c21,
0x0756094e,0x03d9056b,0x00900229,0xfd18fed4,0xfa05fb61,0xf8c8f919,0xf851f8b5,0xf602f75c,
0xf4a9f4e5,0xf7b1f5af,0xfca0fa2c,0xffc8fe79,0x0190009f,0x06de0390,0x0e750ada,0x112d10ae,
0x0eeb104c,0x0d190db8,0x0d270d0d,0x0c0d0d15,0x06ae09ea,0xfe7502be,0xf6a4fa31,0xf223f416,
0xee01f039,0xe971eb89,0xe927e873,0xef43eb93,0xf6ebf335,0xfcf6fa25,0xff7dfec7,0x0033ffa7,
0x047401d7,0x0ac307ad,0x0e850d4b,0x0ed10ec8,0x10e20f68,0x13451281,0x0fcb1263,0x07790bff,
0xfee902e3,0xf8e1fb86,0xf541f6dd,0xf393f425,0xf3a0f372,0xf573f438,0xf997f758,0xfcb4fb8a,
0xfd72fd3c,0xfe5cfdc2,0x005cff34,0x0466022d,0x089e06af,0x0a1f09af,0x095909ea,0x0754088c,
0x035b05ac,0xfcdb005d,0xf6bdf974,0xf3f4f4e8,0xf4bef3f1,0xf736f602,0xf7b9f7cc,0xf74ef753,
0xf9acf819,0xfe1efbd4,0x029e0047,0x076d0502,0x0bae09ae,0x0e1d0d33,0x0efb0e85,0x10a70fb6,
0x109110fd,0x0de70f6c,0x09710be0,0x025a063e,0xf9e0fe2a,0xf3acf65e,0xef95f1a1,0xeb89ed75,
0xe9baea51,0xeb9fea37,0xf06eedda,0xf58ef30b,0xfabcf80c,0xffedfd54,0x05d102a5,0x0b490904,
0x0c580c43,0x0d470c90,0x10070e9e,0x11d51169,0x0fa81164,0x0a8c0d5e,0x0412077e,0xfcf10060,
0xf8d5fa53,0xf78af80c,0xf56ff6af,0xf267f3e2,0xf1d2f176,0xf81ff42b,0xffe9fc8e,0x028801cb,
0x031702bc,0x058e0410,0x0839072a,0x07860858,0x04b80614,0x03c703f6,0x03ab03cd,0x021b0323,
0xfe260082,0xf7e8fb07,0xf32df51d,0xf227f221,0xf31bf2ab,0xf3e0f340,0xf86df582,0xff92fc11,
0x042f0261,0x06210536,0x09830780,0x0de50bad,0x110d0fac,0x112a11b2,0x0dea0fc8,0x0be10c61,
0x0c8a0c2f,0x09a30be9,0x008b05a0,0xf684fb1b,0xf1b9f37f,0xedaaf00f,0xe7dceaa7,0xe6abe65b,
0xecb7e8f5,0xf514f128,0xf951f7ce,0xfb41fa2e,0x003ffd3a,0x08b6045b,0x0e710c67,0x0ec30eec,
0x0fcb0eff,0x10e3109e,0x0fcb1096,0x0c080e65,0x04bf08b6,0xfe46011e,0xfbb6fc84,0xfa8afb57,
0xf708f925,0xf3f7f51d,0xf4c0f3eb,0xf73ef5e0,0xf971f87a,0xfa8dfa0c,0xfe60fbcd,0x071e0229,
0x00000513,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,
0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,
0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,
0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,
};
| [
"[email protected]"
] | |
11c2d81fe4c17305f13a4843d4711c0cfa113cd4 | f598c1568d7e183beecf9b82ea331371bf97289e | /Hamlet/Source/BloodNight/Enemies/Ghost.hpp | d832d9ad6a2ba0a5649d30fd37063c34122a9df4 | [] | no_license | Elin4527/Hamlet-Game | ab270f679fb35d53c5d01d89389d6d24fa4b4067 | ed75623dbdc1d2c94e5b2cf293907851c51060ac | refs/heads/master | 2021-05-30T15:08:02.389719 | 2016-01-02T19:59:29 | 2016-01-02T19:59:29 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 397 | hpp |
#pragma once
#include "../../WildVEngine/WildVEngine.hpp"
class Ghost : public wv::Enemy
{
public:
Ghost(wv::TileMap* t, unsigned int r, unsigned int c);
Ghost();
virtual ~Ghost();
virtual void fixedUpdate() override;
virtual void collided(wv::Player& p) override;
// Inherited via Enemy
virtual std::shared_ptr<Enemy> spawn(wv::TileMap * t, unsigned int r, unsigned int c) override;
}; | [
"[email protected]"
] | |
599d3a0e31f91763e742898b074d4ca14a53bfa4 | 1abb4677cbf73b8d40c8ba64b9d78c1386fc5b8e | /Stafra/App/DisplayRenderer.hpp | b667862a24e2c92b07011765c6ceda8e4aa35e22 | [] | no_license | Sixshaman/Stafra | e89a2dea3141208843ed6e6ab1dab1161be2eed3 | 7187aca318db58f300883b1dafa43bd14cd10e38 | refs/heads/master | 2021-07-08T10:05:04.787779 | 2020-09-14T18:42:46 | 2020-09-14T18:42:46 | 191,761,229 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,013 | hpp | #pragma once
#include <d3d11.h>
#include <wrl/client.h>
#include <cstdint>
#include "Renderer.hpp"
class DisplayRenderer final: public Renderer
{
struct CBParamsClickRuleStruct
{
uint32_t Flags;
};
public:
DisplayRenderer(int gpuIndex, HWND previewWnd, HWND clickRuleWnd);
~DisplayRenderer();
void ResizePreviewArea(uint32_t newWidth, uint32_t newHeight) override;
bool GetClickRuleGridVisible() const override;
void SetClickRuleGridVisible(bool bVisible) override;
void DrawPreview() override; //Only to be called from the background thread
void DrawClickRule() override; //Only to be called from the background thread
void SetCurrentBoard(ID3D11ShaderResourceView* srv) override;
void SetCurrentClickRule(ID3D11ShaderResourceView* srv) override;
private:
void CreateSwapChains(HWND previewWnd, HWND clickRuleWnd);
void LoadShaders();
void CreateSwapChain(IDXGIFactory* factory, HWND hwnd, uint32_t width, uint32_t height, IDXGISwapChain** outSwapChain);
void InitRenderAreaSize(IDXGISwapChain* swapChain, uint32_t width, uint32_t height, ID3D11RenderTargetView** outRTV, D3D11_VIEWPORT* outViewport);
private:
Microsoft::WRL::ComPtr<IDXGISwapChain> mPreviewSwapChain;
Microsoft::WRL::ComPtr<IDXGISwapChain> mClickRuleSwapChain;
Microsoft::WRL::ComPtr<ID3D11RenderTargetView> mPreviewRTV;
Microsoft::WRL::ComPtr<ID3D11RenderTargetView> mClickRuleRTV;
D3D11_VIEWPORT mPreviewViewport;
D3D11_VIEWPORT mClickRuleViewport;
Microsoft::WRL::ComPtr<ID3D11SamplerState> mBoardSampler;
Microsoft::WRL::ComPtr<ID3D11VertexShader> mRenderVertexShader;
Microsoft::WRL::ComPtr<ID3D11PixelShader> mRenderPixelShader;
Microsoft::WRL::ComPtr<ID3D11PixelShader> mRenderClickRulePixelShader;
Microsoft::WRL::ComPtr<ID3D11Buffer> mCBufferParamsClickRule;
CBParamsClickRuleStruct mCBufferParamsClickRuleCopy;
ID3D11ShaderResourceView* mCurrentBoardSRV; //Non-owning observer pointer
ID3D11ShaderResourceView* mCurrentClickRuleSRV; //Non-owning observer pointer
}; | [
"[email protected]"
] | |
a1ed06ca330d6dccf93b6a33e227a9ffd495e51c | 3b1c7561c8d3b9452fc0cdefe299b208e0db1853 | /include/core/SkColorFilter.h | c6441d64c62b82afcc89f7202104bdb11dce5a5b | [
"BSD-3-Clause"
] | permissive | NearTox/Skia | dee04fc980bd40c1861c424b5643e7873f656b01 | 4d0cd2b6deca44eb2255651c4f04396963688761 | refs/heads/master | 2022-12-24T02:01:41.138176 | 2022-08-27T14:32:37 | 2022-08-27T14:32:37 | 153,816,056 | 0 | 0 | BSD-3-Clause | 2022-12-13T23:42:44 | 2018-10-19T17:05:47 | C++ | UTF-8 | C++ | false | false | 3,175 | h | /*
* Copyright 2006 The Android Open Source Project
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#ifndef SkColorFilter_DEFINED
#define SkColorFilter_DEFINED
#include "include/core/SkBlendMode.h"
#include "include/core/SkColor.h"
#include "include/core/SkFlattenable.h"
class SkColorMatrix;
class SkColorSpace;
/**
* ColorFilters are optional objects in the drawing pipeline. When present in
* a paint, they are called with the "src" colors, and return new colors, which
* are then passed onto the next stage (either ImageFilter or Xfermode).
*
* All subclasses are required to be reentrant-safe : it must be legal to share
* the same instance between several threads.
*/
class SK_API SkColorFilter : public SkFlattenable {
public:
/** If the filter can be represented by a source color plus Mode, this
* returns true, and sets (if not NULL) the color and mode appropriately.
* If not, this returns false and ignores the parameters.
*/
bool asAColorMode(SkColor* color, SkBlendMode* mode) const;
/** If the filter can be represented by a 5x4 matrix, this
* returns true, and sets the matrix appropriately.
* If not, this returns false and ignores the parameter.
*/
bool asAColorMatrix(float matrix[20]) const;
// Returns true if the filter is guaranteed to never change the alpha of a color it filters.
bool isAlphaUnchanged() const;
SkColor filterColor(SkColor) const;
/**
* Converts the src color (in src colorspace), into the dst colorspace,
* then applies this filter to it, returning the filtered color in the dst colorspace.
*/
SkColor4f filterColor4f(
const SkColor4f& srcColor, SkColorSpace* srcCS, SkColorSpace* dstCS) const;
/** Construct a colorfilter whose effect is to first apply the inner filter and then apply
* this filter, applied to the output of the inner filter.
*
* result = this(inner(...))
*/
sk_sp<SkColorFilter> makeComposed(sk_sp<SkColorFilter> inner) const;
static sk_sp<SkColorFilter> Deserialize(
const void* data, size_t size, const SkDeserialProcs* procs = nullptr);
private:
SkColorFilter() = default;
friend class SkColorFilterBase;
using INHERITED = SkFlattenable;
};
class SK_API SkColorFilters {
public:
static sk_sp<SkColorFilter> Compose(sk_sp<SkColorFilter> outer, sk_sp<SkColorFilter> inner) {
return outer ? outer->makeComposed(inner) : inner;
}
static sk_sp<SkColorFilter> Blend(SkColor c, SkBlendMode mode);
static sk_sp<SkColorFilter> Matrix(const SkColorMatrix&);
static sk_sp<SkColorFilter> Matrix(const float rowMajor[20]);
// A version of Matrix which operates in HSLA space instead of RGBA.
// I.e. HSLA-to-RGBA(Matrix(RGBA-to-HSLA(input))).
static sk_sp<SkColorFilter> HSLAMatrix(const SkColorMatrix&);
static sk_sp<SkColorFilter> HSLAMatrix(const float rowMajor[20]);
static sk_sp<SkColorFilter> LinearToSRGBGamma();
static sk_sp<SkColorFilter> SRGBToLinearGamma();
static sk_sp<SkColorFilter> Lerp(float t, sk_sp<SkColorFilter> dst, sk_sp<SkColorFilter> src);
private:
SkColorFilters() = delete;
};
#endif
| [
"[email protected]"
] | |
0484edd24607dd8b14fe9ac3b9a2e82d25893463 | 4c23be1a0ca76f68e7146f7d098e26c2bbfb2650 | /ic8h18/0.008/IC3H7CO | 6eae18ad0d984ed7b81710a57675f1724ff239a7 | [] | no_license | labsandy/OpenFOAM_workspace | a74b473903ddbd34b31dc93917e3719bc051e379 | 6e0193ad9dabd613acf40d6b3ec4c0536c90aed4 | refs/heads/master | 2022-02-25T02:36:04.164324 | 2019-08-23T02:27:16 | 2019-08-23T02:27:16 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 838 | /*--------------------------------*- C++ -*----------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | Website: https://openfoam.org
\\ / A nd | Version: 6
\\/ M anipulation |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volScalarField;
location "0.008";
object IC3H7CO;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 0 0 0 0 0 0];
internalField uniform 1.0992e-23;
boundaryField
{
boundary
{
type empty;
}
}
// ************************************************************************* //
| [
"[email protected]"
] | ||
550db07c30c2215144d455b9c7305ecbf8684616 | 0b431412de715f7ee9000e46d40c337422ab9d0c | /src/game/entities/components/powerupcomponent.h | cdee08fe68a8558adc25d320f586882ef9f086ca | [] | no_license | gered/MonsterDefense | 66f53c7459e96acab4d194919fe92657dd23e7ac | 4960df2ea152049a2348fc48c0821977a6606c1c | refs/heads/master | 2020-04-26T07:24:29.793861 | 2019-03-02T02:17:33 | 2019-03-02T02:23:29 | 173,393,236 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 773 | h | #ifndef __GAME_ENTITIES_COMPONENTS_POWERUPCOMPONENT_H_INCLUDED__
#define __GAME_ENTITIES_COMPONENTS_POWERUPCOMPONENT_H_INCLUDED__
#include "../../../framework/common.h"
#include "../../../entities/component.h"
#include "../powerups/powerup.h"
#include <stl/string.h>
class PowerUpComponent : public Component
{
public:
static COMPONENT_TYPE GetType()
{
static COMPONENT_TYPE typeName = "PowerUpComponent";
return typeName;
}
COMPONENT_TYPE GetTypeOf() const { return GetType(); }
PowerUpComponent();
void Reset();
PowerUp *powerUp;
BOOL shouldRaisePowerUpOnCollect;
};
inline PowerUpComponent::PowerUpComponent()
{
Reset();
}
inline void PowerUpComponent::Reset()
{
powerUp = NULL;
shouldRaisePowerUpOnCollect = FALSE;
}
#endif
| [
"[email protected]"
] | |
e9d284d700603ffe8a0a6661613b29a450160751 | 8a1a7363c96b7f96b7be641d86f783cbb1571d7d | /CW2_Album_database/Duration.hpp | 6e97838601b74260bc02f2247256973917351b54 | [] | no_license | G-Marshall-Dutton/Album-Database | fbaf2cb6da2e8e6bc501c19839405d8f3ded5814 | 7eac3ab849f10ec99a75fb1674ed054adcabcd6c | refs/heads/master | 2021-06-13T02:29:48.002322 | 2020-04-09T15:49:11 | 2020-04-09T15:49:11 | 254,414,089 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,163 | hpp | //
// Duration.hpp
// CW2_Album_database
//
// Copyright © 2019 George Marshall-Dutton. All rights reserved.
//
#ifndef Duration_hpp
#define Duration_hpp
#include <stdio.h>
#include <iomanip>
#include <ostream>
#include <iostream>
class Duration{
private:
int hours, minutes, seconds;
public:
Duration();
Duration(int seconds);
Duration(int hrs, int mins, int secs);
int getHours() const;
int getMinutes() const;
int getSeconds() const;
operator int() const;
};
// CONSTRUCTORS ----------------------
inline Duration::Duration(){
this->hours = 0;
this->minutes = 0;
this->seconds = 0;
}
inline Duration::Duration(int totalSeconds){
this->hours = totalSeconds / 3600;
totalSeconds %= 3600;
this->minutes = totalSeconds / 60;
totalSeconds %= 60;
this->seconds = totalSeconds;
}
inline Duration::Duration(int hrs, int mins, int secs){
// ADD ERROR CHECKING (values cant be < 0)
// Convert to totalSeconds
int totalSeconds = hrs * 3600;
totalSeconds += mins * 60;
totalSeconds += secs;
*this = Duration(totalSeconds);
}
// ACCESSOR METHODS ------------------
inline int Duration::getHours() const{
return hours;
}
inline int Duration::getMinutes() const{
return minutes;
}
inline int Duration::getSeconds() const{
return seconds;
}
// OVERLOADED OPERATORS ---------------
// Duration - Duration
inline int operator-(const Duration& d1, const Duration& d2){
return static_cast<int>(d1) - static_cast<int>(d2);
}
// Duration + Duration
inline int operator+(const Duration& d1, const Duration d2){
return static_cast<int>(d1) + static_cast<int>(d2);
}
// Duration += Duration
inline void operator+=(Duration& d1, const Duration d2){
d1 = Duration(static_cast<int>(d1) + static_cast<int>(d2));
}
// Duration += Duration
inline void operator-=(Duration& d1, const Duration d2){
d1 = Duration(static_cast<int>(d1) - static_cast<int>(d2));
}
// Duration > Duration
inline bool operator>(const Duration& d1, const Duration& d2){
return static_cast<int>(d1) > static_cast<int>(d2);
}
// Duration < Duration
inline bool operator<(const Duration& d1, const Duration& d2){
return static_cast<int>(d1) < static_cast<int>(d2);
}
// Duration == Duration
inline bool operator==(const Duration& d1, const Duration& d2){
return static_cast<int>(d1) == static_cast<int>(d2);
}
// Duration != Duration
inline bool operator!=(const Duration& d1, const Duration& d2){
return !(d1==d2);
}
// Duration >= Duration
inline bool operator>=(const Duration& d1, const Duration& d2){
return !(d1<d2);
}
// Duration <= Duration
inline bool operator<=(const Duration& d1, const Duration& d2){
return !(d1>d2);
}
// os << Duration
inline std::ostream& operator<<(std::ostream& os, const Duration& d){
return os << std::setfill('0')
<< std::setw(1)<< d.getHours() << ':'
<< std::setw(2) << d.getMinutes() << ':'
<< std::setw(2) << d.getSeconds() ;
}
// is >> Duration
std::istream& operator>>(std::istream& is, Duration& d);
#endif /* Duration_hpp */
| [
"[email protected]"
] | |
b3c7366f546352f87b197079a3a2ea3c8e83f984 | 2ba94892764a44d9c07f0f549f79f9f9dc272151 | /Engine/Plugins/Experimental/Phya/Source/Phya/Private/PhyaLib/include/Signal/paBlock.hpp | caa0f90a6255150f6735213e6b0bc5d0a65be22d | [
"Zlib",
"BSD-2-Clause",
"LicenseRef-scancode-proprietary-license"
] | permissive | PopCap/GameIdea | 934769eeb91f9637f5bf205d88b13ff1fc9ae8fd | 201e1df50b2bc99afc079ce326aa0a44b178a391 | refs/heads/master | 2021-01-25T00:11:38.709772 | 2018-09-11T03:38:56 | 2018-09-11T03:38:56 | 37,818,708 | 0 | 0 | BSD-2-Clause | 2018-09-11T03:39:05 | 2015-06-21T17:36:44 | null | UTF-8 | C++ | false | false | 2,862 | hpp | //
// paBlock.hpp
//
// Container class for audio blocks used in signal processing.
//
// This provides a friendly extra layer of indirection to the sample data,
// which is neccessary if we wish to establish signal connections between objects once,
// and later page-switch samples in the output paBlock of an object.
// The price of the extra indirection is not important since it is only incurred
// once per block operation.
#if !defined(__paBlock_hpp)
#define __paBlock_hpp
#include "Scene/paAudio.hpp"
#include "Utility/paObjectPool.hpp"
class PHYA_API paBlock;
//template class PHYA_API paObjectPool<paBlock>; // For dll interface only.
class PHYA_API paBlock {
private:
paFloat* m_samples; // Location of this block's own samples.
paFloat* m_start; // Start of sample block, initially this block, but can point to other blocks.
// bool m_zeroState; // Experimental flag for reducing arithmetic operations. Probably more hassle than its worth.
public:
static paObjectPool<paBlock> pool;
static paBlock* newBlock();
static int deleteBlock(paBlock*);
static int nFrames; // Working sample space can change size.
static int nMaxFrames; // Changing this during execution could cause confusion.
static int setnMaxFrames(int n);
static int setnFrames(int n);
int m_poolHandle; // Used for freeing a block to the pool.
paBlock();
~paBlock();
void zero();
// void setZeroState(void) { m_zeroState = true; } // Makes efficient buffer filling easy: If m_zeroState is set 'addWithMultiply' interpreted as 'copyWithMultiply' so 'zero' is avoided.
// void clearZeroState(void) { m_zeroState = false; } // Makes efficient buffer filling easy: If m_zeroState is set 'addWithMultiply' interpreted as 'copyWithMultiply' so 'zero' is avoided.
// bool isZero() { return m_zeroState; }
void copy(paBlock* input); // Useful for creating extra 'buffer' blocks, when minimizing block memory usage.
void multiplyBy(paFloat multfactor); // Multiply block by a factor.
void add(paBlock* toadd); // Multiply toadd by multfactor then add to current value of this audio block.
void addWithMultiply(paBlock* toadd, paFloat multfactor); // Multiply toadd by multfactor then add to current value of this audio block.
void copyWithMultiply(paBlock* tocopy, paFloat multfactor); // Multiply 'tocopy' by 'multfactor' then copy to this audio block.
void multiplyByNoise();
paFloat* getStart() { return m_start; }
void square();
paFloat sum(); // Sum the samples in the block.
void fadeout();
void fillWithNoise();
void fillWithNoise(paFloat amp);
paFloat getLastSample() { return m_start[nFrames-1]; }
void setStart(paFloat* s) { m_start = s; }
void resetStart(void) { m_start = m_samples; }
void limit(); // Ultra simple limiter. Better to use paLimiter
void plot();
void plot(paFloat scale);
};
#endif
| [
"[email protected]"
] | |
d70e2388de032a044709fc225d3ddb3aa120f034 | b81424733ba7aa22971017a2b723cebdb79e2ff9 | /B1005/B1005.cpp | f768d052f13d76fdcd92f6b3532975144d9be2cb | [] | no_license | tongnamuu/Algorithm-PS | 1d8ee70c60da9bafdae7c820872e685fdf2b28fa | 464b68c34bb07f9e1e00e4b5475c6f0240cd20d4 | refs/heads/master | 2022-06-04T01:57:29.432141 | 2022-04-08T11:52:01 | 2022-04-08T11:52:01 | 164,219,701 | 0 | 1 | null | 2019-03-28T03:43:13 | 2019-01-05T13:58:05 | C++ | UTF-8 | C++ | false | false | 1,289 | cpp | #include <iostream>
#include <vector>
#include <queue>
using namespace std;
struct NodeTimeInfo {
int now, time;
bool operator<(const NodeTimeInfo& a) const {
return time > a.time;
}
};
#define N 1001
int indegree[N];
int a[N];
vector<int>adj[N];
signed main() {
ios_base::sync_with_stdio(false), cin.tie(0);
int T; cin >> T;
while (T--) {
int n, k; cin >> n >> k;
for (int i = 1; i <= n; ++i) {
cin >> a[i];
adj[i].clear();
indegree[i] = 0;
}
for (int i = 0, u, v; i < k; ++i) {
cin >> u >> v;
indegree[v] += 1;
adj[u].push_back(v);
}
int w; cin >> w;
priority_queue<NodeTimeInfo>q;
for (int i = 1; i <= n; ++i) {
if (!indegree[i]) q.push({ i,a[i] });
}
while (!q.empty()) {
int now = q.top().now;
int time = q.top().time;
if (now == w) {
cout << time << '\n';
break;
}
q.pop();
for (int next : adj[now]) {
indegree[next]--;
if (indegree[next] == 0) {
q.push({ next, a[next] + time });
}
}
}
}
}
| [
"[email protected]"
] |
Subsets and Splits