Exemplo n.º 1
0
void MyFrame::OnReadFile (wxString filename)
{
   if (mol.ReadPdb((const char*)filename.mb_str(wxConvUTF8) )) {
       if ((mol.natm==0) && (mol.nhetatm!=0)) geoSettings.showHetatm=true;
       MyTab::EnableGeom();
       UpdateShadowmap();
       wxString name( mol.GetMolName(), wxConvUTF8 ); 
       SetTitle(  name.BeforeLast('.')+ _T(" - QuteMol") );
       m_tb->SetTitleText(name);
       geoSettings.Apply();

       // redo shaders, as texture size could have changed 
       cgSettings.UpdateShaders();

   } else {
      wxMessageBox(wxString::FromAscii(QAtom::lastReadError), _T(":-("), wxOK | wxICON_EXCLAMATION, this);
      m_tb->SetTitleText();
   }
   
  // remake shaders cos texture size could have changed...

   
   //theText->LoadFile(openFileDialog->GetFilename());
   //SetStatusText(GetCurrentFilename(), 0);      
}
Exemplo n.º 2
0
void TestGLCanvas::OnKeyDown( wxKeyEvent& event ){
  wxConsumeTrackBallEvent(event,true,track);
#ifdef __DARWIN__
	wxString path = wxStandardPaths::Get().GetResourcesDir() + "/presets/new.preset";
#else
	wxString path =  "presets\\new.preset";
#endif
  if (event.GetKeyCode() == WXK_F7 ) {
    cgSettings.Save(path.c_str());
  }

  if (event.GetKeyCode() == WXK_F6 ) {
    if (cgSettings.Load(path.c_str())) {
      MyTab::UpdateAll();
      
      cgSettings.ResetHalo();
      cgSettings.UpdateShaders();
      SceneChanged();
    }

  }

  if (event.GetKeyCode() == WXK_F5 ) {
    mol.PrepareAOSingleView();
    SceneChanged();
  }

  if (event.GetKeyCode() == WXK_F2 ) {
    static int status=0;
    status=(status+1) % 5;
    draw_balls = (status==0) || (status==1)  || (status==2) ; 
    draw_sticks = (status==0) || (status==1) || (status==3) || (status==4) ; 
    draw_wireframe_balls= (status==1)  ;
    draw_wireframe_sticks= (status==1)  || (status==3) ;
    
    SceneChanged();
  }
  
  if (event.GetKeyCode() == WXK_F1 ) {
    wxString text; 
    if (!mol.IsReady() ) text=wxT("(no molecule)");
    else {

      text=wxString( mol.GetMolName(), wxConvUTF8 ).BeforeLast('.') + 
           wxT("\n (file: \"")+wxString( mol.filename, wxConvUTF8 ) +wxT("\")\n\n");
      
      text=text+wxString::Format(wxT("%d atoms\n"),mol.atom.size());
      
      if (mol.sticks) {
        text=text+wxString::Format(wxT("%d bonds\n"),mol.bond.size());
      }
      
           
      text=text+wxString::Format(
        _T("\nUsing:\n Texture size = %dx%d\n Patch size=%dx%d"), 
        moltextureCanvas.GetHardRes(),
        moltextureCanvas.GetHardRes(),
        CSIZE,CSIZE
      );

      
    }       
    wxMessageBox(text, _T("QuteMol - file info"), wxOK | wxICON_INFORMATION, this);
  }

  if (event.GetKeyCode() == WXK_F6 ) {
    use_accurate_halo=!use_accurate_halo;
    SceneChanged();
  }
  
  // temp, should e set auto depending on dist
  if (event.GetKeyCode() == WXK_F2 ) {

    cgSettings.P_capping=!cgSettings.P_capping;
    cgSettings.UpdateShaders();
    SceneChanged();
  }
}