tesseract  5.0.0
tesseract::ParamsEditor Class Reference

#include <paramsd.h>

Inheritance diagram for tesseract::ParamsEditor:
tesseract::SVEventHandler

Public Member Functions

 ParamsEditor (tesseract::Tesseract *, ScrollView *sv=nullptr)
 
void Notify (const SVEvent *sve) override
 
- Public Member Functions inherited from tesseract::SVEventHandler
virtual ~SVEventHandler ()
 

Detailed Description

Definition at line 96 of file paramsd.h.

Constructor & Destructor Documentation

◆ ParamsEditor()

tesseract::ParamsEditor::ParamsEditor ( tesseract::Tesseract tess,
ScrollView sv = nullptr 
)
explicit

Definition at line 289 of file paramsd.cpp.

289  {
290  if (sv == nullptr) {
291  const char *name = "ParamEditorMAIN";
292  sv = new ScrollView(name, 1, 1, 200, 200, 300, 200);
293  }
294 
295  sv_window_ = sv;
296 
297  // Only one event handler per window.
298  // sv->AddEventHandler((SVEventHandler*) this);
299 
300  SVMenuNode *svMenuRoot = BuildListOfAllLeaves(tess);
301 
302  std::string paramfile;
303  paramfile = tess->datadir;
304  paramfile += VARDIR; // parameters dir
305  paramfile += "edited"; // actual name
306 
307  SVMenuNode *std_menu = svMenuRoot->AddChild("Build Config File");
308 
309  writeCommands[0] = nrParams + 1;
310  std_menu->AddChild("All Parameters", writeCommands[0], paramfile.c_str(), "Config file name?");
311 
312  writeCommands[1] = nrParams + 2;
313  std_menu->AddChild("changed_ Parameters Only", writeCommands[1], paramfile.c_str(),
314  "Config file name?");
315 
316  svMenuRoot->BuildMenu(sv, false);
317 }
#define VARDIR
Definition: paramsd.cpp:46
std::string datadir
Definition: ccutil.h:57

Member Function Documentation

◆ Notify()

void tesseract::ParamsEditor::Notify ( const SVEvent sve)
overridevirtual

Reimplemented from tesseract::SVEventHandler.

Definition at line 271 of file paramsd.cpp.

271  {
272  if (sve->type == SVET_POPUP) { // only catch SVET_POPUP!
273  char *param = sve->parameter;
274  if (sve->command_id == writeCommands[0]) {
275  WriteParams(param, false);
276  } else if (sve->command_id == writeCommands[1]) {
277  WriteParams(param, true);
278  } else {
279  ParamContent *vc = ParamContent::GetParamContentById(sve->command_id);
280  vc->SetValue(param);
281  sv_window_->AddMessageF("Setting %s to %s", vc->GetName(), vc->GetValue().c_str());
282  }
283  }
284 }
@ SVET_POPUP
Definition: scrollview.h:61
static ParamContent * GetParamContentById(int id)
Definition: paramsd.cpp:91
void AddMessageF(const char *format,...) __attribute__((format(printf
Definition: scrollview.cpp:555

The documentation for this class was generated from the following files: