tesseract  4.0.0-1-g2a2b
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)
 
- Public Member Functions inherited from SVEventHandler
virtual ~SVEventHandler ()
 

Detailed Description

Definition at line 98 of file paramsd.h.

Constructor & Destructor Documentation

◆ ParamsEditor()

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

Definition at line 285 of file paramsd.cpp.

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

Member Function Documentation

◆ Notify()

void ParamsEditor::Notify ( const SVEvent sve)
virtual

Reimplemented from SVEventHandler.

Definition at line 265 of file paramsd.cpp.

265  {
266  if (sve->type == SVET_POPUP) { // only catch SVET_POPUP!
267  char* param = sve->parameter;
268  if (sve->command_id == writeCommands[0]) {
269  WriteParams(param, false);
270  } else if (sve->command_id == writeCommands[1]) {
271  WriteParams(param, true);
272  } else {
274  sve->command_id);
275  vc->SetValue(param);
276  sv_window_->AddMessage("Setting %s to %s",
277  vc->GetName(), vc->GetValue().string());
278  }
279  }
280 }
const char * GetName() const
Definition: paramsd.cpp:115
const char * string() const
Definition: strngs.cpp:196
STRING GetValue() const
Definition: paramsd.cpp:134
void SetValue(const char *val)
Definition: paramsd.cpp:153
SVEventType type
Definition: scrollview.h:64
static ParamContent * GetParamContentById(int id)
Definition: paramsd.cpp:90
int command_id
Definition: scrollview.h:70
char * parameter
Definition: scrollview.h:71
void AddMessage(const char *format,...)
Definition: scrollview.cpp:563

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