MCPcopy Create free account
hub / github.com/RomanKubiak/ctrlr / triggerSourceChangeFromEditor

Method triggerSourceChangeFromEditor

Source/Lua/Methods/CtrlrLuaMethod.cpp:220–249  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

218}
219
220void CtrlrLuaMethod::triggerSourceChangeFromEditor(const bool recompile)
221{
222 if (methodCodeEditor == nullptr || methodCodeEditor.wasObjectDeleted())
223 {
224 jassertfalse; // no editor and we got a trigger from it ? that's just fucked up
225 return;
226 }
227
228 if (isSourceInFile())
229 {
230 // replace the contents of the file with the editors content
231 getSourceFile().replaceWithText (methodCodeEditor->getCodeDocument().getAllContent());
232 }
233 else
234 {
235 // replace the contents of the property with the editors content
236 methodTree.setProperty (Ids::luaMethodCode, methodCodeEditor.get()->getCodeDocument().getAllContent(), nullptr);
237 }
238
239 if (recompile)
240 {
241 // we need to recompile our code
242 setCodeInternal (getCode());
243 }
244 else
245 {
246 errorString.clear();
247 errorString.append (Time::getCurrentTime().formatted (getName()+" saved at %m/%d/%y %H:%M:%S\n"), out, Colours::black);
248 }
249}
250
251int CtrlrLuaMethod::getCodeSize()
252{

Callers 2

saveDocumentMethod · 0.80

Calls 8

replaceWithTextMethod · 0.80
getAllContentMethod · 0.80
formattedMethod · 0.80
getNameFunction · 0.50
setPropertyMethod · 0.45
getMethod · 0.45
clearMethod · 0.45
appendMethod · 0.45

Tested by

no test coverage detected