text
stringlengths
0
2.2M
void JucerDocument::userEditedCpp()
{
if (userDocChangeTimer == nullptr)
userDocChangeTimer.reset (new UserDocChangeTimer (*this));
userDocChangeTimer->startTimer (500);
}
void JucerDocument::beginTransaction()
{
getUndoManager().beginNewTransaction();
}
void JucerDocument::beginTransaction (const String& name)
{
getUndoManager().beginNewTransaction (name);
}
void JucerDocument::timerCallback()
{
if (! Component::isMouseButtonDownAnywhere())
{
stopTimer();
beginTransaction();
flushChangesToDocuments (nullptr, false);
}
}
void JucerDocument::codeDocumentTextInserted (const String&, int) { userEditedCpp(); }
void JucerDocument::codeDocumentTextDeleted (int, int) { userEditedCpp(); }
bool JucerDocument::perform (UndoableAction* const action, const String& actionName)
{
return undoManager.perform (action, actionName);
}
void JucerDocument::refreshAllPropertyComps()
{
if (ComponentLayout* l = getComponentLayout())
l->getSelectedSet().changed();
for (int i = getNumPaintRoutines(); --i >= 0;)
{
getPaintRoutine (i)->getSelectedElements().changed();
getPaintRoutine (i)->getSelectedPoints().changed();
}
}
//==============================================================================
void JucerDocument::setClassName (const String& newName)
{
if (newName != className
&& build_tools::makeValidIdentifier (newName, false, false, true).isNotEmpty())
{
className = build_tools::makeValidIdentifier (newName, false, false, true);
changed();
}
}
void JucerDocument::setComponentName (const String& newName)
{
if (newName != componentName)
{
componentName = newName;
changed();
}
}
void JucerDocument::setParentClasses (const String& classes)
{
if (classes != parentClasses)
{
StringArray parentClassLines (getCleanedStringArray (StringArray::fromTokens (classes, ",", StringRef())));
for (int i = parentClassLines.size(); --i >= 0;)
{
String s (parentClassLines[i]);
String type;
if (s.startsWith ("public ")
|| s.startsWith ("protected ")
|| s.startsWith ("private "))
{
type = s.upToFirstOccurrenceOf (" ", true, false);
s = s.fromFirstOccurrenceOf (" ", false, false);
if (s.trim().isEmpty())
type = s = String();
}
s = type + build_tools::makeValidIdentifier (s.trim(), false, false, true, true);
parentClassLines.set (i, s);
}
parentClasses = parentClassLines.joinIntoString (", ");
changed();
}