Tesseract  3.02
ParamsEditor Class Reference

#include <paramsd.h>

Inheritance diagram for ParamsEditor:
SVEventHandler

List of all members.

Public Member Functions

 ParamsEditor (tesseract::Tesseract *, ScrollView *sv=NULL)
void Notify (const SVEvent *sve)

Detailed Description

Definition at line 91 of file paramsd.h.


Constructor & Destructor Documentation

ParamsEditor::ParamsEditor ( tesseract::Tesseract tess,
ScrollView sv = NULL 
)

Definition at line 289 of file paramsd.cpp.

                                                 {
  if (sv == NULL) {
    const char* name = "ParamEditorMAIN";
    sv = new ScrollView(name, 1, 1, 200, 200, 300, 200);
  }

  sv_window_ = sv;

  //Only one event handler per window.
  //sv->AddEventHandler((SVEventHandler*) this);

  SVMenuNode* svMenuRoot = BuildListOfAllLeaves(tess);

  STRING paramfile;
  paramfile = tess->datadir;
  paramfile += VARDIR;             // parameters dir
  paramfile += "edited";           // actual name

  SVMenuNode* std_menu = svMenuRoot->AddChild ("Build Config File");

  writeCommands[0] = nrParams+1;
  std_menu->AddChild("All Parameters", writeCommands[0],
                     paramfile.string(), "Config file name?");

  writeCommands[1] = nrParams+2;
  std_menu->AddChild ("changed_ Parameters Only", writeCommands[1],
                      paramfile.string(), "Config file name?");

  svMenuRoot->BuildMenu(sv, false);
}

Member Function Documentation

void ParamsEditor::Notify ( const SVEvent sve) [virtual]

Reimplemented from SVEventHandler.

Definition at line 269 of file paramsd.cpp.

                                            {
  if (sve->type == SVET_POPUP) {  // only catch SVET_POPUP!
    char* param = sve->parameter;
    if (sve->command_id == writeCommands[0]) {
      WriteParams(param, false);
    } else if (sve->command_id == writeCommands[1]) {
      WriteParams(param, true);
    } else {
      ParamContent* vc = ParamContent::GetParamContentById(
          sve->command_id);
      vc->SetValue(param);
      sv_window_->AddMessage("Setting %s to %s",
                             vc->GetName(), vc->GetValue());
    }
  }
}

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