/* /////////////////////////////////////////////////////////////////////////////
 * Menu "Recent files..." action
 */
void TTCutMainWindow::onFileRecent()
{
  QAction* action = qobject_cast<QAction*>(sender());

  if (action) 
  {
    //log->infoMsg(oName, "open recent project file: %s", TTCut::toAscii(action->data().toString()));
    openProjectFile(action->data().toString());
  }
}
/* /////////////////////////////////////////////////////////////////////////////
 * Menu "File open" action
 */
void TTCutMainWindow::onFileOpen()
{
  QString fn = QFileDialog::getOpenFileName(this,
      tr("Open project-file"),
      TTCut::lastDirPath,
      "Project(*.prj)");

  if (!fn.isEmpty()) {
    openProjectFile(fn);
  }
}
예제 #3
0
void testApp::keyPressed( int key )
{
    cout << "key : " << key << endl ;
 //   if ( canvasAlpha > 0.0f )
 //   {
        WordBlock * wb = quote.getEditableBlock( ) ;
        if ( wb == NULL )
        {
            switch ( key )
            {
                case 'p':
                case 'P':
                    exportPDF() ;
                    break ;

                case 'r':
                case 'R':
                    resetAgents() ;
                    break ;

                case 's':
                case 'S':
                    saveProjectFile( ) ;
                    break ;

                case 'o':
                case 'O':
                    openProjectFile( ) ;
                    break ;

                case ' ':
                    bRunAgents = !bRunAgents ;
                    break ;

                case 'd':
                case 'D':
                    bDebugDraw = !bDebugDraw ;
                    break ;

                case 'n':
                case 'N':
                    cout << "new WordBlock" << endl ;
                    createNewWordBlock() ;
                    break ;

                case 13 :
                    cout << "end typing wordBlock" << endl ;
                    break ;

                case 'e':
                case 'E':
                    quote.editWordBlockAt ( mouseX , mouseY ) ;
                    break ;

                case 'f':
                case 'F':
                    openFontDialogue() ;
                    break ;
                case 127 :
                case 8 :
                    quote.removeWordBlockAt ( mouseX , mouseY ) ;
                    break ;

            }
            cout << "no editable path!" << endl;
        }
        else
        {
            if ( key == 13 )
            {
                wb->bEditable = false ;
                return ;
            }

            //Backspace
            else if ( key == 127|| key == 8 )
            {
                string word = wb->word ;
                if ( word.size() > 0 )
                {
                    string word1 = word.substr( 0 , word.size()-1 ) ;
                    word = word1 ;
                }
                wb->word = word ;

                updateNewWordBlock( wb->word , newFontSize ) ;
                //updateNewWordBlock( wb->word , newFontSize ) ;
                return ;
            }

            wb->word += key ;
            cout << "updating word blcok with : " << wb->word << endl ;
            //void testApp::updateNewWordBlock ( string _word , float _fontSize )
           //   WordBlock * wb = quote.getEditableBlock( ) ;
            updateNewWordBlock( wb->word , newFontSize ) ;

        }
  //  }

}