<commit_before>/*
 * Qumulus UML editor
 * Author: Randy Thiemann
 *
 */

#include "MainWindow.h"
#include <QtWidgets/QMenuBar>
#include <QtWidgets/QMenu>
#include <Gui/Widgets/SideBar.h>
#include <Gui/Widgets/ToolBar.h>
#include <Gui/Widgets/StyleType.h>
#include <Gui/Widgets/StatusBar.h>
#include <Gui/Widgets/EditorView.h>
#include <Gui/Widgets/ElementItem.h>
#include <Gui/Widgets/ToolBarMenu.h>
#include <Gui/Core/QumulusApplication.h>
#include <QtWidgets/QSplitter>
#include <QtWidgets/QGridLayout>
#include <QtWidgets/QAction>
#include <QtWidgets/QMessageBox>
#include <QtGui/QCursor>
#include <QtGui/QPixmap>

QUML_BEGIN_NAMESPACE_GW

MainWindow::MainWindow() :
        mToolBar(new ToolBar(this)),
        mSideBar(new SideBar(this)),
        mSplitter(new QSplitter(this)),
        mStatusBar(new StatusBar(this)),
        mEditorView(new EditorView(this)) {
    constexpr unsigned kWidth = 700, kHeight = 480, kSideWidth = 220;
    createCursors();

    // Size constraints
    setMinimumSize(400, 300);
    resize(kWidth, kHeight);

    // Title
    setWindowTitle("Qumulus");

    // Create and populate the toolbar.
    populateToolbar();

    // Create main view.
    setCentralWidget(mSplitter);

#ifdef Q_OS_MAC
    mSplitter->setHandleWidth(0);
#endif

    mSplitter->setChildrenCollapsible(false);

    // Add the treeview.
    mSplitter->addWidget(mSideBar);

    // Add the Editor view.
    QSizePolicy editorViewPolicy = mEditorView->sizePolicy();
    editorViewPolicy.setHorizontalPolicy(QSizePolicy::Expanding);
    mEditorView->setSizePolicy(editorViewPolicy);
    mSplitter->addWidget(mEditorView);

    // Force the treeview an appropriate size.
    mSplitter->setSizes({kSideWidth, kWidth - kSideWidth});
    mSplitter->setStretchFactor(0, 0);
    mSplitter->setStretchFactor(1, 1);

    // Add the status bar.
    setStatusBar(mStatusBar);

    // Create the main menus.
    createMenus();

    connect(mStatusBar->slider(), &ZoomSlider::zoomChanged,
            mEditorView, &EditorView::zoom);
}

void MainWindow::populateToolbar() {
    mToolBar->showInWindow(this);

    // Class and submenu.
    mClassItem = new ToolBarItem(
            ElementItem("Class",
                    QIcon(":/data/img/toolbar/class.png"),
                    QKeySequence(tr("C")),
                    [&]{mEditorView->setCursor(mCursors["class"]);})
            );

    mClassMenu = new ToolBarMenu();
    mClassMenu->addItem(
            ElementItem("Template Class",
                    QIcon(":/data/img/toolbar/template-class.png"),
                    QKeySequence(tr("T")),
                    [&]{QMessageBox::information(this, "", "Template Class");}));
    mClassMenu->addItem(
            ElementItem("Enum",
                    QIcon(":/data/img/toolbar/enum.png"),
                    QKeySequence(tr("E")),
                    [&]{QMessageBox::information(this, "", "Enum");}));
    mClassMenu->addItem(
            ElementItem("Primitive Datatype",
                    QIcon(":/data/img/toolbar/primitive.png"),
                    QKeySequence(tr("D")),
                    [&]{QMessageBox::information(this, "", "Primitive Datatype");}));
    mClassItem->setMenu(mClassMenu);
    mToolBar->addWidget(mClassItem);

    // Package and submenu.
    mPackageItem = new ToolBarItem(
            ElementItem("Package",
                    QIcon(":/data/img/toolbar/package.png"),
                    QKeySequence(tr("P")),
                    [&]{QMessageBox::information(this, "", "Package");})
            );

    mPackageMenu = new ToolBarMenu();
    mPackageMenu->addItem(
            ElementItem("Comment",
                    QIcon(":/data/img/toolbar/comment.png"),
                    QKeySequence(tr("H")),
                    [&]{QMessageBox::information(this, "", "Comment");}));
    mPackageItem->setMenu(mPackageMenu);
    mToolBar->addWidget(mPackageItem);

    mToolBar->addSeparator();

    // Inheritance and submenu.
    mInheritanceItem = new ToolBarItem(
            ElementItem("Inheritance",
                    QIcon(":/data/img/toolbar/inheritance.png"),
                    QKeySequence(tr("I")),
                    [&]{QMessageBox::information(this, "", "Inheritance");})
            );

    mInheritanceMenu = new ToolBarMenu();
    mInheritanceMenu->addItem(
            ElementItem("Template Specialization",
                    QIcon(":/data/img/toolbar/template-specialization.png"),
                    QKeySequence(tr("S")),
                    [&]{QMessageBox::information(this, "", "Template Specialization");}));
    mInheritanceItem->setMenu(mInheritanceMenu);
    mToolBar->addWidget(mInheritanceItem);

    // Aggregation and submenu.
    mAggregationItem = new ToolBarItem(
            ElementItem("Aggregation",
                    QIcon(":/data/img/toolbar/aggregation.png"),
                    QKeySequence(tr("G")),
                    [&]{QMessageBox::information(this, "", "Aggregation");})
            );

    mAggregationMenu = new ToolBarMenu();
    mAggregationMenu->addItem(
            ElementItem("Containment",
                    QIcon(":/data/img/toolbar/containment.png"),
                    QKeySequence(tr("N")),
                    [&]{QMessageBox::information(this, "", "Containment");}));
    mAggregationItem->setMenu(mAggregationMenu);
    mToolBar->addWidget(mAggregationItem);

    // Relationship and submenu.
    mRelationshipItem = new ToolBarItem(
            ElementItem("Relationship",
                    QIcon(":/data/img/toolbar/relationship.png"),
                    QKeySequence(tr("R")),
                    [&]{QMessageBox::information(this, "", "Relationship");})
            );

    mRelationshipMenu = new ToolBarMenu();
    mRelationshipMenu->addItem(
            ElementItem("Package Membership",
                    QIcon(":/data/img/toolbar/package-membership.png"),
                    QKeySequence(tr("M")),
                    [&]{QMessageBox::information(this, "", "Package Membership");}));
    mRelationshipItem->setMenu(mRelationshipMenu);
    mToolBar->addWidget(mRelationshipItem);

    mToolBar->addSeparator();

    // Operations and attributes.
    mOperationItem = new ToolBarItem(
            ElementItem("Operation",
                    QIcon(":/data/img/toolbar/operation.png"),
                    QKeySequence(tr("O")),
                    [&]{QMessageBox::information(this, "", "Operation");})
            );
    mToolBar->addWidget(mOperationItem);
    mAttributeItem = new ToolBarItem(
            ElementItem("Attribute",
                    QIcon(":/data/img/toolbar/Attribute.png"),
                    QKeySequence(tr("A")),
                    [&]{QMessageBox::information(this, "", "Attribute");})
            );
    mToolBar->addWidget(mAttributeItem);
}

void MainWindow::createMenus() {
    mFileMenu = menuBar()->addMenu(tr("&File"));
    mEditMenu = menuBar()->addMenu(tr("&Edit"));
    mInsertMenu = menuBar()->addMenu(tr("&Insert"));
    mViewMenu = menuBar()->addMenu(tr("&View"));
    mHelpMenu = menuBar()->addMenu(tr("&Help"));

    // File Menu
    mNewAction = new QAction(tr("&New"), this);
    mNewAction->setShortcuts(QKeySequence::New);

    mOpenAction = new QAction(tr("&Open..."), this);
    mOpenAction->setShortcuts(QKeySequence::Open);

    mCloseAction = new QAction(tr("Close"), this);
    mCloseAction->setShortcuts(QKeySequence::Close);

    mPrintAction = new QAction(tr("&Print..."), this);
    mPrintAction->setShortcuts(QKeySequence::Print);

    mPrefsAction = new QAction(tr("Settings"), this);
    mPrefsAction->setShortcuts(QKeySequence::Preferences);

    mQuitAction = new QAction(tr("&Quit"), this);
    mQuitAction->setShortcuts(QKeySequence::Quit);
    connect(mQuitAction, &QAction::triggered, &QApplication::exit);

    mFileMenu->addAction(mNewAction);
    mFileMenu->addAction(mOpenAction);
    mFileMenu->addSeparator();
    mFileMenu->addAction(mCloseAction);
    mFileMenu->addSeparator();
    mFileMenu->addAction(mPrintAction);
    mFileMenu->addSeparator();
    mFileMenu->addAction(mPrefsAction);
    mFileMenu->addAction(mQuitAction);

    // Edit Menu
    mUndoAction = new QAction(tr("&Undo"), this);
    mUndoAction->setShortcuts(QKeySequence::Undo);

    mRedoAction = new QAction(tr("&Redo"), this);
    mRedoAction->setShortcuts(QKeySequence::Redo);

    mCutAction = new QAction(tr("&Cut"), this);
    mCutAction->setShortcuts(QKeySequence::Cut);

    mCopyAction = new QAction(tr("C&opy"), this);
    mCopyAction->setShortcuts(QKeySequence::Copy);

    mPasteAction = new QAction(tr("&Paste"), this);
    mPasteAction->setShortcuts(QKeySequence::Paste);

    mDeleteAction = new QAction(tr("&Delete"), this);
    mDeleteAction->setShortcuts(QKeySequence::Delete);

    mDuplicateAction = new QAction(tr("D&uplicate"), this);
    mDuplicateAction->setShortcuts({QKeySequence(tr("Ctrl+D"))});

    mEditMenu->addAction(mUndoAction);
    mEditMenu->addAction(mRedoAction);
    mEditMenu->addAction(mCutAction);
    mEditMenu->addAction(mCopyAction);
    mEditMenu->addAction(mPasteAction);
    mEditMenu->addAction(mDeleteAction);
    mEditMenu->addAction(mDuplicateAction);

    // Help Menu
    mAboutAction = new QAction(tr("&About Qumulus"), this);
    connect(mAboutAction, &QAction::triggered, [&]{
            this->setWindowIcon(QIcon(":/logo/qumulus-256.png"));
            QMessageBox::about(this,
                "About Qumulus",
                "Qumulus\n"
                "Version 0.1\n\n"
                "Authors: Frank Erens & Randy Thiemann");
            this->setWindowIcon(QIcon(""));});

    mHelpMenu->addAction(mAboutAction);
}

