MCPcopy Create free account
hub / github.com/Tablecruncher/tablecruncher / executeMacroListCB

Method executeMacroListCB

src/csvapplication.cpp:2320–2343  ·  view source on GitHub ↗

executeMacroListCB: click into the Macro list on the left

Source from the content-addressed store, hash-verified

2318
2319// executeMacroListCB: click into the Macro list on the left
2320void 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(&macros, 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
2346void CsvApplication::executeMacroCB(Fl_Widget *, void *data) {

Callers

nothing calls this directly

Calls 4

setMethod · 0.80
getPreferenceMethod · 0.80
valueMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected