| 2214 | |
| 2215 | |
| 2216 | void CsvApplication::addNewMacroCB(Fl_Widget *, void *data) { |
| 2217 | addDelParamType *addDelParam = (addDelParamType *)data; |
| 2218 | std::string macroName; |
| 2219 | int retType; |
| 2220 | std::tie(retType, macroName) = myFlAskString("Enter Macro Name", "OK"); |
| 2221 | Fl_Browser *macroList = std::get<0>(*addDelParam); |
| 2222 | Fl_Text_Editor *sourceEditor = std::get<1>(*addDelParam); |
| 2223 | std::string newSource = "// "+macroName+"\n"; |
| 2224 | |
| 2225 | if( retType ) { |
| 2226 | if( macroName != "") { |
| 2227 | if( !macros.entryExists(macroName.c_str()) ) { |
| 2228 | app.lastChoosenMacroName = macroName; |
| 2229 | macros.set( macroName.c_str(), newSource.c_str() ); |
| 2230 | updateMacroBrowserList(macroList); |
| 2231 | int insertedIndex = selectMacroBrowserEntry(macroList, macroName); |
| 2232 | if( insertedIndex > 0 && insertedIndex <= macroList->size() ) { |
| 2233 | app.lastSelectedMacro = insertedIndex; |
| 2234 | Fl_Text_Buffer *sourceBuffer = sourceEditor->buffer(); |
| 2235 | if( sourceBuffer ) { |
| 2236 | sourceBuffer->text( app.getPreference(¯os, macroName, "").c_str() ); |
| 2237 | } |
| 2238 | } |
| 2239 | sourceEditor->show(); |
| 2240 | } else { |
| 2241 | myFlChoice("", "This macro name is already in use. Please provide a new macro name.", {"Okay"}); |
| 2242 | } |
| 2243 | } else { |
| 2244 | myFlChoice("", "You have to enter a macro name.", {"Okay"}); |
| 2245 | } |
| 2246 | } |
| 2247 | } |
| 2248 | |
| 2249 | void CsvApplication::deleteMacroCB(Fl_Widget *, void *data) { |
| 2250 | addDelParamType *addDelParam = (addDelParamType *)data; |
nothing calls this directly
no test coverage detected