void MainWindow::createCursors() {
    mCursors["class"] = QCursor(QPixmap(":/data/img/cursor/class.png"), -1, -1);
    mCursors["comment"] = QCursor(QPixmap(":/data/img/cursor/comment.png"), -1, -1);
    mCursors["enum"] = QCursor(QPixmap(":/data/img/cursor/enum.png"), -1, -1);
    mCursors["interface"] = QCursor(QPixmap(":/data/img/cursor/interface.png"), -1, -1);
    mCursors["package"] = QCursor(QPixmap(":/data/img/cursor/package.png"), -1, -1);
    mCursors["primitive"] = QCursor(QPixmap(":/data/img/cursor/primitive.png"), -1, -1);
    mCursors["template-class"] = QCursor(QPixmap(":/data/img/cursor/template-class.png"), -1, -1);
}

QUML_END_NAMESPACE_GW

<commit_msg>Add cursors for all buttons.<commit_after>/*
 * Qumulus UML editor
 * Author: Randy Thiemann
 *
 */

#include "MainWindow.h"
#include <QtWidgets/QMenuBar>
#include <QtWidgets/QMenu>
#include <Gui/Widgets/SideBar.h>
#include <Gui/Widgets/ToolBar.h>
#include <Gui/Widgets/StyleType.h>
#include <Gui/Widgets/StatusBar.h>
#include <Gui/Widgets/EditorView.h>
#include <Gui/Widgets/ElementItem.h>
#include <Gui/Widgets/ToolBarMenu.h>
#include <Gui/Core/QumulusApplication.h>
#include <QtWidgets/QSplitter>
#include <QtWidgets/QGridLayout>
#include <QtWidgets/QAction>
#include <QtWidgets/QMessageBox>
#include <QtGui/QCursor>
#include <QtGui/QPixmap>

QUML_BEGIN_NAMESPACE_GW

MainWindow::MainWindow() :
        mToolBar(new ToolBar(this)),
        mSideBar(new SideBar(this)),
        mSplitter(new QSplitter(this)),
        mStatusBar(new StatusBar(this)),
        mEditorView(new EditorView(this)) {
    constexpr unsigned kWidth = 700, kHeight = 480, kSideWidth = 220;
    createCursors();

    // Size constraints
    setMinimumSize(400, 300);
    resize(kWidth, kHeight);

    // Title
    setWindowTitle("Qumulus");

    // Create and populate the toolbar.
    populateToolbar();

    // Create main view.
    setCentralWidget(mSplitter);

#ifdef Q_OS_MAC
    mSplitter->setHandleWidth(0);
#endif

    mSplitter->setChildrenCollapsible(false);

    // Add the treeview.
    mSplitter->addWidget(mSideBar);

    // Add the Editor view.
    QSizePolicy editorViewPolicy = mEditorView->sizePolicy();
    editorViewPolicy.setHorizontalPolicy(QSizePolicy::Expanding);
    mEditorView->setSizePolicy(editorViewPolicy);
    mSplitter->addWidget(mEditorView);

    // Force the treeview an appropriate size.
    mSplitter->setSizes({kSideWidth, kWidth - kSideWidth});
    mSplitter->setStretchFactor(0, 0);
    mSplitter->setStretchFactor(1, 1);

    // Add the status bar.
    setStatusBar(mStatusBar);

    // Create the main menus.
    createMenus();

    connect(mStatusBar->slider(), &ZoomSlider::zoomChanged,
            mEditorView, &EditorView::zoom);
}

void MainWindow::populateToolbar() {
    mToolBar->showInWindow(this);

    // Class and submenu.
    mClassItem = new ToolBarItem(
            ElementItem("Class",
                    QIcon(":/data/img/toolbar/class.png"),
                    QKeySequence(tr("C")),
                    [&]{mEditorView->setCursor(mCursors["class"]);}));

    mClassMenu = new ToolBarMenu();
    mClassMenu->addItem(
            ElementItem("Template Class",
                    QIcon(":/data/img/toolbar/template-class.png"),
                    QKeySequence(tr("T")),
                    [&]{mEditorView->setCursor(mCursors["template-class"]);}));
    mClassMenu->addItem(
            ElementItem("Enum",
                    QIcon(":/data/img/toolbar/enum.png"),
                    QKeySequence(tr("E")),
                    [&]{mEditorView->setCursor(mCursors["enum"]);}));
    mClassMenu->addItem(
            ElementItem("Primitive Datatype",
                    QIcon(":/data/img/toolbar/primitive.png"),
                    QKeySequence(tr("D")),
                    [&]{mEditorView->setCursor(mCursors["primitive"]);}));
    mClassItem->setMenu(mClassMenu);
    mToolBar->addWidget(mClassItem);

    // Package and submenu.
    mPackageItem = new ToolBarItem(
            ElementItem("Package",
                    QIcon(":/data/img/toolbar/package.png"),
                    QKeySequence(tr("P")),
                    [&]{mEditorView->setCursor(mCursors["package"]);}));

    mPackageMenu = new ToolBarMenu();
    mPackageMenu->addItem(
            ElementItem("Comment",
                    QIcon(":/data/img/toolbar/comment.png"),
                    QKeySequence(tr("H")),
                    [&]{mEditorView->setCursor(mCursors["comment"]);}));
    mPackageItem->setMenu(mPackageMenu);
    mToolBar->addWidget(mPackageItem);

    mToolBar->addSeparator();

    // Inheritance and submenu.
    mInheritanceItem = new ToolBarItem(
            ElementItem("Inheritance",
                    QIcon(":/data/img/toolbar/inheritance.png"),
                    QKeySequence(tr("I")),
                    [&]{mEditorView->setCursor(mCursors["inheritance"]);}));

    mInheritanceMenu = new ToolBarMenu();
    mInheritanceMenu->addItem(
            ElementItem("Template Specialization",
                    QIcon(":/data/img/toolbar/template-specialization.png"),
                    QKeySequence(tr("S")),
                    [&]{mEditorView->setCursor(mCursors["template-specialization"]);}));
    mInheritanceItem->setMenu(mInheritanceMenu);
    mToolBar->addWidget(mInheritanceItem);

    // Aggregation and submenu.
    mAggregationItem = new ToolBarItem(
            ElementItem("Aggregation",
                    QIcon(":/data/img/toolbar/aggregation.png"),
                    QKeySequence(tr("G")),
                    [&]{mEditorView->setCursor(mCursors["aggregation"]);}));

    mAggregationMenu = new ToolBarMenu();
    mAggregationMenu->addItem(
            ElementItem("Containment",
                    QIcon(":/data/img/toolbar/containment.png"),
                    QKeySequence(tr("N")),
                    [&]{mEditorView->setCursor(mCursors["containment"]);}));
    mAggregationItem->setMenu(mAggregationMenu);
    mToolBar->addWidget(mAggregationItem);

    // Relationship and submenu.
    mRelationshipItem = new ToolBarItem(
            ElementItem("Relationship",
                    QIcon(":/data/img/toolbar/relationship.png"),
                    QKeySequence(tr("R")),
                    [&]{mEditorView->setCursor(mCursors["relationship"]);}));

    mRelationshipMenu = new ToolBarMenu();
    mRelationshipMenu->addItem(
            ElementItem("Package Membership",
                    QIcon(":/data/img/toolbar/package-membership.png"),
                    QKeySequence(tr("M")),
                    [&]{mEditorView->setCursor(mCursors["package-membership"]);}));
    mRelationshipItem->setMenu(mRelationshipMenu);
    mToolBar->addWidget(mRelationshipItem);

    mToolBar->addSeparator();

    // Operations and attributes.
    mOperationItem = new ToolBarItem(
            ElementItem("Operation",
                    QIcon(":/data/img/toolbar/operation.png"),
                    QKeySequence(tr("O")),
                    [&]{QMessageBox::information(this, "", "Operation");})
            );
    mToolBar->addWidget(mOperationItem);
    mAttributeItem = new ToolBarItem(
            ElementItem("Attribute",
                    QIcon(":/data/img/toolbar/Attribute.png"),
                    QKeySequence(tr("A")),
                    [&]{QMessageBox::information(this, "", "Attribute");})
            );
    mToolBar->addWidget(mAttributeItem);
}

