Exemplo n.º 1
0
static void
basic_polar(const fixed mc)
{
  char bname[100];
  sprintf(bname,"results/res-polar-%02d-best.txt",(int)(mc*10));
  std::ofstream pfile("results/res-polar.txt");
  std::ofstream mfile(bname);

  GlidePolar polar(mc);
  for (fixed V= Vmin; V<= polar.GetVMax(); V+= fixed(0.25)) {
    pfile << (double)mc << " " 
          << (double)V << " " 
          << -(double)polar.SinkRate(V) << " " 
          << (double)(V/polar.SinkRate(V))
          << "\n";
  }

  mfile << (double)mc 
        << " " << 0
        << " " << (double)mc
        << " " << (double)polar.GetBestLD() 
        << "\n";
  mfile << (double)mc 
        << " " << (double)polar.GetVBestLD() 
        << " " << -(double)polar.GetSBestLD() 
        << " " << (double)polar.GetBestLD() 
        << "\n";
}
Exemplo n.º 2
0
	// 2 file arguments -> add e+m from different files e.g. data
	// this is considered to be data not added to sum histo
	TH1D* get(const TString& eFile, const TString& mFile){
		TFile mfile(path+mFile);
		TFile efile(path+eFile);
		TH1D* mH = (TH1D*)mfile.Get(mName);
		TH1D* eH = (TH1D*)efile.Get(eName);
		gROOT->cd();
		TH1D*  H = mH->Clone();
		H->Add(eH);
		return H;
	}
