| 305 | } |
| 306 | |
| 307 | void ScriptingEditor::showCallback(int callbackIndex, int lineToScroll/*=-1*/) |
| 308 | { |
| 309 | if (currentCallbackIndex != callbackIndex && callbackIndex < callbackButtons.size()) |
| 310 | { |
| 311 | if (codeEditor != nullptr) |
| 312 | lastPositions.set(currentCallbackIndex, CommonEditorFunctions::getCaretPos(codeEditor).getPosition());; |
| 313 | |
| 314 | currentCallbackIndex = callbackIndex; |
| 315 | |
| 316 | callbackButtons[callbackIndex]->setToggleState(true, dontSendNotification); |
| 317 | |
| 318 | auto jp = dynamic_cast<JavascriptProcessor*>(getProcessor()); |
| 319 | |
| 320 | auto d = jp->getSnippet(callbackIndex); |
| 321 | |
| 322 | addAndMakeVisible(codeEditor = new PopupIncludeEditor(jp, d->getCallbackName())); |
| 323 | |
| 324 | CodeDocument::Position pos(*d, lastPositions[callbackIndex]); |
| 325 | CommonEditorFunctions::moveCaretTo(codeEditor, pos, false); |
| 326 | |
| 327 | } |
| 328 | else |
| 329 | { |
| 330 | currentCallbackIndex = -1; |
| 331 | codeEditor = nullptr; |
| 332 | } |
| 333 | |
| 334 | refreshBodySize(); |
| 335 | resized(); |
| 336 | } |
| 337 | |
| 338 | void ScriptingEditor::showOnInitCallback() |
| 339 | { |
nothing calls this directly
no test coverage detected