Ejemplo n.º 1
0
TAlignmentDialog::TAlignmentDialog(wxWindow *parent, const wxString& title )
    : wxDialog ( myapp()->frame , -1 , title , wxDefaultPosition , wxSize ( 600 , 450 ) )
    {
	myapp()->frame->push_help ( _T("GENtle:Alignments") ) ; // TODO : Link to dialog help page
    bo = 5 ;
    th = 15 ;
    al = (TAlignment*) parent ;
#ifndef __WXMAC__
    Show ( TRUE ) ;
#endif
    int w , h ;
#ifdef __WXMSW__
    GetClientSize ( &w , &h ) ;
    h -= 30 ;
#else
    w = -1 ;
    h = -1 ;
#endif
    nb = new wxNotebook ( this , -1 , wxDefaultPosition , wxSize ( w , h ) );

    init_what () ;
    init_how () ;
//    init_disp () ;

    wxButton *b = new wxButton ( this , AL_OK , txt("b_OK") ) ;
    wxButton *c = new wxButton ( this , AL_CANCEL , txt("b_cancel") ) ;

#ifndef __WXMSW__
    wxBoxSizer *v0 = new wxBoxSizer ( wxVERTICAL ) ;
    wxBoxSizer *h0 = new wxBoxSizer ( wxHORIZONTAL ) ;

    h0->Add ( b , 1 , wxALL , 5 ) ;
    h0->Add ( c , 1 , wxALL , 5 ) ;

    v0->Add ( nb , 1 , wxEXPAND|wxALL , 5 ) ;
    v0->Add ( h0 , 0 , wxCENTRE , 5 ) ;
    SetSizer ( v0 ) ;
#else
	b->SetSize ( w / 5 , h + 5 , -1 , -1 ) ;
	c->SetSize ( w / 5 * 3 , h + 5 , -1 , -1 ) ;
#endif
    nb->SetSelection ( 0 ) ;

    b->SetDefault () ;
    b->SetFocus () ;
    }
Ejemplo n.º 2
0
void TAlignmentDialog::OnCharHook ( wxKeyEvent& event )
    {
    int k = event.GetKeyCode () ;
    wxCommandEvent ev ;
    if ( k == WXK_ESCAPE ) OnCancel ( ev ) ;
    else if ( k == WXK_F1 ) myapp()->frame->OnHelp(ev) ;
    else event.Skip() ;
    }
Ejemplo n.º 3
0
int main( int argc, char* argv[] , char *envp[])
{
  QApplication myapp( argc, argv );
  
  QString rcfil;
  QString bibl;
  QStringList lines;
  QString homeDir( QDir::homeDirPath() );
  
  rcfil.append(homeDir);
  rcfil.append("/.olfixrc");	/* resursfil, configfil		*/
  QFile file(rcfil);
  /***************************************************/
  /*  Testa om $HOME/.olfixrc existerar, om inte skapa den.    */
  /***************************************************/
  if ( !file.open( IO_ReadOnly )){
      file.close();
      find_homedir(envp);		/* Hämta $HOME		    			*/
      copy_rcfile();			/* Kopiera från /opt/olfix/script/.olficrc till  $HOME/.olfixrc	*/
  }
/*  fprintf(stderr,"Start 2 OLFIXW\n");	*/
/****************************************/
/*  Vilken databas ska användas?		*/
/****************************************/      
   which_database(envp);
/*fprintf(stderr,"Start 3 OLFIXW\n");	*/
  /****************************************/
  /*  Läs in data från $HOME/.olfixrc här	 */
  /****************************************/
   file.close();
   if ( file.open( IO_ReadOnly ) ) {
	QTextStream stream( &file );
	QString line;
        while ( !stream.eof() ) {
            line = stream.readLine(); // line of text excluding '\n'
            int i = line.find( QRegExp("PATH="), 0 );    // i == 1
	    if ( i == 0){
	    	int l =line.length();
	    	bibl = line.mid(5,l);
	    }
            lines += line;
        }
	file.close();
//	fprintf(stdout,"Bibliotek=%s\n",bibl.latin1() );
  }else{
      	qWarning( "Cannot find the $HOME/.olfixrc file" );
 	fprintf(stderr,"%s\n", rcfil.latin1() );
  }
  QDir::setCurrent ( bibl );
 
  frmOlfix* mywidget = new frmOlfix();
  mywidget->lineEditDatabase->setText(database);
  
  myapp.setMainWidget( mywidget);
  mywidget->show();
  return myapp.exec();
}
Ejemplo n.º 4
0
int main( int argc, char* argv[] )
{
    QApplication myapp( argc, argv );

    WinImage* mywidget = new WinImage();
    mywidget->resize( 640, 480);
    mywidget->show();

    return myapp.exec();
}
Ejemplo n.º 5
0
int32 xmain(void* data) {
  char sig[50];
  thread_info info;
  strcpy(sig, "application/x-");
  get_thread_info(find_thread(NULL), &info);
  strcat(sig, info.name);
  XApp myapp(sig);
  myapp.Run();
  return 0;
};
Ejemplo n.º 6
0
int main(int argc,char **argv)
{
 QApplication myapp(argc,argv);
 Mylabel * showXY = new Mylabel;
 showXY->setGeometry(10,10,150,150);
 myapp.setMainWidget(showXY);
 showXY->show();
 
 return myapp.exec();	
	
}	
Ejemplo n.º 7
0
Archivo: main.cpp Proyecto: CCJY/coliru
int main(int argc, char* argv[])
{
    Validation val;
    Subscriber sub;
    Configuration config(val, sub);
    MyApp1 myapp(sub, val);
    Interface interface(sub, val);
    config.add_interface(interface);
 
    return 0;
}
Ejemplo n.º 8
0
void myQLoader::load_module_ex(const QString& name, bool module, const QString& nameModule, const QPixmap& pix)
{
  if(!module)
	{
	  worker->clearArguments();
	   //add code run program
	   
	  QStringList str = QStringList::split(" ",name);
	  
	   worker->setArguments(str);
	   
	   if(!worker->start());
	   		 
	}
	else
	{
		QLibrary lib(name);
		//add code run module
		
		QSettings settings;
		
		QString ApplicationPath; // = qApp->applicationDirPath();
		setAplDir(ApplicationPath);
	  
		QDir d = QDir::home();
  
		QString s1 = d.absPath();
	 
		settings.removeSearchPath( QSettings::Unix, s1+"/.qt");
		settings.insertSearchPath( QSettings::Unix, s1+"/.SCT" );
   
		QString slang = settings.readEntry("/SCT/Language_UI","en"); 
		
		QTranslator myapp( 0 );
		myapp.load( nameModule + "_" + slang, ApplicationPath+"/lang");
		qApp->installTranslator( &myapp );
	  	typedef  void (*showW)(const QPixmap& );
		showW shw = (showW)lib.resolve( "run_module" );
                		if ( shw )
                                  shw(pix);
		else
		  ;//QMessageBox::about(this,tr("Error"),tr("Can't load module"));
				
    	        lib.unload();
		//qApp->removeTranslator(&myapp);
	}
}
Ejemplo n.º 9
0
void SeqAA::updateProteases ()
    {
    proteases.Clear () ;
    CLEAR_DELETE ( pc ) ;
    if ( !can ) return ;

    wxArrayString vs ;
    if ( can->child ) vs = can->child->vec->proteases ;
    else if ( can->p ) vs = can->p->vec->proteases ;
    else if ( can->getAA() ) vs = can->getAA()->vec->proteases ;

    int a ;
    proteases.Alloc ( vs.GetCount() ) ;
    for ( a = 0 ; a < vs.GetCount() ; a++ )
        {
        TProtease *pro = myapp()->frame->LS->getProtease ( vs[a] ) ;
        if ( pro ) proteases.Add ( pro ) ;
        }
    }
Ejemplo n.º 10
0
int main(int argc, char *argv[])
{
	QApplication myapp(argc,argv);

	//ÖÐÎÄÖ§³Ö
	QTextCodec *codec=QTextCodec::codecForName("GBK");
	if (codec==NULL)
	{
		codec=QTextCodec::codecForLocale();
	}
	QTextCodec::setCodecForLocale(codec);
	QTextCodec::setCodecForTr(codec);
	QTextCodec::setCodecForCStrings(codec);

	CStandInput *pInputDlg=new CStandInput;
	pInputDlg->show();

	myapp.exec();
}
Ejemplo n.º 11
0
int main( int argc, char *argv[] )
{
    QApplication a( argc, argv );

    // translation file for Qt
//    QTranslator qt( 0 );
//    qt.load( QString( "qt_" ) + QTextCodec::locale(), "." );
//    app.installTranslator( &qt );

    // translation file for application strings
    QTranslator myapp( 0 );
//    myapp.load( QString( "myapp_" ) + QTextCodec::locale(), "." );
    myapp.load("chinese.qm");
    a.installTranslator( &myapp );

    MainWindow w;
    w.showMaximized();
    w.activate();

    return a.exec();
}
int main(int argc, char *argv[])
{
  QApplication a( argc, argv );

  // translation file for Qt
  //QTranslator qt;
  QLocale s( QLocale::system() );
  //qDebug( QString( s.name() ).toStdString().data() );
  //qt.load( QString( "qt_" ) + s.name() );
  //a.installTranslator( &qt );

  // translation file for application strings
  QTranslator myapp( 0 );
  if ( !myapp.load( QString( "mtt_" ) + s.name(), "/usr/local/share/mediatagtools" ) )
    myapp.load( QString( "mtt_" ) + s.name(), "/usr/share/mediatagtools" );
  a.installTranslator( &myapp );

  mttMainWin m;

  // TODO: Window icon (get rid of that pink/purple X!)
  //QPixmap icon( QImage( QString( QString( PREFIX ) + "/share/mediatagtools/icons/mediatagtools.png" ) ) );
  //QPixmap icon( QString( QString( PREFIX ) + "/share/mediatagtools/icons/mediatagtools.png" ) );
  //m.setIcon( icon );

  m.show();

//   qDebug( QString( "argv[1]=\"" ) + argv[1] + "\"\n" );
  if ( argc > 1 ) {
    QDir td;
    td.setPath( QString::fromUtf8( argv[1] ) );
    if ( td.exists() ) {
//         qDebug( "Exists!" );
        m.addDir( QString::fromUtf8( argv[1] ) );
    }
  }

  a.exec();

  return EXIT_SUCCESS;
}
Ejemplo n.º 13
0
int main( int argc, char* argv[] )
{
  QApplication myapp( argc, argv );

  frmPrtFoljesedel* mywidget = new frmPrtFoljesedel();

  // mywidget->lineEditBestNr->setText(QString(argv[1]));

  QString rcfil;
  QString bibl;
  QStringList lines;
  QString homeDir( QDir::homeDirPath() );
   rcfil.append(homeDir);
   rcfil.append("/.olfixrc");	// configfil
// Läs in config filen här
   QFile file(rcfil);
   if ( file.open( IO_ReadOnly ) ) {
	QTextStream stream( &file );
	QString line;
        while ( !stream.eof() ) {
            line = stream.readLine(); // line of text excluding '\n'
            int i = line.find( QRegExp("PATH="), 0 );    // i == 1
	    if ( i == 0){
	    	int l =line.length();
	    	bibl = line.mid(5,l);
	    }
            lines += line;
        }
	file.close();
    }else{
	QMessageBox::warning( mywidget, "OLFIX - FSORDW",
 	"Kan inte hitta filen $HOME/.olfixrc.\n FSORDW kommer inte att fungera!\n");
	qWarning( "Cannot find the $HOME/.olfixrc file" );
    }
   QDir::setCurrent ( bibl );

  myapp.setMainWidget( mywidget );
  mywidget->show();
  return myapp.exec();
}
Ejemplo n.º 14
0
int main( int argc, char* argv[] )
{
  QApplication myapp( argc, argv );

  QString rcfil;
  QString bibl;
  QStringList lines;
  QString homeDir( QDir::homeDirPath() );
   rcfil.append(homeDir);
   rcfil.append("/.olfixrc");	// configfil
// Läs in config filen här
   QFile file(rcfil);
   if ( file.open( IO_ReadOnly ) ) {
	QTextStream stream( &file );
	QString line;
        while ( !stream.eof() ) {
            line = stream.readLine(); // line of text excluding '\n'
            int i = line.find( QRegExp("PATH="), 0 );    // i == 1
	    if ( i == 0){
	    	int l =line.length();
	    	bibl = line.mid(5,l);
	    }
            lines += line;
        }
	file.close();
    }else{
	qWarning( "Cannot find the $HOME/.olfixrc file" );
 	fprintf(stdout,"%s\n", rcfil.latin1() );
    }
   QDir::setCurrent ( bibl );

  frmListValuta ListaValuta;

  myapp.setMainWidget( &ListaValuta );
  ListaValuta.show();
  myapp.exec();
}
Ejemplo n.º 15
0
void TAlignmentDialog::init_what ()
    {

	wxBoxSizer *vx = new wxBoxSizer ( wxVERTICAL ) ;
	wxBoxSizer *h0 = new wxBoxSizer ( wxHORIZONTAL ) ;
	wxBoxSizer *v0 = new wxBoxSizer ( wxVERTICAL ) ;
	wxBoxSizer *v1 = new wxBoxSizer ( wxVERTICAL ) ;
	wxBoxSizer *v2 = new wxBoxSizer ( wxVERTICAL ) ;

    pwhat = new wxPanel ( nb , -1 ) ;
    wxPanel *p = pwhat ;
    v0->Add ( new wxStaticText ( p , -1 , txt("al_cur") ) , 0 , wxEXPAND ) ;
    v2->Add ( new wxStaticText ( p , -1 , txt("al_all") ) , 0 , wxEXPAND ) ;

    cur = new wxListBox ( p , AL_CUR , 
			  wxDefaultPosition ,
			  wxDefaultSize ,
			  0 , NULL , wxLB_EXTENDED ) ;
    all = new wxListBox ( p , AL_ALL , 
			  wxDefaultPosition ,
			  wxDefaultSize ,
			  0 , NULL , wxLB_EXTENDED ) ;

    v0->Add ( cur , 1 , wxEXPAND ) ;
    v2->Add ( all , 1 , wxEXPAND ) ;

    v1->Add ( new wxStaticText ( p , -1 , _T(" ") ) , 0 , wxALIGN_CENTER_HORIZONTAL ) ;
    v1->Add ( new wxButton ( p , AL_ADD , txt("<-- add") ) , 0 , wxALIGN_CENTER_HORIZONTAL ) ;
    v1->Add ( new wxButton ( p , AL_DEL , txt("del -->") ) , 0 , wxALIGN_CENTER_HORIZONTAL ) ;
    v1->Add ( new wxStaticText ( p , -1 , _T(" ") ) , 0 , wxALIGN_CENTER_HORIZONTAL ) ;
    v1->Add ( new wxButton ( p , AL_UP , txt("b_up_in_list") ) , 0 , wxALIGN_LEFT ) ;
    v1->Add ( new wxButton ( p , AL_DOWN , txt("b_down_in_list") ) , 0 , wxALIGN_LEFT ) ;
				  
    unsigned int a ;
    MyFrame *f = myapp()->frame ;
    // All
    for ( a = 0 ; a < f->children.GetCount() ; a++ )
        {
        if ( f->children[a]->def == _T("dna") ||
             f->children[a]->def == _T("AminoAcids") ||
             f->children[a]->def == _T("ABIviewer") )
           {
           vav.Add ( ((MyChild*)f->children[a])->vec ) ;
           van.Add ( f->children[a]->getName() ) ;
           all->Append ( f->children[a]->getName() ) ;
           }
        }
        
    // Current
    for ( a = 0 ; a < al->lines.size() ; a++ )
        {
        if ( al->lines[a].name != txt("t_identity") )
           {
           vcv.Add ( al->lines[a].v ) ;
           vcn.Add ( al->lines[a].name ) ;
           cur->Append ( al->lines[a].name ) ;
           }
        }
/*
	// Add all when dialog is first opened
    if ( vcn.GetCount() == 0 )
        {
        for ( a = 0 ; a < van.GetCount() ; a++ )
           {
           vcn.Add ( van[a] ) ;
           vcv.Add ( vav[a] ) ;
           cur->Append ( van[a] ) ;
           }
        }
*/

    h0->Add ( v0 , 1 , wxEXPAND|wxALL , 5 ) ;    
    h0->Add ( v1 , 1 , wxALL , 5 ) ;    
    h0->Add ( v2 , 1 , wxEXPAND|wxALL , 5 ) ;    
    vx->Add ( h0 , 1 , wxEXPAND ) ;
    vx->Add ( new wxStaticText ( p , -1 , txt("t_alignment_txt") ) , 0 , wxEXPAND|wxALIGN_CENTER_HORIZONTAL ) ;    
    p->SetSizer ( vx ) ;
    nb->AddPage ( pwhat , txt("t_sequences") ) ;
    }
