# HG changeset patch # User Chris Cannam # Date 1173883179 0 # Node ID a45733cc3939b1c644dfc87651feead2ff58fe8d # Parent 8ad3609080b3f6dff00d422736f8bfc7745a551a * Remove tip dialog for now. I don't like it enough * Fixes to export image diff -r 8ad3609080b3 -r a45733cc3939 i18n/tips_en.xml --- a/i18n/tips_en.xml Tue Mar 13 19:51:09 2007 +0000 +++ b/i18n/tips_en.xml Wed Mar 14 14:39:39 2007 +0000 @@ -1,13 +1,16 @@ + + + -

Welcome to Sonic Visualiser!

-

Sonic Visualiser is pretty complex, but you can use it for simple -things very easily.

-

Try importing an audio file and using the Pane -menu to add some different views of it.

-

Check out the links on the Help menu for tutorials and other -documentation!

+

Welcome to Sonic Visualiser!

Sonic Visualiser is a +complex application, but it's easy enough to get started with.

+

Try importing an audio file and using the Pane menu to add some +different views of it.

Check out the links on the Help menu for +tutorials and other documentation!

diff -r 8ad3609080b3 -r a45733cc3939 main/MainWindow.cpp --- a/main/MainWindow.cpp Tue Mar 13 19:51:09 2007 +0000 +++ b/main/MainWindow.cpp Wed Mar 14 14:39:39 2007 +0000 @@ -2303,7 +2303,60 @@ if (QFileInfo(path).suffix() == "") path += ".png"; - QImage *image = pane->toNewImage(); + bool haveSelection = m_viewManager && !m_viewManager->getSelections().empty(); + + QSize total, visible, selected; + total = pane->getImageSize(); + visible = pane->getImageSize(pane->getFirstVisibleFrame(), + pane->getLastVisibleFrame()); + + size_t sf0 = 0, sf1 = 0; + + if (haveSelection) { + MultiSelection::SelectionList selections = m_viewManager->getSelections(); + sf0 = selections.begin()->getStartFrame(); + MultiSelection::SelectionList::iterator e = selections.end(); + --e; + sf1 = e->getEndFrame(); + selected = pane->getImageSize(sf0, sf1); + } + + QStringList items; + items << tr("Export the entire pane (%1x%2 pixels") + .arg(total.width()).arg(total.height()); + items << tr("Export the visible area only (%1x%2 pixels)") + .arg(visible.width()).arg(visible.height()); + if (haveSelection) { + items << tr("Export the selection extent (%1x%2 pixels)") + .arg(selected.width()).arg(selected.height()); + } + + QSettings settings; + settings.beginGroup("MainWindow"); + int deflt = settings.value("lastimageexportregion", 0).toInt(); + if (deflt == 2 && !haveSelection) deflt = 1; + + bool ok = false; + QString item = ListInputDialog::getItem + (this, tr("Select region to export"), + tr("Which region of the current pane do you want to export as an image?"), + items, deflt, &ok); + + if (!ok || item.isEmpty()) return; + + settings.setValue("lastimageexportregion", deflt); + + QImage *image = 0; + + if (item == items[0]) { + image = pane->toNewImage(); + } else if (item == items[1]) { + image = pane->toNewImage(pane->getFirstVisibleFrame(), + pane->getLastVisibleFrame()); + } else if (haveSelection) { + image = pane->toNewImage(sf0, sf1); + } + if (!image) return; if (!image->save(path, "PNG")) { diff -r 8ad3609080b3 -r a45733cc3939 main/main.cpp --- a/main/main.cpp Tue Mar 13 19:51:09 2007 +0000 +++ b/main/main.cpp Wed Mar 14 14:39:39 2007 +0000 @@ -194,12 +194,12 @@ QMessageBox::tr("File \"%1\" could not be opened").arg(path)); } } - +/* TipDialog tipDialog; if (tipDialog.isOK()) { tipDialog.exec(); } - +*/ int rv = application.exec(); std::cerr << "application.exec() returned " << rv << std::endl;