void MainWindow::createMenus() {
    mFileMenu = menuBar()->addMenu(tr("&File"));
    mEditMenu = menuBar()->addMenu(tr("&Edit"));
    mInsertMenu = menuBar()->addMenu(tr("&Insert"));
    mViewMenu = menuBar()->addMenu(tr("&View"));
    mHelpMenu = menuBar()->addMenu(tr("&Help"));

    // File Menu
    mNewAction = new QAction(tr("&New"), this);
    mNewAction->setShortcuts(QKeySequence::New);

    mOpenAction = new QAction(tr("&Open..."), this);
    mOpenAction->setShortcuts(QKeySequence::Open);

    mCloseAction = new QAction(tr("Close"), this);
    mCloseAction->setShortcuts(QKeySequence::Close);

    mPrintAction = new QAction(tr("&Print..."), this);
    mPrintAction->setShortcuts(QKeySequence::Print);

    mPrefsAction = new QAction(tr("Settings"), this);
    mPrefsAction->setShortcuts(QKeySequence::Preferences);

    mQuitAction = new QAction(tr("&Quit"), this);
    mQuitAction->setShortcuts(QKeySequence::Quit);
    connect(mQuitAction, &QAction::triggered, &QApplication::exit);

    mFileMenu->addAction(mNewAction);
    mFileMenu->addAction(mOpenAction);
    mFileMenu->addSeparator();
    mFileMenu->addAction(mCloseAction);
    mFileMenu->addSeparator();
    mFileMenu->addAction(mPrintAction);
    mFileMenu->addSeparator();
    mFileMenu->addAction(mPrefsAction);
    mFileMenu->addAction(mQuitAction);

    // Edit Menu
    mUndoAction = new QAction(tr("&Undo"), this);
    mUndoAction->setShortcuts(QKeySequence::Undo);

    mRedoAction = new QAction(tr("&Redo"), this);
    mRedoAction->setShortcuts(QKeySequence::Redo);

    mCutAction = new QAction(tr("&Cut"), this);
    mCutAction->setShortcuts(QKeySequence::Cut);

    mCopyAction = new QAction(tr("C&opy"), this);
    mCopyAction->setShortcuts(QKeySequence::Copy);

    mPasteAction = new QAction(tr("&Paste"), this);
    mPasteAction->setShortcuts(QKeySequence::Paste);

    mDeleteAction = new QAction(tr("&Delete"), this);
    mDeleteAction->setShortcuts(QKeySequence::Delete);

    mDuplicateAction = new QAction(tr("D&uplicate"), this);
    mDuplicateAction->setShortcuts({QKeySequence(tr("Ctrl+D"))});

    mEditMenu->addAction(mUndoAction);
    mEditMenu->addAction(mRedoAction);
    mEditMenu->addAction(mCutAction);
    mEditMenu->addAction(mCopyAction);
    mEditMenu->addAction(mPasteAction);
    mEditMenu->addAction(mDeleteAction);
    mEditMenu->addAction(mDuplicateAction);

    // Help Menu
    mAboutAction = new QAction(tr("&About Qumulus"), this);
    connect(mAboutAction, &QAction::triggered, [&]{
            this->setWindowIcon(QIcon(":/logo/qumulus-256.png"));
            QMessageBox::about(this,
                "About Qumulus",
                "Qumulus\n"
                "Version 0.1\n\n"
                "Authors: Frank Erens & Randy Thiemann");
            this->setWindowIcon(QIcon(""));});

    mHelpMenu->addAction(mAboutAction);
}

void MainWindow::createCursors() {
    mCursors["aggregation"] =
        QCursor(QPixmap(":/data/img/cursor/aggregation.png"), -1, -1);
    mCursors["class"] =
        QCursor(QPixmap(":/data/img/cursor/class.png"), -1, -1);
    mCursors["comment"] =
        QCursor(QPixmap(":/data/img/cursor/comment.png"), -1, -1);
    mCursors["containment"] =
        QCursor(QPixmap(":/data/img/cursor/containment.png"), -1, -1);
    mCursors["enum"] =
        QCursor(QPixmap(":/data/img/cursor/enum.png"), -1, -1);
    mCursors["inheritance"] =
        QCursor(QPixmap(":/data/img/cursor/inheritance.png"), -1, -1);
    mCursors["interface"] =
        QCursor(QPixmap(":/data/img/cursor/interface.png"), -1, -1);
    mCursors["package-membership"] =
        QCursor(QPixmap(":/data/img/cursor/package-membership.png"), -1, -1);
    mCursors["package"] =
        QCursor(QPixmap(":/data/img/cursor/package.png"), -1, -1);
    mCursors["primitive"] =
        QCursor(QPixmap(":/data/img/cursor/primitive.png"), -1, -1);
    mCursors["relationship"] =
        QCursor(QPixmap(":/data/img/cursor/relationship.png"), -1, -1);
    mCursors["template-class"] =
        QCursor(QPixmap(":/data/img/cursor/template-class.png"), -1, -1);
    mCursors["template-specialization"] =
        QCursor(QPixmap(":/data/img/cursor/template-specialization.png"), -1, -1);
}

QUML_END_NAMESPACE_GW

<|endoftext|>


<commit_before>/*
 * Copyright (c) 2013-2015 John Connor (BM-NC49AxAjcqVcF5jNPu85Rb8MJ2d9JqZt)
 *
 * This file is part of vanillacoin.
 *
 * vanillacoin is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Affero General Public License with
 * additional permissions to the one published by the Free Software
 * Foundation, either version 3 of the License, or (at your option)
 * any later version. For more information see LICENSE.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Affero General Public License for more details.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with this program. If not, see <http://www.gnu.org/licenses/>.
 */

#include <coin/data_buffer.hpp>
#include <coin/db_tx.hpp>
#include <coin/globals.hpp>
#include <coin/inventory_vector.hpp>
#include <coin/transaction_pool.hpp>
#include <coin/zerotime.hpp>

using namespace coin;

inventory_vector::inventory_vector()
    : m_type(type_error)
    , m_hash(0)
{
    // ...
}

inventory_vector::inventory_vector(const type_t & type, const sha256 & hash)
    : m_type(type)
    , m_hash(hash)
{
    // ...
}

inventory_vector::inventory_vector(
    const std::string & type, const sha256 & hash
    )
    : m_hash(hash)
{
    auto i  = 1;

    for (
        ; i < sizeof(protocol::inventory_type_names) /
        sizeof(protocol::inventory_type_names[0]); i++
        )
    {
        if (type == protocol::inventory_type_names[i])
        {
            m_type = static_cast<type_t> (i);

            break;
        }
    }

    if (
        i == sizeof(protocol::inventory_type_names) /
        sizeof(protocol::inventory_type_names[0])
        )
    {
        throw std::runtime_error(
            "unkown type (" + type + ")"
        );
    }
}

bool inventory_vector::encode(data_buffer & buffer)
{
    buffer.write_uint32(m_type);
    buffer.write_sha256(m_hash);

    return true;
}

bool inventory_vector::decode(data_buffer & buffer)
{
    m_type = static_cast<type_t> (buffer.read_uint32());
    m_hash = buffer.read_sha256();

    return true;
}

const inventory_vector::type_t & inventory_vector::type() const
{
    return m_type;
}

const sha256 & inventory_vector::hash() const
{
    return m_hash;
}

bool inventory_vector::is_know_type() const
{
    #warning :TODO: :FIXME:
    return
        m_type > type_error && m_type <
        sizeof(protocol::inventory_type_names) /
        sizeof(protocol::inventory_type_names[0])
    ;
}

const std::string inventory_vector::command() const
{
    if (is_know_type() == false)
    {
        throw std::runtime_error(
            "unkown type (" + std::to_string(m_type) + ")"
        );
    }

    return protocol::inventory_type_names[m_type];
}

const std::string inventory_vector::to_string() const
{
    return
        command() + " " + m_hash.to_string().substr(0, 20)
    ;
}

bool inventory_vector::already_have(
    db_tx & tx_db, const inventory_vector & inv
    )
{
    switch (inv.type())
    {
        case type_error:
        {
            // ...
        }
        break;
        case type_msg_tx:
        {
            auto tx_in_map = transaction_pool::instance().exists(inv.hash());

            return
                tx_in_map ||
                globals::instance().orphan_transactions().count(inv.hash()) ||
                tx_db.contains_transaction(inv.hash()
            );
        }
        break;
        case type_msg_block:
        {
            return
                globals::instance().block_indexes().count(inv.hash()) ||
                globals::instance().orphan_blocks().count(inv.hash())
            ;
        }
        break;
        case type_msg_ztlock:
        {
            return zerotime::instance().locks().count(inv.hash()) > 0;
        }
        break;
        default:
        break;
    }

    return true;
}
<commit_msg>fixed compile warning<commit_after>/*
 * Copyright (c) 2013-2015 John Connor (BM-NC49AxAjcqVcF5jNPu85Rb8MJ2d9JqZt)
 *
 * This file is part of vanillacoin.
 *
 * vanillacoin is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Affero General Public License with
 * additional permissions to the one published by the Free Software
 * Foundation, either version 3 of the License, or (at your option)
 * any later version. For more information see LICENSE.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Affero General Public License for more details.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with this program. If not, see <http://www.gnu.org/licenses/>.
 */

#include <coin/data_buffer.hpp>
#include <coin/db_tx.hpp>
#include <coin/globals.hpp>
#include <coin/inventory_vector.hpp>
#include <coin/transaction_pool.hpp>
#include <coin/zerotime.hpp>

using namespace coin;

inventory_vector::inventory_vector()
    : m_type(type_error)
    , m_hash(0)
{
    // ...
}

inventory_vector::inventory_vector(const type_t & type, const sha256 & hash)
    : m_type(type)
    , m_hash(hash)
{
    // ...
}

inventory_vector::inventory_vector(
    const std::string & type, const sha256 & hash
    )
    : m_hash(hash)
{
    auto i  = 1;

    for (
        ; i < sizeof(protocol::inventory_type_names) /
        sizeof(protocol::inventory_type_names[0]); i++
        )
    {
        if (type == protocol::inventory_type_names[i])
        {
            m_type = static_cast<type_t> (i);

            break;
        }
    }

    if (
        i == sizeof(protocol::inventory_type_names) /
        sizeof(protocol::inventory_type_names[0])
        )
    {
        throw std::runtime_error(
            "unkown type (" + type + ")"
        );
    }
}

bool inventory_vector::encode(data_buffer & buffer)
{
    buffer.write_uint32(m_type);
    buffer.write_sha256(m_hash);

    return true;
}

bool inventory_vector::decode(data_buffer & buffer)
{
    m_type = static_cast<type_t> (buffer.read_uint32());
    m_hash = buffer.read_sha256();

    return true;
}

const inventory_vector::type_t & inventory_vector::type() const
{
    return m_type;
}

const sha256 & inventory_vector::hash() const
{
    return m_hash;
}

bool inventory_vector::is_know_type() const
{
    return
        m_type > type_error && m_type <
        static_cast<type_t> (sizeof(protocol::inventory_type_names) /
        sizeof(protocol::inventory_type_names[0]))
    ;
}

const std::string inventory_vector::command() const
{
    if (is_know_type() == false)
    {
        throw std::runtime_error(
            "unkown type (" + std::to_string(m_type) + ")"
        );
    }

    return protocol::inventory_type_names[m_type];
}

const std::string inventory_vector::to_string() const
{
    return
        command() + " " + m_hash.to_string().substr(0, 20)
    ;
}