Ejemplo n.º 16
0
FindSequenceDialog::FindSequenceDialog ( wxWindow *parent, const wxString& title )
	: wxDialog ( parent , -1 , title , wxDefaultPosition , wxSize ( 410 , 400 ) )
	{ 
    myapp()->frame->push_help ( _T("GENtle:Find") ) ;
	highlight = *wxBLUE ;
	wxBoxSizer *v0 = new wxBoxSizer ( wxVERTICAL ) ;
	wxBoxSizer *h0 = new wxBoxSizer ( wxHORIZONTAL ) ;
	wxBoxSizer *h1 = new wxBoxSizer ( wxHORIZONTAL ) ;
	wxBoxSizer *h2 = new wxBoxSizer ( wxHORIZONTAL ) ;
	p = 0 ;
	c = (ChildBase*) parent ;
	allowed_chars = _T("AGCT") ; // For DNA search; currently ignored
	
	t = new wxTextCtrl ( this , SH_TEXT , _T("") ) ;
	status = new wxTextCtrl ( this , -1 , txt("t_find_hint") , 
		wxDefaultPosition , wxDefaultSize , wxTE_READONLY|wxSTATIC_BORDER ) ;
	status->SetBackgroundColour ( GetBackgroundColour() ) ;
	
	find_button = new wxButton ( this , SH_SEARCH , txt("b_find") ) ;	
	h0->Add ( find_button , 1 , wxALL|wxEXPAND , 2 ) ;
	h0->Add ( new wxStaticText ( this , -1 , _T("") ) , 1 , wxALL|wxEXPAND , 2 ) ;
	h0->Add ( new wxButton ( this , SH_CANCEL , txt("b_cancel") ) , 1 , wxALL|wxEXPAND , 2 ) ;

    // Highlight stuff
    highlight_display = new wxStaticText ( this , -1 , _T("      ") ) ;
    do_highlight = new wxButton ( this , FD_ADD_HIGHLIGHTS , txt("b_find_highlight") ) ;
	h1->Add ( do_highlight , 0 , wxALL|wxEXPAND , 2 ) ;
	h1->Add ( highlight_display , 0 , wxLEFT|wxEXPAND , 5 ) ;
	h1->Add ( new wxButton ( this , FD_SET_HIGHLIGHT_COLOR , txt("b_find_highlight_color") ) , 0 , wxALL|wxEXPAND , 2 ) ;
	h1->Add ( new wxButton ( this , FD_RESET_HIGHLIGHTS , txt("b_find_remove_highlights") ) , 0 , wxALL|wxEXPAND , 2 ) ;
	highlight_display->SetBackgroundColour ( highlight ) ;

    // Options
    cb_sequence = cb_items = cb_enzymes = cb_translation = NULL ;
    cb_sequence = new wxCheckBox ( this , SH_CB_SEQUENCE , txt("t_sh_cb_sequence") ) ;
    h2->Add ( cb_sequence , 0 , wxALL|wxEXPAND , 2 ) ;
    cb_sequence->SetValue ( true ) ;
    if ( c->def != _T("ABIviewer") )
       {
       cb_items = new wxCheckBox ( this , SH_CB_ITEMS , txt("t_sh_cb_items") ) ;
       h2->Add ( cb_items , 0 , wxALL|wxEXPAND , 2 ) ;
       cb_items->SetValue ( true ) ;
       }
    if ( c->def == _T("dna") || c->def == _T("PrimerDesign") )
       {
       cb_enzymes = new wxCheckBox ( this , SH_CB_ENZYMES , txt("t_sh_cb_enzymes") ) ;
       cb_translation = new wxCheckBox ( this , SH_CB_TRANSLATION , txt("t_sh_cb_translation") ) ;
       h2->Add ( cb_enzymes , 0 , wxALL|wxEXPAND , 2 ) ;
       h2->Add ( cb_translation , 0 , wxALL|wxEXPAND , 2 ) ;
       cb_enzymes->SetValue ( true ) ;
       cb_translation->SetValue ( true ) ;
       }
    

	lb = new wxListBox ( this , SH_LB ) ;
	
	v0->Add ( t , 0 , wxALL|wxEXPAND , 2 ) ;
	v0->Add ( h0 , 0 , wxALL|wxEXPAND , 2 ) ;
	v0->Add ( h1 , 0 , wxALL|wxEXPAND , 2 ) ;
	v0->Add ( h2 , 0 , wxALL|wxEXPAND , 2 ) ;
	v0->Add ( status , 0 , wxALL|wxEXPAND , 2 ) ;
	v0->Add ( lb , 1 , wxALL|wxEXPAND , 2 ) ;
	
	do_highlight->Disable() ;
	find_button->SetDefault () ;
	t->SetFocus () ;
	
	SetSizer ( v0 ) ;
	v0->Layout () ;
	Center () ;
	
	// Move the dialog so it won't hide the sequence
	int x , y , w , h , x1 , y1 ;
	GetClientSize ( &w , &h ) ;
	GetPosition ( &x , &y ) ;
	myapp()->frame->GetPosition ( &x1, &y1 ) ;
	x -= w ;
	y -= h/2 ;
	x -= 30 ;
	if ( x < x1+5 ) x = x1+5 ;
	if ( y < y1+5 ) y = y1+5 ;
	Move ( x , y ) ;	
	}
