tesseract  5.0.0-alpha-619-ge9db
ParamsEditor Class Reference

#include <paramsd.h>

Inheritance diagram for ParamsEditor:
SVEventHandler

Public Member Functions

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

Detailed Description

Definition at line 99 of file paramsd.h.

Constructor & Destructor Documentation

◆ ParamsEditor()

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

Definition at line 291 of file paramsd.cpp.

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

Member Function Documentation

◆ Notify()

void ParamsEditor::Notify ( const SVEvent sve)
overridevirtual

Reimplemented from 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 {
280  sve->command_id);
281  vc->SetValue(param);
282  sv_window_->AddMessage("Setting %s to %s",
283  vc->GetName(), vc->GetValue().c_str());
284  }
285  }
286 }

The documentation for this class was generated from the following files:
ScrollView
Definition: scrollview.h:97
tesseract::CCUtil::datadir
STRING datadir
Definition: ccutil.h:53
ScrollView::AddMessage
void AddMessage(const char *format,...)
Definition: scrollview.cpp:560
SVET_POPUP
Definition: scrollview.h:53
SVMenuNode::AddChild
SVMenuNode * AddChild(const char *txt)
Definition: svmnode.cpp:58
ParamContent::GetParamContentById
static ParamContent * GetParamContentById(int id)
Definition: paramsd.cpp:91
STRING
Definition: strngs.h:45
ParamContent
Definition: paramsd.h:53
SVEvent::parameter
char * parameter
Definition: scrollview.h:65
ParamContent::GetName
const char * GetName() const
Definition: paramsd.cpp:116
STRING::c_str
const char * c_str() const
Definition: strngs.cpp:192
ParamContent::SetValue
void SetValue(const char *val)
Definition: paramsd.cpp:154
ParamContent::GetValue
STRING GetValue() const
Definition: paramsd.cpp:135
SVEvent::type
SVEventType type
Definition: scrollview.h:63
VARDIR
#define VARDIR
Definition: paramsd.cpp:44
SVMenuNode::BuildMenu
void BuildMenu(ScrollView *sv, bool menu_bar=true)
Definition: svmnode.cpp:120
SVMenuNode
Definition: svmnode.h:35
SVEvent::command_id
int command_id
Definition: scrollview.h:70