Exemplo n.º 1
0
void MatrixSelector::editMatrix() {
  KstDataObjectPtr pro;
  KstMatrixPtr matrix;
  
  KST::matrixList.lock().readLock();
  matrix = *KST::matrixList.findTag(_matrix->currentText());
  KST::matrixList.lock().unlock();

  if (matrix) {
    pro = kst_cast<KstDataObject>(matrix->provider());
  }

  if (pro) {
    pro->readLock();
    pro->showDialog(false);
    pro->unlock();
  } else {
// xxx    KstDialogs::self()->showMatrixDialog(_matrix->currentText(), true);
  }
}
Exemplo n.º 2
0
void KstDataManagerI::new_I() {
  QStringList l;

  //The original KstDataObjects...
  l << i18n( "Vector" );
  l << i18n( "Curve" );
  l << i18n( "Equation" );
  l << i18n( "Histogram" );
  l << i18n( "Power Spectrum" );
  l << i18n( "Event Monitor" );
  l << i18n( "Matrix" );
  l << i18n( "Image" );
  l << i18n( "CSD" );

  //The new KstDataObject plugins...
  const QStringList newPlugins = KstDataObject::pluginList();
  l += newPlugins;

  //The old C style plugins...
  QStringList oldPlugins;

  const QMap<QString,QString> readable =
    PluginCollection::self()->readableNameList();
  QMap<QString,QString>::const_iterator it = readable.begin();
  for (; it != readable.end(); ++it) {
    oldPlugins << it.key();
  }

  l += oldPlugins;

  bool ok = false;
  QStringList plugin =
      KInputDialog::getItemList( i18n( "Data Objects" ), i18n( "Create..." ), l, 0, false, &ok, this );

  if ( !ok || plugin.isEmpty() )
    return;

  const QString p = plugin.join("");

  //Oh, wouldn't it be nice if C++ could switch strings...
  if ( p == i18n( "Vector" ) )
      KstVectorDialogI::globalInstance()->show();
  else if ( p == i18n( "Curve" ) )
      KstCurveDialogI::globalInstance()->show();
  else if ( p == i18n( "Equation" ) )
      KstEqDialogI::globalInstance()->show();
  else if ( p == i18n( "Histogram" ) )
      KstHsDialogI::globalInstance()->show();
  else if ( p == i18n( "Power Spectrum" ) )
      KstPsdDialogI::globalInstance()->show();
  else if ( p == i18n( "Event Monitor" ) )
      KstEventMonitorI::globalInstance()->show();
  else if ( p == i18n( "Matrix" ) )
      KstMatrixDialogI::globalInstance()->show();
  else if ( p == i18n( "Image" ) )
      KstImageDialogI::globalInstance()->show();
  else if ( p == i18n( "CSD" ) )
      KstCsdDialogI::globalInstance()->show();
  else if ( newPlugins.contains( p ) ) {
    KstDataObjectPtr ptr = KstDataObject::plugin(p);
    ptr->showDialog();
  } else if ( oldPlugins.contains( p ) ) {
      KstPluginDialogI::globalInstance()->showNew(readable[p]);
  }
}