mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-10 23:44:24 +00:00
Introjucer: added a "save all" command.
This commit is contained in:
parent
ab053c5503
commit
4e085e7707
4 changed files with 23 additions and 8 deletions
|
|
@ -229,6 +229,7 @@ public:
|
|||
menu.addCommandItem (commandManager, CommandIDs::closeDocument);
|
||||
menu.addCommandItem (commandManager, CommandIDs::saveDocument);
|
||||
menu.addCommandItem (commandManager, CommandIDs::saveDocumentAs);
|
||||
menu.addCommandItem (commandManager, CommandIDs::saveAll);
|
||||
menu.addSeparator();
|
||||
menu.addCommandItem (commandManager, CommandIDs::closeProject);
|
||||
menu.addCommandItem (commandManager, CommandIDs::saveProject);
|
||||
|
|
@ -381,7 +382,7 @@ public:
|
|||
|
||||
case CommandIDs::saveAll:
|
||||
result.setInfo ("Save All", "Saves all open documents", CommandCategories::general, 0);
|
||||
result.setActive (openDocumentManager.anyFilesNeedSaving());
|
||||
result.defaultKeypresses.add (KeyPress ('s', ModifierKeys::commandModifier | ModifierKeys::altModifier, 0));
|
||||
break;
|
||||
|
||||
case CommandIDs::showUTF8Tool:
|
||||
|
|
|
|||
|
|
@ -111,7 +111,7 @@ void MainWindow::makeVisible()
|
|||
|
||||
ProjectContentComponent* MainWindow::getProjectContentComponent() const
|
||||
{
|
||||
return dynamic_cast <ProjectContentComponent*> (getContentComponent());
|
||||
return dynamic_cast<ProjectContentComponent*> (getContentComponent());
|
||||
}
|
||||
|
||||
void MainWindow::closeButtonPressed()
|
||||
|
|
@ -235,12 +235,12 @@ void MainWindow::filesDropped (const StringArray& filenames, int /*mouseX*/, int
|
|||
bool MainWindow::shouldDropFilesWhenDraggedExternally (const DragAndDropTarget::SourceDetails& sourceDetails,
|
||||
StringArray& files, bool& canMoveFiles)
|
||||
{
|
||||
if (TreeView* tv = dynamic_cast <TreeView*> (sourceDetails.sourceComponent.get()))
|
||||
if (TreeView* tv = dynamic_cast<TreeView*> (sourceDetails.sourceComponent.get()))
|
||||
{
|
||||
Array<JucerTreeViewBase*> selected;
|
||||
|
||||
for (int i = tv->getNumSelectedItems(); --i >= 0;)
|
||||
if (JucerTreeViewBase* b = dynamic_cast <JucerTreeViewBase*> (tv->getSelectedItem(i)))
|
||||
if (JucerTreeViewBase* b = dynamic_cast<JucerTreeViewBase*> (tv->getSelectedItem(i)))
|
||||
selected.add (b);
|
||||
|
||||
if (selected.size() > 0)
|
||||
|
|
@ -444,7 +444,7 @@ MainWindow* MainWindowList::getOrCreateFrontmostWindow()
|
|||
|
||||
for (int i = Desktop::getInstance().getNumComponents(); --i >= 0;)
|
||||
{
|
||||
MainWindow* mw = dynamic_cast <MainWindow*> (Desktop::getInstance().getComponent (i));
|
||||
MainWindow* mw = dynamic_cast<MainWindow*> (Desktop::getInstance().getComponent (i));
|
||||
if (windows.contains (mw))
|
||||
return mw;
|
||||
}
|
||||
|
|
@ -459,7 +459,7 @@ MainWindow* MainWindowList::getOrCreateEmptyWindow()
|
|||
|
||||
for (int i = Desktop::getInstance().getNumComponents(); --i >= 0;)
|
||||
{
|
||||
MainWindow* mw = dynamic_cast <MainWindow*> (Desktop::getInstance().getComponent (i));
|
||||
MainWindow* mw = dynamic_cast<MainWindow*> (Desktop::getInstance().getComponent (i));
|
||||
if (windows.contains (mw) && mw->getProject() == nullptr)
|
||||
return mw;
|
||||
}
|
||||
|
|
@ -467,6 +467,13 @@ MainWindow* MainWindowList::getOrCreateEmptyWindow()
|
|||
return createNewMainWindow();
|
||||
}
|
||||
|
||||
void MainWindowList::updateAllWindowTitles()
|
||||
{
|
||||
for (int i = 0; i < windows.size(); ++i)
|
||||
if (ProjectContentComponent* pc = windows.getUnchecked(i)->getProjectContentComponent())
|
||||
pc->updateMainWindowTitle();
|
||||
}
|
||||
|
||||
void MainWindowList::avoidSuperimposedWindows (MainWindow* const mw)
|
||||
{
|
||||
for (int i = windows.size(); --i >= 0;)
|
||||
|
|
@ -499,7 +506,7 @@ void MainWindowList::saveCurrentlyOpenProjectList()
|
|||
Desktop& desktop = Desktop::getInstance();
|
||||
for (int i = 0; i < desktop.getNumComponents(); ++i)
|
||||
{
|
||||
if (MainWindow* const mw = dynamic_cast <MainWindow*> (desktop.getComponent(i)))
|
||||
if (MainWindow* const mw = dynamic_cast<MainWindow*> (desktop.getComponent(i)))
|
||||
if (Project* p = mw->getProject())
|
||||
projects.add (p->getFile());
|
||||
}
|
||||
|
|
@ -526,7 +533,7 @@ Project* MainWindowList::getFrontmostProject()
|
|||
Desktop& desktop = Desktop::getInstance();
|
||||
|
||||
for (int i = desktop.getNumComponents(); --i >= 0;)
|
||||
if (MainWindow* const mw = dynamic_cast <MainWindow*> (desktop.getComponent(i)))
|
||||
if (MainWindow* const mw = dynamic_cast<MainWindow*> (desktop.getComponent(i)))
|
||||
if (Project* p = mw->getProject())
|
||||
return p;
|
||||
|
||||
|
|
|
|||
|
|
@ -107,6 +107,8 @@ public:
|
|||
void reopenLastProjects();
|
||||
void saveCurrentlyOpenProjectList();
|
||||
|
||||
void updateAllWindowTitles();
|
||||
|
||||
void avoidSuperimposedWindows (MainWindow*);
|
||||
|
||||
void sendLookAndFeelChange();
|
||||
|
|
|
|||
|
|
@ -257,9 +257,14 @@ bool OpenDocumentManager::anyFilesNeedSaving() const
|
|||
bool OpenDocumentManager::saveAll()
|
||||
{
|
||||
for (int i = documents.size(); --i >= 0;)
|
||||
{
|
||||
if (! documents.getUnchecked (i)->save())
|
||||
return false;
|
||||
|
||||
IntrojucerApp::getApp().mainWindowList.updateAllWindowTitles();
|
||||
IntrojucerApp::getCommandManager().commandStatusChanged();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue