void KstVectorDialogI::edit_I() { int index; KstFilePtr file; KstRVectorPtr vector; index = Select->currentItem(); KstRVectorList vectorList = kstObjectSubList<KstVector,KstRVector>(KST::vectorList); if (index < 0) { KMessageBox::sorry(0L, i18n("You need to select an active vector to edit.")); return; } if (unsigned(index) >= vectorList.count()) { new_I(); } else { /* verify that the vector name is unique */ if (Select->currentText() != vectorList[index]->tagName()) { if (KST::dataTagNameNotUnique(Select->currentText())) return; } /* if there is not an active KstFile, create one */ KstFileList::Iterator it = KST::fileList.findFileName(FileName->url()); if (it == KST::fileList.end()) { file = new KstFile(FileName->url()); if (file->numFrames() < 1) { // No data in file KMessageBox::sorry(0L, i18n("The requested file does not contain data.")); return; } KST::fileList.append(file); } else { file = *it; } if (!file->isValidField(Field->currentText())) { KMessageBox::sorry(0L, i18n("The requested field is not defined for the requested file\n")); return; } vector = vectorList[index]; /* change the vector */ vector->change(file, Field->currentText(), Select->currentText(), (CountFromEnd->isChecked() ? -1 : F0->value()), (ReadToEnd->isChecked() ? -1 : N->value()), Skip->value(), DoSkip->isChecked(), DoFilter->isChecked()); /** purge unused files */ //doc->fileList.Purge(); vector = 0L; vectorList.clear(); emit modified(); } }
KstPsdDialogI::KstPsdDialogI(QWidget* parent, const char* name, bool modal, WFlags fl) : KstPsdDialog(parent, name, modal, fl) { connect(Select, SIGNAL(activated(int)), this, SLOT(update(int))); connect(New, SIGNAL(clicked()), this, SLOT(new_I())); connect(Edit, SIGNAL(clicked()), this, SLOT(edit_I())); connect(Delete, SIGNAL(clicked()), this, SLOT(delete_I())); connect(_vector, SIGNAL(newVectorCreated()), this, SIGNAL(modified())); }
void KstCurveDialogI::edit_I() { int index; KstVCurvePtr curve; KstVCurveList curves = kstObjectSubList<KstDataObject, KstVCurve>(KST::dataObjectList); index = Select->currentItem(); if (index < 0 || unsigned(index) >= curves.count()) { new_I(); return; } QString tag_name = Select->currentText(); /* verify that the curve name is unique */ if (tag_name != curves[index]->tagName()) { if (KST::dataTagNameNotUnique(tag_name)) { Select->setFocus(); return; } } curve = curves[index]; curve->setTagName(tag_name); { // leave this scope here to destroy the iterator KstReadLocker ml(&KST::vectorList.lock()); KstVectorList::Iterator i = KST::vectorList.findTag(_xVector->selectedVector()); if (i != KST::vectorList.end()) curve->setXVector(*i); i = KST::vectorList.findTag(_yVector->selectedVector()); if (i != KST::vectorList.end()) curve->setYVector(*i); i = KST::vectorList.findTag(_xError->selectedVector()); curve->setXError(*i); i = KST::vectorList.findTag(_yError->selectedVector()); curve->setYError(*i); } curve->setColor(_curveAppearance->color()); curve->setHasPoints(_curveAppearance->showPoints()); curve->setHasLines(_curveAppearance->showLines()); curve->setLineWidth(_curveAppearance->lineWidth()); curve->setLineStyle(_curveAppearance->lineStyle()); curve->Point.setType(_curveAppearance->pointType()); curve->update(-1); curve = 0L; curves.clear(); emit modified(); }
KstPluginDialogI::KstPluginDialogI(QWidget* parent, const char* name, bool modal, WFlags fl) : KstPluginDialog(parent, name, modal, fl) { connect(Select, SIGNAL(activated(int)), this, SLOT(updatePlugin(int))); connect(New, SIGNAL(clicked()), this, SLOT(new_I())); connect(Edit, SIGNAL(clicked()), this, SLOT(edit_I())); connect(Delete, SIGNAL(clicked()), this, SLOT(delete_I())); connect(PluginCombo, SIGNAL(activated(int)), this, SLOT(pluginChanged(int))); connect(_pluginManager, SIGNAL(clicked()), this, SLOT(showPluginManager())); QGridLayout *grid = new QGridLayout(_pluginFrame, 1, 1); grid->addWidget(_frameWidget = new QWidget(_pluginFrame, "Frame Widget"), 0, 0); }
KstCurveDialogI::KstCurveDialogI(QWidget* parent, const char* name, bool modal, WFlags fl) : KstCurveDialog(parent, name, modal, fl) { connect(Select, SIGNAL(activated(int)), this, SLOT(update(int))); connect(New, SIGNAL(clicked()), this, SLOT(new_I())); connect(Edit, SIGNAL(clicked()), this, SLOT(edit_I())); connect(Delete, SIGNAL(clicked()), this, SLOT(delete_I())); connect(_xVector, SIGNAL(newVectorCreated()), this, SIGNAL(modified())); connect(_yVector, SIGNAL(newVectorCreated()), this, SIGNAL(modified())); connect(_xError, SIGNAL(newVectorCreated()), this, SIGNAL(modified())); connect(_yError, SIGNAL(newVectorCreated()), this, SIGNAL(modified())); _xError->provideNoneVector(true); _yError->provideNoneVector(true); }
KstVectorDialogI::KstVectorDialogI(QWidget* parent, const char* name, bool modal, WFlags fl) : KstVectorDialog(parent, name, modal, fl) { connect(Select, SIGNAL(activated(int)), this, SLOT(update(int))); connect(New, SIGNAL(clicked()), this, SLOT(new_I())); connect(Edit, SIGNAL(clicked()), this, SLOT(edit_I())); connect(Delete, SIGNAL(clicked()), this, SLOT(delete_I())); FileName->setMode(KFile::File | KFile::Directory | KFile::ExistingOnly | KFile::LocalOnly); _fieldCompletion = Field->completionObject(); Field->setAutoDeleteCompletionObject( true ); // connect(Field,SIGNAL(returnPressed(const QString&)), // _fieldCompletion,SLOT(addItem(const QString&)); }
_DPlane<T> _DPlane<T>::rotate_image(double angle, T bg_val) const { int new_rows = int(ceil(sqrt(_DMatrix<T>::rows()*_DMatrix<T>::rows()+_DMatrix<T>::cols()*_DMatrix<T>::cols()))); int new_cols = new_rows; _DPlane<T> new_I(new_rows, new_cols); new_I = T(bg_val); int row_half = (_DMatrix<T>::rows()/2); int col_half = (_DMatrix<T>::cols()/2); int new_row_half = (new_rows/2); int new_col_half = (new_cols/2); float c = cos(angle); float s = sin(angle); T *cp = new_I[0]; for(int i=0; i<new_rows; ++i) { float i2 = (c*(i-new_row_half)+s*(-1-new_col_half)) + row_half; float j2 = (-s*(i-new_row_half)+c*(-1-new_col_half)) + col_half; for(int j=0; j<new_cols; ++j, ++cp) { i2 += s; j2 += c; if(i2 < 0 || j2 < 0 || i2>=_DMatrix<T>::rows()-1 || j2>=_DMatrix<T>::cols()-1) continue; int low_i = int(i2); int low_j = int(j2); float i_diff = i2-low_i; float j_diff = j2-low_j; T *cp1 = (*this)[low_i]; T *cp2 = (*this)[low_i+1]; *cp = T(((1-i_diff)*(1-j_diff)*cp1[low_j]) + ((1-i_diff)*j_diff*cp1[low_j+1]) + (i_diff*(1-j_diff)*cp2[low_j]) + (i_diff * j_diff * cp2[low_j+1])); } } return new_I; }
KstDataManagerI::KstDataManagerI(KstDoc *in_doc, QWidget* parent, const char* name, bool modal, WFlags fl) : KstDataManager(parent, name, modal, fl) { doc = in_doc; _yesPixmap = QPixmap(locate("data", "kst/pics/yes.png")); connect(Edit, SIGNAL(clicked()), this, SLOT(edit_I())); connect(Delete, SIGNAL(clicked()), this, SLOT(delete_I())); connect(New, SIGNAL(clicked()), this, SLOT(new_I())); connect(Purge, SIGNAL(clicked()), doc, SLOT(purge())); connect(DataView, SIGNAL(doubleClicked(QListViewItem *)), this, SLOT(edit_I())); connect(DataView, SIGNAL(currentChanged(QListViewItem *)), this, SLOT(currentChanged(QListViewItem *))); connect(DataView, SIGNAL(selectionChanged()), this, SLOT(selectionChanged())); connect(DataView, SIGNAL(contextMenuRequested(QListViewItem*, const QPoint&, int)), this, SLOT(contextMenu(QListViewItem*, const QPoint&, int))); }
_DPlane<T> _DPlane<T>::rotate_image_nn(double angle) const { int new_rows = int(ceil(sqrt(_DMatrix<T>::rows()*_DMatrix<T>::rows()+_DMatrix<T>::cols()*_DMatrix<T>::cols()))); int new_cols = new_rows; _DPlane<T> new_I(new_rows, new_cols); new_I = T(1e100); int row_half = (_DMatrix<T>::rows()/2); int col_half = (_DMatrix<T>::cols()/2); int new_row_half = (new_rows/2); int new_col_half = (new_cols/2); float c = cos(angle); float s = sin(angle); T *cp = new_I[0]; for(int i=0; i<new_rows; ++i) { float i2 = (c*(i-new_row_half)+s*(-1-new_col_half)) + row_half; float j2 = (-s*(i-new_row_half)+c*(-1-new_col_half)) + col_half; for(int j=0; j<new_cols; ++j, ++cp) { i2 += s; j2 += c; if(i2 < 0 || j2 < 0 || i2>=_DMatrix<T>::rows()-1 || j2>=_DMatrix<T>::cols()-1) continue; int rnd_i = (int) round(i2); int rnd_j = (int) round(j2); *cp = T((*this)[rnd_i][rnd_j]); } } return new_I; }
void KstPsdDialogI::edit_I() { int index; KstPSDCurvePtr curve; double new_freq; int new_len; index = Select->currentItem(); KstPSDCurveList curves = kstObjectSubList<KstDataObject, KstPSDCurve>(KST::dataObjectList); if (index < 0 || unsigned(index) >= curves.count()) { new_I(); return; } curve = curves[index]; /* verify that the curve name is unique */ QString tag_name = Select->currentText(); if (tag_name != curve->tagName()) { if (KST::dataTagNameNotUnique(tag_name)) { Select->setFocus(); return; } } curve->setTagName(tag_name); KST::vectorList.lock().readLock(); curve->setVector(*KST::vectorList.findTag(_vector->selectedVector())); KST::vectorList.lock().readUnlock(); curve->setColor(_curveAppearance->color()); curve->setHasPoints(_curveAppearance->showPoints()); curve->setHasLines(_curveAppearance->showLines()); curve->Point.setType(_curveAppearance->pointType()); /* find new_freq */ new_freq = SampRate->text().toDouble(); if (new_freq <= 0) { KMessageBox::sorry(NULL, i18n("The sample rate must be greater than 0")); return; } /* find new_len */ new_len = FFTLen->text().toInt(); if (new_len<2) { KMessageBox::sorry(NULL, i18n("The FFT length must be greater than 2^2")); return; } curve->setFreq(new_freq); curve->setLen(new_len); curve->VUnits = VectorUnits->text(); curve->RUnits = RateUnits->text(); curve->setAppodize(Appodize->isChecked()); curve->setRemoveMean(RemoveMean->isChecked()); curve->update(); curve = 0L; curves.clear(); emit modified(); }
void KstPluginDialogI::edit_I() { int index = Select->currentItem(); if (Select->count() == 0 || index < 0) { new_I(); return; } QString tagName = Select->currentText(); KstPluginList pl = kstObjectSubList<KstDataObject, KstPlugin>(KST::dataObjectList); KstPluginPtr plugin = pl[index]; if (!plugin.data()) { new_I(); return; } int pitem = PluginCombo->currentItem(); if (tagName.endsWith(newPluginString)) { QString tmpTagName; int i = 0; do { tmpTagName = i18n("P%1-%2").arg(++i).arg(_pluginList[pitem]); } while (KST::dataTagNameNotUnique(tmpTagName, false)); tagName = tmpTagName; } //kdDebug() << "Apply as edit [" << tagName << "]" << endl; if (tagName != plugin->tagName()) { if (KST::dataTagNameNotUnique(tagName, true, this)) { Select->setFocus(); return; } } plugin->setTagName(tagName); plugin->inputVectors().clear(); plugin->inputScalars().clear(); KstSharedPtr<Plugin> pPtr = PluginCollection::self()->plugin(_pluginList[pitem]); // Save the vectors and scalars if (!saveInputs(plugin, pPtr)) { return; } if (pitem >= 0 && PluginCombo->count() > 0) { plugin->setPlugin(pPtr); } if (!saveOutputs(plugin, pPtr)) { return; } if (!plugin->isValid()) { KMessageBox::sorry(this, i18n("There is an error in the plugin you entered. Please fix it.")); return; } plugin = 0L; // release pl.clear(); // release emit modified(); }