bool inventory_vector::already_have(
    db_tx & tx_db, const inventory_vector & inv
    )
{
    switch (inv.type())
    {
        case type_error:
        {
            // ...
        }
        break;
        case type_msg_tx:
        {
            auto tx_in_map = transaction_pool::instance().exists(inv.hash());

            return
                tx_in_map ||
                globals::instance().orphan_transactions().count(inv.hash()) ||
                tx_db.contains_transaction(inv.hash()
            );
        }
        break;
        case type_msg_block:
        {
            return
                globals::instance().block_indexes().count(inv.hash()) ||
                globals::instance().orphan_blocks().count(inv.hash())
            ;
        }
        break;
        case type_msg_ztlock:
        {
            return zerotime::instance().locks().count(inv.hash()) > 0;
        }
        break;
        default:
        break;
    }

    return true;
}
<|endoftext|>


<commit_before>/*************************************************************************
 *
 *  $RCSfile: PaneDockingWindow.cxx,v $
 *
 *  $Revision: 1.10 $
 *
 *  last change: $Author: obo $ $Date: 2005-05-02 13:17:56 $
 *
 *  The Contents of this file are made available subject to the terms of
 *  either of the following licenses
 *
 *         - GNU Lesser General Public License Version 2.1
 *         - Sun Industry Standards Source License Version 1.1
 *
 *  Sun Microsystems Inc., October, 2000
 *
 *  GNU Lesser General Public License Version 2.1
 *  =============================================
 *  Copyright 2000 by Sun Microsystems, Inc.
 *  901 San Antonio Road, Palo Alto, CA 94303, USA
 *
 *  This library is free software; you can redistribute it and/or
 *  modify it under the terms of the GNU Lesser General Public
 *  License version 2.1, as published by the Free Software Foundation.
 *
 *  This library is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 *  Lesser General Public License for more details.
 *
 *  You should have received a copy of the GNU Lesser General Public
 *  License along with this library; if not, write to the Free Software
 *  Foundation, Inc., 59 Temple Place, Suite 330, Boston,
 *  MA  02111-1307  USA
 *
 *
 *  Sun Industry Standards Source License Version 1.1
 *  =================================================
 *  The contents of this file are subject to the Sun Industry Standards
 *  Source License Version 1.1 (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.openoffice.org/license.html.
 *
 *  Software provided under this License is provided on an "AS IS" basis,
 *  WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
 *  WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
 *  MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
 *  See the License for the specific provisions governing your rights and
 *  obligations concerning the Software.
 *
 *  The Initial Developer of the Original Code is: Sun Microsystems, Inc.
 *
 *  Copyright: 2000 by Sun Microsystems, Inc.
 *
 *  All Rights Reserved.
 *
 *  Contributor(s): _______________________________________
 *
 *
 ************************************************************************/

#include "PaneDockingWindow.hxx"
#include "ViewShellBase.hxx"
#include "Window.hxx"
#include "sdresid.hxx"
#include "res_bmp.hrc"
#ifndef _SFXDISPATCH_HXX
#include <sfx2/dispatch.hxx>
#endif
#include <vcl/toolbox.hxx>
#ifndef _SV_TASKPANELIST_HXX
#include <vcl/taskpanelist.hxx>
#endif

namespace sd {

PaneDockingWindow::PaneDockingWindow (
    SfxBindings *pBindings,
    SfxChildWindow *pChildWindow,
    ::Window* pParent,
    const ResId& rResId,
    PaneManager::PaneType ePane)
    : SfxDockingWindow (
        pBindings,
        pChildWindow,
        pParent,
        rResId
        ),
      mePane(ePane),
      msTitle(),
      mpTitleToolBox(NULL),
      maBorder (3,1,3,3),
      mnChildWindowId(pChildWindow->GetType())
{
    SetBackground (Wallpaper());

    InitializeTitleToolBox();

    ViewShellBase* pBase = ViewShellBase::GetViewShellBase(
        pBindings->GetDispatcher()->GetFrame());
    if (pBase != NULL)
    {
        msTitle = pBase->GetPaneManager().GetWindowTitle (mePane);
        pBase->GetPaneManager().SetWindow (mePane, this);
    }

    // Tell the system window about the new docking window so that it can be
    // reached via the keyboard.
    SystemWindow* pSystemWindow = GetSystemWindow();
    if (pSystemWindow != NULL)
        pSystemWindow->GetTaskPaneList()->AddWindow(this);

    AddEventListener(LINK(this,PaneDockingWindow,WindowEventListener));
}

PaneDockingWindow::~PaneDockingWindow (void)
{
    RemoveEventListener(LINK(this,PaneDockingWindow,WindowEventListener));

    ViewShellBase* pBase = ViewShellBase::GetViewShellBase(
        GetBindings().GetDispatcher()->GetFrame());

    // Tell the next system window that the docking window is no longer
    // available.
    SystemWindow* pSystemWindow = GetSystemWindow();
    if (pSystemWindow != NULL)
        pSystemWindow->GetTaskPaneList()->RemoveWindow(this);

    // Tell the ViewShellBase that the window of this slide sorter is not
    // available anymore.
    if (pBase != NULL)
        pBase->GetPaneManager().SetWindow (mePane, NULL);
}

void PaneDockingWindow::SetTitle (const String& rsTitle)
{
    msTitle = rsTitle;
    Invalidate();
}

void PaneDockingWindow::Resize (void)
{
    SfxDockingWindow::Resize();
    Size aWindowSize (GetOutputSizePixel());
    Size aToolBoxSize (0,0);
    int nTitleBarHeight (GetSettings().GetStyleSettings().GetTitleHeight());

    // Place the title tool box.
    if (mpTitleToolBox.get() != NULL)
    {
        if (IsFloatingMode())
            mpTitleToolBox->HideItem (1);
        else
            mpTitleToolBox->ShowItem (1);

        aToolBoxSize = mpTitleToolBox->CalcWindowSizePixel();
        if (aToolBoxSize.Height() > nTitleBarHeight)
            nTitleBarHeight = aToolBoxSize.Height();
        mpTitleToolBox->SetPosSizePixel (
            Point(aWindowSize.Width()-aToolBoxSize.Width(),
                (nTitleBarHeight-aToolBoxSize.Height())/2),
            aToolBoxSize);
    }

    // Place the view shell.
    ViewShellBase* pBase (ViewShellBase::GetViewShellBase(
        GetBindings().GetDispatcher()->GetFrame()));
    if (pBase != NULL)
    {
        ViewShell* pViewShell = pBase->GetPaneManager().GetViewShell (mePane);
        if (pViewShell != NULL)
        {
            ::sd::Window* pWindow = pViewShell->GetActiveWindow();
            if (nTitleBarHeight < aToolBoxSize.Height())
                nTitleBarHeight = aToolBoxSize.Height();
            aWindowSize.Height() -= nTitleBarHeight;
            pViewShell->Resize(
                Point(maBorder.Left(),nTitleBarHeight+maBorder.Top()),
                Size (aWindowSize.Width()-maBorder.Left()-maBorder.Right(),
                    aWindowSize.Height()-maBorder.Top()-maBorder.Bottom()));
        }
    }
}

void PaneDockingWindow::Paint (const Rectangle& rRectangle)
{
    SfxDockingWindow::Paint (rRectangle);
    int nTitleBarHeight (GetSettings().GetStyleSettings().GetTitleHeight());
    Size aToolBoxSize = mpTitleToolBox->CalcWindowSizePixel();
    if (aToolBoxSize.Height() > nTitleBarHeight)
        nTitleBarHeight = aToolBoxSize.Height();
    Color aOriginalLineColor (GetLineColor());
    Color aOriginalFillColor (GetFillColor());
    SetFillColor (GetSettings().GetStyleSettings().GetDialogColor());
    SetLineColor ();

    // Make font bold.
    const Font& rOriginalFont (GetFont());
    Font aFont (rOriginalFont);
    aFont.SetWeight (WEIGHT_BOLD);
    SetFont (aFont);

    // Set border values.
    Size aWindowSize (GetOutputSizePixel());
    int nOuterLeft = 0;
    int nInnerLeft = nOuterLeft + maBorder.Left() - 1;
    int nOuterRight = aWindowSize.Width() - 1;
    int nInnerRight = nOuterRight - maBorder.Right() + 1;
    int nInnerTop = nTitleBarHeight + maBorder.Top() - 1;
    int nOuterBottom = aWindowSize.Height() - 1;
    int nInnerBottom = nOuterBottom - maBorder.Bottom() + 1;

    // Paint title bar background.
    Rectangle aTitleBarBox (Rectangle(
        nOuterLeft,
        0,
        nOuterRight,
        nInnerTop-1));
    DrawRect (aTitleBarBox);

    if (nInnerLeft > nOuterLeft)
        DrawRect (
            Rectangle (nOuterLeft, nInnerTop, nInnerLeft, nInnerBottom));
    if (nOuterRight > nInnerRight)
        DrawRect (
            Rectangle (nInnerRight, nInnerTop, nOuterRight, nInnerBottom));
    if (nInnerBottom < nOuterBottom)
        DrawRect (
            Rectangle (nOuterLeft, nInnerBottom, nOuterRight, nOuterBottom));

    // Paint bevel border.
    SetFillColor ();
    SetLineColor (GetSettings().GetStyleSettings().GetShadowColor());
    if (maBorder.Top() > 0)
        DrawLine (
            Point(nInnerLeft,nInnerTop),
            Point(nInnerLeft,nInnerBottom));
    if (maBorder.Left() > 0)
        DrawLine (
            Point(nInnerLeft,nInnerTop),
            Point(nInnerRight,nInnerTop));
    SetLineColor (GetSettings().GetStyleSettings().GetLightColor());
    if (maBorder.Bottom() > 0)
        DrawLine (
            Point(nInnerRight,nInnerBottom),
            Point(nInnerLeft,nInnerBottom));
    if (maBorder.Right() > 0)
        DrawLine (
            Point(nInnerRight,nInnerBottom),
            Point(nInnerRight,nInnerTop));

    // Paint title bar text.
    SetLineColor (GetSettings().GetStyleSettings().GetActiveTextColor());
    SetFillColor ();
    aTitleBarBox.Left() += 3;
    DrawText (aTitleBarBox, msTitle,
        TEXT_DRAW_LEFT
        | TEXT_DRAW_VCENTER
        | TEXT_DRAW_MULTILINE
        | TEXT_DRAW_WORDBREAK);

    // Restore original values of the output device.
    SetFont (rOriginalFont);
    SetFillColor (aOriginalFillColor);
}

void PaneDockingWindow::InitializeTitleToolBox (void)
{
    if (mpTitleToolBox.get() == NULL)
    {
        // Initialize the title tool box.
        mpTitleToolBox.reset (new ToolBox(this));
        mpTitleToolBox->SetSelectHdl (
            LINK(this, PaneDockingWindow, ToolboxSelectHandler));
        mpTitleToolBox->SetOutStyle (TOOLBOX_STYLE_FLAT);
        mpTitleToolBox->SetBackground (Wallpaper (
            GetSettings().GetStyleSettings().GetDialogColor()));
        mpTitleToolBox->Show();
    }
    else
        mpTitleToolBox->Clear();

    // Get the closer bitmap and set it as right most button.
    Bitmap aBitmap (SdResId (BMP_CLOSE_DOC));
    Bitmap aBitmapHC (SdResId (BMP_CLOSE_DOC_H));
    Image aImage = Image (aBitmap, Color (COL_LIGHTMAGENTA));
    Image aImageHC = Image (aBitmapHC, Color (BMP_COLOR_HIGHCONTRAST));
    mpTitleToolBox->InsertItem (1,
        GetSettings().GetStyleSettings().GetMenuBarColor().IsDark()
        ? aImageHC
        : aImage);
    mpTitleToolBox->ShowItem (1);
}

USHORT PaneDockingWindow::AddMenu (
    const String& rsMenuName,
    ULONG nHelpId,
    const Link& rCallback)
{
    // Add the menu before the closer button.
    int nItemCount (mpTitleToolBox->GetItemCount());
    USHORT nItemId = nItemCount+1;
    mpTitleToolBox->InsertItem (
        nItemId,
        rsMenuName,
        TIB_DROPDOWNONLY,
        nItemCount-1);
    mpTitleToolBox->SetHelpId( nItemId, nHelpId );
    mpTitleToolBox->SetClickHdl (rCallback);
    mpTitleToolBox->SetDropdownClickHdl (rCallback);

    return nItemCount+1;
}

IMPL_LINK(PaneDockingWindow, ToolboxSelectHandler, ToolBox*, pToolBox)
{
    USHORT nId = pToolBox->GetCurItemId();

    if (nId == 1)
    {
        EndTracking();
        SfxBoolItem aVisibility (mnChildWindowId, FALSE);
        GetBindings().GetDispatcher()->Execute (
            mnChildWindowId,
            SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD,
            &aVisibility,
            NULL);
    }

    return 0;
}

long PaneDockingWindow::Notify( NotifyEvent& rNEvt )
{
    return SfxDockingWindow::Notify (rNEvt);
}

void PaneDockingWindow::StateChanged( StateChangedType nType )
{
    switch (nType)
    {
        case STATE_CHANGE_INITSHOW:
            Resize();
            break;
    }
    SfxDockingWindow::StateChanged (nType);
}

void PaneDockingWindow::DataChanged (const DataChangedEvent& rEvent)
{
    SfxDockingWindow::DataChanged (rEvent);

    switch (rEvent.GetType())
    {
        case DATACHANGED_SETTINGS:
            if ((rEvent.GetFlags() & SETTINGS_STYLE) == NULL)
                break;
            // else fall through.
        case DATACHANGED_FONTS:
        case DATACHANGED_FONTSUBSTITUTION:
        {
            const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();

            // Font.
            Font aFont = rStyleSettings.GetAppFont();
            if (IsControlFont())
                aFont.Merge(GetControlFont());
            SetZoomedPointFont(aFont);

            // Color.
            Color aColor;
            if (IsControlForeground())
                aColor = GetControlForeground();
            else
                aColor = rStyleSettings.GetButtonTextColor();
            SetTextColor(aColor);
            SetTextFillColor();

            Resize();
            Invalidate();
        }
        break;
    }
}

IMPL_LINK(PaneDockingWindow, WindowEventListener, VclSimpleEvent*, pEvent)
{
    if (pEvent!=NULL && pEvent->ISA(VclWindowEvent))
    {
        ViewShellBase* pBase = ViewShellBase::GetViewShellBase(
            GetBindings().GetDispatcher()->GetFrame());

        VclWindowEvent* pWindowEvent = static_cast<VclWindowEvent*>(pEvent);
        switch (pWindowEvent->GetId())
        {
            case VCLEVENT_WINDOW_SHOW:
                if (pBase != NULL)
                    pBase->GetPaneManager().RequestWindowVisibilityChange(
                        mePane,
                        true,
                        PaneManager::CM_ASYNCHRONOUS);
                break;

            case VCLEVENT_WINDOW_HIDE:
                if (pBase != NULL)
                    pBase->GetPaneManager().RequestWindowVisibilityChange(
                        mePane,
                        false,
                        PaneManager::CM_ASYNCHRONOUS);
                break;
        }
    }
    return 1;
}

} // end of namespace ::sd
<commit_msg>INTEGRATION: CWS ooo19126 (1.10.118); FILE MERGED 2005/09/05 13:21:37 rt 1.10.118.1: #i54170# Change license header: remove SISSL<commit_after>/*************************************************************************
 *
 *  OpenOffice.org - a multi-platform office productivity suite
 *
 *  $RCSfile: PaneDockingWindow.cxx,v $
 *
 *  $Revision: 1.11 $
 *
 *  last change: $Author: rt $ $Date: 2005-09-09 03:49:47 $
 *
 *  The Contents of this file are made available subject to
 *  the terms of GNU Lesser General Public License Version 2.1.
 *
 *
 *    GNU Lesser General Public License Version 2.1
 *    =============================================
 *    Copyright 2005 by Sun Microsystems, Inc.
 *    901 San Antonio Road, Palo Alto, CA 94303, USA
 *
 *    This library is free software; you can redistribute it and/or
 *    modify it under the terms of the GNU Lesser General Public
 *    License version 2.1, as published by the Free Software Foundation.
 *
 *    This library is distributed in the hope that it will be useful,
 *    but WITHOUT ANY WARRANTY; without even the implied warranty of
 *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 *    Lesser General Public License for more details.
 *
 *    You should have received a copy of the GNU Lesser General Public
 *    License along with this library; if not, write to the Free Software
 *    Foundation, Inc., 59 Temple Place, Suite 330, Boston,
 *    MA  02111-1307  USA
 *
 ************************************************************************/

