mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-02-03 03:30:06 +00:00
Renamed the experimental jucer as the Introjucer.
This commit is contained in:
parent
6e76ba29ab
commit
82e8d68a5d
94 changed files with 187 additions and 169 deletions
|
|
@ -0,0 +1,131 @@
|
|||
/*
|
||||
==============================================================================
|
||||
|
||||
This file is part of the JUCE library - "Jules' Utility Class Extensions"
|
||||
Copyright 2004-10 by Raw Material Software Ltd.
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
|
||||
JUCE can be redistributed and/or modified under the terms of the GNU General
|
||||
Public License (Version 2), as published by the Free Software Foundation.
|
||||
A copy of the license is included in the JUCE distribution, or can be found
|
||||
online at www.gnu.org/licenses.
|
||||
|
||||
JUCE is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
|
||||
A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
|
||||
To release a closed-source product which uses JUCE, commercial licenses are
|
||||
available: visit www.rawmaterialsoftware.com/juce for more information.
|
||||
|
||||
==============================================================================
|
||||
*/
|
||||
|
||||
#include "jucer_DocumentEditorComponent.h"
|
||||
#include "../Project/jucer_ProjectContentComponent.h"
|
||||
|
||||
|
||||
//==============================================================================
|
||||
DocumentEditorComponent::DocumentEditorComponent (OpenDocumentManager::Document* document_)
|
||||
: document (document_)
|
||||
{
|
||||
OpenDocumentManager::getInstance()->addListener (this);
|
||||
}
|
||||
|
||||
DocumentEditorComponent::~DocumentEditorComponent()
|
||||
{
|
||||
OpenDocumentManager::getInstance()->removeListener (this);
|
||||
}
|
||||
|
||||
void DocumentEditorComponent::documentAboutToClose (OpenDocumentManager::Document* closingDoc)
|
||||
{
|
||||
if (document == closingDoc)
|
||||
{
|
||||
jassert (document != 0);
|
||||
ProjectContentComponent* pcc = findParentComponentOfClass ((ProjectContentComponent*) 0);
|
||||
|
||||
if (pcc != 0)
|
||||
{
|
||||
pcc->hideDocument (document);
|
||||
return;
|
||||
}
|
||||
|
||||
jassertfalse
|
||||
}
|
||||
}
|
||||
|
||||
ApplicationCommandTarget* DocumentEditorComponent::getNextCommandTarget()
|
||||
{
|
||||
return findFirstTargetParentComponent();
|
||||
}
|
||||
|
||||
void DocumentEditorComponent::getAllCommands (Array <CommandID>& commands)
|
||||
{
|
||||
const CommandID ids[] = { CommandIDs::saveDocument,
|
||||
CommandIDs::saveDocumentAs,
|
||||
CommandIDs::closeDocument };
|
||||
|
||||
commands.addArray (ids, numElementsInArray (ids));
|
||||
}
|
||||
|
||||
void DocumentEditorComponent::getCommandInfo (const CommandID commandID, ApplicationCommandInfo& result)
|
||||
{
|
||||
result.setActive (document != 0);
|
||||
String name;
|
||||
|
||||
if (document != 0)
|
||||
name = " '" + document->getName().substring (0, 32) + "'";
|
||||
|
||||
switch (commandID)
|
||||
{
|
||||
case CommandIDs::saveDocument:
|
||||
result.setInfo ("Save" + name,
|
||||
"Saves the current document",
|
||||
CommandCategories::general, 0);
|
||||
result.defaultKeypresses.add (KeyPress ('s', ModifierKeys::commandModifier, 0));
|
||||
break;
|
||||
|
||||
case CommandIDs::saveDocumentAs:
|
||||
result.setInfo ("Save" + name + " As...",
|
||||
"Saves the current document to a different filename",
|
||||
CommandCategories::general, 0);
|
||||
result.defaultKeypresses.add (KeyPress ('s', ModifierKeys::commandModifier | ModifierKeys::shiftModifier, 0));
|
||||
break;
|
||||
|
||||
case CommandIDs::closeDocument:
|
||||
result.setInfo ("Close" + name,
|
||||
"Closes the current document",
|
||||
CommandCategories::general, 0);
|
||||
result.defaultKeypresses.add (KeyPress ('w', ModifierKeys::commandModifier | ModifierKeys::shiftModifier, 0));
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
bool DocumentEditorComponent::perform (const InvocationInfo& info)
|
||||
{
|
||||
switch (info.commandID)
|
||||
{
|
||||
case CommandIDs::saveDocument:
|
||||
document->save();
|
||||
return true;
|
||||
|
||||
case CommandIDs::saveDocumentAs:
|
||||
jassertfalse //xxxx
|
||||
//document.save();
|
||||
return true;
|
||||
|
||||
case CommandIDs::closeDocument:
|
||||
OpenDocumentManager::getInstance()->closeDocument (document, true);
|
||||
return true;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue