char *Controller::getText(char *dest, int maxSize) { int x = _output->getX(); int y = _output->getY(); int w = EXTENT_X(maGetTextSize("YNM")); int h = _output->textHeight(); dest[0] = '\0'; _runMode = modal_state; IFormWidget *formWidget = _output->createLineInput(dest, maxSize, x, y, w, h); _output->redraw(); maShowVirtualKeyboard(); while (isModal()) { MAEvent event = processEvents(EVENT_WAIT_INFINITE, EVENT_TYPE_KEY_PRESSED); if (event.type == EVENT_TYPE_KEY_PRESSED) { dev_clrkb(); if (isModal()) { if (event.key == 10) { _runMode = run_state; } else { _output->edit(formWidget, event.key); } } } } // paint the widget result onto the backing screen if (dest[0]) { _output->print(dest); } delete formWidget; return dest; }
void XMainWindow::showEvent(QShowEvent *event) { if(!_private->_shown) { _private->_shown = true; //qDebug("isModal() %s", isModal()?"true":"false"); QRect availableGeometry = QApplication::desktop()->availableGeometry(); if(!omfgThis->showTopLevel() && !isModal()) availableGeometry = omfgThis->workspace()->geometry(); QString objName = objectName(); QPoint pos = xtsettingsValue(objName + "/geometry/pos").toPoint(); QSize lsize = xtsettingsValue(objName + "/geometry/size").toSize(); if(lsize.isValid() && xtsettingsValue(objName + "/geometry/rememberSize", true).toBool() && (metaObject()->className() != QString("xTupleDesigner"))) resize(lsize); setAttribute(Qt::WA_DeleteOnClose); if(omfgThis->showTopLevel() || isModal()) { omfgThis->_windowList.append(this); statusBar()->show(); QRect r(pos, size()); if(!pos.isNull() && availableGeometry.contains(r) && xtsettingsValue(objName + "/geometry/rememberPos", true).toBool()) move(pos); } else { QWidget * fw = focusWidget(); omfgThis->workspace()->addWindow(this); QRect r(pos, size()); if(!pos.isNull() && availableGeometry.contains(r) && xtsettingsValue(objName + "/geometry/rememberPos", true).toBool()) move(pos); // This originally had to be after the show? Will it work here? if(fw) fw->setFocus(); } _private->loadScriptEngine(); QList<XCheckBox*> allxcb = findChildren<XCheckBox*>(); for (int i = 0; i < allxcb.size(); ++i) allxcb.at(i)->init(); shortcuts::setStandardKeys(this); } bool blocked = _private->_action->blockSignals(true); _private->_action->setChecked(true); _private->_action->blockSignals(blocked); _private->callShowEvent(event); QMainWindow::showEvent(event); }
void XWidget::showEvent(QShowEvent *event) { if(!_private->_shown) { _private->_shown = true; if (windowFlags() & (Qt::Window | Qt::Dialog)) { QRect availableGeometry = QApplication::desktop()->availableGeometry(); if(!omfgThis->showTopLevel() && !isModal()) availableGeometry = QRect(QPoint(0, 0), omfgThis->workspace()->size()); QString objName = objectName(); QPoint pos = xtsettingsValue(objName + "/geometry/pos").toPoint(); QSize lsize = xtsettingsValue(objName + "/geometry/size").toSize(); if(lsize.isValid() && xtsettingsValue(objName + "/geometry/rememberSize", true).toBool()) resize(lsize); setAttribute(Qt::WA_DeleteOnClose); if(omfgThis->showTopLevel() || isModal()) { omfgThis->_windowList.append(this); QRect r(pos, size()); if(!pos.isNull() && availableGeometry.contains(r) && xtsettingsValue(objName + "/geometry/rememberPos", true).toBool()) move(pos); } else { QWidget * fw = focusWidget(); omfgThis->workspace()->addWindow(this); QRect r(pos, size()); if(!pos.isNull() && availableGeometry.contains(r) && xtsettingsValue(objName + "/geometry/rememberPos", true).toBool() && parentWidget()) parentWidget()->move(pos); // This originally had to be after the show? Will it work here? if(fw) fw->setFocus(); } } _private->loadScriptEngine(); QList<XCheckBox*> allxcb = findChildren<XCheckBox*>(); for (int i = 0; i < allxcb.size(); ++i) allxcb.at(i)->init(); shortcuts::setStandardKeys(this); } _private->callShowEvent(event); QWidget::showEvent(event); }
void gMainWindow::showModal() { gMainWindow *save; if (!isTopLevel()) return; if (isModal()) return; //show(); gtk_window_set_modal(GTK_WINDOW(border), true); center(); //show(); gtk_grab_add(border); if (_active) gtk_window_set_transient_for(GTK_WINDOW(border), GTK_WINDOW(_active->topLevel()->border)); save = _current; _current = this; gApplication::enterLoop(this, true); _current = save; gtk_grab_remove(border); gtk_window_set_modal(GTK_WINDOW(border), false); if (!persistent) destroyNow(); else hide(); }
GtkWidget * AP_UnixDialog_Lists::_constructWindow(void) { GtkWidget *contents; GtkWidget *vbox1; ConstructWindowName(); m_wMainWindow = abiDialogNew ( "list dialog", TRUE, getWindowName() ); vbox1 = gtk_dialog_get_content_area(GTK_DIALOG(m_wMainWindow)); contents = _constructWindowContents(); gtk_widget_show (contents); gtk_box_pack_start (GTK_BOX (vbox1), contents, FALSE, TRUE, 0); if(!isModal()) { m_wClose = abiAddStockButton ( GTK_DIALOG(m_wMainWindow), GTK_STOCK_CLOSE, BUTTON_CLOSE ) ; m_wApply = abiAddStockButton ( GTK_DIALOG(m_wMainWindow), GTK_STOCK_APPLY, BUTTON_APPLY ) ; } else { m_wApply = abiAddStockButton ( GTK_DIALOG(m_wMainWindow), GTK_STOCK_OK, BUTTON_OK ) ; m_wClose = abiAddStockButton ( GTK_DIALOG(m_wMainWindow), GTK_STOCK_CANCEL, BUTTON_CANCEL ) ; } gtk_widget_grab_default (m_wClose); _connectSignals (); return (m_wMainWindow); }
// ****************************************************************************************** // Switch which screen is being shown // ****************************************************************************************** void ROSControllersWidget::changeScreen(int index) { stacked_layout_->setCurrentIndex(index); // Announce this widget's mode Q_EMIT isModal(index != 0); }
// ****************************************************************************************** // Switch to current controllers view // ****************************************************************************************** void ROSControllersWidget::showMainScreen() { stacked_layout_->setCurrentIndex(0); // Announce that this widget is not in modal mode Q_EMIT isModal(false); }
gMainWindow::~gMainWindow() { //fprintf(stderr, "delete window %p %s\n", this, name()); if (opened) { emit(SIGNAL(onClose)); opened = false; if (GTK_IS_WINDOW(border) && isModal()) gApplication::exitLoop(this); } gPicture::assign(&_picture); gPicture::assign(&_icon); if (_title) g_free(_title); g_object_unref(accel); if (_style) g_object_unref(_style); if (_active == this) _active = NULL; if (gApplication::mainWindow() == this) gApplication::setMainWindow(NULL); windows = g_list_remove(windows, (gpointer)this); }
void Dialog::showEvent(QShowEvent *e) { if (!shown) { shown=true; AcceleratorManager::manage(this); if (defButton) { setDefaultButton((ButtonCode)defButton); } if (buttonBox && mw) { QSize mwSize=mw->minimumSize(); if (mwSize.width()<16 || mwSize.height()<16) { mwSize=mw->minimumSizeHint(); } if (mwSize.width()>15 && mwSize.height()>15) { setMinimumHeight(qMax(minimumHeight(), buttonBox->height()+layout()->spacing()+mwSize.height()+(2*layout()->margin()))); setMinimumWidth(qMax(minimumWidth(), mwSize.width()+(2*layout()->margin()))); } } } #ifdef Q_OS_MAC if (!isModal()) { OSXStyle::self()->addWindow(this); } #endif QDialog::showEvent(e); }
// ****************************************************************************************** // Cancel changes // ****************************************************************************************** void VirtualJointsWidget::cancelEditing() { // Switch to screen stacked_layout_->setCurrentIndex( 0 ); // Announce that this widget is not in modal mode Q_EMIT isModal( false ); }
void CQDlgTextures::cancelEvent() // this was empty before VDialog wrap thing { // We just hide the dialog and destroy it at next rendering pass _identification[0]=-1; if (isModal()) // this condition and next line on 20/5/2013: on Linux the dlg couldn't be closed! Thanks to Ulrich Schwesinger defaultModalDialogEndRoutine(false); else CDlgEx::cancelEvent(); }
/*! * This method sets the parameters of the "Fake" list shown in the preview. * The values display are theones the user should expect to get in their document * should they press "Apply" */ void AP_Dialog_Lists::fillFakeLabels(void) { /*! * m_bisCustomized is true if the user has changed anything in the dialog without * pressing "Apply". If this variable is false we should just display what is * in the document at the list point. */ if(m_bisCustomized == false && !isModal()) { m_iLevel = getBlock()->getLevel(); if(m_iLevel == 0 ) { m_iLevel++; } /*! * This method loads the list info from the document at the current point * into the XP member variables. */ PopulateDialogData(); // // We may not need this. Will check. Sevior 18/7/2001 // if(m_bguiChanged == false) m_NewListType = m_DocListType; m_bguiChanged = false; } /*! * For Bullet type lists we don't allow the user to set either the delimimiter * or font from their specified values. Here we override whatever was in them * to the values they SHOULD be given the list type. */ if( m_NewListType == BULLETED_LIST || m_NewListType == IMPLIES_LIST || m_NewListType == DASHED_LIST ) { m_pszFont = "Symbol"; m_pszDelim = "%L"; } else if (m_NewListType == NOT_A_LIST) { m_pszFont = "NULL"; m_pszDelim = "%L"; } else if(m_NewListType > DASHED_LIST && m_NewListType < OTHER_NUMBERED_LISTS) { m_pszFont = _getDingbatsFontName(); m_pszDelim = "%L"; } /*! * OK fill the preview variables with what they need and load them into * the preview class. */ m_pFakeAuto->setListType(m_NewListType); m_pFakeAuto->setDelim(m_pszDelim); m_pFakeAuto->setDecimal(m_pszDecimal); m_pFakeAuto->setStartValue(m_iStartValue); m_pListsPreview->setData(m_pszFont,m_fAlign,m_fIndent); }
bool AP_UnixDialog_Lists::isPageLists(void) { if(isModal()) { return true; } bool isPage = (gtk_notebook_get_current_page(GTK_NOTEBOOK(m_wContents)) == m_iPageLists); return isPage; }
void Q3ProgressDialog::setProgress(int progress) { if (progress == bar()->progress() || (bar()->progress() == -1 && progress == bar()->totalSteps())) return; bar()->setProgress(progress); if (d->shown_once) { if (isModal()) qApp->processEvents(); } else { if (progress == 0) { #ifndef QT_NO_CURSOR if (d->creator) { d->parentCursor = d->creator->cursor(); d->creator->setCursor(Qt::WaitCursor); } #endif d->starttime.start(); forceTimer->start(d->showTime); return; } else { bool need_show; int elapsed = d->starttime.elapsed(); if (elapsed >= d->showTime) { need_show = true; } else { if (elapsed > minWaitTime) { int estimate; if ((totalSteps() - progress) >= INT_MAX / elapsed) estimate = (totalSteps() - progress) / progress * elapsed; else estimate = elapsed * (totalSteps() - progress) / progress; need_show = estimate >= d->showTime; } else { need_show = false; } } if (need_show) { int w = qMax(isVisible() ? width() : 0, sizeHint().width()); int h = qMax(isVisible() ? height() : 0, sizeHint().height()); resize(w, h); show(); d->shown_once = true; } } #ifdef Q_WS_MAC QApplication::flush(); #endif } if (progress == bar()->totalSteps() && d->autoReset) reset(); }
void AP_UnixDialog_Lists::applyClicked(void) { setXPFromLocal(); previewExposed(); Apply(); if(isModal()) { setAnswer(AP_Dialog_Lists::a_OK); } }
void gMainWindow::showPopup(int x, int y) { gMainWindow *save; bool has_border; int oldx, oldy; //int type; if (!isTopLevel()) return; if (isModal()) return; //gtk_widget_unrealize(border); //((GtkWindow *)border)->type = GTK_WINDOW_POPUP; //gtk_widget_realize(border); oldx = left(); oldy = top(); has_border = gtk_window_get_decorated(GTK_WINDOW(border)); //type = getType(); //setType(_NET_WM_WINDOW_TYPE_COMBO); gtk_window_set_decorated(GTK_WINDOW(border), false); //gtk_window_set_type_hint(GTK_WINDOW(border), GDK_WINDOW_TYPE_HINT_POPUP_MENU); move(x, y); gtk_window_resize(GTK_WINDOW(border), bufW, bufH); //reparent(NULL, x, y, GTK_WINDOW_POPUP); _popup = true; save = _current; _current = this; gApplication::enterPopup(this); _current = save; _popup = false; if (!persistent) { destroyNow(); } else { hide(); //gdk_window_set_override_redirect(gtk_widget_get_window(GTK_WINDOW(border)), false); gtk_window_set_decorated(GTK_WINDOW(border), has_border); //setType(type); //gtk_window_set_type_hint(GTK_WINDOW(border), type); move(oldx, oldy); } }
bool gMainWindow::doClose() { if (_closing) return false; if (opened) { if (isModal() && !gApplication::hasLoop(this)) return true; _closing = true; if (onClose) { if (!onClose(this)) opened = false; } else opened = false; _closing = false; if (!opened && isModal()) gApplication::exitLoop(this); } if (!opened) // && !modal()) { if (_active == this) setActiveWindow(NULL); if (!isModal()) { if (persistent) hide(); else destroy(); } return false; } else return opened; }
void XMainWindow::closeEvent(QCloseEvent *event) { QString objName = objectName(); QSettings settings(QSettings::UserScope, "OpenMFG.com", "OpenMFG"); settings.setValue(objName + "/geometry/size", size()); if(omfgThis->showTopLevel() || isModal()) settings.setValue(objName + "/geometry/pos", pos()); else settings.setValue(objName + "/geometry/pos", parentWidget()->pos()); QMainWindow::closeEvent(event); }
/*! \property QProgressDialog::value \brief the current amount of progress made. For the progress dialog to work as expected, you should initially set this property to 0 and finally set it to QProgressDialog::maximum(); you can call setValue() any number of times in-between. \warning If the progress dialog is modal (see QProgressDialog::QProgressDialog()), setValue() calls QApplication::processEvents(), so take care that this does not cause undesirable re-entrancy in your code. For example, don't use a QProgressDialog inside a paintEvent()! \sa minimum, maximum */ void QProgressDialog::setValue(int progress) { Q_D(QProgressDialog); if (progress == d->bar->value() || (d->bar->value() == -1 && progress == d->bar->maximum())) return; d->bar->setValue(progress); if (d->shown_once) { if (isModal()) QApplication::processEvents(); } else { if (progress == 0) { d->starttime.start(); d->forceTimer->start(d->showTime); return; } else { bool need_show; int elapsed = d->starttime.elapsed(); if (elapsed >= d->showTime) { need_show = true; } else { if (elapsed > minWaitTime) { int estimate; int totalSteps = maximum() - minimum(); int myprogress = progress - minimum(); if (myprogress == 0) myprogress = 1; if ((totalSteps - myprogress) >= INT_MAX / elapsed) estimate = (totalSteps - myprogress) / myprogress * elapsed; else estimate = elapsed * (totalSteps - myprogress) / myprogress; need_show = estimate >= d->showTime; } else { need_show = false; } } if (need_show) { int w = qMax(isVisible() ? width() : 0, sizeHint().width()); int h = qMax(isVisible() ? height() : 0, sizeHint().height()); resize(w, h); show(); d->shown_once = true; } } #ifdef Q_WS_MAC QApplication::flush(); #endif } if (progress == d->bar->maximum() && d->autoReset) reset(); }
/*! \property QProgressDialog::value \brief the current amount of progress made. For the progress dialog to work as expected, you should initially set this property to QProgressDialog::minimum() and finally set it to QProgressDialog::maximum(); you can call setValue() any number of times in-between. \warning If the progress dialog is modal (see QProgressDialog::QProgressDialog()), setValue() calls QApplication::processEvents(), so take care that this does not cause undesirable re-entrancy in your code. For example, don't use a QProgressDialog inside a paintEvent()! \sa minimum, maximum */ void QProgressDialog::setValue(int progress) { Q_D(QProgressDialog); if (d->setValue_called && progress == d->bar->value()) return; d->bar->setValue(progress); if (d->shown_once) { if (isModal()) QApplication::processEvents(); } else { if ((!d->setValue_called && progress == 0 /* for compat with Qt < 5.4 */) || progress == minimum()) { d->starttime.start(); d->forceTimer->start(d->showTime); d->setValue_called = true; return; } else { d->setValue_called = true; bool need_show; int elapsed = d->starttime.elapsed(); if (elapsed >= d->showTime) { need_show = true; } else { if (elapsed > minWaitTime) { int estimate; int totalSteps = maximum() - minimum(); int myprogress = progress - minimum(); if (myprogress == 0) myprogress = 1; if ((totalSteps - myprogress) >= INT_MAX / elapsed) estimate = (totalSteps - myprogress) / myprogress * elapsed; else estimate = elapsed * (totalSteps - myprogress) / myprogress; need_show = estimate >= d->showTime; } else { need_show = false; } } if (need_show) { d->ensureSizeIsAtLeastSizeHint(); show(); d->shown_once = true; } } #ifdef Q_DEAD_CODE_FROM_QT4_MAC QApplication::flush(); #endif } if (progress == d->bar->maximum() && d->autoReset) reset(); }
int QDialog::qt_metacall(QMetaObject::Call _c, int _id, void **_a) { _id = QWidget::qt_metacall(_c, _id, _a); if (_id < 0) return _id; if (_c == QMetaObject::InvokeMetaMethod) { switch (_id) { case 0: finished((*reinterpret_cast< int(*)>(_a[1]))); break; case 1: accepted(); break; case 2: rejected(); break; case 3: { int _r = exec(); if (_a[0]) *reinterpret_cast< int*>(_a[0]) = _r; } break; case 4: done((*reinterpret_cast< int(*)>(_a[1]))); break; case 5: accept(); break; case 6: reject(); break; case 7: showExtension((*reinterpret_cast< bool(*)>(_a[1]))); break; } _id -= 8; } #ifndef QT_NO_PROPERTIES else if (_c == QMetaObject::ReadProperty) { void *_v = _a[0]; switch (_id) { case 0: *reinterpret_cast< bool*>(_v) = isSizeGripEnabled(); break; case 1: *reinterpret_cast< bool*>(_v) = isModal(); break; } _id -= 2; } else if (_c == QMetaObject::WriteProperty) { void *_v = _a[0]; switch (_id) { case 0: setSizeGripEnabled(*reinterpret_cast< bool*>(_v)); break; case 1: setModal(*reinterpret_cast< bool*>(_v)); break; } _id -= 2; } else if (_c == QMetaObject::ResetProperty) { _id -= 2; } else if (_c == QMetaObject::QueryPropertyDesignable) { _id -= 2; } else if (_c == QMetaObject::QueryPropertyScriptable) { _id -= 2; } else if (_c == QMetaObject::QueryPropertyStored) { _id -= 2; } else if (_c == QMetaObject::QueryPropertyEditable) { _id -= 2; } else if (_c == QMetaObject::QueryPropertyUser) { _id -= 2; } #endif // QT_NO_PROPERTIES return _id; }
void XMainWindow::closeEvent(QCloseEvent *event) { event->accept(); // we have no reason not to accept and let the script change it if needed _private->callCloseEvent(event); if(event->isAccepted()) { QString objName = objectName(); xtsettingsSetValue(objName + "/geometry/size", size()); if(omfgThis->showTopLevel() || isModal()) xtsettingsSetValue(objName + "/geometry/pos", pos()); else if (parentWidget() != 0) xtsettingsSetValue(objName + "/geometry/pos", parentWidget()->pos()); } }
// ****************************************************************************************** // Show edit screen for creating a new vjoint // ****************************************************************************************** void VirtualJointsWidget::showNewScreen() { // Remember that this is a new vjoint current_edit_vjoint_.clear(); // Clear previous data vjoint_name_field_->setText(""); parent_name_field_->setText(""); child_link_field_->clearEditText(); joint_type_field_->clearEditText(); // actually this just chooses first option // Switch to screen stacked_layout_->setCurrentIndex( 1 ); // Announce that this widget is in modal mode Q_EMIT isModal( true ); }
// ****************************************************************************************** // Show edit screen for creating a new effector // ****************************************************************************************** void EndEffectorsWidget::showNewScreen() { // Remember that this is a new effector current_edit_effector_.clear(); // Clear previous data effector_name_field_->setText(""); parent_name_field_->clearEditText(); group_name_field_->clearEditText(); // actually this just chooses first option parent_group_name_field_->clearEditText(); // actually this just chooses first option // Switch to screen stacked_layout_->setCurrentIndex( 1 ); // Announce that this widget is in modal mode Q_EMIT isModal( true ); }
// ****************************************************************************************** // Edit effector // ****************************************************************************************** void EndEffectorsWidget::edit( const std::string &name ) { // Remember what we are editing current_edit_effector_ = name; // Find the selected in datastruture srdf::Model::EndEffector *effector = findEffectorByName( name ); // Set effector name effector_name_field_->setText( effector->name_.c_str() ); // Set effector parent link int index = parent_name_field_->findText( effector->parent_link_.c_str() ); if( index == -1 ) { QMessageBox::critical( this, "Error Loading", "Unable to find parent link in drop down box" ); return; } parent_name_field_->setCurrentIndex( index ); // Set group: index = group_name_field_->findText( effector->component_group_.c_str() ); if( index == -1 ) { QMessageBox::critical( this, "Error Loading", "Unable to find group name in drop down box" ); return; } group_name_field_->setCurrentIndex( index ); // Set parent group: index = parent_group_name_field_->findText( effector->parent_group_.c_str() ); if( index == -1 ) { QMessageBox::critical( this, "Error Loading", "Unable to find parent group name in drop down box" ); return; } parent_group_name_field_->setCurrentIndex( index ); // Switch to screen stacked_layout_->setCurrentIndex( 1 ); // Announce that this widget is in modal mode Q_EMIT isModal( true ); }
void XMainWindow::closeEvent(QCloseEvent *event) { event->accept(); // we have no reason not to accept and let the script change it if needed if(_private->_engine && (_private->_engine->globalObject().property("closeEvent").isFunction())) { QScriptValueList args; args << _private->_engine->toScriptValue((QEvent*)event); _private->_engine->globalObject().property("closeEvent").call(QScriptValue(), args); } if(event->isAccepted()) { QString objName = objectName(); xtsettingsSetValue(objName + "/geometry/size", size()); if(omfgThis->showTopLevel() || isModal()) xtsettingsSetValue(objName + "/geometry/pos", pos()); else xtsettingsSetValue(objName + "/geometry/pos", parentWidget()->pos()); } }
int QDialog::qt_metacall(QMetaObject::Call _c, int _id, void **_a) { _id = QWidget::qt_metacall(_c, _id, _a); if (_id < 0) return _id; if (_c == QMetaObject::InvokeMetaMethod) { if (_id < 9) qt_static_metacall(this, _c, _id, _a); _id -= 9; } #ifndef QT_NO_PROPERTIES else if (_c == QMetaObject::ReadProperty) { void *_v = _a[0]; switch (_id) { case 0: *reinterpret_cast< bool*>(_v) = isSizeGripEnabled(); break; case 1: *reinterpret_cast< bool*>(_v) = isModal(); break; } _id -= 2; } else if (_c == QMetaObject::WriteProperty) { void *_v = _a[0]; switch (_id) { case 0: setSizeGripEnabled(*reinterpret_cast< bool*>(_v)); break; case 1: setModal(*reinterpret_cast< bool*>(_v)); break; } _id -= 2; } else if (_c == QMetaObject::ResetProperty) { _id -= 2; } else if (_c == QMetaObject::QueryPropertyDesignable) { _id -= 2; } else if (_c == QMetaObject::QueryPropertyScriptable) { _id -= 2; } else if (_c == QMetaObject::QueryPropertyStored) { _id -= 2; } else if (_c == QMetaObject::QueryPropertyEditable) { _id -= 2; } else if (_c == QMetaObject::QueryPropertyUser) { _id -= 2; } #endif // QT_NO_PROPERTIES return _id; }
void AP_UnixDialog_Lists::destroy(void) { UT_ASSERT (m_wMainWindow); if(isModal()) { setAnswer(AP_Dialog_Lists::a_QUIT); } else { m_bDestroy_says_stopupdating = true; m_pAutoUpdateLists->stop(); setAnswer(AP_Dialog_Lists::a_CLOSE); m_glFonts.clear(); modeless_cleanup(); abiDestroyWidget(m_wMainWindow); m_wMainWindow = NULL; DELETEP(m_pAutoUpdateLists); DELETEP (m_pPreviewWidget); } }
// ****************************************************************************************** // Edit vjoint // ****************************************************************************************** void VirtualJointsWidget::edit( const std::string &name ) { // Remember what we are editing current_edit_vjoint_ = name; // Find the selected in datastruture srdf::Model::VirtualJoint *vjoint = findVJointByName( name ); // Set vjoint name vjoint_name_field_->setText( vjoint->name_.c_str() ); parent_name_field_->setText( vjoint->parent_frame_.c_str() ); // Set vjoint child link int index = child_link_field_->findText( vjoint->child_link_.c_str() ); if( index == -1 ) { QMessageBox::critical( this, "Error Loading", "Unable to find child link in drop down box" ); return; } child_link_field_->setCurrentIndex( index ); // Set joint type index = joint_type_field_->findText( vjoint->type_.c_str() ); if( index == -1 ) { QMessageBox::critical( this, "Error Loading", "Unable to find joint type in drop down box" ); return; } joint_type_field_->setCurrentIndex( index ); // Switch to screen stacked_layout_->setCurrentIndex( 1 ); // Announce that this widget is in modal mode Q_EMIT isModal( true ); }
GtkWidget *AP_UnixDialog_Lists::_constructWindowContents (void) { GtkWidget *vbox2; GtkWidget *hbox2; GtkWidget *vbox4; GtkWidget *table1; GtkWidget *style_om; GtkWidget *type_om; GtkWidget *type_lb; GtkWidget *style_lb; GtkWidget *customized_cb; GtkWidget *frame1; GtkWidget *table2; GtkComboBox *font_om; GtkListStore *font_om_menu; GtkWidget *format_en; GtkWidget *decimal_en; GtkAdjustment *start_sb_adj; GtkWidget *start_sb; GtkAdjustment *text_align_sb_adj; GtkWidget *text_align_sb; GtkAdjustment *label_align_sb_adj; GtkWidget *label_align_sb; GtkWidget *format_lb; GtkWidget *font_lb; GtkWidget *delimiter_lb; GtkWidget *start_at_lb; GtkWidget *text_align_lb; GtkWidget *label_align_lb; GtkWidget *vbox3; GtkWidget *preview_lb; GtkWidget *hbox1; GSList *action_group = NULL; GtkWidget *start_list_rb; GtkWidget *apply_list_rb; GtkWidget *resume_list_rb; GtkWidget *preview_area; GtkWidget *preview_frame; const XAP_StringSet * pSS = m_pApp->getStringSet(); UT_UTF8String s; GtkWidget * wNoteBook = NULL; vbox2 = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0); gtk_widget_show (vbox2); if(!isModal()) { // Note Book creation wNoteBook = gtk_notebook_new (); gtk_widget_show(wNoteBook); // Container for the lists pSS->getValueUTF8(AP_STRING_ID_DLG_Lists_PageProperties,s); GtkWidget * lbPageLists = gtk_label_new(s.utf8_str()); gtk_widget_show(lbPageLists); gtk_notebook_append_page(GTK_NOTEBOOK(wNoteBook),vbox2,lbPageLists); m_iPageLists = gtk_notebook_page_num(GTK_NOTEBOOK(wNoteBook),vbox2); // Container for Text Folding pSS->getValueUTF8(AP_STRING_ID_DLG_Lists_PageFolding,s); GtkWidget * lbPageFolding = gtk_label_new(s.utf8_str()); GtkWidget * wFoldingTable = gtk_table_new(6,3,FALSE); gtk_widget_show(lbPageFolding); gtk_widget_show(wFoldingTable); gtk_notebook_append_page(GTK_NOTEBOOK(wNoteBook),wFoldingTable,lbPageFolding); m_iPageFold = gtk_notebook_page_num(GTK_NOTEBOOK(wNoteBook),wFoldingTable); // Left Spacing Here GtkWidget * lbLeftSpacer = gtk_label_new(""); gtk_misc_set_padding(GTK_MISC(lbLeftSpacer),8,0); gtk_table_attach(GTK_TABLE(wFoldingTable),lbLeftSpacer,0,1,0,6,GTK_SHRINK,GTK_FILL,0,0); gtk_widget_show(lbLeftSpacer); // Bold markup GtkWidget * lbFoldHeading = gtk_label_new("<b>%s</b>"); gtk_label_set_use_markup(GTK_LABEL(lbFoldHeading),TRUE); localizeLabelMarkup(lbFoldHeading,pSS,AP_STRING_ID_DLG_Lists_FoldingLevelexp); gtk_table_attach(GTK_TABLE(wFoldingTable),lbFoldHeading,1,3,0,1,GTK_FILL,GTK_EXPAND,0,0); gtk_widget_show(lbFoldHeading); // Mid Left Spacing Here GtkWidget * lbMidLeftSpacer = gtk_label_new(""); gtk_misc_set_padding(GTK_MISC(lbMidLeftSpacer),8,0); gtk_table_attach(GTK_TABLE(wFoldingTable),lbMidLeftSpacer,1,2,1,6,GTK_SHRINK,GTK_FILL,0,0); gtk_widget_show(lbMidLeftSpacer); m_vecFoldCheck.clear(); m_vecFoldID.clear(); UT_uint32 ID =0; // RadioButtons pSS->getValueUTF8(AP_STRING_ID_DLG_Lists_FoldingLevel0,s); GtkWidget * wF = gtk_radio_button_new_with_label(NULL, s.utf8_str()); GSList *wG = gtk_radio_button_get_group(GTK_RADIO_BUTTON(wF)); g_object_set_data(G_OBJECT(wF),"level",(gpointer)"0"); ID = g_signal_connect(G_OBJECT(wF), "toggled", G_CALLBACK(s_FoldCheck_changed), (gpointer) this); gtk_table_attach(GTK_TABLE(wFoldingTable),wF,2,3,1,2,GTK_FILL,GTK_EXPAND,0,0); gtk_widget_show(wF); m_vecFoldCheck.addItem(wF); m_vecFoldID.addItem(ID); pSS->getValueUTF8(AP_STRING_ID_DLG_Lists_FoldingLevel1,s); wF = gtk_radio_button_new_with_label(wG, s.utf8_str()); wG = gtk_radio_button_get_group(GTK_RADIO_BUTTON(wF)); g_object_set_data(G_OBJECT(wF),"level",(gpointer)"1"); ID = g_signal_connect(G_OBJECT(wF), "toggled", G_CALLBACK(s_FoldCheck_changed), (gpointer) this); gtk_table_attach(GTK_TABLE(wFoldingTable),wF,2,3,2,3,GTK_FILL,GTK_EXPAND,0,0); gtk_widget_show(wF); m_vecFoldCheck.addItem(wF); m_vecFoldID.addItem(ID); pSS->getValueUTF8(AP_STRING_ID_DLG_Lists_FoldingLevel2,s); wF = gtk_radio_button_new_with_label(wG, s.utf8_str()); wG = gtk_radio_button_get_group(GTK_RADIO_BUTTON(wF)); g_object_set_data(G_OBJECT(wF),"level",(gpointer)"2"); ID = g_signal_connect(G_OBJECT(wF), "toggled", G_CALLBACK(s_FoldCheck_changed), (gpointer) this); gtk_table_attach(GTK_TABLE(wFoldingTable),wF,2,3,3,4,GTK_FILL,GTK_EXPAND,0,0); gtk_widget_show(wF); m_vecFoldCheck.addItem(wF); m_vecFoldID.addItem(ID); pSS->getValueUTF8(AP_STRING_ID_DLG_Lists_FoldingLevel3,s); wF = gtk_radio_button_new_with_label(wG, s.utf8_str()); wG = gtk_radio_button_get_group(GTK_RADIO_BUTTON(wF)); g_object_set_data(G_OBJECT(wF),"level",(gpointer)"3"); ID = g_signal_connect(G_OBJECT(wF), "toggled", G_CALLBACK(s_FoldCheck_changed), (gpointer) this); gtk_table_attach(GTK_TABLE(wFoldingTable),wF,2,3,4,5,GTK_FILL,GTK_EXPAND,0,0); gtk_widget_show(wF); m_vecFoldCheck.addItem(wF); m_vecFoldID.addItem(ID); pSS->getValueUTF8(AP_STRING_ID_DLG_Lists_FoldingLevel4,s); wF = gtk_radio_button_new_with_label(wG, s.utf8_str()); g_object_set_data(G_OBJECT(wF),"level",(gpointer)"4"); ID = g_signal_connect(G_OBJECT(wF), "toggled", G_CALLBACK(s_FoldCheck_changed), (gpointer) this); gtk_table_attach(GTK_TABLE(wFoldingTable),wF,2,3,5,6,GTK_FILL,GTK_EXPAND,0,0); gtk_widget_show(wF); m_vecFoldCheck.addItem(wF); m_vecFoldID.addItem(ID); gtk_widget_show(wFoldingTable); gtk_notebook_set_current_page(GTK_NOTEBOOK(wNoteBook),m_iPageLists); } // List Page gtk_container_set_border_width (GTK_CONTAINER (vbox2), 8); hbox2 = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 8); gtk_widget_show (hbox2); gtk_box_pack_start (GTK_BOX (vbox2), hbox2, TRUE, TRUE, 0); vbox4 = gtk_box_new (GTK_ORIENTATION_VERTICAL, 4); gtk_widget_show (vbox4); gtk_box_pack_start (GTK_BOX (hbox2), vbox4, FALSE, TRUE, 0); table1 = gtk_table_new (3, 2, FALSE); gtk_widget_show (table1); gtk_box_pack_start (GTK_BOX (vbox4), table1, FALSE, TRUE, 0); gtk_table_set_row_spacings (GTK_TABLE (table1), 4); style_om = gtk_combo_box_text_new(); gtk_widget_show (style_om); gtk_table_attach (GTK_TABLE (table1), style_om, 1, 2, 1, 2, (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), (GtkAttachOptions) (0), 0, 0); m_wListStyleNone_menu = gtk_list_store_new(2, G_TYPE_STRING, G_TYPE_INT); _fillNoneStyleMenu(m_wListStyleNone_menu.obj()); m_wListStyleNumbered_menu = gtk_list_store_new (2, G_TYPE_STRING, G_TYPE_INT); _fillNumberedStyleMenu(m_wListStyleNumbered_menu.obj()); m_wListStyleBulleted_menu = gtk_list_store_new(2, G_TYPE_STRING, G_TYPE_INT); _fillBulletedStyleMenu(m_wListStyleBulleted_menu.obj()); // This is the default list. Change if the list style changes // m_wListStyle_menu = m_wListStyleNumbered_menu; gtk_combo_box_set_model(GTK_COMBO_BOX (style_om), GTK_TREE_MODEL(m_wListStyleNumbered_menu.obj())); type_om = gtk_combo_box_text_new(); gtk_widget_show (type_om); gtk_table_attach (GTK_TABLE (table1), type_om, 1, 2, 0, 1, (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), (GtkAttachOptions) (0), 0, 0); pSS->getValueUTF8(AP_STRING_ID_DLG_Lists_Type_none,s); gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(type_om), s.utf8_str()); pSS->getValueUTF8(AP_STRING_ID_DLG_Lists_Type_bullet,s); gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(type_om), s.utf8_str()); pSS->getValueUTF8(AP_STRING_ID_DLG_Lists_Type_numbered,s); gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(type_om), s.utf8_str()); gtk_combo_box_set_active(GTK_COMBO_BOX(type_om), 0); pSS->getValueUTF8(AP_STRING_ID_DLG_Lists_Type,s); type_lb = gtk_label_new (s.utf8_str()); gtk_widget_show (type_lb); gtk_table_attach (GTK_TABLE (table1), type_lb, 0, 1, 0, 1, (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), (GtkAttachOptions) (0), 0, 0); gtk_misc_set_alignment (GTK_MISC (type_lb), 0, 0.5); pSS->getValueUTF8(AP_STRING_ID_DLG_Lists_Style,s); style_lb = gtk_label_new (s.utf8_str()); gtk_widget_show (style_lb); gtk_table_attach (GTK_TABLE (table1), style_lb, 0, 1, 1, 2, (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), (GtkAttachOptions) (0), 0, 0); gtk_misc_set_alignment (GTK_MISC (style_lb), 0, 0.5); pSS->getValueUTF8(AP_STRING_ID_DLG_Lists_SetDefault,s); customized_cb = gtk_dialog_add_button (GTK_DIALOG(m_wMainWindow), s.utf8_str(), BUTTON_RESET); gtk_widget_show (customized_cb); /* todo gtk_table_attach (GTK_TABLE (table1), customized_cb, 0, 2, 2, 3, (GtkAttachOptions) (GTK_SHRINK), (GtkAttachOptions) (0), 0, 0); */ frame1 = gtk_frame_new (NULL); gtk_frame_set_shadow_type(GTK_FRAME(frame1), GTK_SHADOW_NONE); //gtk_widget_show (frame1); gtk_box_pack_start (GTK_BOX (vbox4), frame1, TRUE, TRUE, 0); table2 = gtk_table_new (6, 2, FALSE); gtk_widget_show (table2); gtk_container_add (GTK_CONTAINER (frame1), table2); gtk_container_set_border_width (GTK_CONTAINER (table2), 4); gtk_widget_set_sensitive (table2, TRUE); gtk_table_set_row_spacings (GTK_TABLE (table2), 4); gtk_table_set_col_spacings (GTK_TABLE (table2), 4); font_om_menu = gtk_list_store_new (2, G_TYPE_STRING, G_TYPE_INT); _fillFontMenu(font_om_menu); font_om = GTK_COMBO_BOX(gtk_combo_box_new()); gtk_combo_box_set_model(font_om, GTK_TREE_MODEL(font_om_menu)); gtk_widget_show (GTK_WIDGET(font_om)); gtk_table_attach (GTK_TABLE (table2), GTK_WIDGET(font_om), 1, 2, 1, 2, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0); format_en = gtk_entry_new (); gtk_entry_set_max_length(GTK_ENTRY(format_en), 20); gtk_widget_show (format_en); gtk_table_attach (GTK_TABLE (table2), format_en, 1, 2, 0, 1, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0); gtk_entry_set_text (GTK_ENTRY (format_en), "%L"); decimal_en = gtk_entry_new (); gtk_widget_show (decimal_en); gtk_table_attach (GTK_TABLE (table2), decimal_en, 1, 2, 2, 3, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0); gtk_entry_set_text (GTK_ENTRY (format_en), ""); start_sb_adj = (GtkAdjustment*)gtk_adjustment_new (1, 0, G_MAXINT32, 1, 10, 10); start_sb = gtk_spin_button_new (GTK_ADJUSTMENT (start_sb_adj), 1, 0); gtk_widget_show (start_sb); gtk_table_attach (GTK_TABLE (table2), start_sb, 1, 2, 3, 4, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0); text_align_sb_adj = (GtkAdjustment*)gtk_adjustment_new (0.25, 0, 10, 0.01, 0.2, 1); text_align_sb = gtk_spin_button_new (GTK_ADJUSTMENT (text_align_sb_adj), 0.05, 2); gtk_widget_show (text_align_sb); gtk_table_attach (GTK_TABLE (table2), text_align_sb, 1, 2, 4, 5, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0); gtk_spin_button_set_snap_to_ticks (GTK_SPIN_BUTTON (text_align_sb), TRUE); gtk_spin_button_set_wrap (GTK_SPIN_BUTTON (text_align_sb), TRUE); label_align_sb_adj = (GtkAdjustment*)gtk_adjustment_new (0, 0, 10, 0.01, 0.2, 1); label_align_sb = gtk_spin_button_new (GTK_ADJUSTMENT (label_align_sb_adj), 0.05, 2); gtk_widget_show (label_align_sb); gtk_table_attach (GTK_TABLE (table2), label_align_sb, 1, 2, 5, 6, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0); gtk_spin_button_set_snap_to_ticks (GTK_SPIN_BUTTON (label_align_sb), TRUE); gtk_spin_button_set_wrap (GTK_SPIN_BUTTON (label_align_sb), TRUE); pSS->getValueUTF8(AP_STRING_ID_DLG_Lists_Format,s); format_lb = gtk_label_new (s.utf8_str()); gtk_widget_show (format_lb); gtk_table_attach (GTK_TABLE (table2), format_lb, 0, 1, 0, 1, (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), (GtkAttachOptions) (0), 0, 0); gtk_misc_set_alignment (GTK_MISC (format_lb), 0.0, 0.5); pSS->getValueUTF8(AP_STRING_ID_DLG_Lists_Font,s); font_lb = gtk_label_new (s.utf8_str()); gtk_widget_show (font_lb); gtk_table_attach (GTK_TABLE (table2), font_lb, 0, 1, 1, 2, (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), (GtkAttachOptions) (0), 0, 0); gtk_misc_set_alignment (GTK_MISC (font_lb), 0.0, 0.5); pSS->getValueUTF8(AP_STRING_ID_DLG_Lists_DelimiterString,s); delimiter_lb = gtk_label_new (s.utf8_str()); gtk_widget_show (delimiter_lb); gtk_table_attach (GTK_TABLE (table2), delimiter_lb, 0, 1, 2, 3, (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), (GtkAttachOptions) (0), 0, 0); gtk_misc_set_alignment (GTK_MISC (delimiter_lb), 0.0, 0.5); pSS->getValueUTF8(AP_STRING_ID_DLG_Lists_Start,s); start_at_lb = gtk_label_new (s.utf8_str()); gtk_widget_show (start_at_lb); gtk_table_attach (GTK_TABLE (table2), start_at_lb, 0, 1, 3, 4, (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), (GtkAttachOptions) (0), 0, 0); gtk_misc_set_alignment (GTK_MISC (start_at_lb), 0.0, 0.5); pSS->getValueUTF8(AP_STRING_ID_DLG_Lists_Align,s); text_align_lb = gtk_label_new (s.utf8_str()); gtk_widget_show (text_align_lb); gtk_table_attach (GTK_TABLE (table2), text_align_lb, 0, 1, 4, 5, (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), (GtkAttachOptions) (0), 0, 0); gtk_misc_set_alignment (GTK_MISC (text_align_lb), 0.0, 0.5); pSS->getValueUTF8(AP_STRING_ID_DLG_Lists_Indent,s); label_align_lb = gtk_label_new (s.utf8_str()); gtk_widget_show (label_align_lb); gtk_table_attach (GTK_TABLE (table2), label_align_lb, 0, 1, 5, 6, (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), (GtkAttachOptions) (0), 0, 0); gtk_misc_set_alignment (GTK_MISC (label_align_lb), 0.0, 0.5); vbox3 = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0); gtk_widget_show (vbox3); gtk_box_pack_start (GTK_BOX (hbox2), vbox3, TRUE, TRUE, 0); pSS->getValueUTF8(AP_STRING_ID_DLG_Lists_Preview,s); preview_lb = gtk_label_new (s.utf8_str()); gtk_widget_show (preview_lb); gtk_box_pack_start (GTK_BOX (vbox3), preview_lb, FALSE, FALSE, 0); gtk_misc_set_alignment (GTK_MISC (preview_lb), 0.0, 0.5); preview_frame = gtk_frame_new (NULL); gtk_widget_show (preview_frame); gtk_box_pack_start (GTK_BOX (vbox3), preview_frame, TRUE, TRUE, 0); gtk_container_set_border_width (GTK_CONTAINER (preview_frame), 3); gtk_frame_set_shadow_type (GTK_FRAME (preview_frame), GTK_SHADOW_NONE); preview_area = createDrawingArea (); gtk_widget_set_size_request (preview_area,180,225); gtk_widget_show (preview_area); gtk_container_add (GTK_CONTAINER (preview_frame), preview_area); hbox1 = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0); if(!isModal()) gtk_widget_show (hbox1); gtk_box_pack_start (GTK_BOX (vbox2), hbox1, FALSE, FALSE, 0); pSS->getValueUTF8(AP_STRING_ID_DLG_Lists_Start_New,s); start_list_rb = gtk_radio_button_new_with_label (action_group, s.utf8_str()); action_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (start_list_rb)); if(!isModal()) gtk_widget_show (start_list_rb); gtk_box_pack_start (GTK_BOX (hbox1), start_list_rb, FALSE, FALSE, 0); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (start_list_rb), TRUE); pSS->getValueUTF8(AP_STRING_ID_DLG_Lists_Apply_Current,s); apply_list_rb = gtk_radio_button_new_with_label (action_group, s.utf8_str()); action_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (apply_list_rb)); if(!isModal()) gtk_widget_show (apply_list_rb); gtk_box_pack_start (GTK_BOX (hbox1), apply_list_rb, FALSE, FALSE, 0); pSS->getValueUTF8(AP_STRING_ID_DLG_Lists_Resume,s); resume_list_rb = gtk_radio_button_new_with_label (action_group, s.utf8_str()); action_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (resume_list_rb)); if(!isModal()) gtk_widget_show (resume_list_rb); gtk_box_pack_start (GTK_BOX (hbox1), resume_list_rb, FALSE, FALSE, 0); // Save useful widgets in member variables if(isModal()) { m_wContents = vbox2; } else { m_wContents = wNoteBook; } m_wStartNewList = start_list_rb; m_wStartNew_label = gtk_bin_get_child(GTK_BIN(start_list_rb)); m_wApplyCurrent = apply_list_rb; m_wStartSubList = resume_list_rb; m_wStartSub_label = gtk_bin_get_child(GTK_BIN(resume_list_rb)); m_wRadioGroup = action_group; m_wPreviewArea = preview_area; m_wDelimEntry = format_en; m_oAlignList_adj = text_align_sb_adj; m_wAlignListSpin = text_align_sb; m_oIndentAlign_adj = label_align_sb_adj; m_wIndentAlignSpin = label_align_sb; m_wDecimalEntry = decimal_en; m_oStartSpin_adj = start_sb_adj; m_wStartSpin = start_sb; m_wFontOptions = font_om; m_wFontOptions_menu = font_om_menu; m_wCustomFrame = frame1; m_wCustomLabel = customized_cb; m_wCustomTable = table2; m_wListStyleBox = GTK_COMBO_BOX(style_om); m_wListTypeBox = GTK_COMBO_BOX(type_om); m_wListType_menu = m_wListStyleNumbered_menu; // Start by hiding the Custom frame // // gtk_widget_hide(m_wCustomFrame); gtk_widget_show(m_wCustomFrame); setbisCustomized(false); return m_wContents; }