Integrate the parameters editor as popupmenu into the existing scrollview window (usually the pg editor). If sv == null, create a new empty empty window and attach the parameters editor to that window (ugly).
| 287 | // window (usually the pg editor). If sv == null, create a new empty |
| 288 | // empty window and attach the parameters editor to that window (ugly). |
| 289 | ParamsEditor::ParamsEditor(tesseract::Tesseract* tess, |
| 290 | ScrollView* sv) { |
| 291 | if (sv == NULL) { |
| 292 | const char* name = "ParamEditorMAIN"; |
| 293 | sv = new ScrollView(name, 1, 1, 200, 200, 300, 200); |
| 294 | } |
| 295 | |
| 296 | sv_window_ = sv; |
| 297 | |
| 298 | //Only one event handler per window. |
| 299 | //sv->AddEventHandler((SVEventHandler*) this); |
| 300 | |
| 301 | SVMenuNode* svMenuRoot = BuildListOfAllLeaves(tess); |
| 302 | |
| 303 | STRING paramfile; |
| 304 | paramfile = tess->datadir; |
| 305 | paramfile += VARDIR; // parameters dir |
| 306 | paramfile += "edited"; // actual name |
| 307 | |
| 308 | SVMenuNode* std_menu = svMenuRoot->AddChild ("Build Config File"); |
| 309 | |
| 310 | writeCommands[0] = nrParams+1; |
| 311 | std_menu->AddChild("All Parameters", writeCommands[0], |
| 312 | paramfile.string(), "Config file name?"); |
| 313 | |
| 314 | writeCommands[1] = nrParams+2; |
| 315 | std_menu->AddChild ("changed_ Parameters Only", writeCommands[1], |
| 316 | paramfile.string(), "Config file name?"); |
| 317 | |
| 318 | svMenuRoot->BuildMenu(sv, false); |
| 319 | } |
| 320 | |
| 321 | |
| 322 | // Write all (changed_) parameters to a config file. |