#include "PaneDockingWindow.hxx"
#include "ViewShellBase.hxx"
#include "Window.hxx"
#include "sdresid.hxx"
#include "res_bmp.hrc"
#ifndef _SFXDISPATCH_HXX
#include <sfx2/dispatch.hxx>
#endif
#include <vcl/toolbox.hxx>
#ifndef _SV_TASKPANELIST_HXX
#include <vcl/taskpanelist.hxx>
#endif

namespace sd {

PaneDockingWindow::PaneDockingWindow (
    SfxBindings *pBindings,
    SfxChildWindow *pChildWindow,
    ::Window* pParent,
    const ResId& rResId,
    PaneManager::PaneType ePane)
    : SfxDockingWindow (
        pBindings,
        pChildWindow,
        pParent,
        rResId
        ),
      mePane(ePane),
      msTitle(),
      mpTitleToolBox(NULL),
      maBorder (3,1,3,3),
      mnChildWindowId(pChildWindow->GetType())
{
    SetBackground (Wallpaper());

    InitializeTitleToolBox();

    ViewShellBase* pBase = ViewShellBase::GetViewShellBase(
        pBindings->GetDispatcher()->GetFrame());
    if (pBase != NULL)
    {
        msTitle = pBase->GetPaneManager().GetWindowTitle (mePane);
        pBase->GetPaneManager().SetWindow (mePane, this);
    }

    // Tell the system window about the new docking window so that it can be
    // reached via the keyboard.
    SystemWindow* pSystemWindow = GetSystemWindow();
    if (pSystemWindow != NULL)
        pSystemWindow->GetTaskPaneList()->AddWindow(this);

    AddEventListener(LINK(this,PaneDockingWindow,WindowEventListener));
}

PaneDockingWindow::~PaneDockingWindow (void)
{
    RemoveEventListener(LINK(this,PaneDockingWindow,WindowEventListener));

    ViewShellBase* pBase = ViewShellBase::GetViewShellBase(
        GetBindings().GetDispatcher()->GetFrame());

    // Tell the next system window that the docking window is no longer
    // available.
    SystemWindow* pSystemWindow = GetSystemWindow();
    if (pSystemWindow != NULL)
        pSystemWindow->GetTaskPaneList()->RemoveWindow(this);

    // Tell the ViewShellBase that the window of this slide sorter is not
    // available anymore.
    if (pBase != NULL)
        pBase->GetPaneManager().SetWindow (mePane, NULL);
}

void PaneDockingWindow::SetTitle (const String& rsTitle)
{
    msTitle = rsTitle;
    Invalidate();
}

void PaneDockingWindow::Resize (void)
{
    SfxDockingWindow::Resize();
    Size aWindowSize (GetOutputSizePixel());
    Size aToolBoxSize (0,0);
    int nTitleBarHeight (GetSettings().GetStyleSettings().GetTitleHeight());

    // Place the title tool box.
    if (mpTitleToolBox.get() != NULL)
    {
        if (IsFloatingMode())
            mpTitleToolBox->HideItem (1);
        else
            mpTitleToolBox->ShowItem (1);

        aToolBoxSize = mpTitleToolBox->CalcWindowSizePixel();
        if (aToolBoxSize.Height() > nTitleBarHeight)
            nTitleBarHeight = aToolBoxSize.Height();
        mpTitleToolBox->SetPosSizePixel (
            Point(aWindowSize.Width()-aToolBoxSize.Width(),
                (nTitleBarHeight-aToolBoxSize.Height())/2),
            aToolBoxSize);
    }

    // Place the view shell.
    ViewShellBase* pBase (ViewShellBase::GetViewShellBase(
        GetBindings().GetDispatcher()->GetFrame()));
    if (pBase != NULL)
    {
        ViewShell* pViewShell = pBase->GetPaneManager().GetViewShell (mePane);
        if (pViewShell != NULL)
        {
            ::sd::Window* pWindow = pViewShell->GetActiveWindow();
            if (nTitleBarHeight < aToolBoxSize.Height())
                nTitleBarHeight = aToolBoxSize.Height();
            aWindowSize.Height() -= nTitleBarHeight;
            pViewShell->Resize(
                Point(maBorder.Left(),nTitleBarHeight+maBorder.Top()),
                Size (aWindowSize.Width()-maBorder.Left()-maBorder.Right(),
                    aWindowSize.Height()-maBorder.Top()-maBorder.Bottom()));
        }
    }
}

void PaneDockingWindow::Paint (const Rectangle& rRectangle)
{
    SfxDockingWindow::Paint (rRectangle);
    int nTitleBarHeight (GetSettings().GetStyleSettings().GetTitleHeight());
    Size aToolBoxSize = mpTitleToolBox->CalcWindowSizePixel();
    if (aToolBoxSize.Height() > nTitleBarHeight)
        nTitleBarHeight = aToolBoxSize.Height();
    Color aOriginalLineColor (GetLineColor());
    Color aOriginalFillColor (GetFillColor());
    SetFillColor (GetSettings().GetStyleSettings().GetDialogColor());
    SetLineColor ();

    // Make font bold.
    const Font& rOriginalFont (GetFont());
    Font aFont (rOriginalFont);
    aFont.SetWeight (WEIGHT_BOLD);
    SetFont (aFont);

    // Set border values.
    Size aWindowSize (GetOutputSizePixel());
    int nOuterLeft = 0;
    int nInnerLeft = nOuterLeft + maBorder.Left() - 1;
    int nOuterRight = aWindowSize.Width() - 1;
    int nInnerRight = nOuterRight - maBorder.Right() + 1;
    int nInnerTop = nTitleBarHeight + maBorder.Top() - 1;
    int nOuterBottom = aWindowSize.Height() - 1;
    int nInnerBottom = nOuterBottom - maBorder.Bottom() + 1;

    // Paint title bar background.
    Rectangle aTitleBarBox (Rectangle(
        nOuterLeft,
        0,
        nOuterRight,
        nInnerTop-1));
    DrawRect (aTitleBarBox);

    if (nInnerLeft > nOuterLeft)
        DrawRect (
            Rectangle (nOuterLeft, nInnerTop, nInnerLeft, nInnerBottom));
    if (nOuterRight > nInnerRight)
        DrawRect (
            Rectangle (nInnerRight, nInnerTop, nOuterRight, nInnerBottom));
    if (nInnerBottom < nOuterBottom)
        DrawRect (
            Rectangle (nOuterLeft, nInnerBottom, nOuterRight, nOuterBottom));

    // Paint bevel border.
    SetFillColor ();
    SetLineColor (GetSettings().GetStyleSettings().GetShadowColor());
    if (maBorder.Top() > 0)
        DrawLine (
            Point(nInnerLeft,nInnerTop),
            Point(nInnerLeft,nInnerBottom));
    if (maBorder.Left() > 0)
        DrawLine (
            Point(nInnerLeft,nInnerTop),
            Point(nInnerRight,nInnerTop));
    SetLineColor (GetSettings().GetStyleSettings().GetLightColor());
    if (maBorder.Bottom() > 0)
        DrawLine (
            Point(nInnerRight,nInnerBottom),
            Point(nInnerLeft,nInnerBottom));
    if (maBorder.Right() > 0)
        DrawLine (
            Point(nInnerRight,nInnerBottom),
            Point(nInnerRight,nInnerTop));

    // Paint title bar text.
    SetLineColor (GetSettings().GetStyleSettings().GetActiveTextColor());
    SetFillColor ();
    aTitleBarBox.Left() += 3;
    DrawText (aTitleBarBox, msTitle,
        TEXT_DRAW_LEFT
        | TEXT_DRAW_VCENTER
        | TEXT_DRAW_MULTILINE
        | TEXT_DRAW_WORDBREAK);

    // Restore original values of the output device.
    SetFont (rOriginalFont);
    SetFillColor (aOriginalFillColor);
}

void PaneDockingWindow::InitializeTitleToolBox (void)
{
    if (mpTitleToolBox.get() == NULL)
    {
        // Initialize the title tool box.
        mpTitleToolBox.reset (new ToolBox(this));
        mpTitleToolBox->SetSelectHdl (
            LINK(this, PaneDockingWindow, ToolboxSelectHandler));
        mpTitleToolBox->SetOutStyle (TOOLBOX_STYLE_FLAT);
        mpTitleToolBox->SetBackground (Wallpaper (
            GetSettings().GetStyleSettings().GetDialogColor()));
        mpTitleToolBox->Show();
    }
    else
        mpTitleToolBox->Clear();

    // Get the closer bitmap and set it as right most button.
    Bitmap aBitmap (SdResId (BMP_CLOSE_DOC));
    Bitmap aBitmapHC (SdResId (BMP_CLOSE_DOC_H));
    Image aImage = Image (aBitmap, Color (COL_LIGHTMAGENTA));
    Image aImageHC = Image (aBitmapHC, Color (BMP_COLOR_HIGHCONTRAST));
    mpTitleToolBox->InsertItem (1,
        GetSettings().GetStyleSettings().GetMenuBarColor().IsDark()
        ? aImageHC
        : aImage);
    mpTitleToolBox->ShowItem (1);
}

USHORT PaneDockingWindow::AddMenu (
    const String& rsMenuName,
    ULONG nHelpId,
    const Link& rCallback)
{
    // Add the menu before the closer button.
    int nItemCount (mpTitleToolBox->GetItemCount());
    USHORT nItemId = nItemCount+1;
    mpTitleToolBox->InsertItem (
        nItemId,
        rsMenuName,
        TIB_DROPDOWNONLY,
        nItemCount-1);
    mpTitleToolBox->SetHelpId( nItemId, nHelpId );
    mpTitleToolBox->SetClickHdl (rCallback);
    mpTitleToolBox->SetDropdownClickHdl (rCallback);

    return nItemCount+1;
}

IMPL_LINK(PaneDockingWindow, ToolboxSelectHandler, ToolBox*, pToolBox)
{
    USHORT nId = pToolBox->GetCurItemId();

    if (nId == 1)
    {
        EndTracking();
        SfxBoolItem aVisibility (mnChildWindowId, FALSE);
        GetBindings().GetDispatcher()->Execute (
            mnChildWindowId,
            SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD,
            &aVisibility,
            NULL);
    }

    return 0;
}

long PaneDockingWindow::Notify( NotifyEvent& rNEvt )
{
    return SfxDockingWindow::Notify (rNEvt);
}

void PaneDockingWindow::StateChanged( StateChangedType nType )
{
    switch (nType)
    {
        case STATE_CHANGE_INITSHOW:
            Resize();
            break;
    }
    SfxDockingWindow::StateChanged (nType);
}

void PaneDockingWindow::DataChanged (const DataChangedEvent& rEvent)
{
    SfxDockingWindow::DataChanged (rEvent);

    switch (rEvent.GetType())
    {
        case DATACHANGED_SETTINGS:
            if ((rEvent.GetFlags() & SETTINGS_STYLE) == NULL)
                break;
            // else fall through.
        case DATACHANGED_FONTS:
        case DATACHANGED_FONTSUBSTITUTION:
        {
            const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();

            // Font.
            Font aFont = rStyleSettings.GetAppFont();
            if (IsControlFont())
                aFont.Merge(GetControlFont());
            SetZoomedPointFont(aFont);

            // Color.
            Color aColor;
            if (IsControlForeground())
                aColor = GetControlForeground();
            else
                aColor = rStyleSettings.GetButtonTextColor();
            SetTextColor(aColor);
            SetTextFillColor();

            Resize();
            Invalidate();
        }
        break;
    }
}

IMPL_LINK(PaneDockingWindow, WindowEventListener, VclSimpleEvent*, pEvent)
{
    if (pEvent!=NULL && pEvent->ISA(VclWindowEvent))
    {
        ViewShellBase* pBase = ViewShellBase::GetViewShellBase(
            GetBindings().GetDispatcher()->GetFrame());

        VclWindowEvent* pWindowEvent = static_cast<VclWindowEvent*>(pEvent);
        switch (pWindowEvent->GetId())
        {
            case VCLEVENT_WINDOW_SHOW:
                if (pBase != NULL)
                    pBase->GetPaneManager().RequestWindowVisibilityChange(
                        mePane,
                        true,
                        PaneManager::CM_ASYNCHRONOUS);
                break;

            case VCLEVENT_WINDOW_HIDE:
                if (pBase != NULL)
                    pBase->GetPaneManager().RequestWindowVisibilityChange(
                        mePane,
                        false,
                        PaneManager::CM_ASYNCHRONOUS);
                break;
        }
    }
    return 1;
}

} // end of namespace ::sd
<|endoftext|>


<commit_before>/*
===========================================================================
Copyright (C) 2011 Matthias Bentrup <matthias.bentrup@googlemail.com>

This file is part of Daemon source code.

Daemon source code is free software; you can redistribute it
and/or modify it under the terms of the GNU General Public License as
published by the Free Software Foundation; either version 2 of the License,
or (at your option) any later version.

Daemon source code is distributed in the hope that it will be
useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with Daemon source code; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
===========================================================================
*/
// tr_image.c
#include "tr_local.h"
#include <webp/decode.h>

/*
=========================================================

LoadWEBP

=========================================================
*/

void LoadWEBP( const char *filename, unsigned char **pic, int *width, int *height,
	       int*, int*, int*, byte )
{
	byte *out;
	int  len;
	int  stride;
	int  size;
	union
	{
		byte *b;
		void *v;
	} fbuffer;

	/* read compressed data */
	len = ri.FS_ReadFile( ( char * ) filename, &fbuffer.v );

	if ( !fbuffer.b || len < 0 )
	{
		return;
	}

	/* validate data and query image size */
	if ( !WebPGetInfo( fbuffer.b, len, width, height ) )
	{
		ri.FS_FreeFile( fbuffer.v );
		return;
	}

	stride = *width * sizeof( u8vec4_t );
	size = *height * stride;

	out = (byte*) ri.Z_Malloc( size );

	if ( !WebPDecodeRGBAInto( fbuffer.b, len, out, size, stride ) )
	{
		ri.Free( out );
		return;
	}

	ri.FS_FreeFile( fbuffer.v );
	*pic = out;
}
<commit_msg>Stop using a union in LoadWEBP<commit_after>/*
===========================================================================
Copyright (C) 2011 Matthias Bentrup <matthias.bentrup@googlemail.com>

This file is part of Daemon source code.

Daemon source code is free software; you can redistribute it
and/or modify it under the terms of the GNU General Public License as
published by the Free Software Foundation; either version 2 of the License,
or (at your option) any later version.

Daemon source code is distributed in the hope that it will be
useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with Daemon source code; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
===========================================================================
*/
// tr_image.c
#include "tr_local.h"
#include <webp/decode.h>

/*
=========================================================

LoadWEBP

=========================================================
*/

void LoadWEBP( const char *filename, unsigned char **pic, int *width, int *height,
	       int*, int*, int*, byte )
{
	byte *out;
	int  len;
	int  stride;
	int  size;
	void* filebuf;

	/* read compressed data */
	len = ri.FS_ReadFile( filename, &filebuf );

	if ( !filebuf || len < 0 )
	{
		return;
	}

	/* validate data and query image size */
	if ( !WebPGetInfo( static_cast<const uint8_t*>(filebuf), len, width, height ) )
	{
		ri.FS_FreeFile( filebuf );
		return;
	}

	stride = *width * sizeof( u8vec4_t );
	size = *height * stride;

	out = (byte*) ri.Z_Malloc( size );

	if ( !WebPDecodeRGBAInto( static_cast<const uint8_t*>(filebuf), len, out, size, stride ) )
	{
		ri.Free( out );
		return;
	}

	ri.FS_FreeFile( filebuf );
	*pic = out;
}
<|endoftext|>


<commit_before>/*
 * ModuleClassRegistry.cpp
 * Copyright (C) 2008 - 2015 by MegaMol Consortium
 * All rights reserved. Alle Rechte vorbehalten.
 */

#include "stdafx.h"
#include "factories/ModuleClassRegistry.h"

#include "mmcore/factories/ModuleDescriptionManager.h"
#include "mmcore/factories/LoaderADModuleAutoDescription.h"
#include "mmcore/factories/ModuleAutoDescription.h"
#include "mmcore/factories/ModuleDescription.h"

#include "mmcore/cluster/ClusterController.h"
#include "mmcore/cluster/ClusterViewMaster.h"
#include "mmcore/cluster/PowerwallView.h"
#include "mmcore/cluster/mpi/MpiProvider.h"
#include "mmcore/cluster/mpi/View.h"
#include "mmcore/cluster/simple/Client.h"
#include "mmcore/cluster/simple/Heartbeat.h"
#include "mmcore/cluster/simple/Server.h"
#include "mmcore/cluster/simple/View.h"
#include "mmcore/misc/ImageViewer.h"
#include "mmcore/misc/LinesRenderer.h"
#include "mmcore/misc/SiffCSplineFitter.h"
#include "mmcore/misc/TestSpheresDataSource.h"
#include "mmcore/moldyn/AddParticleColours.h"
#include "mmcore/moldyn/ArrowRenderer.h"
#include "mmcore/moldyn/DataGridder.h"
#include "mmcore/moldyn/GrimRenderer.h"
#include "mmcore/moldyn/MipDepthSphereRenderer.h"
#include "mmcore/moldyn/MMPGDDataSource.h"
#include "mmcore/moldyn/MMPGDWriter.h"
#include "mmcore/moldyn/MMPLDDataSource.h"
#include "mmcore/moldyn/MMPLDWriter.h"
#include "mmcore/moldyn/OracleSphereRenderer.h"
#include "mmcore/moldyn/SimpleGeoSphereRenderer.h"
#include "mmcore/moldyn/SimpleSphereRenderer.h"
#include "mmcore/moldyn/ClusteredSphereRenderer.h"
#include "mmcore/moldyn/SphereOutlineRenderer.h"
#include "mmcore/moldyn/DirPartColModulate.h"
#include "mmcore/moldyn/DirPartFilter.h"
#include "mmcore/moldyn/ParticleListFilter.h"
#include "mmcore/moldyn/ParticleWorker.h"
#ifdef MEGAMOLCORE_WITH_DIRECT3D11
#include "mmcore/moldyn/D3D11SimpleSphereRenderer.h"
#endif /* MEGAMOLCORE_WITH_DIRECT3D11 */
//#include "mmcore/special/ColStereoDisplay.h"
#include "mmcore/view/ClipPlane.h"
#include "mmcore/view/LinearTransferFunction.h"
#include "mmcore/view/TransferFunctionRenderer.h"
#include "mmcore/view/MuxRenderer3D.h"
#include "mmcore/view/special/AnaglyphStereoView.h"
#include "mmcore/view/special/ChronoGraph.h"
#include "mmcore/view/special/DemoRenderer2D.h"
#include "mmcore/view/special/QuadBufferStereoView.h"
#include "mmcore/view/special/ScreenShooter.h"
#include "mmcore/view/SwitchRenderer3D.h"
#include "mmcore/view/TileView.h"
#include "mmcore/view/View2D.h"
#include "mmcore/view/View3D.h"
#ifdef MEGAMOLCORE_WITH_DIRECT3D11
#include "mmcore/view/ViewDirect3D.h"
#endif /* MEGAMOLCORE_WITH_DIRECT3D11 */
#include "mmcore/view/BlinnPhongRendererDeferred.h"
#include "mmcore/view/SplitView.h"
#include "mmcore/view/SharedCameraParameters.h"
#include "mmcore/view/LinkedView3D.h"
#include "mmcore/job/DataWriterJob.h"
#include "mmcore/job/JobThread.h"
//#include "mmcore/vismol2/Mol20DataSource.h"
//#include "mmcore/vismol2/Mol20Renderer.h"
#include "mmcore/moldyn/VolumeDataCall.h"
#include "mmcore/moldyn/VTFDataSource.h"
#include "mmcore/moldyn/VTFResDataSource.h"
#include "mmcore/moldyn/AddClusterColours.h"
#include "mmcore/moldyn/DynDensityGradientEstimator.h"

using namespace megamol::core;

/*
 * factories::register_module_classes
 */
void factories::register_module_classes(factories::ModuleDescriptionManager& instance) {

    //////////////////////////////////////////////////////////////////////
    // Register all rendering graph module descriptions here
    //////////////////////////////////////////////////////////////////////

    instance.RegisterAutoDescription<cluster::ClusterController>();
    instance.RegisterAutoDescription<cluster::ClusterViewMaster>();
    instance.RegisterAutoDescription<cluster::PowerwallView>();
    instance.RegisterAutoDescription<cluster::simple::Client>();
    instance.RegisterAutoDescription<cluster::simple::Heartbeat>();
    instance.RegisterAutoDescription<cluster::simple::Server>();
    instance.RegisterAutoDescription<cluster::simple::View>();
    instance.RegisterAutoDescription<cluster::mpi::MpiProvider>();
    instance.RegisterAutoDescription<cluster::mpi::View>();
    instance.RegisterAutoDescription<misc::ImageViewer>();
    instance.RegisterAutoDescription<misc::LinesRenderer>();
    instance.RegisterAutoDescription<misc::SiffCSplineFitter>();
    instance.RegisterAutoDescription<misc::TestSpheresDataSource>();
    instance.RegisterAutoDescription<moldyn::AddParticleColours>();
    instance.RegisterAutoDescription<moldyn::ArrowRenderer>();
    instance.RegisterAutoDescription<moldyn::DataGridder>();
    instance.RegisterAutoDescription<moldyn::GrimRenderer>();
    instance.RegisterAutoDescription<moldyn::MipDepthSphereRenderer>();
    instance.RegisterAutoDescription<moldyn::MMPGDDataSource>();
    instance.RegisterAutoDescription<moldyn::MMPGDWriter>();
    instance.RegisterAutoDescription<moldyn::MMPLDDataSource>();
    instance.RegisterAutoDescription<moldyn::MMPLDWriter>();
    instance.RegisterAutoDescription<moldyn::SimpleGeoSphereRenderer>();
    instance.RegisterAutoDescription<moldyn::SimpleSphereRenderer>();
    instance.RegisterAutoDescription<moldyn::ClusteredSphereRenderer>();
    instance.RegisterAutoDescription<moldyn::SphereOutlineRenderer>();
    instance.RegisterAutoDescription<moldyn::OracleSphereRenderer>();
    instance.RegisterAutoDescription<moldyn::DirPartColModulate>();
    instance.RegisterAutoDescription<moldyn::ParticleListFilter>();
    instance.RegisterAutoDescription<moldyn::ParticleWorker>();
    instance.RegisterAutoDescription<moldyn::DirPartFilter>();
    //instance.RegisterAutoDescription<special::ColStereoDisplay>();
    instance.RegisterAutoDescription<view::ClipPlane>();
    instance.RegisterAutoDescription<view::LinearTransferFunction>();
    instance.RegisterAutoDescription<view::TransferFunctionRenderer>();
    instance.RegisterAutoDescription<view::MuxRenderer3D<2> >();
    instance.RegisterAutoDescription<view::MuxRenderer3D<3> >();
    instance.RegisterAutoDescription<view::MuxRenderer3D<4> >();
    instance.RegisterAutoDescription<view::MuxRenderer3D<5> >();
    instance.RegisterAutoDescription<view::MuxRenderer3D<10> >();
    instance.RegisterAutoDescription<view::special::AnaglyphStereoView>();
    instance.RegisterAutoDescription<view::special::ChronoGraph>();
    instance.RegisterAutoDescription<view::special::DemoRenderer2D>();
    instance.RegisterAutoDescription<view::special::QuadBufferStereoView>();
    instance.RegisterAutoDescription<view::special::ScreenShooter>();
    instance.RegisterAutoDescription<view::SwitchRenderer3D>();
    instance.RegisterAutoDescription<view::TileView>();
    instance.RegisterAutoDescription<view::View2D>();
    instance.RegisterAutoDescription<view::View3D>();
#ifdef MEGAMOLCORE_WITH_DIRECT3D11
    instance.RegisterAutoDescription<view::ViewDirect3D>();
#endif /* MEGAMOLCORE_WITH_DIRECT3D11 */
    instance.RegisterAutoDescription<view::BlinnPhongRendererDeferred>();
    instance.RegisterAutoDescription<view::SplitView>();
    instance.RegisterAutoDescription<view::SharedCameraParameters>();
    instance.RegisterAutoDescription<view::LinkedView3D>();
    //instance.RegisterAutoDescription<vismol2::Mol20Renderer>();
    //instance.RegisterAutoDescription<vismol2::Mol20DataSource>();
    instance.RegisterAutoDescription<job::DataWriterJob>();
    instance.RegisterAutoDescription<job::JobThread>();
    instance.RegisterAutoDescription<moldyn::VTFDataSource>();
    instance.RegisterAutoDescription<moldyn::VTFResDataSource>();
#ifdef MEGAMOLCORE_WITH_DIRECT3D11
    instance.RegisterAutoDescription<moldyn::D3D11SimpleSphereRenderer>();
#endif /* MEGAMOLCORE_WITH_DIRECT3D11 */
    instance.RegisterAutoDescription<moldyn::AddClusterColours>();
    instance.RegisterAutoDescription<moldyn::DynDensityGradientEstimator>();

}
<commit_msg>factories/ModuleClassRegistry fixed<commit_after>/*
 * ModuleClassRegistry.cpp
 * Copyright (C) 2008 - 2015 by MegaMol Consortium
 * All rights reserved. Alle Rechte vorbehalten.
 */