Ejemplo n.º 17
0
FindSequenceDialog::~FindSequenceDialog ()
	{
    myapp()->frame->pop_help () ;
	}
Ejemplo n.º 18
0
int main(int argc, char **argv)
{
   if (!TGo4Version::CheckVersion(__GO4BUILDVERSION__)) {
      std::cerr << "Go4 was build with version " << __GO4BUILDVERSION__ << std::endl;
      std::cerr << "Loaded go4 libraries has version " << TGo4Version::Instance()->GetBuildVersion() << std::endl;
      std::cerr << "Please configure your system correctly and restart go4 again" << std::endl;
      return -1;
   }

   int dologin = -1;
   const char* loghost = "localhost";
   int logport = 5000;
   const char* logpass = 0;

   bool traceon = false;
   bool prepare_for_client = false;
   QString hotstart = "";
   QStringList files;

   for(int narg=1;narg<argc;narg++) {
      if (strlen(argv[narg])==0) continue;

      if (argv[narg][0]=='-') {
         if(!strcmp(argv[narg], "-debug")) {
            std::cout << "G-OOOO-> MainGo4GUI switched on debug output" << std::endl;
            traceon = true;
         } else
         if((strcmp(argv[narg], "-observer")==0) ||
            (strcmp(argv[narg], "-controller")==0) ||
            (strcmp(argv[narg], "-admin")==0)) {

            if(strcmp(argv[narg], "-observer")==0) dologin = 0;
            if(strcmp(argv[narg], "-controller")==0) dologin = 1;
            if(strcmp(argv[narg], "-admin")==0) dologin = 2;

            if ((narg+1<argc) && (argv[narg+1][0]!='-'))
               loghost = argv[++narg];

            if ((narg+1<argc) && (argv[narg+1][0]!='-') && (argv[narg+1][0]>='0') && (argv[narg+1][0]<='9'))
               logport = atoi(argv[++narg]);

            if ((narg+1<argc) && (argv[narg+1][0]!='-')) logpass = argv[++narg];
         } else
         if (strcmp(argv[narg], "-prepare")==0) {
            prepare_for_client = true;
         }
      } else
         if (strstr(argv[narg],".root")!=0)
            files.append(argv[narg]);
         else
            if (hotstart.length()==0) {
               hotstart = argv[narg];
               if(!strstr(argv[narg], ".hotstart")) hotstart.append(".hotstart");
            }
   }

   TQApplication app("uno",&argc,argv); // init ROOT before Qt because of XInitThreads JA

   QRootApplication myapp( argc, argv, 0 );

   TGo4AbstractInterface::SetInitSharedLibs();

   TGo4Log::LogfileEnable(kFALSE); // will enable or disable logging all messages
   TGo4Log::Instance(); // init logger object
   TGo4Log::SetIgnoreLevel(1); // set this to 1 to suppress detailed debug output
   // set this to 2 to get warnings and errors only
   // set this to 3 to get errors only

   gInterpreter->SetProcessLineLock(kFALSE);
   // ShowGuideLines cases crashes - it has stored gpad in static variable
   gEnv->SetValue("Canvas.ShowGuideLines", 0);

   ///////////// Define the GO4 Settings. //////////////////////
   // has to be done here, since mainwindow components have local
   // settings access before mainwindow init is executed!
   // Default is to use current directory. Environment variable
   // GO4SETTINGS can be set to a certain go4 setup location
   // if GO4SETTINGS contains the "ACCOUNT" keyword, we use the
   // qt default to have the settings in $HOME/.qt/
   // NOTE: if $HOME/.qt/go4rc exists,
   // Qt would use these settings even if the TGo4QSettings use the
   // current dir option or userpath for saving the settings;
   // Therefore, the local settings will have different names go4localrc
   TGo4QSettings::SetHomeSettingsFile("/go4"); // might change the default filename in .qt here
   bool accountsettings=false;
   QString settingsenv=getenv("GO4SETTINGS");
   if(settingsenv.isEmpty()) {
      // use Qt settings in $PWD/.qt. if false, use $HOME/.qt, or the user path if set
      if (gSystem->AccessPathName(QDir::currentDirPath(),kWritePermission)) {
         TGo4QSettings::SetToCurrentDir(false);
         accountsettings=true;
      } else {
         TGo4QSettings::SetToCurrentDir(true);
      }
   } else
      if(settingsenv.contains("ACCOUNT")) {
         TGo4QSettings::SetToCurrentDir(false);
         accountsettings=true;
      } else {
         TGo4QSettings::SetUserPath(settingsenv);
      }
   /// check here if current settings exist. If not, copy from home
   QString homesettings = QDir::homeDirPath()+ "/.qt/go4rc";
   QString usersettings = TGo4QSettings::GetUserPath()+TGo4QSettings::GetSettingsName()+"rc";
   QString hometools = QDir::homeDirPath()+ "/.qt/go4toolsrc";
   QString usertools = TGo4QSettings::GetUserPath()+"/go4toolsrc";

   if(!accountsettings && gSystem->AccessPathName(usersettings)) // file not there
   {
      // first create subfolder .qt if not there, otherwise copy fails!
      QString qsubdir=TGo4QSettings::GetUserPath();
      if(gSystem->AccessPathName(qsubdir))
      {
         std::cout <<"Creating settings subdirectory "<<qsubdir<<" ..."<< std::endl;
         if(gSystem->mkdir(qsubdir,true)!=0)
            std::cout <<"Could not create "<<qsubdir<<" !"<< std::endl;

      }

      if(gSystem->CopyFile(homesettings,usersettings,kTRUE)==0)
         std::cout <<"Copied account settings "<<homesettings<<" to "<<usersettings << std::endl;
      else
         std::cout<<"Could not copy "<<homesettings<<" to "<<usersettings << std::endl;
      if(gSystem->CopyFile(hometools,usertools,kTRUE)==0)
         std::cout <<"Copied account settings "<<hometools<<" to "<<usertools << std::endl;
      else
         std::cout<<"Could not copy "<<hometools<<" to "<<usertools << std::endl;
   }
   /////// end settings setup ///////////////////////////////
   if(traceon) TGo4Log::SetIgnoreLevel(0);
          else TGo4Log::SetIgnoreLevel(1);

   std::cout << "   Go4 " << __GO4RELEASE__
        << ",   build with ROOT " << ROOT_RELEASE << " and Qt " << QT_VERSION_STR << std::endl;

   // create instance, which should be used everywhere
   go4sett = new TGo4QSettings();

   TGo4MainWindow* Go4MainGUI = new TGo4MainWindow(&myapp);


   myapp.setMainWidget(Go4MainGUI);
   Go4MainGUI->polish();
   Go4MainGUI->show();
   myapp.connect( &myapp, SIGNAL( lastWindowClosed() ), &myapp, SLOT( quit() ) );
   QApplication::setDoubleClickInterval(400); //ms, for Qt>=3.3 avoid very fast defaults!
   QApplication::setStartDragTime(150); // ms

   for ( QStringList::Iterator it = files.begin(); it != files.end(); ++it )
      Go4MainGUI->Browser()->OpenFile((*it).latin1());

   if (hotstart.length()>0)
      Go4MainGUI->HotStart(hotstart.latin1());

   if (dologin>=0) {
      go4sett->setClientNode(loghost);
      go4sett->setClientPort(logport);
      go4sett->setClientDefaultPass(logpass==0);
      go4sett->setClientControllerMode(dologin);
      Go4MainGUI->ConnectServerSlot(false, logpass);
   } else
   if (prepare_for_client) {
      Go4MainGUI->PrepareForClientConnectionSlot(false);
   }

   int res = myapp.exec();

   delete go4sett;

   return res;
}
Ejemplo n.º 19
0
void SeqAA::show ( wxDC& dc )
    {
    if ( useDirectRoutines() ) { show_direct ( dc ) ; return ; }
    wxMessageBox ( _T("One has to wonder...2") ) ;
    int cw2 , ch2 ;
    dc.SetFont(*can->smallFont);
    dc.GetTextExtent ( _T("A") , &cw2 , &ch2 ) ;
    dc.SetFont(*can->font);
    wxColour tbg = dc.GetTextBackground () ;
    wxColour tfg = dc.GetTextForeground () ;
    int bm = dc.GetBackgroundMode () ;
    int a = 0 , b , cnt = offset+1 ;
    wxString t ;
    wxColour bbg ( 150 , 150 , 255 ) ;
    dc.SetTextBackground ( *wxWHITE ) ;
    if ( primaryMode ) dc.SetTextForeground ( getHighlightColor ( a , *wxBLACK ) ) ;
    else dc.SetTextForeground ( myapp()->frame->aa_color ) ;
    dc.SetBackgroundMode ( wxTRANSPARENT ) ;

    int xa , ya , yb ;
    dc.GetDeviceOrigin ( &xa , &ya ) ;
    ya = -ya ;
    can->MyGetClientSize ( &xa , &yb ) ;
    yb += ya ;
    for ( a = 0 ; a < pos.p.GetCount() ; a++ )
        {
        if ( can->hardstop > -1 && a > can->hardstop ) break ;
        b = pos.p[a] ;
        int ty = pos.r[a].y ;
        int tz = ty + can->charheight ;
        bool insight = true ;
        if ( tz < ya ) insight = false ;
        if ( ty > yb ) insight = false ;
        if ( can->getDrawAll() ) insight = true ;
        if ( !insight && ty > yb ) a = pos.p.GetCount() ;
        if ( b > 0 && !insight ) cnt++ ;
        if ( b > 0 && insight ) // Character
           {
           if ( getMark ( a ) == 1 )
              {
              if ( primaryMode )
                 {
                 dc.SetTextForeground ( *wxBLACK ) ;
              dc.SetBackgroundMode ( wxSOLID ) ;
                 dc.SetTextBackground ( *wxLIGHT_GREY ) ;
                 }
              else
                 {
                 dc.SetTextForeground ( bbg ) ;
                 dc.SetTextBackground ( *wxWHITE ) ;
                 }
              }
           else if ( getMark ( a ) == 2 && can->doOverwrite() )
              {
              dc.SetTextForeground ( *wxWHITE ) ;
              dc.SetTextBackground ( *wxBLACK ) ;
              dc.SetBackgroundMode ( wxSOLID ) ;
              }

	 		  wxChar ch2 = s.GetChar(b-1) ;
		 	  if ( ch2 == '|' ) ch2 = myapp()->frame->stopcodon ;
           t = ch2 ;
           if ( can->isPrinting() && !can->getPrintToColor() )
              {
              dc.SetTextForeground ( *wxBLACK ) ;
              dc.SetBackgroundMode ( wxTRANSPARENT ) ;
              }

           dc.DrawText ( t, pos.r[a].x, pos.r[a].y ) ;

           if ( getMark ( a ) == 2 && !can->doOverwrite() )
              {
                 int tx = pos.r[a].x , ty = pos.r[a].y ;
                 int tz = ty + can->charheight ;
                 dc.SetPen(*wxBLACK_PEN);
                 dc.DrawLine ( tx-1 , ty , tx-1 , tz ) ;
                 dc.DrawLine ( tx-3 , ty , tx+2 , ty ) ;
                 dc.DrawLine ( tx-3 , tz , tx+2 , tz ) ;
              }
           if ( getMark ( a ) > 0 )
              {
              dc.SetTextBackground ( *wxWHITE ) ;
              if ( primaryMode ) dc.SetTextForeground ( getHighlightColor ( a , *wxBLACK ) ) ;
              else dc.SetTextForeground ( myapp()->frame->aa_color ) ;
              dc.SetBackgroundMode ( wxTRANSPARENT ) ;
              }

           // Protease cuts
           for ( int q = 0 ; q < pc.GetCount() ; q++ )
              {
              if ( b == pc[q]->cut )
                 {
                 int qx = pos.r[a].x - 2 ;
                 int qy = pos.r[a].y ;
                 if ( !pc[q]->left ) qx += can->charwidth + 4 ;
                 dc.SetTextForeground ( *wxBLACK ) ;
                 dc.SetPen(*wxGREY_PEN);
                 dc.DrawLine ( qx   , qy + 1 , qx   , qy + can->charheight - 2 ) ;
                 dc.SetPen(*wxBLACK_PEN);
                 dc.DrawLine ( qx+1 , qy + 1 , qx+1 , qy + can->charheight - 2 ) ;

                 wxString pn = pc[q]->protease->name ;
                 for ( int w = 0 ; w+1 < pn.length() ; w++ )
                    if ( pn.GetChar(w) == ' ' && pn.GetChar(w+1) == '(' )
                       pn = pn.substr ( 0 , w ) ;
                 dc.SetFont(*can->smallFont);
                 int u1 , u2 ;
                 dc.GetTextExtent ( pn , &u1 , &u2 ) ;
                 dc.DrawText ( pn , qx - u1/2 , qy - u2/2 ) ;
                 dc.SetFont(*can->font);
                 
                 if ( primaryMode ) dc.SetTextForeground ( getHighlightColor ( a , *wxBLACK ) ) ;
                 else dc.SetTextForeground ( myapp()->frame->aa_color ) ;
                 }
              }
              
           cnt++ ;
           }
        else if ( insight ) // Front number
           {
//           if ( primaryMode ) sprintf ( u , "%d" , cnt ) ;
//           else sprintf ( u , "%d" , cnt/3 ) ;
//           t = u ;
			  if ( primaryMode ) t = wxString::Format ( _T("%d") , cnt ) ;
			  else t = wxString::Format ( _T("%d") , cnt/3 ) ;
           while ( t.length() < endnumberlength ) t = _T("0") + t ;
           dc.DrawText ( t , pos.r[a].x, pos.r[a].y ) ;
           }
        }
    dc.SetBackgroundMode ( bm ) ;
    dc.SetTextBackground ( tbg ) ;
    dc.SetTextForeground ( tfg ) ;
    }
