executeMacroListCB: click into the Macro list on the left
| 2318 | |
| 2319 | // executeMacroListCB: click into the Macro list on the left |
| 2320 | void CsvApplication::executeMacroListCB(Fl_Widget *widget, void *data) { |
| 2321 | Fl_Hold_Browser *macroList = (Fl_Hold_Browser *)widget; |
| 2322 | std::tuple<Fl_Text_Buffer *, Fl_Text_Editor *> *widgets = (std::tuple<Fl_Text_Buffer *, Fl_Text_Editor *> *)data; |
| 2323 | Fl_Text_Buffer *sourceBuffer = std::get<0>(*widgets); |
| 2324 | int clickedItem = macroList->value(); |
| 2325 | if( clickedItem > 0 && clickedItem <= macroList->size() ) { |
| 2326 | // clicked onto an item |
| 2327 | char *macroSource = sourceBuffer->text(); |
| 2328 | if( macroSource ) { |
| 2329 | const char *macroName = macroList->text(app.lastSelectedMacro); |
| 2330 | if( macroName ) { |
| 2331 | macros.set( macroName, macroSource ); |
| 2332 | } |
| 2333 | delete macroSource; // Fl_Text_Buffer::text() returns a pointer that has to be freed by the application |
| 2334 | } |
| 2335 | sourceBuffer->text( app.getPreference(¯os, macroList->text(clickedItem), "").c_str() ); |
| 2336 | |
| 2337 | app.lastChoosenMacroName = macroList->text(clickedItem); |
| 2338 | app.lastSelectedMacro = clickedItem; |
| 2339 | } else { |
| 2340 | // clicked outside of macro items |
| 2341 | macroList->select(app.lastSelectedMacro); |
| 2342 | } |
| 2343 | } |
| 2344 | |
| 2345 | |
| 2346 | void CsvApplication::executeMacroCB(Fl_Widget *, void *data) { |
nothing calls this directly
no test coverage detected