#include "stdafx.h"
#include "factories/ModuleClassRegistry.h"

#include "mmcore/factories/ModuleDescriptionManager.h"
#include "mmcore/factories/LoaderADModuleAutoDescription.h"
#include "mmcore/factories/ModuleAutoDescription.h"
#include "mmcore/factories/ModuleDescription.h"

#include "mmcore/cluster/ClusterController.h"
#include "mmcore/cluster/ClusterViewMaster.h"
#include "mmcore/cluster/PowerwallView.h"
#include "mmcore/cluster/mpi/MpiProvider.h"
#include "mmcore/cluster/mpi/View.h"
#include "mmcore/cluster/simple/Client.h"
#include "mmcore/cluster/simple/Heartbeat.h"
#include "mmcore/cluster/simple/Server.h"
#include "mmcore/cluster/simple/View.h"
#include "mmcore/misc/ImageViewer.h"
#include "mmcore/misc/LinesRenderer.h"
#include "mmcore/misc/SiffCSplineFitter.h"
#include "mmcore/misc/TestSpheresDataSource.h"
#include "mmcore/moldyn/AddParticleColours.h"
#include "mmcore/moldyn/ArrowRenderer.h"
#include "mmcore/moldyn/DataGridder.h"
#include "mmcore/moldyn/GrimRenderer.h"
#include "mmcore/moldyn/MipDepthSphereRenderer.h"
#include "mmcore/moldyn/MMPGDDataSource.h"
#include "mmcore/moldyn/MMPGDWriter.h"
#include "mmcore/moldyn/MMPLDDataSource.h"
#include "mmcore/moldyn/MMPLDWriter.h"
#include "mmcore/moldyn/OracleSphereRenderer.h"
#include "mmcore/moldyn/SimpleGeoSphereRenderer.h"
#include "mmcore/moldyn/SimpleSphereRenderer.h"
#include "mmcore/moldyn/ClusteredSphereRenderer.h"
#include "mmcore/moldyn/SphereOutlineRenderer.h"
#include "mmcore/moldyn/DirPartColModulate.h"
#include "mmcore/moldyn/DirPartFilter.h"
#include "mmcore/moldyn/ParticleListFilter.h"
//#include "mmcore/special/ColStereoDisplay.h"
#include "mmcore/view/ClipPlane.h"
#include "mmcore/view/LinearTransferFunction.h"
#include "mmcore/view/TransferFunctionRenderer.h"
#include "mmcore/view/MuxRenderer3D.h"
#include "mmcore/view/special/AnaglyphStereoView.h"
#include "mmcore/view/special/ChronoGraph.h"
#include "mmcore/view/special/DemoRenderer2D.h"
#include "mmcore/view/special/QuadBufferStereoView.h"
#include "mmcore/view/special/ScreenShooter.h"
#include "mmcore/view/SwitchRenderer3D.h"
#include "mmcore/view/TileView.h"
#include "mmcore/view/View2D.h"
#include "mmcore/view/View3D.h"
#ifdef MEGAMOLCORE_WITH_DIRECT3D11
#include "mmcore/view/ViewDirect3D.h"
#include "mmcore/moldyn/D3D11SimpleSphereRenderer.h"
#endif /* MEGAMOLCORE_WITH_DIRECT3D11 */
#include "mmcore/view/BlinnPhongRendererDeferred.h"
#include "mmcore/view/SplitView.h"
#include "mmcore/view/SharedCameraParameters.h"
#include "mmcore/view/LinkedView3D.h"
#include "mmcore/job/DataWriterJob.h"
#include "mmcore/job/JobThread.h"
//#include "mmcore/vismol2/Mol20DataSource.h"
//#include "mmcore/vismol2/Mol20Renderer.h"
#include "mmcore/moldyn/VolumeDataCall.h"
#include "mmcore/moldyn/AddClusterColours.h"
#include "mmcore/moldyn/DynDensityGradientEstimator.h"

using namespace megamol::core;

/*
 * factories::register_module_classes
 */
void factories::register_module_classes(factories::ModuleDescriptionManager& instance) {

    //////////////////////////////////////////////////////////////////////
    // Register all rendering graph module descriptions here
    //////////////////////////////////////////////////////////////////////

    instance.RegisterAutoDescription<cluster::ClusterController>();
    instance.RegisterAutoDescription<cluster::ClusterViewMaster>();
    instance.RegisterAutoDescription<cluster::PowerwallView>();
    instance.RegisterAutoDescription<cluster::simple::Client>();
    instance.RegisterAutoDescription<cluster::simple::Heartbeat>();
    instance.RegisterAutoDescription<cluster::simple::Server>();
    instance.RegisterAutoDescription<cluster::simple::View>();
    instance.RegisterAutoDescription<cluster::mpi::MpiProvider>();
    instance.RegisterAutoDescription<cluster::mpi::View>();
    instance.RegisterAutoDescription<misc::ImageViewer>();
    instance.RegisterAutoDescription<misc::LinesRenderer>();
    instance.RegisterAutoDescription<misc::SiffCSplineFitter>();
    instance.RegisterAutoDescription<misc::TestSpheresDataSource>();
    instance.RegisterAutoDescription<moldyn::AddParticleColours>();
    instance.RegisterAutoDescription<moldyn::ArrowRenderer>();
    instance.RegisterAutoDescription<moldyn::DataGridder>();
    instance.RegisterAutoDescription<moldyn::GrimRenderer>();
    instance.RegisterAutoDescription<moldyn::MipDepthSphereRenderer>();
    instance.RegisterAutoDescription<moldyn::MMPGDDataSource>();
    instance.RegisterAutoDescription<moldyn::MMPGDWriter>();
    instance.RegisterAutoDescription<moldyn::MMPLDDataSource>();
    instance.RegisterAutoDescription<moldyn::MMPLDWriter>();
    instance.RegisterAutoDescription<moldyn::SimpleGeoSphereRenderer>();
    instance.RegisterAutoDescription<moldyn::SimpleSphereRenderer>();
    instance.RegisterAutoDescription<moldyn::ClusteredSphereRenderer>();
    instance.RegisterAutoDescription<moldyn::SphereOutlineRenderer>();
    instance.RegisterAutoDescription<moldyn::OracleSphereRenderer>();
    instance.RegisterAutoDescription<moldyn::DirPartColModulate>();
    instance.RegisterAutoDescription<moldyn::ParticleListFilter>();
    instance.RegisterAutoDescription<moldyn::DirPartFilter>();
    //instance.RegisterAutoDescription<special::ColStereoDisplay>();
    instance.RegisterAutoDescription<view::ClipPlane>();
    instance.RegisterAutoDescription<view::LinearTransferFunction>();
    instance.RegisterAutoDescription<view::TransferFunctionRenderer>();
    instance.RegisterAutoDescription<view::MuxRenderer3D<2> >();
    instance.RegisterAutoDescription<view::MuxRenderer3D<3> >();
    instance.RegisterAutoDescription<view::MuxRenderer3D<4> >();
    instance.RegisterAutoDescription<view::MuxRenderer3D<5> >();
    instance.RegisterAutoDescription<view::MuxRenderer3D<10> >();
    instance.RegisterAutoDescription<view::special::AnaglyphStereoView>();
    instance.RegisterAutoDescription<view::special::ChronoGraph>();
    instance.RegisterAutoDescription<view::special::DemoRenderer2D>();
    instance.RegisterAutoDescription<view::special::QuadBufferStereoView>();
    instance.RegisterAutoDescription<view::special::ScreenShooter>();
    instance.RegisterAutoDescription<view::SwitchRenderer3D>();
    instance.RegisterAutoDescription<view::TileView>();
    instance.RegisterAutoDescription<view::View2D>();
    instance.RegisterAutoDescription<view::View3D>();
    instance.RegisterAutoDescription<view::BlinnPhongRendererDeferred>();
    instance.RegisterAutoDescription<view::SplitView>();
    instance.RegisterAutoDescription<view::SharedCameraParameters>();
    instance.RegisterAutoDescription<view::LinkedView3D>();
    //instance.RegisterAutoDescription<vismol2::Mol20Renderer>();
    //instance.RegisterAutoDescription<vismol2::Mol20DataSource>();
    instance.RegisterAutoDescription<job::DataWriterJob>();
    instance.RegisterAutoDescription<job::JobThread>();
    instance.RegisterAutoDescription<moldyn::AddClusterColours>();
    instance.RegisterAutoDescription<moldyn::DynDensityGradientEstimator>();
#ifdef MEGAMOLCORE_WITH_DIRECT3D11
    instance.RegisterAutoDescription<view::ViewDirect3D>();
    instance.RegisterAutoDescription<moldyn::D3D11SimpleSphereRenderer>();
#endif /* MEGAMOLCORE_WITH_DIRECT3D11 */

}
<|endoftext|>