Ejemplo n.º 20
0
void SeqAA::show_direct ( wxDC& dc )
    {
    myass ( itemsperline , "AA:show_direct_ipl" ) ;
    if ( !itemsperline ) return ;
    mylog ( "SeqAA::show_direct" , "0" ) ;
    can->SetFont(*can->font);
    dc.SetFont(*can->font);
    int a , b , w , h , n , bo = can->border ;
    int csgc = can->NumberOfLines() , cbs = can->blocksize ;
    int cih = can->isHorizontal() ;
    int xa , xb , ya , yb ;
    for ( n = 0 ; n < csgc && can->seq[n] != this ; n++ ) ;
    if ( n == csgc ) return ;
    mylog ( "SeqAA::show_direct" , "1" ) ;
    
    // Setting basic values
    int cw = can->charwidth , ch = can->charheight ;
    int ox = bo + cw + cw * endnumberlength ;
    int oy = n*ch+bo ;
    
    can->MyGetClientSize ( &w , &h ) ;
    xb = w ;
    yb = h ;

    wxColour tbg = dc.GetTextBackground () ;
    wxColour tfg = dc.GetTextForeground () ;
    int bm = dc.GetBackgroundMode () ;
    wxColour tf ;
    if ( primaryMode ) tf = *wxBLACK ;
    else tf = myapp()->frame->aa_color ;; // wxColour ( 130 , 130 , 130 ) ;//*wxLIGHT_GREY ;
    dc.SetTextForeground ( tf ) ;
    dc.SetBackgroundMode ( wxTRANSPARENT ) ;

    dc.GetDeviceOrigin ( &xa , &ya ) ;
    xa = -xa ;
    xb += xa ;
    ya = -ya ;
    yb += ya ;
    
    mylog ( "SeqAA::show_direct" , "2" ) ;
    b = ( ya - ch - oy ) / ( ch * csgc ) * itemsperline ;
    mylog ( "SeqAA::show_direct" , "3" ) ;
    for ( a = 0 ; a < b && a < s.length() ; a += itemsperline ) ;
        
    for ( ; a < s.length() ; a++ )
        {
        int px = a % itemsperline , py = a / itemsperline ;
        
        bool showNumber = ( px == 0 ) ;
        
        px = px * cw + ( px / cbs ) * ( cw - 1 ) + ox ;
        py = py * ch * csgc + oy ;
        
        if ( !can->getDrawAll() )
           {
           if ( py + ch < ya ) continue ;
           if ( py > yb ) break ;
           if ( cih )
              {
              if ( px + cw < xa ) continue ;
              if ( px > xb ) continue ;
              }    
           }    

       int pm = getMark ( a ) ;
       if ( pm == 1 ) // Marked (light gray background)
          {
          dc.SetBackgroundMode ( wxSOLID ) ;
          dc.SetTextBackground ( *wxLIGHT_GREY ) ;
          dc.SetTextForeground ( getHighlightColor ( a , tf ) ) ;
          }
       else if ( pm == 2 && can->doOverwrite() ) // Overwrite cursor
          {
          dc.SetBackgroundMode ( wxSOLID ) ;
          dc.SetTextBackground ( *wxBLACK ) ;
          }
       if ( pm == 2 && can->doOverwrite() ) dc.SetTextForeground ( *wxWHITE ) ;
       else dc.SetTextForeground ( getHighlightColor ( a , tf ) ) ;
       if ( can->isPrinting() && pm == 1 )
          {
          dc.SetBrush ( *MYBRUSH ( wxColour ( 230 , 230 , 230 ) ) ) ;
          dc.SetPen(*wxTRANSPARENT_PEN);
          dc.DrawRectangle ( px , py , cw , ch ) ;
          }
       if ( can->isPrinting() && !can->getPrintToColor() )
          {
          dc.SetBackgroundMode ( wxTRANSPARENT ) ;
          dc.SetTextForeground ( *wxBLACK ) ;
          }

		 // Show the char
		 wxChar ch2 = s.GetChar(a) ;
		 if ( ch2 == '|' ) ch2 = myapp()->frame->stopcodon ;
       dc.DrawText ( wxString ( ch2 ) , px , py ) ;
       
       int pz = py + ch ;

       if ( pm == 2 && !can->doOverwrite() ) // Insert cursor
          {
             dc.SetPen(*wxBLACK_PEN);
             dc.DrawLine ( px-1 , py , px-1 , pz ) ;
             dc.DrawLine ( px-3 , py , px+2 , py ) ;
             dc.DrawLine ( px-3 , pz , px+2 , pz ) ;
          }
       if ( pm > 0 ) // Reverting cursor settings
          {
          dc.SetBackgroundMode ( wxTRANSPARENT ) ;
          dc.SetTextForeground ( getHighlightColor ( a , tf ) ) ;
          }

       // Protease cuts
       for ( int q = 0 ; q < pc.GetCount() ; q++ )
          {
          if ( a == pc[q]->cut - pc[q]->left )
             {
             int qx = px ;
             int qy = py ;
             if ( !pc[q]->left ) qx += cw + 4 ;
             dc.SetTextForeground ( *wxBLACK ) ;
             dc.SetPen(*wxGREY_PEN);
             dc.DrawLine ( qx   , qy + 1 , qx   , qy + can->charheight - 2 ) ;
             dc.SetPen(*wxBLACK_PEN);
             dc.DrawLine ( qx+1 , qy + 1 , qx+1 , qy + can->charheight - 2 ) ;

             wxString pn = pc[q]->protease->name ;
             for ( int w = 0 ; w+1 < pn.length() ; w++ )
                if ( pn.GetChar(w) == ' ' && pn.GetChar(w+1) == '(' )
                   pn = pn.substr ( 0 , w ) ;
             dc.SetFont(*can->smallFont);
             int u1 , u2 ;
             dc.GetTextExtent ( pn , &u1 , &u2 ) ;
             dc.DrawText ( pn , qx - u1/2 , qy - u2/2 ) ;
             dc.SetFont(*can->font);
             
             if ( primaryMode ) dc.SetTextForeground ( getHighlightColor ( a , *wxBLACK ) ) ;
             else dc.SetTextForeground ( myapp()->frame->aa_color /* *wxLIGHT_GREY */ ) ;
             }
          }

        if ( showNumber && primaryMode )
           {
           wxString t = wxString::Format ( _T("%d") , a + 1 ) ;
           while ( endnumberlength > t.length() ) t = _T("0") + t ;
//           t.Pad ( endnumberlength - t.length() , '0' , false ) ;
           dc.DrawText ( t , bo , py ) ;
           }    
        }    


    dc.SetBackgroundMode ( bm ) ;
    dc.SetTextBackground ( tbg ) ;
    dc.SetTextForeground ( tfg ) ;
    }