void PropertyEditorToolWindow::showEvent(QShowEvent *event)
{
    if (QDesignerPropertyEditorInterface *e = workbench()->core()->propertyEditor()) {
        // workaround to update the propertyeditor when it is not visible!
        e->setObject(e->object()); // ### remove me
    }

    QDesignerToolWindow::showEvent(event);
}
Beispiel #2
0
QRect WidgetBoxToolWindow::geometryHint() const
{
    const QRect g = availableToolWindowGeometry();
    const int margin = workbench()->marginHint();
    const  QRect rc = QRect(g.left() + margin,
                            g.top() + margin,
                            g.width() * 1/4, g.height() * 5/6);
    if (debugToolWindow)
        qDebug() << Q_FUNC_INFO << rc;
    return rc;
}
Beispiel #3
0
//-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~
GameObjectType::pDocument_type
GameObjectType::getDocument()
{
    if (m_pDocument.isValid())
    {
        return m_pDocument;
    }

    // Create a document and return it.

    // Get a reference to the workbench
    Zen::Studio::Workbench::I_WorkbenchService& 
        workbench(m_project.getController().getWorkbenchService());

    // TODO Create a spread sheet document user data.
    // Since GameObjectTypeDocument is a user-implemented document,
    // the user data isn't needed, but possibly eventually it will be.
    //Zen::Studio::Workbench::I_SpreadSheetDocument::pUserData_type
    //    pUserData();

    // Get the parent document.
    Zen::Studio::Workbench::I_ExplorerNode* const pParentNode = getNode()->getParent();

    pDocument_type* ppParentDocument = NULL;

    // If the parent node isn't NULL, see if the user data is a GameObjectType
    if (pParentNode != NULL)
    {
        GameObjectType* pParent = dynamic_cast<GameObjectType*>(pParentNode->getUserData().get());

        if (pParent)
        {
            ppParentDocument = new pDocument_type(pParent->getDocument());
        }
    }

    // Create the document.
    GameObjectTypeDocument* pRawDocument = new GameObjectTypeDocument(m_project, ppParentDocument);
    Zen::Studio::Workbench::I_Document::pDocument_type 
        pGameObjectTypeDocument(pRawDocument, &GameObjectType::destroyDocument);

    // TODO Create a future and pass it to this method.  Then have
    // this method fire the future event when the document is fully loaded.
    pRawDocument->load(*this);

    m_pDocument = pGameObjectTypeDocument;

    onOpened(pRawDocument);

    // TODO Return a future.
    return m_pDocument;
}
Beispiel #4
0
QRect SignalSlotEditorToolWindow::geometryHint() const
{
    const QRect g = availableToolWindowGeometry();
    const int margin = workbench()->marginHint();

    const QSize sz(g.width() * 1/3, g.height() * 1/6);
    QRect r(QPoint(0, 0), sz);
    r.moveCenter(g.center());
    r.moveTop(margin + g.top());
    if (debugToolWindow)
        qDebug() << Q_FUNC_INFO << r;
    return r;
}
Beispiel #5
0
QRect ObjectInspectorToolWindow::geometryHint() const
{
    const QRect g = availableToolWindowGeometry();
    const int margin = workbench()->marginHint();

    const QSize sz(g.width() * 1/4, g.height() * 1/6);

    const QRect rc = QRect((g.right() + 1 - sz.width() - margin),
                            g.top() + margin,
                           sz.width(), sz.height());
    if (debugToolWindow)
        qDebug() << Q_FUNC_INFO << rc;
    return rc;
}
Beispiel #6
0
QRect PropertyEditorToolWindow::geometryHint() const
{
    const QRect g = availableToolWindowGeometry();
    const int margin = workbench()->marginHint();
    const int spacing = 40;
    const QSize sz(g.width() * 1/4, g.height() * 4/6);

    const QRect rc = QRect((g.right() + 1 - sz.width() - margin),
                           (g.top() + margin + g.height() * 1/6) + spacing,
                           sz.width(), sz.height());
    if (debugToolWindow)
        qDebug() << Q_FUNC_INFO << rc;
    return rc;
}
void QDesignerFormWindow::closeEvent(QCloseEvent *ev)
{
    if (m_editor->isDirty()) {
// Сохраняем автоматически
        bool ok = workbench()->saveForm(m_editor);
        ev->setAccepted(ok);
        m_editor->setDirty(!ok);

        /*        raise();
                QMessageBox box(tr("Save Form?"),
                        tr("Do you want to save the changes you made to \"%1\" before closing?")
                        .arg(m_editor->fileName().isEmpty() ? action()->text() : m_editor->fileName()),
                        QMessageBox::Information,
                        QMessageBox::Yes | QMessageBox::Default, QMessageBox::No,
                        QMessageBox::Cancel | QMessageBox::Escape, m_editor, Qt::Sheet);
                box.setButtonText(QMessageBox::Yes, m_editor->fileName().isEmpty() ? tr("Save...") : tr("Save"));
                box.setButtonText(QMessageBox::No, tr("Don't Save"));
                switch (box.exec()) {
                    case QMessageBox::Yes: {
                        bool ok = workbench()->saveForm(m_editor);
                        ev->setAccepted(ok);
                        m_editor->setDirty(!ok);
                        break;
                    }
                    case QMessageBox::No:
                        m_editor->setDirty(false); // Not really necessary, but stops problems if we get close again.
                        ev->accept();
                        break;
                    case QMessageBox::Cancel:
                        ev->ignore();
                        break;
                }*/
    }

    if (m_workbench->core()->formWindowManager()->formWindowCount() == 1 && ev->isAccepted()
            && QDesignerSettings().showNewFormOnStartup())
        QTimer::singleShot(200, m_workbench->actionManager(), SLOT(createForm()));  // Use timer in case we are quitting.
}
QDesignerFormWindow::~QDesignerFormWindow()
{
    if (workbench())
        workbench()->removeFormWindow(this);
}
Beispiel #9
0
int main(int argc, char **argv)
{
    char c;

    /*
     * init 
     */
    begin_mtx = (pthread_mutex_t) PTHREAD_MUTEX_INITIALIZER;
    begin_cond = (pthread_cond_t) PTHREAD_COND_INITIALIZER;
    end_mtx = (pthread_mutex_t) PTHREAD_MUTEX_INITIALIZER;
    end_cond = (pthread_cond_t) PTHREAD_COND_INITIALIZER;
    begin_thread_num = 0;
    end_thread_num = 0;
    init_system_variables();

    /* options  */
#if defined(_Skiplist_) || (_LazySkiplist_) || (_LockFreeSkiplist_)
    while ((c = getopt(argc, argv, "t:n:l:vVh")) != -1) {
#else
    while ((c = getopt(argc, argv, "t:n:vVh")) != -1) {
#endif
	switch (c) {
	case 't':		/* number of thread */
	    system_variables.thread_num = strtol(optarg, NULL, 10);
	    if (system_variables.thread_num <= 0) {
		fprintf(stderr, "Error: thread number %d is not valid\n",
			system_variables.thread_num);
		exit(-1);
	    } else if (MAX_THREADS <= system_variables.thread_num)
		system_variables.thread_num = MAX_THREADS;

	    break;
	case 'n':		/* number of item */
	    system_variables.item_num = strtol(optarg, NULL, 10);
	    if (system_variables.item_num <= 0) {
		fprintf(stderr, "Error: item number %d is not valid\n",
			system_variables.item_num);
		exit(-1);
	    } else if (MAX_ITEMS <= system_variables.item_num)
		system_variables.item_num = MAX_ITEMS;
	    break;
#if defined(_Skiplist_) || (_LazySkiplist_) || (_LockFreeSkiplist_)
	case 'l':		/* max level of skiplist */
	    system_variables.max_level = strtol(optarg, NULL, 10);
	    if (system_variables.max_level <= 0) {
		fprintf(stderr, "Error: max level %d is not valid\n",
			system_variables.max_level);
		exit(-1);
	    } else if (MAX_LEVEL <= system_variables.max_level)
		system_variables.max_level = MAX_LEVEL;
	    break;
#endif
	case 'v':               /* verbose 1 */
	    system_variables.verbose = 1;
	    break;
	case 'V':               /* verbose 2 */
	    system_variables.verbose = 2;
	    break;
	case 'h':	        /* help */
	    usage(argv);
	    exit(0);
	default:
	    fprintf(stderr, "ERROR: option error: -%c is not valid\n",
		    optopt);
	    exit(-1);
	}
    }

    /*
     * main work 
     */
    if (workbench() != 0)
      abort();

    free (stat_data);
    free (work_thread_tptr);

    return 0;
}