Exemplo n.º 3
0
void mexFunction( int nargout, mxArray *out[],
                  int nargin, const mxArray *in[] )
{
    jhm::cout_redirect();
    jhm::MAT mfile("data.mat");
    
    jhm::println( "Opened file with %d variables.", mfile.nfields() );
    showLogical(mfile);
    showNumeric(mfile);
    showString(mfile);
    showVector(mfile);
    showMatrix(mfile);
    showVolume(mfile);
}
Exemplo n.º 4
0
	float GetMemUsageLinux()
	{
		std::ifstream mfile("/proc/meminfo");
		if (!mfile.is_open())
			return -1;
		unsigned long MemTotal = -1;
		unsigned long MemFree = -1;
		unsigned long MemBuffers = -1;
		unsigned long  MemCached = -1;
		std::string token;
		while (mfile >> token) {
			if (token == "MemTotal:") {
				mfile >> MemTotal;
			}
			else if (token == "MemFree:") {
Exemplo n.º 5
0
int
main(int argc, char **argv)
{
  if (argc < 4) {
    std::cerr << "Usage: test_image_rgb_mask " <<
                 "<ifile> <mfile> <ofile> [r] [g] [b]" << std::endl;
    exit(1);
  }

  CFile ifile(argv[1]);
  CFile mfile(argv[2]);
  CFile ofile(argv[3]);

  double r, g, b;

  if (argc >= 5 && ! CStrUtil::toReal(argv[4], &r)) exit(1);
  if (argc >= 6 && ! CStrUtil::toReal(argv[5], &g)) exit(1);
  if (argc >= 7 && ! CStrUtil::toReal(argv[6], &b)) exit(1);

  CImageFileSrc src1(ifile);

  CImagePtr src_image = CImageMgrInst->createImage(src1);

  CImageFileSrc src2(mfile);

  CImagePtr merge_image = CImageMgrInst->createImage(src2);

  CImagePtr merge_image1;

  if (argc >= 5) {
    CRGBA rgba(r, g, b);

    merge_image1 = merge_image->createRGBAMask(rgba);
  }
  else
    merge_image1 = merge_image->createRGBAMask();

  src_image->combineAlpha(merge_image1);

  CFileType type = CFileUtil::getImageTypeFromName(argv[3]);

  src_image->write(&ofile, type);

  exit(0);
}
Exemplo n.º 6
0
//--------------------------------------------------------------------------
asize_t calc_macho_image_size(linput_t *li, ea_t *p_base)
{
  if ( li == NULL )
    return 0;
  if ( p_base != NULL )
    *p_base = BADADDR;

  macho_file_t mfile(li);

  if ( !mfile.parse_header()
    || !mfile.select_subfile(CPUTYPE) )
  {
    msg("Warning: bad file or could not find a member with matching cpu type\n");
    return 0;
  }

  // load sections
  const segcmdvec_t &segcmds = mfile.get_segcmds();

  ea_t base = BADADDR;
  ea_t maxea = 0;
  for ( size_t i=0; i < segcmds.size(); i++ )
  {
    const segment_command_64 &sg = segcmds[i];
    // since mac os x scatters application segments over the memory
    // we calculate only the text segment size
    if ( is_text_segment(sg) )
    {
      if ( base == BADADDR )
        base = sg.vmaddr;
      ea_t end = sg.vmaddr + sg.vmsize;
      if ( maxea < end )
        maxea = end;
//    msg("segment %s base %a size %d maxea %a\n", sg.segname, sg.vmaddr, sg.vmsize, maxea);
    }
  }
  asize_t size = maxea - base;
  if ( p_base != NULL )
    *p_base = base;
// msg("%s: base %a size %d\n", fname, base, size);
  return size;
}
Exemplo n.º 7
0
/***
 * @brief converts files with hex strings to binary
 *
 * This method converts the given file, which contains
 * command strings in hexadecimal and saves them in
 * binary form in a binary file.
 *
 */
void asc2bin(std::string const &filein,std::string const &fileout){
    #ifdef TRACE
    T(std::cout, "Enters BinFile::asc2bin");
    #endif

    // coverts configuration files to binary files
    std::ifstream mfile(filein.c_str());
    std::ofstream bfile(fileout.c_str(), std::ios::out | std::ios::binary);

    assert(mfile.is_open());
    assert(bfile.is_open());

    std::string line;
    while(mfile.good()){
        // remove trash in line
        std::getline(mfile,line);
        line.erase(0, line.find_first_not_of(" \t\r\n\v\f"));
        size_t index = line.find_first_of("#");
        if (index != std::string::npos) line.erase(index, std::string::npos);
        line.erase(remove_if(line.begin(), line.end(), ::isspace), line.end());
        line.append("\n");

        // write binary file
        unsigned short int value = 0;
        char hex[3];
        hex[2] = '\0';
        for(unsigned int i=0;i<line.size();i+=2){
            hex[0] = line[i];
            hex[1] = line[i+1];
            sscanf(hex,"%hx\n", &value);
            bfile.write((char*)&value,1);
        }
    }

    mfile.close();
    bfile.close();
}
Exemplo n.º 8
0
void GameApp::Create()
{
    srand((unsigned int) time(0)); // initialize random
#if !defined(QT_CONFIG) && !defined(IOS)
#if defined (WIN32)
    _CrtSetDbgFlag ( _CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF );
#elif defined (PSP)
    pspFpuSetEnable(0); //disable FPU Exceptions until we find where the FPU errors come from
    pspDebugScreenPrintf("Wagic:Loading resources...");
#endif
#endif //QT_CONFIG
    //_CrtSetBreakAlloc(368);
    LOG("starting Game");

    string systemFolder = "Res/";
    string foldersRoot = "";

    //Find the Res folder
    ifstream mfile("Res.txt");
    string resPath;
    if (mfile)
    {
        bool found = false;
        while (!found && std::getline(mfile, resPath))
        {
            if (resPath[resPath.size() - 1] == '\r')
                resPath.erase(resPath.size() - 1); //Handle DOS files
            string testfile = resPath + systemFolder;
            testfile.append("graphics/simon.dat");
            ifstream tempfile(testfile.c_str());
            if (tempfile)
            {
                found = true;
                tempfile.close();
                foldersRoot = resPath;
            }
        }
        mfile.close();
    }
    LOG("init Res Folder at " + foldersRoot);
    JFileSystem::init(foldersRoot + "User/", foldersRoot + systemFolder);

    
    // Create User Folders (for write access) if they don't exist
    {
        const char* folders[] = { "ai", "ai/baka", "ai/baka/stats", "campaigns", "graphics", "lang", "packs", "player", "player/stats", "profiles", "rules", "sets", "settings", "sound", "sound/sfx", "themes", "test"};

        for (size_t i = 0; i < sizeof(folders)/sizeof(folders[0]); ++i)
        {
            JFileSystem::GetInstance()->MakeDir(string(folders[i]));
        }
    }

    LOG("Loading Modrules");
    //Load Mod Rules before everything else
    gModRules.load("rules/modrules.xml");

    LOG("Loading Unlockables");
    //Load awards (needs to be loaded before any option are accessed)
    Unlockable::load();

    //Link this to our settings manager.
    options.theGame = this;

    //Ensure that options are partially loaded before loading files.
    LOG("options.reloadProfile()");
    options.reloadProfile();


    //Setup Cache before calling any gfx/sfx functions
	WResourceManager::Instance()->ResetCacheLimits();


    LOG("Checking for music files");
    //Test for Music files presence
    JFileSystem * jfs = JFileSystem::GetInstance();
    HasMusic = jfs->FileExists(WResourceManager::Instance()->musicFile("Track0.mp3")) && jfs->FileExists(WResourceManager::Instance()->musicFile("Track1.mp3"));
    
    LOG("Init Collection");
    MTGAllCards::getInstance();

    LOG("Loading rules");
    Rules::loadAllRules();


    LOG("Loading Textures");
    LOG("--Loading menuicons.png");
    WResourceManager::Instance()->RetrieveTexture("menuicons.png", RETRIEVE_MANAGE);
#if !defined (PSP)
    WResourceManager::Instance()->RetrieveTexture("miconslarge.png", RETRIEVE_MANAGE);
#endif
    LOG("---Gettings menuicons.png quads");
   
    //Load all icons from gModRules and save in manaIcons -> todo. Change the icons positions on menuicons.png to avoid use item->mColorId
    vector<ModRulesBackGroundCardGuiItem *>items = gModRules.cardgui.background;
    for(size_t i= 0; i < items.size(); i ++)
    {
        
        ModRulesBackGroundCardGuiItem * item = items[i];
        if (item->mMenuIcon == 1)
        {
            manaIcons.push_back(WResourceManager::Instance()->RetrieveQuad("menuicons.png", 2 + (float)item->mColorId * 36, 38, 32, 32, "c_" + item->MColorName, RETRIEVE_MANAGE));
            Constants::MTGColorStrings.push_back(item->MColorName.c_str());
        }
    }
    Constants::NB_Colors = (int)Constants::MTGColorStrings.size();
    
    items.erase(items.begin(),items.end());
    

    for (int i = manaIcons.size()-1; i >= 0; --i)
        if (manaIcons[i].get())
            manaIcons[i]->SetHotSpot(16, 16);

    LOG("--Loading back.jpg");
    WResourceManager::Instance()->RetrieveTexture("back.jpg", RETRIEVE_MANAGE);
    JQuadPtr jq = WResourceManager::Instance()->RetrieveQuad("back.jpg", 0, 0, 0, 0, kGenericCardID, RETRIEVE_MANAGE);
    if (jq.get())
        jq->SetHotSpot(jq->mWidth / 2, jq->mHeight / 2);

    WResourceManager::Instance()->RetrieveTexture("back_thumb.jpg", RETRIEVE_MANAGE);
    WResourceManager::Instance()->RetrieveQuad("back_thumb.jpg", 0, 0, MTG_MINIIMAGE_WIDTH, MTG_MINIIMAGE_HEIGHT, kGenericCardThumbnailID, RETRIEVE_MANAGE);

    LOG("--Loading particles.png");
    WResourceManager::Instance()->RetrieveTexture("particles.png", RETRIEVE_MANAGE);
    jq = WResourceManager::Instance()->RetrieveQuad("particles.png", 0, 0, 32, 32, "particles", RETRIEVE_MANAGE);
    if (jq)
        jq->SetHotSpot(16, 16);
    jq = WResourceManager::Instance()->RetrieveQuad("particles.png", 64, 0, 32, 32, "stars", RETRIEVE_MANAGE);
    if (jq)
        jq->SetHotSpot(16, 16);

    LOG("--Loading fonts");
    string lang = options[Options::LANG].str;
    std::transform(lang.begin(), lang.end(), lang.begin(), ::tolower);
    WResourceManager::Instance()->InitFonts(lang);
    Translator::GetInstance()->init();
    // The translator is ready now.

    LOG("--Loading various textures");
    // Load in this function only textures that are used frequently throughout the game. These textures will constantly stay in Ram, so be frugal
    WResourceManager::Instance()->RetrieveTexture("phasebar.png", RETRIEVE_MANAGE);
    WResourceManager::Instance()->RetrieveTexture("wood.png", RETRIEVE_MANAGE);
    WResourceManager::Instance()->RetrieveTexture("gold.png", RETRIEVE_MANAGE);
    WResourceManager::Instance()->RetrieveTexture("goldglow.png", RETRIEVE_MANAGE);
    WResourceManager::Instance()->RetrieveTexture("backdrop.jpg", RETRIEVE_MANAGE);
    WResourceManager::Instance()->RetrieveTexture("handback.png", RETRIEVE_MANAGE);
    WResourceManager::Instance()->RetrieveTexture("shadows.png", RETRIEVE_MANAGE);

    jq = WResourceManager::Instance()->RetrieveQuad("shadows.png", 2, 2, 16, 16, "white", RETRIEVE_MANAGE);
    if (jq)
        jq->SetHotSpot(8, 8);
    jq = WResourceManager::Instance()->RetrieveQuad("shadows.png", 20, 2, 16, 16, "shadow", RETRIEVE_MANAGE);
    if (jq)
        jq->SetHotSpot(8, 8);
    jq = WResourceManager::Instance()->RetrieveQuad("shadows.png", 38, 2, 16, 16, "extracostshadow", RETRIEVE_MANAGE);
    if (jq)
        jq->SetHotSpot(8, 8);

    jq = WResourceManager::Instance()->RetrieveQuad("phasebar.png", 0, 0, 0, 0, "phasebar", RETRIEVE_MANAGE);



    LOG("Creating Game States");
    mGameStates[GAME_STATE_DECK_VIEWER] = NEW GameStateDeckViewer(this);
    mGameStates[GAME_STATE_DECK_VIEWER]->Create();

    mGameStates[GAME_STATE_MENU] = NEW GameStateMenu(this);
    mGameStates[GAME_STATE_MENU]->Create();

    mGameStates[GAME_STATE_DUEL] = NEW GameStateDuel(this);
    mGameStates[GAME_STATE_DUEL]->Create();

    mGameStates[GAME_STATE_SHOP] = NEW GameStateShop(this);
    mGameStates[GAME_STATE_SHOP]->Create();

    mGameStates[GAME_STATE_OPTIONS] = NEW GameStateOptions(this);
    mGameStates[GAME_STATE_OPTIONS]->Create();

    mGameStates[GAME_STATE_AWARDS] = NEW GameStateAwards(this);
    mGameStates[GAME_STATE_AWARDS]->Create();

    mGameStates[GAME_STATE_STORY] = NEW GameStateStory(this);
    mGameStates[GAME_STATE_STORY]->Create();

    mGameStates[GAME_STATE_TRANSITION] = NULL;

    mCurrentState = NULL;
    mNextState = mGameStates[GAME_STATE_MENU];

    //Set Audio volume
    JSoundSystem::GetInstance()->SetSfxVolume(options[Options::SFXVOLUME].number);
    JSoundSystem::GetInstance()->SetMusicVolume(options[Options::MUSICVOLUME].number);

    DebugTrace("size of MTGCardInstance: " << sizeof(MTGCardInstance));
    DebugTrace("size of MTGCard: "<< sizeof(MTGCard));
    DebugTrace("size of CardPrimitive: "<< sizeof(CardPrimitive));
    DebugTrace("size of ExtraCost: " << sizeof(ExtraCost));
    DebugTrace("size of ManaCost: " << sizeof(ManaCost));

    LOG("Game Creation Done.");
}
Exemplo n.º 9
0
//--------------------------------------------------------------------------
//parse a mach-o file image in memory and enumerate its segments and symbols
bool parse_macho(ea_t start, linput_t *li, symbol_visitor_t &sv, bool in_mem)
{
  macho_file_t mfile(li);

  if ( !mfile.parse_header()
    || !mfile.select_subfile(CPUTYPE) )
  {
    msg("Warning: bad file or could not find a member with matching cpu type\n");
    return false;
  }

  // load sections
  const secvec_t &sections   = mfile.get_sections();
  const segcmdvec_t &segcmds = mfile.get_segcmds();

  ea_t expected_base = BADADDR;
  for ( size_t i=0; i < segcmds.size(); i++ )
  {
    const segment_command_64 &sg = segcmds[i];
    if ( is_text_segment(sg) && expected_base == BADADDR )
    {
      expected_base = sg.vmaddr;
      break;
    }
  }

  if ( expected_base == BADADDR )
    return false;

  sval_t slide = start - expected_base;

  // msg("%a: expected base is %a; in_mem = %d\n", start, expected_base, in_mem);

  if ( (sv.velf & VISIT_SEGMENTS) != 0 )
  {
    for ( size_t i=0; i < segcmds.size(); i++ )
    {
      const segment_command_64 &sg = segcmds[i];
      if ( sg.nsects == 0 )
        sv.visit_segment(sg.vmaddr + slide, sg.vmsize, sg.segname);
    }
    for ( size_t i=0; i < sections.size(); i++ )
    {
      const section_64 &sect = sections[i];
      sv.visit_segment(sect.addr + slide, sect.size, sect.sectname);
    }
  }

  if ( (sv.velf & VISIT_SYMBOLS) != 0 )
  {
    nlistvec_t symbols;
    qstring strings;
    mfile.get_symbol_table_info(symbols, strings, in_mem);

    // msg("%a: loaded %ld symbols and %ld string bytes\n", start, symbols.size(), strings.size());

    for ( size_t i=0; i < symbols.size(); i++ )
    {
      const struct nlist_64 &nl = symbols[i];
      if ( nl.n_un.n_strx > strings.size() )
        continue;
      const char *name = &strings[nl.n_un.n_strx];

      ea_t ea;
      int type = nl.n_type & N_TYPE;
      switch ( type )
      {
        case N_UNDF:
        case N_PBUD:
        case N_ABS:
          break;
        case N_SECT:
        case N_INDR:
          ea = nl.n_value + slide;
          if ( name[0] != '\0' )
          {
            if ( (nl.n_type & (N_EXT|N_PEXT)) == N_EXT ) // exported
            {
              sv.visit_symbol(ea, name);
            }
            else if ( type == N_SECT && nl.n_sect != NO_SECT ) // private symbols
            {
              sv.visit_symbol(ea, name);
            }
          }
          break;
      }
    }
  }
  return true;
}
Exemplo n.º 10
0
void BuildAndroid::Build(const String& buildPath)
{
    ToolEnvironment* tenv = GetSubsystem<ToolEnvironment>();
    ToolSystem* tsystem = GetSubsystem<ToolSystem>();
    Project* project = tsystem->GetProject();

    buildPath_ = AddTrailingSlash(buildPath) + GetBuildSubfolder();

    Initialize();
 
    if (!BuildClean(buildPath_))
        return;

    //generate manifest file
    String manifest;
    for (unsigned i = 0; i < resourceEntries_.Size(); i++)
    {
        BuildResourceEntry* entry = resourceEntries_[i];
        manifest += entry->packagePath_;
        if ( i != resourceEntries_.Size() - 1)
            manifest += ";";
    }

    String buildSourceDir = tenv->GetToolDataDir();

    String androidProject = buildSourceDir + "Deployment/Android";

    // Copy the base android project
    FileSystem* fileSystem = GetSubsystem<FileSystem>();
    if( !BuildCopyDir(androidProject, buildPath_))
        return;

    Vector<String> defaultResourcePaths;
    GetDefaultResourcePaths(defaultResourcePaths);
    String projectResources = project->GetResourcePath();

    for (unsigned i = 0; i < defaultResourcePaths.Size(); i++)
    {
        if ( !BuildCopyDir(defaultResourcePaths[i], buildPath_ + "/assets/" + GetFileName(RemoveTrailingSlash(defaultResourcePaths[i]))))
            return;
    }

    if( !BuildCopyDir(project->GetProjectPath() + "Cache/", buildPath_ + "/assets/Cache"))
        return;
    if( !BuildCopyDir(projectResources, buildPath_ + "/assets/AtomicResources"))
        return;

    // write the manifest
    SharedPtr<File> mfile(new File(context_, buildPath_ + "/assets/AtomicManifest", FILE_WRITE));
    mfile->WriteString(manifest);
    mfile->Close();

    //check for Deployment/Android/libs/armeabi-v7a/libAtomicPlayer.so
    if ( !fileSystem->FileExists(androidProject + "/libs/armeabi-v7a/libAtomicPlayer.so")  )
    {
        FailBuild( "The file libAtomicPlayer.so is not found. This is required for APK generation." );
        return;
    }

    AndroidProjectGenerator gen(context_, this);
    gen.SetBuildPath(buildPath_);

    if (!gen.Generate())
    {
        FailBuild(gen.GetErrorText());
        return;
    }

    RunAntDebug();

}
Exemplo n.º 11
0
//*****************************************************************************
mlMainWindow::mlMainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::mlMainWindow),
    uniConverter(0) {

    ui->setupUi(this);

    //-------------------------------------------------------------------------
    // Load the mapping file
    QByteArray map;
    QFile mfile(":/maps/maps/mollana-urdu.tec");
    if( mfile.open( QIODevice::ReadOnly ) ) {
        qDebug() << "Internal Urdu mapping file loaded...";
        map = mfile.readAll();
        mfile.close();
        qDebug() << "Map size: " << map.size() << "";
    } else {
        qDebug() << "Unable to open Internal Urdu mapping file for reading...\n";
        //raise exception
        return;
    }

    //-------------------------------------------------------------------------
    // Create the converter
    uniConverter = new TECkitConverter( map );
    if( !uniConverter->isValid() ) {
        qDebug() << "Unable to create Unicode TECkit converter...";
        //raise exception
        return;
    }

    //-------------------------------------------------------------------------
    // Toolbars
    ui->mainToolBar->addAction( ui->actionNew );
    ui->mainToolBar->addAction( ui->actionOpen );
    ui->mainToolBar->addAction( ui->actionSave );
    ui->mainToolBar->addSeparator();

    ui->mainToolBar->addAction( ui->actionUndo );
    ui->mainToolBar->addAction( ui->actionRedo );
    ui->mainToolBar->addSeparator();

    ui->mainToolBar->addAction( ui->actionCopy );
    ui->mainToolBar->addAction( ui->actionCut );
    ui->mainToolBar->addAction( ui->actionPaste );
    ui->mainToolBar->addSeparator();

    ui->mainToolBar->addAction( ui->actionUnicodeViewFont );
    ui->mainToolBar->addAction( ui->actionWordWrap );
    ui->mainToolBar->addSeparator();

    //-------------------------------------------------------------------------
    // Signal/Slots
    connect(ui->actionNew,      SIGNAL(triggered()),
            this,               SLOT(newFile()) );
    connect(ui->actionOpen,     SIGNAL(triggered()),
            this,               SLOT(open()) );
    connect(ui->actionSave,     SIGNAL(triggered()),
            this,               SLOT(save()) );
    connect(ui->actionSaveAs,   SIGNAL(triggered()),
            this,               SLOT(saveAs()) );
    connect(ui->actionQuit,     SIGNAL(triggered()),
            this,               SLOT(close()) );
    connect(ui->actionSelectAll,SIGNAL(triggered()),
            ui->tbxEditor,      SLOT(selectAll()) );
    connect(ui->actionEditorFont,
                                SIGNAL(triggered()),
            this,               SLOT(editorFontChanged()) );
    connect(ui->actionUnicodeViewFont,
                                SIGNAL(triggered()),
            this,               SLOT(unicodeFontChanged()) );
    connect(ui->actionAbout,    SIGNAL(triggered()),
            this,               SLOT(about()) );

    connect(ui->tbxEditor->document(),
                                SIGNAL(contentsChanged()),
            this,               SLOT(documentModified()) );

    // Copy, Cut & Paste
    connect(ui->actionCut,      SIGNAL(triggered()),
            ui->tbxEditor,      SLOT(cut()) );
    connect(ui->actionCopy,     SIGNAL(triggered()),
            ui->tbxEditor,      SLOT(copy()) );
    connect(ui->actionPaste,    SIGNAL(triggered()),
            ui->tbxEditor,      SLOT(paste()) );

    connect(ui->tbxEditor,      SIGNAL(copyAvailable(bool)),
            ui->actionCopy,     SLOT(setEnabled(bool)) );
    connect(ui->tbxEditor,      SIGNAL(copyAvailable(bool)),
            ui->actionCut,      SLOT(setEnabled(bool)) );

    // Undo & Redo
    connect(ui->actionUndo,     SIGNAL(triggered()),
            ui->tbxEditor,      SLOT(undo()) );
    connect(ui->actionCopy,     SIGNAL(triggered()),
            ui->tbxEditor,      SLOT(redo()) );

    connect(ui->tbxEditor,      SIGNAL(undoAvailable(bool)),
            ui->actionUndo,     SLOT(setEnabled(bool)) );
    connect(ui->tbxEditor,      SIGNAL(redoAvailable(bool)),
            ui->actionRedo,     SLOT(setEnabled(bool)) );

    connect(ui->actionWordWrap, SIGNAL(toggled(bool)),
            this,               SLOT(wordWrapChanged(bool)) );

    connect(ui->actionUnicodeOutput,
                                SIGNAL(toggled(bool)),
            ui->dckUnicodeOutput,
                                SLOT(setVisible(bool)) );

    connect(ui->tbxEditor,      SIGNAL(textChanged()),
            this,               SLOT(translateText()) );

    //-------------------------------------------------------------------------
    QFont f = ui->tbxUnicodeView->font();
    f.setStyleStrategy(QFont::PreferAntialias);
    ui->tbxUnicodeView->setFont(f);

    //-------------------------------------------------------------------------
    // Start with a new file
    newFile();
}