mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-16 00:34:19 +00:00
Projucer: Implement PIPGenerator
This commit is contained in:
parent
fa02112614
commit
47af78fe0b
31 changed files with 1256 additions and 457 deletions
|
|
@ -394,6 +394,13 @@ static void registerRecentFile (const File& file)
|
|||
getAppSettings().flush();
|
||||
}
|
||||
|
||||
static void forgetRecentFile (const File& file)
|
||||
{
|
||||
RecentlyOpenedFilesList::forgetRecentFileNatively (file);
|
||||
getAppSettings().recentFiles.removeFile (file);
|
||||
getAppSettings().flush();
|
||||
}
|
||||
|
||||
//==============================================================================
|
||||
Result Project::loadDocument (const File& file)
|
||||
{
|
||||
|
|
@ -408,6 +415,7 @@ Result Project::loadDocument (const File& file)
|
|||
return Result::fail ("The document contains errors and couldn't be parsed!");
|
||||
|
||||
registerRecentFile (file);
|
||||
|
||||
enabledModulesList.reset();
|
||||
projectRoot = newTree;
|
||||
|
||||
|
|
@ -437,9 +445,15 @@ Result Project::saveProject (const File& file, bool isCommandLineApp)
|
|||
if (isSaving)
|
||||
return Result::ok();
|
||||
|
||||
if (isTemporaryProject())
|
||||
{
|
||||
askUserWhereToSaveProject();
|
||||
return Result::ok();
|
||||
}
|
||||
|
||||
updateProjectSettings();
|
||||
|
||||
if (! isCommandLineApp)
|
||||
if (! isCommandLineApp && ! isTemporaryProject())
|
||||
registerRecentFile (file);
|
||||
|
||||
const ScopedValueSetter<bool> vs (isSaving, true, false);
|
||||
|
|
@ -454,17 +468,55 @@ Result Project::saveResourcesOnly (const File& file)
|
|||
return saver.saveResourcesOnly();
|
||||
}
|
||||
|
||||
//==============================================================================
|
||||
void Project::setTemporaryDirectory (const File& dir) noexcept
|
||||
{
|
||||
tempDirectory = dir;
|
||||
|
||||
// remove this file from the recent documents list as it is a temporary project
|
||||
forgetRecentFile (getFile());
|
||||
}
|
||||
|
||||
void Project::askUserWhereToSaveProject()
|
||||
{
|
||||
FileChooser fc ("Save Project");
|
||||
fc.browseForDirectory();
|
||||
|
||||
if (fc.getResult().exists())
|
||||
moveTemporaryDirectory (fc.getResult());
|
||||
}
|
||||
|
||||
void Project::moveTemporaryDirectory (const File& newParentDirectory)
|
||||
{
|
||||
auto newDirectory = newParentDirectory.getChildFile (tempDirectory.getFileName());
|
||||
auto oldJucerFileName = getFile().getFileName();
|
||||
|
||||
tempDirectory.copyDirectoryTo (newDirectory);
|
||||
tempDirectory.deleteRecursively();
|
||||
tempDirectory = File();
|
||||
|
||||
// reload project from new location
|
||||
if (auto* window = ProjucerApplication::getApp().mainWindowList.getMainWindowForFile (getFile()))
|
||||
window->moveProject (newDirectory.getChildFile (oldJucerFileName));
|
||||
}
|
||||
|
||||
//==============================================================================
|
||||
void Project::valueTreePropertyChanged (ValueTree& tree, const Identifier& property)
|
||||
{
|
||||
if (tree.getRoot() == tree)
|
||||
{
|
||||
if (property == Ids::projectType)
|
||||
{
|
||||
sendChangeMessage();
|
||||
}
|
||||
else if (property == Ids::name)
|
||||
{
|
||||
setTitle (projectRoot [Ids::name]);
|
||||
}
|
||||
else if (property == Ids::defines)
|
||||
{
|
||||
parsedPreprocessorDefs = parsePreprocessorDefs (preprocessorDefsValue.get());
|
||||
}
|
||||
|
||||
changed();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue