From 69202c901ccd3245d60339093a233d791dc9a9f6 Mon Sep 17 00:00:00 2001 From: Steffen Moeller Date: Mon, 12 Aug 2024 17:15:36 +0200 Subject: [PATCH 1/2] fix: loading from disk works again --- src/ChildBase.cpp | 11 +- src/ManageDatabase.cpp | 210 +++++++++++++++++++++++++----------- src/MyChild.cpp | 24 +++-- src/MyFrame.cpp | 135 +++++++++++++++++------ src/MyFrame.h | 22 ++-- src/PlasmidCanvas.cpp | 56 ++++++++-- src/PlasmidCanvasLinear.cpp | 9 ++ src/SequenceCanvas.cpp | 10 +- src/SequenceTypeAA.cpp | 121 ++++++++++++--------- src/TImageDisplay.cpp | 16 ++- src/TSilmutDialog.cpp | 19 +++- 11 files changed, 447 insertions(+), 186 deletions(-) diff --git a/src/ChildBase.cpp b/src/ChildBase.cpp index 769d09ff..a38f39b3 100644 --- a/src/ChildBase.cpp +++ b/src/ChildBase.cpp @@ -58,17 +58,26 @@ void ChildBase::showName ( const wxString& _x ) const void ChildBase::OnFocus(wxFocusEvent& event) { + wxPrintf( "D: ChildBase::OnFocus - start\n" ) ; myass ( myapp() , "Oh no! No application defined!" ) ; myass ( myapp()->frame , "Oh no! No frame defined!" ) ; if ( myapp()->frame->dying ) + { + wxPrintf( "D: ChildBase::OnFocus - ret dying\n" ) ; return ; + } Activate () ; showName () ; //SetFocusedItem ( inMainTree ) ; - if ( cSequence ) cSequence->SetFocus() ; + if ( cSequence ) + { + wxPrintf( "D: ChildBase::OnFocus - cSequence\n" ) ; + cSequence->SetFocus() ; + } + wxPrintf( "D: ChildBase::OnFocus - start\n" ) ; } bool ChildBase::caniclose(wxCloseEvent& event) diff --git a/src/ManageDatabase.cpp b/src/ManageDatabase.cpp index 8bc20466..f08366c9 100644 --- a/src/ManageDatabase.cpp +++ b/src/ManageDatabase.cpp @@ -45,6 +45,7 @@ END_EVENT_TABLE() TManageDatabaseDialog::TManageDatabaseDialog ( wxWindow *parent , const wxString& title , const int mode , TVector * const _v ) : wxDialog ( parent , -1 , title , wxDefaultPosition , wxSize ( 700 , 550 ) ) { + wxPrintf( "D: TManageDatabaseDialog::TManageDatabaseDialog - start\n" ) ; pm_dd_l = pm_dd_r = NULL ; filter_txt = NULL ; pm_name = NULL ; @@ -70,25 +71,28 @@ TManageDatabaseDialog::TManageDatabaseDialog ( wxWindow *parent , const wxString dc.GetTextExtent ( "X" , &bo , &th ) ; th = th * 3 / 2 ; bo = th / 4 ; - wxBeginBusyCursor() ; - nb = new wxNotebook ( (wxWindow*) this , - -1 , - wxPoint ( 0 , 0 ) , - wxSize ( w , h ) ) ; + nb = new wxNotebook ( (wxWindow*) this , -1 , wxPoint ( 0 , 0 ) , wxSize ( w , h ) ) ; pDatabases = new wxPanel ( nb , -1 ) ; pCopynMove = new wxPanel ( nb , -1 ) ; + wxBeginBusyCursor() ; initDatabases () ; initCopynMove () ; - if ( startup ) f_twopanes->SetValue ( 0 ) ; + if ( startup ) + { + f_twopanes->SetValue ( 0 ) ; + } else if ( doLoad || doSave ) { int tp = myapp()->frame->LS->getOption ( _T("TWOPANES") , 0 ) ; f_twopanes->SetValue ( tp ) ; } - else f_twopanes->SetValue ( 1 ) ; + else + { + f_twopanes->SetValue ( 1 ) ; + } updateTwoLists () ; nb->SetSelection ( 1 ) ; @@ -98,16 +102,20 @@ TManageDatabaseDialog::TManageDatabaseDialog ( wxWindow *parent , const wxString Center () ; wxEndBusyCursor() ; + wxPrintf( "D: TManageDatabaseDialog::TManageDatabaseDialog - end\n" ) ; } TManageDatabaseDialog::~TManageDatabaseDialog () { + wxPrintf( "D: TManageDatabaseDialog::~TManageDatabaseDialog - start\n" ) ; nb->DeleteAllPages() ; if ( il ) delete il ; + wxPrintf( "D: TManageDatabaseDialog::~TManageDatabaseDialog - end\n" ) ; } void TManageDatabaseDialog::initCopynMove () { + wxPrintf( "D: TManageDatabaseDialog::initCopynMove - start\n" ) ; v0 = new wxBoxSizer ( wxVERTICAL ) ; wxBoxSizer *v1 = new wxBoxSizer ( wxVERTICAL ) ; v2 = new wxBoxSizer ( wxVERTICAL ) ; @@ -128,12 +136,8 @@ void TManageDatabaseDialog::initCopynMove () pm_dd_l = new wxChoice ( p , MD_PM_DD_L ) ; pm_dd_r = new wxChoice ( p , MD_PM_DD_R ) ; - pm_left = new wxListCtrl ( p , MD_PM_LEFT , wxDefaultPosition , - wxDefaultSize , - lbstyle ) ; - pm_right = new wxListCtrl ( p , MD_PM_RIGHT , wxDefaultPosition , - wxDefaultSize , - lbstyle ) ; + pm_left = new wxListCtrl ( p , MD_PM_LEFT , wxDefaultPosition , wxDefaultSize , lbstyle ) ; + pm_right = new wxListCtrl ( p , MD_PM_RIGHT , wxDefaultPosition , wxDefaultSize , lbstyle ) ; TMyDropTarget *rdt = new TMyDropTarget ( this , pm_right ) ; pm_right->SetDropTarget ( (wxDropTarget*) rdt ) ; @@ -141,7 +145,6 @@ void TManageDatabaseDialog::initCopynMove () TMyDropTarget *ldt = new TMyDropTarget ( this , pm_left ) ; pm_left->SetDropTarget ( (wxDropTarget*) ldt ) ; - wxBitmap bmp_helix ( myapp()->bmpdir.GetFullPath() + wxFileName::GetPathSeparator() + "Helix.bmp" , wxBITMAP_TYPE_BMP ) ; wxBitmap bmp_project ( myapp()->bmpdir.GetFullPath() + wxFileName::GetPathSeparator() + "project.bmp" , wxBITMAP_TYPE_BMP ) ; wxBitmap bmp_protein ( myapp()->bmpdir.GetFullPath() + wxFileName::GetPathSeparator() + "protein.bmp" , wxBITMAP_TYPE_BMP ) ; @@ -218,6 +221,7 @@ void TManageDatabaseDialog::initCopynMove () p->SetSizer ( v0 ) ; p->Layout () ; + wxPrintf( "D: TManageDatabaseDialog::initCopynMove - end\n" ) ; } void TManageDatabaseDialog::updateTwoLists () @@ -265,15 +269,22 @@ void TManageDatabaseDialog::pm_init_lists () { wxString db = defdb ; if ( isProject && !myapp()->frame->project.db.IsEmpty() ) + { db = myapp()->frame->project.db ; + } else if ( !isProject ) + { db = v->getDatabase() ; - if ( db.IsEmpty() ) db = defdb ; + } + if ( db.IsEmpty() ) + { + db = defdb ; + } pm_dd_save->SetStringSelection ( db ) ; } pm_list_items ( PM_LEFT ) ; -// pm_list_items ( PM_RIGHT ) ; +// pm_list_items ( PM_RIGHT ) ; pm_left->SetFocus() ; } @@ -319,8 +330,12 @@ void TManageDatabaseDialog::pm_list_items ( const int x ) // Filtering for ( int a = 0 ; a < filter.length() ; a++ ) + { if ( filter.GetChar(a) == '\"' ) + { filter.SetChar ( a , '\'' ) ; + } + } wxArrayString vf ; explode ( " " , filter , vf ) ; wxString sql2 , sql3 ; @@ -328,12 +343,19 @@ void TManageDatabaseDialog::pm_list_items ( const int x ) { if ( !vf[a].IsEmpty() ) { - if ( !sql2.IsEmpty() ) sql2 += " AND" ; + if ( !sql2.IsEmpty() ) + { + sql2 += " AND" ; + } sql2 += " (dna_name LIKE \"%" + vf[a] + "%\"" ; if ( f_desc->GetValue() ) + { sql2 += " OR dna_description LIKE \"%" + vf[a] + "%\"" ; + } if ( f_seq->GetValue() ) + { sql2 += " OR dna_sequence LIKE \"%" + vf[a] + "%\"" ; + } sql2 += ")" ; } } @@ -416,14 +438,18 @@ void TManageDatabaseDialog::pmOnListEvent ( wxListEvent &ev , wxListCtrl *source wxArrayString vs ; vi = getSelectedListItems ( source ) ; for ( int a = 0 ; a < vi.GetCount() ; a++ ) + { vs.Add ( source->GetItemText ( vi[a] ) ) ; + } wxTextDataObject my_data(GENTLE_DRAG_DATA); wxDropSource dragSource( this ); dragSource.SetData( my_data ); wxDragResult result = dragSource.DoDragDrop( TRUE ); if ( result != wxDragCopy && result != wxDragMove ) + { return ; + } wxString sdb = dds->GetStringSelection() ; wxString tdb = ddt->GetStringSelection() ; @@ -439,6 +465,7 @@ void TManageDatabaseDialog::pmOnListEvent ( wxListEvent &ev , wxListCtrl *source bool TManageDatabaseDialog::do_copy ( const wxString& name , const wxString& sdb , const wxString& tdb ) { + wxPrintf( "D: TManageDatabaseDialog::do_copy (%a, db, tdb)\n" ) ; if ( isProject ) return false ; else return copyDNA ( name , sdb , tdb ) ; } @@ -451,40 +478,56 @@ bool TManageDatabaseDialog::do_move ( const wxString& name , const wxString& sdb void TManageDatabaseDialog::do_del ( const wxString& name , const wxString& db ) { - if ( isProject ) return ; - else delDNA ( name , db ) ; + if ( isProject ) + { + return ; + } + else + { + delDNA ( name , db ) ; + } } -bool TManageDatabaseDialog::copyDNA ( const wxString& _n , const wxString& sdb , const wxString& tdb ) +bool TManageDatabaseDialog::copyDNA ( const wxString& _name , const wxString& sdb , const wxString& tdb ) { if ( sdb == tdb ) return false ; SetCursor ( *wxHOURGLASS_CURSOR ) ; TStorage *source = getTempDB ( getFileName ( sdb ) ) ; TStorage *target = getTempDB ( getFileName ( tdb ) ) ; + const wxString name = source->fixDNAname ( _name ) ; - wxString name = source->fixDNAname ( _n ) ; + TSQLresult r ; // Already there? - wxString sql = "SELECT dna_name FROM dna WHERE dna_name=\"" + name + "\"" ; - TSQLresult r = target->getObject ( sql ) ; - if ( r.rows() > 0 ) { - wxMessageDialog md ( this , txt("t_entry_exists_brief") , txt("msg_box") ) ; - md.ShowModal() ; - return false ; + const wxString sql = "SELECT dna_name FROM dna WHERE dna_name=\"" + name + "\"" ; + r = target->getObject ( sql ) ; + if ( r.rows() > 0 ) + { + SetCursor ( *wxSTANDARD_CURSOR ) ; + wxMessageDialog md ( this , txt("t_entry_exists_brief") , txt("msg_box") ) ; + md.ShowModal() ; + return false ; + } } - // Copy DNA and items source->copySQLfields ( *target , "dna" , "dna_name=\"" + name + "\"" ) ; source->copySQLfields ( *target , "dna_item" , "di_dna=\"" + name + "\"" ) ; // Enzymes - sql = "SELECT dna_restriction_enzymes FROM dna WHERE dna_name=\"" + name + "\"" ; - r = source->getObject ( sql ) ; - if ( r.rows() == 0 ) return false ; + { + const wxString sql = "SELECT dna_restriction_enzymes FROM dna WHERE dna_name=\"" + name + "\"" ; + r = source->getObject ( sql ) ; + if ( r.rows() == 0 ) + { + SetCursor ( *wxSTANDARD_CURSOR ) ; + wxPrintf("I: TManageDatabaseDialog::copyDNA: ret - No enzymes found for '%s'\n" , name ) ; + return false ; + } + } - wxString s = r[0][0] ; + const wxString s = r[0][0] ; wxString t = "" ; wxArrayString ve ; for ( int a = 0 ; a < s.length() ; a++ ) @@ -500,7 +543,7 @@ bool TManageDatabaseDialog::copyDNA ( const wxString& _n , const wxString& sdb , for ( int a = 0 ; a < ve.GetCount() ; a++ ) { - sql = "SELECT e_name FROM enzyme WHERE e_name=\"" + ve[a] + "\"" ; + const wxString sql = "SELECT e_name FROM enzyme WHERE e_name=\"" + ve[a] + "\"" ; r = target->getObject ( sql ) ; if ( r.rows() == 0 ) source->copySQLfields ( *target , "enzyme" , "e_name=\"" + ve[a] + "\"" ) ; @@ -519,8 +562,8 @@ bool TManageDatabaseDialog::moveDNA ( const wxString& name , const wxString& sdb void TManageDatabaseDialog::delDNA ( const wxString& _n, const wxString& db ) { - TStorage *source = getTempDB ( getFileName ( db ) ) ; - wxString name = source->fixDNAname ( _n ) ; + TStorage * const source = getTempDB ( getFileName ( db ) ) ; + const wxString name = source->fixDNAname ( _n ) ; source->getObject ( "DELETE FROM dna WHERE dna_name=\"" + name + "\"" ) ; source->getObject ( "DELETE FROM dna_item WHERE di_dna=\"" + name + "\"" ) ; } @@ -530,6 +573,7 @@ wxString TManageDatabaseDialog::getFileName ( const wxString& dbname ) const for ( int a = 0 ; a < db_name.GetCount() ; a++ ) if ( db_name[a] == dbname ) return db_file[a] ; + wxPrintf("I: TManageDatabaseDialog::getFileName: Could not find database '%s'\n" , dbname ) ; return "" ; } @@ -610,7 +654,7 @@ void TManageDatabaseDialog::pd_loadList () // Event handlers -void TManageDatabaseDialog::OnCharHook(wxKeyEvent& event) +void TManageDatabaseDialog::OnCharHook ( wxKeyEvent& event ) { int k = event.GetKeyCode () ; wxCommandEvent ev ; @@ -638,16 +682,15 @@ void TManageDatabaseDialog::pdOnDBchange ( wxCommandEvent &ev ) void TManageDatabaseDialog::pdOnNew ( wxCommandEvent &ev ) { - wxString wildcard = "GENtle database (*.db)|*.db" ; + const wxString wildcard = "GENtle database (*.db)|*.db" ; wxFileDialog d ( this , txt("t_add_new_db") , "" , "" , wildcard , wxFD_SAVE|wxFD_OVERWRITE_PROMPT ) ; int x = d.ShowModal() ; if ( x != wxID_OK ) return ; - wxString fn = d.GetPath() ; - wxString blank = myapp()->homedir.GetFullPath() + wxFileName::GetPathSeparator() ; - blank += "blank.db" ; + const wxString fn = d.GetPath() ; + const wxString blank = myapp()->homedir.GetFullPath() + wxFileName::GetPathSeparator() + "blank.db" ; - bool b = wxCopyFile ( blank , fn , true ) ; + const bool b = wxCopyFile ( blank , fn , true ) ; if ( !b ) { wxMessageBox ( fn , txt("t_db_already_exists") ) ; @@ -659,13 +702,17 @@ void TManageDatabaseDialog::pdOnNew ( wxCommandEvent &ev ) void TManageDatabaseDialog::pdOnAdd ( wxCommandEvent &ev ) { - wxString wildcard = "GENtle database (*.db)|*.db" ; + const wxString wildcard = "GENtle database (*.db)|*.db" ; wxFileDialog d ( this , txt("t_choose_db") , "" , "" , wildcard , wxFD_OPEN ) ; int x = d.ShowModal() ; if ( x != wxID_OK ) return ; - wxString fn = d.GetPath() ; - if ( !wxFileExists ( fn ) ) return ; + const wxString fn = d.GetPath() ; + if ( !wxFileExists ( fn ) ) + { + wxPrintf("I: TManageDatabaseDialog::pdOnAdd: File '%s' does not exist. Not adding database.\n" , fn ) ; + return ; + } addDatabase ( fn ) ; } @@ -701,21 +748,26 @@ void TManageDatabaseDialog::addDatabase ( const wxString& fn ) // Avoiding double names if ( t.GetChar(0) >= 'a' && t.GetChar(0) <= 'z' ) + { t.SetChar ( 0 , t.GetChar(0) - 'a' + 'A' ) ; // Uppercase + } wxString s = t ; b = 1 ; do { + if ( b > 1 ) - s = t + wxString::Format ( " (%d)" , b ) ; + { + s = t + wxString::Format ( " (%d)" , b ) ; + } b++ ; for ( a = 0 ; a < db_name.GetCount() && db_name[a] != s ; a++ ) ; + } while ( a < db_name.GetCount() ) ; t = s ; // Saving in database - TSQLresult r ; - wxString sql = "INSERT INTO stuff (s_type,s_name,s_value) VALUES (\"DATABASE\",\"" + t + "\",\"" + fn + "\")" ; - r = myapp()->frame->LS->getObject ( sql ) ; + const wxString sql = "INSERT INTO stuff (s_type,s_name,s_value) VALUES (\"DATABASE\",\"" + t + "\",\"" + fn + "\")" ; + TSQLresult r = myapp()->frame->LS->getObject ( sql ) ; pd_loadList () ; pd_db->SetStringSelection ( t ) ; pm_init_lists () ; @@ -824,34 +876,61 @@ void TManageDatabaseDialog::pmOnActivate ( wxListEvent &ev , wxListCtrl *side ) void TManageDatabaseDialog::pmOpenFiles ( const wxArrayString & _names , const wxString& _db ) { - if ( _names.GetCount() == 0 ) return ; + wxPrintf( "D: TManageDatabaseDialog::pmOpenFiles - start - _names.Count()=%ld\n" , _names.Count() ) ; + if ( _names.GetCount() == 0 ) + { + wxPrintf( "D: TManageDatabaseDialog::pmOpenFiles - start-check - _names.GetCount() == 0 returning without ending modal.\n" ) ; + return ; + } myapp()->frame->pop_help () ; + wxPrintf( "D: TManageDatabaseDialog::pmOpenFiles - A\n" ) ; if ( doLoad || doSave ) + { + wxPrintf( "D: TManageDatabaseDialog::pmOpenFiles - A2 - doLoad || doSave\n" ) ; myapp()->frame->LS->setOption ( _T("TWOPANES") , f_twopanes->GetValue() ) ; + } + wxPrintf( "D: TManageDatabaseDialog::pmOpenFiles - B1 - setting return code to wxID_OK\n" ) ; SetReturnCode ( wxID_OK ) ; + wxPrintf( "D: TManageDatabaseDialog::pmOpenFiles - B2 - ending modal\n" ) ; EndModal ( true ) ; wxBeginBusyCursor () ; - myapp()->frame->lockDisplay ( true ) ; + wxPrintf( "D: TManageDatabaseDialog::pmOpenFiles - C\n" ) ; + //myapp()->frame->lockDisplay ( true ) ; + wxPrintf( "D: TManageDatabaseDialog::pmOpenFiles - D\n" ) ; - wxProgressDialog pd ( txt("t_loading") , "" , _names.GetCount() , NULL , wxPD_ALL ) ; + //wxProgressDialog pd ( txt("t_loading") , "" , _names.GetCount() , NULL , wxPD_ALL ) ; + wxPrintf( "D: TManageDatabaseDialog::pmOpenFiles - E\n" ) ; for ( int a = 0 ; a < _names.GetCount() ; a++ ) { + /* + wxPrintf( "D: TManageDatabaseDialog::pmOpenFiles - F - update progress box\n" ) ; if ( !pd.Update ( a , _names[a] ) ) + { + wxPrintf( "D: TManageDatabaseDialog::pmOpenFiles - F - break\n" ) ; break ; + } + */ + wxPrintf( "D: TManageDatabaseDialog::pmOpenFiles - G - invoking do_load(%s,%s)\n" , _names[a] , _db ) ; do_load ( _names[a] , _db ) ; + wxPrintf( "D: TManageDatabaseDialog::pmOpenFiles - H\n" ) ; } - - myapp()->frame->lockDisplay ( false ) ; + wxPrintf( "D: TManageDatabaseDialog::pmOpenFiles - I - EndBusyCursor\n" ) ; wxEndBusyCursor () ; + + wxPrintf( "D: TManageDatabaseDialog::pmOpenFiles - J - UnlockDisplay\n" ) ; + //myapp()->frame->lockDisplay ( false ) ; + wxPrintf( "D: TManageDatabaseDialog::pmOpenFiles - K - MainTreeRefresh\n" ) ; myapp()->frame->mainTree->Refresh () ; + wxPrintf( "D: TManageDatabaseDialog::pmOpenFiles - end\n" ) ; } // -------------------------------- bool TManageDatabaseDialog::do_load ( const wxString& name , const wxString& db ) { + wxPrintf( "D: TManageDatabaseDialog::do_load (%s,%s)\n" , name, db ) ; if ( isProject ) return do_load_project ( name , db ) ; else return do_load_DNA ( name , db ) ; } @@ -914,19 +993,18 @@ bool TManageDatabaseDialog::do_load_project ( const wxString& _n , const wxStrin bool TManageDatabaseDialog::do_load_DNA ( const wxString& name , const wxString& db ) { - wxString sql ; + wxPrintf("D: TManageDatabaseDialog::do_load_DNA (name = %s, db = %s)\n", name, db ) ; + TStorage *tstorage = getTempDB ( getFileName ( db ) ) ; - TSQLresult sr ; v = new TVector () ; - wxPrintf("D: TManageDatabaseDialog::do_load_DNA (name = %s, db = %s)\n", name, db ) ; - if ( name.IsEmpty() ) return false ; // Loading vector - sql = "SELECT * FROM dna WHERE dna_name=\"" ; + wxString sql = "SELECT * FROM dna WHERE dna_name=\"" ; sql += name ; sql += "\"" ; - sr = tstorage->getObject ( sql ) ; + + TSQLresult sr = tstorage->getObject ( sql ) ; if( sr.rows() == 0 ) { wxMessageBox ( name , txt("t_could_not_load") ) ; @@ -1019,7 +1097,8 @@ bool TManageDatabaseDialog::do_load_DNA ( const wxString& name , const wxString& } // Sorting by size, largest first - wxPrintf("D: retrieved %lu elements \n", v->items.size() ) ; + wxPrintf("D: TManageDatabaseDialog::do_load_DNA: retrieved %ld elements \n", v->items.size() ) ; + //wxPrintf( "D: TManageDatabaseDialog::do_load_DNA: retrieved elements \n" ) ; if ( v->items.size() < 100 ) // Don't do that for genomes! { for ( int a = 1 ; a < v->items.size() ; a++ ) @@ -1038,6 +1117,8 @@ bool TManageDatabaseDialog::do_load_DNA ( const wxString& name , const wxString& } } + wxPrintf( "D: TManageDatabaseDialog::do_load_DNA: mostly done\n" ) ; + v->updateDisplay() ; v->undo.clear() ; @@ -1068,6 +1149,7 @@ bool TManageDatabaseDialog::do_load_DNA ( const wxString& name , const wxString& n->vec->setDatabase ( db1 ) ; } + wxPrintf( "D: TManageDatabaseDialog::do_load_DNA: returning\n" ) ; return true ; } @@ -1185,8 +1267,8 @@ void TManageDatabaseDialog::do_save_project () } else { -// wxMessageDialog md ( this , "Not saved" , myapp()->frame->children[a]->def ) ; -// md.ShowModal() ; +// wxMessageDialog md ( this , "Not saved" , myapp()->frame->children[a]->def ) ; +// md.ShowModal() ; } } } @@ -1365,9 +1447,7 @@ void TManageDatabaseDialog::pmOnRename ( wxCommandEvent &ev ) if ( sr.rows() > 0 ) { - wxMessageDialog md ( this , txt("t_entry_exists_del_target") , - txt("t_entry_exists_brief") , - wxYES|wxNO ) ; + wxMessageDialog md ( this , txt("t_entry_exists_del_target") , txt("t_entry_exists_brief") , wxYES|wxNO ) ; if ( wxID_YES != md.ShowModal() ) return ; delDNA ( newname , context_db ) ; } diff --git a/src/MyChild.cpp b/src/MyChild.cpp index 9644986e..1bb5e5ee 100644 --- a/src/MyChild.cpp +++ b/src/MyChild.cpp @@ -540,7 +540,7 @@ void MyChild::initme (TVector * const newVector ) cSequence->SetScrollbars(0, 20, 0, 50); - wxSafeYield() ; + //wxSafeYield() ; wxBoxSizer *v0 = new wxBoxSizer ( wxVERTICAL ) ; v0->Add ( toolbar , 0 , wxEXPAND , 2 ) ; v0->Add ( sw , 1 , wxEXPAND , 2 ) ; @@ -767,7 +767,8 @@ void MyChild::OnEditMode(wxCommandEvent& event) void MyChild::initPanels () { -// myapp()->frame->lockDisplay ( true ) ; + wxPrintf( "D: MyChild::initPanels - start\n" ) ; + myapp()->frame->lockDisplay ( true ) ; myass(vec, "myChild::initPanels: vec should always exist, and if empty.") ; if ( vec->getSequenceLength() > 100000 ) // Arbitary number, 100K { @@ -820,8 +821,14 @@ void MyChild::initPanels () //#ifdef __WXMSW__ // LINUX GetToolBar()->ToggleTool(MDI_CIRCULAR_LINEAR,vec->isCircular()); - if ( !vec->getGenomeMode() ) GetToolBar()->ToggleTool(MDI_TOGGLE_FEATURES,cSequence ? cSequence->findID ( _T("FEATURE" ) ) : (SeqBasic*) NULL ) ; - else aa_offset = 0 ; + if ( !vec->getGenomeMode() ) + { + GetToolBar()->ToggleTool(MDI_TOGGLE_FEATURES,cSequence ? cSequence->findID ( _T("FEATURE" ) ) : (SeqBasic*) NULL ) ; + } + else + { + aa_offset = 0 ; + } GetToolBar()->ToggleTool(MDI_TOGGLE_RESTRICTION,cSequence ? cSequence->findID ( _T("RESTRICTION" ) ) : (SeqBasic*) NULL ) ; //#endif @@ -837,8 +844,12 @@ void MyChild::initPanels () swl->SetSashPosition ( 200 ) ; swu->SetSashPosition ( 200 ) ; #endif -// myapp()->frame->lockDisplay ( false ) ; - if ( myapp()->frame->isLocked() ) return ; + myapp()->frame->lockDisplay ( false ) ; + if ( myapp()->frame->isLocked() ) + { + wxPrintf( "D: MyChild::initPanels - ret isLocked\n" ) ; + return ; + } Show() ; mylog ( "MyChild" , "shown" ) ; SetFocus () ; @@ -847,6 +858,7 @@ void MyChild::initPanels () OnFocus(fev) ; Activate () ; + wxPrintf( "D: MyChild::initPanels - end\n" ) ; } void MyChild::OnHelp(wxCommandEvent& event) diff --git a/src/MyFrame.cpp b/src/MyFrame.cpp index ada8f61f..04825f75 100644 --- a/src/MyFrame.cpp +++ b/src/MyFrame.cpp @@ -150,7 +150,7 @@ MyFrame::MyFrame(wxWindow *parent, if ( s.Left ( 1 ) == "#" ) continue ; // Skip comments dna_marker.Add ( s ) ; } - wxPrintf("I: Successfully opened marker file on '%s'\n",marker_file); + //wxPrintf("I: Successfully opened marker file on '%s'\n",marker_file); } else { @@ -683,7 +683,7 @@ ChildBase *MyFrame::GetActiveChild() //SDI */ void MyFrame::OnEnzymeEditor(wxCommandEvent& event ) { - wxPrintf("MyFrame::OnEnzymeEditor\n"); + //wxPrintf("MyFrame::OnEnzymeEditor\n"); TVectorEditor ee ( this , txt("t_enzymeeditor") , NULL ) ; ee.ShowModal () ; } @@ -692,12 +692,27 @@ void MyFrame::OnEnzymeEditor(wxCommandEvent& event ) */ void MyFrame::OnFileOpen(wxCommandEvent& event ) { - unsigned int i = children.GetCount() ; + //wxPrintf( "D: MyFrame::OnFileOpen - start\n" ); + const unsigned int i = children.GetCount() ; TManageDatabaseDialog dbd ( this , txt("t_open") , ACTION_MODE_LOAD ) ; - dbd.ShowModal () ; + //wxPrintf( "D: MyFrame::OnFileOpen - B\n" ); + int ret = dbd.ShowModal () ; + //wxPrintf( "D: MyFrame::OnFileOpen - C (dbd.ShowModal() returned %d\n" , ret ); if ( i != children.GetCount() ) + { + //wxPrintf( "D: MyFrame::OnFileOpen - setting focus on child with largest count.\n" , i ); setActiveChild ( children[children.GetCount()-1] ) ; - if ( GetActiveChild() ) GetActiveChild()->SetFocus() ; + } + //wxPrintf( "D: MyFrame::OnFileOpen - D\n" ); + if ( GetActiveChild() ) + { + GetActiveChild()->SetFocus() ; + } + else + { + //wxPrintf( "D: MyFrame::OnFileOpen - none of the %d children is active.\n" , i ); + } + //wxPrintf( "D: MyFrame::OnFileOpen - end\n" ); } /** \brief Invokes the "enter sequence manually" dialog and calls the appropriate creation function @@ -818,7 +833,7 @@ void MyFrame::OnFileImport(wxCommandEvent& event ) d.GetFilenames ( files ) ; d.GetPaths ( paths ) ; wxBeginBusyCursor(); - wxSafeYield() ; + //wxSafeYield() ; wxProgressDialog pd ( txt("t_loading") , "" , files.GetCount() , NULL , wxPD_ALL ) ; // lockDisplay ( true ) ; wxString unknown ; @@ -832,9 +847,14 @@ void MyFrame::OnFileImport(wxCommandEvent& event ) unknown += files[a] ; } } - if ( a == files.GetCount() ) pd.Update ( a ) ; // Hide progress dialog + if ( a == files.GetCount() ) + { + pd.Update ( a ) ; // Hide progress dialog + } if ( !unknown.IsEmpty() ) + { wxMessageBox ( unknown , txt("t_unable_to_detect_file_type") ) ; + } // lockDisplay ( false ) ; SetFocus () ; wxEndBusyCursor(); @@ -1600,7 +1620,7 @@ TAminoAcids *MyFrame::newAminoAcids ( const wxString& aa , const wxString& title { TVector nv ; nv.setSequence ( aa ) ; - return newAminoAcids ( &nv , title ) ; // not const + return newAminoAcids ( &nv , title ) ; // not const, calling setChild } /** \brief Creates a new amino acid entry from a TVector structure @@ -2053,19 +2073,30 @@ void MyFrame::removeChild ( ChildBase *ch ) } /** \brief Activates a child (brings to front, makes visible, etc.) - \param a Number of child in children list + \param childno - position of child in children list, starts with 0 */ -void MyFrame::activateChild ( int a ) +void MyFrame::activateChild ( int childno ) { - if ( a >= children.GetCount() ) a = 0 ; - if ( children.GetCount() ) + //wxPrintf( "D: MyFrame::activateChild( %d ) - start\n" , childno) ; + size_t numberOfChildren = children.GetCount() ; + if ( ! numberOfChildren ) { - children[a]->Activate () ; - mainTree->EnsureVisible ( children[a]->inMainTree ) ; - mainTree->SelectItem ( children[a]->inMainTree ) ; + //wxPrintf( "D: MyFrame::activateChild( %d ) - beyond number of children ( = %d), choosing NULL\n" , childno, children.GetCount() ) ; + setActiveChild ( NULL ) ; + } + else + { + if ( childno >= children.GetCount() ) + { + //wxPrintf( "D: MyFrame::activateChild( %d ) - beyond number of children ( = %d), choosing first\n" , childno, children.GetCount() ) ; + childno = 0 ; + } + children[childno]->Activate () ; + mainTree->EnsureVisible ( children[childno]->inMainTree ) ; + mainTree->SelectItem ( children[childno]->inMainTree ) ; } - else setActiveChild ( NULL ) ; - wxSafeYield () ; + //wxSafeYield () ; + //wxPrintf( "D: MyFrame::activateChild( %d ) - end\n" ) ; } /** \brief Locks/unlocks display, counts (un)lock requests @@ -2073,6 +2104,7 @@ void MyFrame::activateChild ( int a ) */ void MyFrame::lockDisplay ( const bool lock ) { + //wxPrintf("D: MyFrame::lockDisplay ( %d ) with locked counter at %d\n" , lock , locked) ; if ( lock ) { if ( locked == 0 ) { mainTree->Freeze() ; Freeze() ; } @@ -2092,6 +2124,7 @@ void MyFrame::lockDisplay ( const bool lock ) } } } + //wxPrintf("D: MyFrame::lockDisplay - end - now with locked counter at %d\n" , locked) ; } /** \brief Is display locked? @@ -2287,12 +2320,25 @@ TStorage *MyFrame::getTempDB ( const wxString& name ) */ void MyFrame::setActiveChild ( ChildBase * const c ) { + //wxPrintf( "D: MyFrame::setActiveChild - start\n" ) ; lastChild = c ; - if ( !IsShown() ) return ; - if ( locked != 0 ) return ; - if ( activating ) return ; - unsigned int a ; - for ( a = 0 ; a < children.GetCount() ; a++ ) + if ( !IsShown() ) + { + //wxPrintf( "D: MyFrame::setActiveChild - ret !IsShown\n" ) ; + return ; + } + if ( locked != 0 ) + { + //wxPrintf( "D: MyFrame::setActiveChild - ret locked\n" ) ; + return ; + } + if ( activating ) + { + //wxPrintf( "D: MyFrame::setActiveChild - ret activating\n" ) ; + return ; + } + + for ( unsigned int a = 0 ; a < children.GetCount() ; a++ ) { ChildBase *d = children[a] ; if ( d != c ) @@ -2301,26 +2347,51 @@ void MyFrame::setActiveChild ( ChildBase * const c ) if ( d->IsEnabled() ) d->Disable () ; } } - if ( children.GetCount() == 0 && GetMenuBar() != menu_bar ) SetMenuBar ( menu_bar ) ; - if ( !c ) return ; + if ( children.GetCount() == 0 && GetMenuBar() != menu_bar ) + { + //wxPrintf( "D: MyFrame::setActiveChild - setting menu bar for 0 children\n" ) ; + SetMenuBar ( menu_bar ) ; + } + if ( !c ) + { + //wxPrintf( "D: MyFrame::setActiveChild - ret !c\n" ) ; + return ; + } activating = true ; // wxSafeYield() ; - if ( !c->IsEnabled() ) c->Enable() ; - if ( c->menubar && GetMenuBar() != c->menubar ) + if ( !c->IsEnabled() ) + { + //wxPrintf( "D: MyFrame::setActiveChild - enabling c\n" ) ; + c->Enable() ; + } + if ( c->menubar && GetMenuBar() != c->menubar ) + { + //wxPrintf( "D: MyFrame::setActiveChild - setting menu bar c\n" ) ; c->SetMyMenuBar () ; + } //SetMenuBar ( c->menubar ) ; + //wxPrintf( "D: MyFrame::setActiveChild - was here B\n" ) ; wxSize s = c->GetParent()->GetClientSize() ; if ( c->GetSize() != s ) { if ( c->vec ) c->vec->updateDisplay() ; c->SetSize ( s ) ; } + //wxPrintf( "D: MyFrame::setActiveChild - was here C\n" ) ; if ( mainTree && c->inMainTree.IsOk() && mainTree->GetSelection() != c->inMainTree ) mainTree->SelectItem ( c->inMainTree ) ; - if ( !c->IsShown() ) c->Show() ; + //wxPrintf( "D: MyFrame::setActiveChild - was here D\n" ) ; + if ( !c->IsShown() ) + { + //wxPrintf( "D: MyFrame::setActiveChild - showing what is not shown\n" ) ; + c->Show() ; + } // c->Refresh () ; - wxSafeYield () ; + //wxPrintf( "D: MyFrame::setActiveChild - was here E\n" ) ; + //wxSafeYield () ; + //wxPrintf( "D: MyFrame::setActiveChild - was here F\n" ) ; activating = false ; + //wxPrintf( "D: MyFrame::setActiveChild - end\n" ) ; } /** \brief Returns the base window for all children @@ -2334,10 +2405,10 @@ wxWindow *MyFrame::getCommonParent() const */ void MyFrame::BollocksMenu(wxCommandEvent& event) { - wxPrintf("MyFrame::BollocksMenu\n") ; + //wxPrintf("MyFrame::BollocksMenu\n") ; if ( !lastChild ) { - wxPrintf("MyFrame::BollocksMenu - return - !lastChild\n") ; + //wxPrintf("MyFrame::BollocksMenu - return - !lastChild\n") ; return ; } if ( event.GetId() == MDI_NEXT_WINDOW || event.GetId() == MDI_PREV_WINDOW ) @@ -2353,12 +2424,12 @@ void MyFrame::BollocksMenu(wxCommandEvent& event) mainTree->SelectItem ( children[a]->inMainTree ) ; children[a]->EnforceRefesh () ; } - wxPrintf("MyFrame::BollocksMenu - return - NEXT_WINDOW\n") ; + //wxPrintf("MyFrame::BollocksMenu - return - NEXT_WINDOW\n") ; return ; } if ( lastChild->def != _T("dna") ) { - wxPrintf("MyFrame::BollocksMenu - return - dna != lastChild->def\n") ; + //wxPrintf("MyFrame::BollocksMenu - return - dna != lastChild->def\n") ; return ; } lastChild->ProcessEvent ( event ) ; diff --git a/src/MyFrame.h b/src/MyFrame.h index fb466904..e216bc0c 100644 --- a/src/MyFrame.h +++ b/src/MyFrame.h @@ -152,31 +152,31 @@ class MyFrame : public MyFrameType virtual TCalculator *RunCalculator () ; virtual TGraph *RunGraph () ; virtual MyChild* newFromVector ( TVector * const nv , const int type = TYPE_VECTOR ) ; - virtual TAminoAcids *newAminoAcids ( const wxString& aa , const wxString& title = _T("") ) ; - virtual TAminoAcids *newAminoAcids ( TVector* const nv , const wxString& title = _T("") ) ; - virtual TABIviewer *newABI ( const wxString& filename , const wxString& title ) ; - virtual MyChild *newCLONE ( TClone &clone ) ; + virtual TAminoAcids* newAminoAcids ( const wxString& aa , const wxString& title = _T("") ) ; + virtual TAminoAcids* newAminoAcids ( TVector* const nv , const wxString& title = _T("") ) ; + virtual TABIviewer* newABI ( const wxString& filename , const wxString& title ) ; + virtual MyChild* newCLONE ( TClone &clone ) ; virtual void newGB ( TGenBank &gb , const wxString& title = "" ) ; virtual void newPDB ( TPDB &pdb , const wxString& title = "" ) ; virtual void newXML ( TXMLfile &xml , const wxString& title = "" ) ; - virtual TPhyloTree *newPhyloTree ( const wxString& title = "" ) ; + virtual TPhyloTree* newPhyloTree ( const wxString& title = "" ) ; virtual void blast ( const wxString& seq , const wxString& prg ) ; virtual bool importFile ( const wxString& file , const wxString& path , const int filter = -1 ) ; virtual void setChild ( ChildBase * const ch ) ; virtual void removeChild ( ChildBase *ch ) ; - virtual TStorage *getTempDB ( const wxString& name ) ; - virtual TAlignment *runAlignment ( wxArrayString &vs , wxArrayChildBase &vc , TVector *nv = NULL ) ; - virtual ChildBase *GetActiveChild() ; + virtual TStorage* getTempDB ( const wxString& name ) ; + virtual TAlignment* runAlignment ( wxArrayString &vs , wxArrayChildBase &vc , TVector *nv = NULL ) ; + virtual ChildBase* GetActiveChild() ; virtual void setActiveChild ( ChildBase * const c ) ; - virtual wxWindow *getCommonParent() const ; + virtual wxWindow* getCommonParent() const ; virtual int getChildIndex ( ChildBase *c ) ; virtual void activateChild ( int a ) ; virtual void lockDisplay ( const bool lock = true ) ; virtual bool isLocked () const ; virtual bool isActivating () const ; - virtual TVirtualGel *useGel ( const wxString& type ) ; + virtual TVirtualGel* useGel ( const wxString& type ) ; virtual void saveImage ( const wxBitmap * const bmp , const wxString& name = "" ) ; - virtual wxChoice *AddFontsizeTool ( wxToolBar* toolBar , int id ) ; + virtual wxChoice* AddFontsizeTool ( wxToolBar* toolBar , int id ) ; virtual void notifyChildrenChanged() ; virtual void push_help ( const wxString& name ) ; diff --git a/src/PlasmidCanvas.cpp b/src/PlasmidCanvas.cpp index 9ddd17ab..b83ee800 100644 --- a/src/PlasmidCanvas.cpp +++ b/src/PlasmidCanvas.cpp @@ -128,6 +128,7 @@ PlasmidCanvas::~PlasmidCanvas () void PlasmidCanvas::Refresh () { + wxPrintf( "D: PlasmidCanvas::Refresh - start\n" ) ; if ( p && p->cSequence->getEditMode() && p->def == _T("DNA") ) return ; // if ( painting ) return ; // painting = true ; @@ -135,6 +136,7 @@ void PlasmidCanvas::Refresh () PrepareDC ( dc ) ; OnDraw ( dc ) ; // painting = false ; + wxPrintf( "D: PlasmidCanvas::Refresh - end\n" ) ; } bool PlasmidCanvas::isEnzymeVisible ( const wxString& s ) const @@ -154,13 +156,31 @@ bool PlasmidCanvas::intersects ( const wxRect &a , const wxRect &b ) const // Define the repainting behaviour void PlasmidCanvas::OnDraw(wxDC& pdc) /* not const */ { - if ( !p || !p->vec ) return ; - if ( myapp()->frame->isLocked() ) return ; - if ( !p->IsShown() ) return ; - if ( !p->IsEnabled() ) return ; + wxPrintf( "D: PlasmidCanvas::OnDraw - start\n" ) ; + if ( !p || !p->vec ) + { + wxPrintf( "D: PlasmidCanvas::OnDraw - ret !p || !p->vec\n" ) ; + return ; + } + if ( myapp()->frame->isLocked() ) + { + wxPrintf( "D: PlasmidCanvas::OnDraw - ret locked\n" ) ; + return ; + } + if ( !p->IsShown() ) + { + wxPrintf( "D: PlasmidCanvas::OnDraw - ret !shown\n" ) ; + return ; + } + if ( !p->IsEnabled() ) + { + wxPrintf( "D: PlasmidCanvas::OnDraw - ret !enabled\n" ) ; + return ; + } if ( p->vec->getSequenceLength() == 0 ) { pdc.Clear () ; + wxPrintf( "D: PlasmidCanvas::OnDraw - ret 0==length\n" ) ; return ; } if ( printing ) @@ -172,7 +192,10 @@ void PlasmidCanvas::OnDraw(wxDC& pdc) /* not const */ { OnDrawCircular ( pdc ) ; } - else OnDrawLinear ( pdc ) ; + else + { + OnDrawLinear ( pdc ) ; + } } else { @@ -201,17 +224,30 @@ void PlasmidCanvas::OnDraw(wxDC& pdc) /* not const */ dc.SelectObject ( bmp ) ; dc.Clear() ; dc.SetDeviceOrigin ( -vx , -vy ) ; - if ( p->vec->isCircular() ) OnDrawCircular ( dc ) ; - else OnDrawLinear ( dc ) ; + if ( p->vec->isCircular() ) + { + OnDrawCircular ( dc ) ; + } + else + { + OnDrawLinear ( dc ) ; + } dc.SetDeviceOrigin ( 0 , 0 ) ; pdc.Blit ( vx , vy , w , h , &dc , 0 , 0 ) ; painting = false ; } + wxPrintf( "D: PlasmidCanvas::OnDraw - end\n" ) ; } void PlasmidCanvas::OnCopyImage ( wxCommandEvent& ev ) { - if ( !p || !p->vec ) return ; + wxPrintf( "D: PlasmidCanvas::OnCopyImage - start\n" ) ; + + if ( !p || !p->vec ) + { + wxPrintf( "D: PlasmidCanvas::OnCopyImage - ret !p || !p->vec\n" ) ; + return ; + } // Metafile support only exists for windows, so... #ifdef __WXMSW__ @@ -259,6 +295,7 @@ void PlasmidCanvas::OnCopyImage ( wxCommandEvent& ev ) GetClientSize(&w, &h); } + wxPrintf( "D: PlasmidCanvas::OnCopyImage - end\n" ) ; } void PlasmidCanvas::OnSaveImage ( wxCommandEvent& ev ) @@ -800,6 +837,7 @@ void PlasmidCanvas::invokeVectorEditor ( const wxString& what , const int num , void PlasmidCanvas::print () { + wxPrintf( "D: PlasmidCanvas::print - start\n" ) ; wxPrintDialog pd ( this ) ; int r = pd.ShowModal () ; if ( r != wxID_OK ) return ; @@ -815,7 +853,7 @@ void PlasmidCanvas::print () printing = false ; pdc->EndPage () ; pdc->EndDoc () ; - wxPrintf( "D: PlasmidCanvas::print E\n" ) ; + wxPrintf( "D: PlasmidCanvas::print - end\n" ) ; } void PlasmidCanvas::makeGCcolor ( const int percent , wxColour &col ) const diff --git a/src/PlasmidCanvasLinear.cpp b/src/PlasmidCanvasLinear.cpp index e19cd71e..1d12bf0b 100644 --- a/src/PlasmidCanvasLinear.cpp +++ b/src/PlasmidCanvasLinear.cpp @@ -4,6 +4,7 @@ void PlasmidCanvas::OnDrawLinear(wxDC& dc) /* not const */ { + wxPrintf( "D: PlasmidCanvas::OnDrawLinear - start\n" ) ; if ( printing ) h = h * 2 / 3 ; // not const int fontfactor = MYFONTSIZE * 10 / 8 ; if ( printing ) fontfactor = (w>h?h:w)/70 ; @@ -81,6 +82,7 @@ void PlasmidCanvas::OnDrawLinear(wxDC& dc) /* not const */ } // Baseline + wxPrintf( "D: PlasmidCanvas::OnDrawLinear - Baseline\n" ) ; if ( p->vec->showGC() > 0 ) // %GC { int dh = h / 80 ; @@ -114,6 +116,7 @@ void PlasmidCanvas::OnDrawLinear(wxDC& dc) /* not const */ else dc.DrawLine ( lineOff , lineH , w - lineOff , lineH ) ; // Numbers + wxPrintf( "D: PlasmidCanvas::OnDrawLinear - Numbers\n" ) ; dc.SetFont( smallFont ); for ( int a = 0 ; a < l ; a += d ) // defined at function entry { @@ -128,6 +131,7 @@ void PlasmidCanvas::OnDrawLinear(wxDC& dc) /* not const */ } // Methylation sites + wxPrintf( "D: PlasmidCanvas::OnDrawLinear - Methylation\n" ) ; dc.SetPen(*wxRED_PEN); for ( int a = 0 ; a < p->vec->countMethylationSites() ; a++ ) { @@ -139,6 +143,7 @@ void PlasmidCanvas::OnDrawLinear(wxDC& dc) /* not const */ dc.SetPen(*wxBLACK_PEN); // Recalc + wxPrintf( "D: PlasmidCanvas::OnDrawLinear - Recalc\n" ) ; if ( p->vec->displayUpdate() ) { // Genes, items, etc. @@ -202,9 +207,11 @@ void PlasmidCanvas::OnDrawLinear(wxDC& dc) /* not const */ } // ORFs + wxPrintf( "D: PlasmidCanvas::OnDrawLinear - ORF\n" ) ; drawLinearORFs ( dc ) ; // Drawing items + wxPrintf( "D: PlasmidCanvas::OnDrawLinear - Items\n" ) ; for ( int a = 0 ; a < p->vec->items.size() ; a++ ) { TVectorItem i = p->vec->items[a] ; @@ -227,6 +234,7 @@ void PlasmidCanvas::OnDrawLinear(wxDC& dc) /* not const */ } // Drawing Restriction Sites + wxPrintf( "D: PlasmidCanvas::OnDrawLinear - Restrictions\n" ) ; dc.SetFont(tinyFont); for ( int a = 0 ; a < p->vec->rc.size() ; a++ ) { @@ -246,6 +254,7 @@ void PlasmidCanvas::OnDrawLinear(wxDC& dc) /* not const */ dc.SetFont( smallFont ); dc.SetPen ( *wxBLACK_PEN ) ; dc.SetTextForeground ( *wxBLACK ) ; + wxPrintf( "D: PlasmidCanvas::OnDrawLinear - end\n" ) ; } void PlasmidCanvas::drawLinearORFs ( wxDC &dc ) const diff --git a/src/SequenceCanvas.cpp b/src/SequenceCanvas.cpp index c9ad43ef..1d89f2d4 100644 --- a/src/SequenceCanvas.cpp +++ b/src/SequenceCanvas.cpp @@ -768,7 +768,6 @@ void SequenceCanvas::OnPrint ( wxCommandEvent &ev ) wxDateTime now = wxDateTime::Now(); wxString printtime = now.Format( _T("%c") , wxDateTime::Local) ; - do { totalpages++ ; yoff += vish - dummy ; @@ -791,7 +790,6 @@ void SequenceCanvas::OnPrint ( wxCommandEvent &ev ) if ( printSelection && yoff + h - pagebottom - dummy > lowy ) print_dc->DrawRectangle ( -xoff , lowy , w , yoff + h - pagebottom - dummy - lowy ) ; - int tw , th ; wxString s ; // Title @@ -800,6 +798,7 @@ void SequenceCanvas::OnPrint ( wxCommandEvent &ev ) else if ( child ) s = child->getName() ; print_dc->SetTextBackground ( *wxWHITE ) ; print_dc->SetFont ( bigfont ) ; + int tw , th ; print_dc->GetTextExtent ( s , &tw , &th ) ; print_dc->DrawText ( s , ( w - tw ) / 2 - xoff , yoff + ( pagetop - th ) / 2 ) ; print_dc->SetTextBackground ( *wxWHITE ) ; @@ -815,7 +814,6 @@ void SequenceCanvas::OnPrint ( wxCommandEvent &ev ) print_dc->GetTextExtent ( printtime , &tw , &th ) ; print_dc->DrawText ( printtime , 0 , yoff + h - ( pagebottom + dummy + th ) / 2 ) ; - print_dc->EndPage () ; yoff += vish - dummy ; @@ -1301,7 +1299,11 @@ void SequenceCanvas::arrange () if ( isMiniDisplay() ) lowx += charwidth*2 ; mylog ( "SequenceCanvas::arrange" , "3" ) ; - if ( printing ) return ; + if ( printing ) + { + wxEndBusyCursor() ; + return ; + } MyGetViewStart ( &vx , &vy ) ; if ( !isHorizontal() && lowy != oldlowy ) diff --git a/src/SequenceTypeAA.cpp b/src/SequenceTypeAA.cpp index 2b869899..d7218628 100644 --- a/src/SequenceTypeAA.cpp +++ b/src/SequenceTypeAA.cpp @@ -32,35 +32,42 @@ void SeqAA::show ( wxDC& dc ) wxPoint SeqAA::showText ( const int ystart , wxArrayString &tout ) const { wxPoint p ( -1 , -1 ) ; - int a , b ; wxString t ; int x = 0 , y = ystart-can->seq.GetCount() , ly = -1 ; - for ( a = 0 ; a < pos.p.GetCount() ; a++ ) + for ( int a = 0 ; a < pos.p.GetCount() ; a++ ) { - b = pos.p[a] ; + int b = pos.p[a] ; if ( b > 0 ) // Character - { - t = s.GetChar(b-1) ; - if ( pos.r[a].y != ly ) - { - ly = pos.r[a].y ; - y += can->seq.GetCount() ; - x = 0 ; - while ( y >= tout.GetCount() ) tout.Add ( _T("") ) ; - } + { + t = s.GetChar(b-1) ; + if ( pos.r[a].y != ly ) + { + ly = pos.r[a].y ; + y += can->seq.GetCount() ; + x = 0 ; + while ( y >= tout.GetCount() ) tout.Add ( _T("") ) ; + } else x++ ; if ( (x) % (can->blocksize+1) == 0 ) x++ ; if ( !t.IsEmpty() ) - { - if ( b >= can->markedFrom() && p.x == -1 ) p.x = y ; - if ( b <= can->markedTo() ) p.y = y ; - while ( tout[y].length() < x ) tout[y] += _T(" ") ; - tout[y].SetChar ( x-1 , t.GetChar(0) ) ; - } + { + if ( b >= can->markedFrom() && p.x == -1 ) + { + p.x = y ; + } + if ( b <= can->markedTo() ) + { + p.y = y ; + } + while ( tout[y].length() < x ) tout[y] += _T(" ") ; + tout[y].SetChar ( x-1 , t.GetChar(0) ) ; + } } } if ( can->getLastWhere() != this || can->markedFrom() == -1 || can->markedTo() < can->markedFrom() ) - p = wxPoint ( -1 , -1 ) ; + { + p = wxPoint ( -1 , -1 ) ; + } return p ; } @@ -78,11 +85,11 @@ void SeqAA::initFromString ( const wxString& s ) pa_wa.Clear() ; pa_wa.Alloc ( s.length() ) ; while ( pa_w != s ) - { - pa_w += s.GetChar(pa_w.length()) ; - pa_wa.Add ( pa_w.length() ) ; - analyzeProteases () ; - } + { + pa_w += s.GetChar(pa_w.length()) ; + pa_wa.Add ( pa_w.length() ) ; + analyzeProteases () ; + } } void SeqAA::updateProteases () /* not const */ @@ -109,21 +116,21 @@ void SeqAA::analyzeProteases () /* not const */ if ( !can ) return ; int compensator = primaryMode ? 0 : 1 ; for ( int q = 0 ; q < proteases.GetCount() ; q++ ) - { - TProtease *pr = proteases[q] ; - if ( pr->len() <= pa_w.length() ) - { - wxString w2 = pa_w.substr ( pa_w.length() - pr->len() , pr->len() ) ; - if ( pr->does_match ( w2 ) ) - { - TProteaseCut *cut = new TProteaseCut ; - cut->protease = pr ; - cut->cut = pa_wa[pa_w.length()-pr->len()+pr->cut+1] + compensator ; - cut->left = true ; - pc.Add ( cut ) ; // not const - } - } - } + { + TProtease *pr = proteases[q] ; + if ( pr->len() <= pa_w.length() ) + { + wxString w2 = pa_w.substr ( pa_w.length() - pr->len() , pr->len() ) ; + if ( pr->does_match ( w2 ) ) + { + TProteaseCut *cut = new TProteaseCut ; + cut->protease = pr ; + cut->cut = pa_wa[pa_w.length()-pr->len()+pr->cut+1] + compensator ; + cut->left = true ; + pc.Add ( cut ) ; // not const + } + } + } } // Seems to be obsolete @@ -132,7 +139,7 @@ void SeqAA::fixOffsets ( TVector * const v ) offset_items.Clear() ; for ( int a = 0 ; a < v->items.size() ; a++ ) { - int off = v->items[a].getOffset () ; + const int off = v->items[a].getOffset () ; int c = 0 ; for ( int b = v->items[a].from ; off != -1 && b < v->items[a].to ; b++ ) { @@ -156,10 +163,11 @@ void SeqAA::fixOffsets ( TVector * const v ) void SeqAA::initFromTVector ( const TVector * const v ) { + wxPrintf( "D: SeqAA::initFromTVector - start\n" ) ; if ( ! v ) { - wxPrintf ( " SeqAA::initFromTVector ( NULL )\n" ) ; + wxPrintf ( " SeqAA::initFromTVector ( NULL ) - abort\n" ) ; abort() ; } showNumbers = true ; @@ -172,7 +180,9 @@ void SeqAA::initFromTVector ( const TVector * const v ) { wxPrintf ( "D: SeqAA::initFromTVector: reusing existing vector - why?\n" ) ; } + wxPrintf ( "D: SeqAA::initFromTVector: pre vec->copy()\n" ) ; vec->copy ( *v ) ; + wxPrintf ( "D: SeqAA::initFromTVector: post vec->copy()\n" ) ; bool truncateEditSequence = false ; if ( can && can->getEditMode() && vec->getSequenceLength() && vec->getSequenceChar(vec->getSequenceLength()-1) == ' ' ) @@ -182,9 +192,9 @@ void SeqAA::initFromTVector ( const TVector * const v ) truncateEditSequence = true ; } wxString t = vec->getSequence() ; - if (0 == t.length()) + if (0 >= t.length()) { - wxPrintf("D: SeqAA::initFromTVector: Assigned the empty string.\n" ) ; + wxPrintf("D: SeqAA::initFromTVector: Assigned the empty string with t=%ld.\n" , t.length() ) ; s=""; } else @@ -209,7 +219,7 @@ void SeqAA::initFromTVector ( const TVector * const v ) t += _T(" ") ; } - int sl = s.length() ; + const int sl = s.length() ; s += _T(" ") ; if ( mode == AA_ALL ) @@ -225,7 +235,7 @@ void SeqAA::initFromTVector ( const TVector * const v ) { // vec->items[a].translate ( vec , this ) ; // TESTING!!! wxPrintf( "D: SeqAA::initFromTVector invoking getArrangedAA @ %d of %ld with disp=%d\n", a, vec->items.size(), disp ) ; - // wxPrintf( "D: SeqAA::initFromTVector invoking getArrangedAA @ s=%s\n", s ) ; +// wxPrintf( "D: SeqAA::initFromTVector invoking getArrangedAA @ s=%s\n", s ) ; vec->items[a].getArrangedAA ( vec , s , disp , this ) ; } } @@ -273,7 +283,12 @@ void SeqAA::initFromTVector ( const TVector * const v ) s = s.substr ( 0 , sl ) ; for ( int a = 0 ; a < s.length() ; a++ ) - if ( s.GetChar(a) == '?' ) s.SetChar(a, unknownAA) ; + { + if ( s.GetChar(a) == '?' ) + { + s.SetChar(a, unknownAA) ; + } + } if ( truncateEditSequence ) { wxPrintf ( "D; SeqAA::initFromTVector: truncateEditSequence\n" ) ; @@ -287,6 +302,8 @@ void SeqAA::initFromTVector ( const TVector * const v ) // mem += pa_wa.GetCount() * sizeof ( int ) ; // mem += sizeof ( wxArrayTProteaseCut ) + sizeof ( wxArrayTProtease ) + sizeof ( wxArrayTVectorItem ) ; mylog ( "AA_mem" , wxString::Format ( "%d" , mem ) ) ; + + wxPrintf( "D: SeqAA::initFromTVector - end\n" ) ; } // direct @@ -299,12 +316,12 @@ bool SeqAA::useDirectRoutines () const int SeqAA::arrange_direct ( const int n ) /* not const */ { - int w , h , bo = can->border ; - // Setting basic values can->SetFont(*can->font); int wx = can->charwidth ; //, wy = can->charheight ; + int bo = can->border ; int ox = bo + wx + wx * endnumberlength ;//, oy = n*wy+bo ; + int w , h ; can->MyGetClientSize ( &w , &h ) ; itemsperline = ( w - ox ) / ( ( can->blocksize + 1 ) * wx - 1 ) ; if ( itemsperline == 0 ) itemsperline = 1 ; @@ -313,12 +330,13 @@ int SeqAA::arrange_direct ( const int n ) /* not const */ // pos.m.Alloc ( s.length() ) ; if ( can->isHorizontal() ) can->setLowX ( ox + ( s.length() ) * can->charwidth ) ; int ret = ( s.length() + itemsperline - 1 ) / itemsperline ; - ret = can->NumberOfLines() * ret * can->charheight + 1 ; + ret *= can->NumberOfLines() * can->charheight + 1 ; return ret ; } void SeqAA::show_direct ( wxDC& dc ) { + wxPrintf("D: SeqAA::show_direct - start\n" ) ; myass ( itemsperline , "AA:show_direct_ipl" ) ; if ( !itemsperline ) return ; mylog ( "SeqAA::show_direct" , "0" ) ; @@ -454,8 +472,12 @@ void SeqAA::show_direct ( wxDC& dc ) 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 ) ; @@ -479,6 +501,7 @@ void SeqAA::show_direct ( wxDC& dc ) dc.SetBackgroundMode ( bm ) ; dc.SetTextBackground ( tbg ) ; dc.SetTextForeground ( tfg ) ; + wxPrintf("D: SeqAA::show_direct - end\n" ) ; } int SeqAA::getLine ( const int _y ) const diff --git a/src/TImageDisplay.cpp b/src/TImageDisplay.cpp index ba9f829a..45cef313 100644 --- a/src/TImageDisplay.cpp +++ b/src/TImageDisplay.cpp @@ -134,7 +134,10 @@ void TImageDisplay::ShowDir ( wxString s ) bu->SetLabel ( s ) ; if ( !dir.IsOpened() ) + { + wxEndBusyCursor() ; return; + } myapp()->frame->LS->setOption ( _T("IMGDIR") , s ) ; wxString filename; @@ -152,18 +155,21 @@ void TImageDisplay::ShowDir ( wxString s ) dir.GetAllFiles ( s , &vs , "*.pcx" ) ; dir.GetAllFiles ( s , &vs , "*.pnm" ) ; */ - int a ; - for ( a = 0 ; a < vs.GetCount() ; a++ ) + + for ( int a = 0 ; a < vs.GetCount() ; a++ ) { vs[a] = vs[a].AfterLast ( '/' ) ; vs[a] = vs[a].AfterLast ( '\\' ) ; } vs.Sort () ; - for ( a = 0 ; a < vs.GetCount() ; a++ ) + for ( int a = 0 ; a < vs.GetCount() ; a++ ) + { lb->Append ( vs[a] ) ; - wxEndBusyCursor() ; - } + } + + wxEndBusyCursor() ; + } void TImageDisplay::OnCopy ( wxCommandEvent &event ) { diff --git a/src/TSilmutDialog.cpp b/src/TSilmutDialog.cpp index a6f454d2..e513edf3 100644 --- a/src/TSilmutDialog.cpp +++ b/src/TSilmutDialog.cpp @@ -221,19 +221,23 @@ void TSilmutDialog::calc () // List of restriction enzymes to check wxArrayTRestrictionEnzyme re ; wxString group = egr->GetStringSelection() ; - if ( group == txt("Current") ) re = v->re ; + if ( group == txt("Current") ) + { + re = v->re ; + } else { wxArrayString z ; myapp()->frame->LS->getEnzymesInGroup ( group , z ) ; for ( int a = 0 ; a < z.GetCount() ; a++ ) + { re.Add ( myapp()->frame->LS->getRestrictionEnzyme ( z[a] ) ) ; + } } wxString vseq = v->getSequence() ; // Marked sequence, uppercase wxString vseq_l = vseq.Lower() ; // Marked sequence, lowercase - // Check each restriction enzyme for ( int a = 0 ; a < re.GetCount() ; a++ ) { @@ -275,7 +279,9 @@ void TSilmutDialog::calc () for ( int c = 0 ; c < new_dna.length() ; c++ ) { if ( c >= b && c < b + s.length() && c-b >= 0 && c-b <= x.length() && x.GetChar(c-b) >= 'A' && x.GetChar(c-b) <= 'Z' ) + { new_dna.SetChar ( c , x.GetChar(c-b) ) ; + } } wxString new_aa = getAAresult ( new_dna ) ; if ( new_aa == orig_aa ) useit = true ; @@ -359,7 +365,10 @@ void TSilmutDialog::calc_acr () // List of restriction enzymes to check // Only those which already exist from previous run ("first stage") wxArrayTRestrictionEnzyme re ; - for ( int a = 0 ; a < vs.size() ; a++ ) re.Add ( vs[a].e ) ; + for ( int a = 0 ; a < vs.size() ; a++ ) + { + re.Add ( vs[a].e ) ; + } vs.clear() ; wxString vseq = v->getSequence() ; // Marked sequence, uppercase @@ -367,7 +376,9 @@ void TSilmutDialog::calc_acr () for ( int a = 0 ; a < vseq.length() ; a++ ) { if ( vseq.GetChar(a) >= 'A' && vseq.GetChar(a) <= 'Z' ) - vseq_l.SetChar ( a , vseq.GetChar(a) - 'A' + 'a' ) ; + { + vseq_l.SetChar ( a , vseq.GetChar(a) - 'A' + 'a' ) ; + } } wxString bases = _T("ACTG") ; From 43b308573fcfeea174fcf62af8a17b9693af3080 Mon Sep 17 00:00:00 2001 From: Steffen Moeller Date: Tue, 20 Aug 2024 19:52:50 +0200 Subject: [PATCH 2/2] Commented out a few more debug messages --- src/ChildBase.cpp | 6 +++--- src/MyChild.cpp | 4 ++-- src/MyFrame.cpp | 50 +++++++++++++++++++++++-------------------- src/MyFrame.h | 4 ++-- src/PlasmidCanvas.cpp | 27 +++++++++++------------ 5 files changed, 47 insertions(+), 44 deletions(-) diff --git a/src/ChildBase.cpp b/src/ChildBase.cpp index a38f39b3..f5452036 100644 --- a/src/ChildBase.cpp +++ b/src/ChildBase.cpp @@ -58,7 +58,7 @@ void ChildBase::showName ( const wxString& _x ) const void ChildBase::OnFocus(wxFocusEvent& event) { - wxPrintf( "D: ChildBase::OnFocus - start\n" ) ; + //wxPrintf( "D: ChildBase::OnFocus - start\n" ) ; myass ( myapp() , "Oh no! No application defined!" ) ; myass ( myapp()->frame , "Oh no! No frame defined!" ) ; if ( myapp()->frame->dying ) @@ -74,10 +74,10 @@ void ChildBase::OnFocus(wxFocusEvent& event) if ( cSequence ) { - wxPrintf( "D: ChildBase::OnFocus - cSequence\n" ) ; + //wxPrintf( "D: ChildBase::OnFocus - cSequence\n" ) ; cSequence->SetFocus() ; } - wxPrintf( "D: ChildBase::OnFocus - start\n" ) ; + //wxPrintf( "D: ChildBase::OnFocus - end\n" ) ; } bool ChildBase::caniclose(wxCloseEvent& event) diff --git a/src/MyChild.cpp b/src/MyChild.cpp index 1bb5e5ee..8fe5ea44 100644 --- a/src/MyChild.cpp +++ b/src/MyChild.cpp @@ -767,7 +767,7 @@ void MyChild::OnEditMode(wxCommandEvent& event) void MyChild::initPanels () { - wxPrintf( "D: MyChild::initPanels - start\n" ) ; + //wxPrintf( "D: MyChild::initPanels - start\n" ) ; myapp()->frame->lockDisplay ( true ) ; myass(vec, "myChild::initPanels: vec should always exist, and if empty.") ; if ( vec->getSequenceLength() > 100000 ) // Arbitary number, 100K @@ -858,7 +858,7 @@ void MyChild::initPanels () OnFocus(fev) ; Activate () ; - wxPrintf( "D: MyChild::initPanels - end\n" ) ; + //wxPrintf( "D: MyChild::initPanels - end\n" ) ; } void MyChild::OnHelp(wxCommandEvent& event) diff --git a/src/MyFrame.cpp b/src/MyFrame.cpp index 04825f75..bf86886c 100644 --- a/src/MyFrame.cpp +++ b/src/MyFrame.cpp @@ -2075,7 +2075,7 @@ void MyFrame::removeChild ( ChildBase *ch ) /** \brief Activates a child (brings to front, makes visible, etc.) \param childno - position of child in children list, starts with 0 */ -void MyFrame::activateChild ( int childno ) +void MyFrame::activateChild ( const int childno ) { //wxPrintf( "D: MyFrame::activateChild( %d ) - start\n" , childno) ; size_t numberOfChildren = children.GetCount() ; @@ -2167,7 +2167,7 @@ wxString MyFrame::check4update () return text ; } -wxString MyFrame::check4update_sub ( const wxString& text ) +wxString MyFrame::check4update_sub ( const wxString& text ) const { bool error = true ; if ( !text.IsEmpty() ) error = false ; @@ -2181,29 +2181,30 @@ wxString MyFrame::check4update_sub ( const wxString& text ) wxString lu = LS->getOption ( _T("LAST_UPDATE") , "" ) ; if ( lu.IsEmpty() ) // Assuming new installation of the latest version, so no update - { + { lu = td ; LS->setOption ( _T("LAST_UPDATE") , lu ) ; - } + } if ( td > lu ) - { + { wxString msg = it.AfterFirst ( '\n' ) ; msg += "\n(" + wxString ( txt("t_you_use_version") ) + myapp()->get_GENtle_version() + ")" ; - wxMessageDialog md ( this , msg , txt("t_new_version" ) , - wxOK | wxCANCEL | wxCENTRE | wxICON_INFORMATION ) ; + wxMessageDialog md ( this , msg , txt("t_new_version" ) , wxOK | wxCANCEL | wxCENTRE | wxICON_INFORMATION ) ; if ( wxID_OK != md.ShowModal() ) + { return "-" ; + } return td ; - } + } } else - { + { // Cannot connect to check for update // SetStatusText ( txt("t_update_warning") , 1 ) ; // wxMessageBox ( "Error" , text ) ; - } + } return "" ; } @@ -2324,29 +2325,29 @@ void MyFrame::setActiveChild ( ChildBase * const c ) lastChild = c ; if ( !IsShown() ) { - //wxPrintf( "D: MyFrame::setActiveChild - ret !IsShown\n" ) ; + wxPrintf( "D: MyFrame::setActiveChild - ret !IsShown\n" ) ; return ; } if ( locked != 0 ) { - //wxPrintf( "D: MyFrame::setActiveChild - ret locked\n" ) ; + wxPrintf( "D: MyFrame::setActiveChild - ret locked\n" ) ; return ; } if ( activating ) { - //wxPrintf( "D: MyFrame::setActiveChild - ret activating\n" ) ; + wxPrintf( "D: MyFrame::setActiveChild - ret activating\n" ) ; return ; } for ( unsigned int a = 0 ; a < children.GetCount() ; a++ ) - { + { ChildBase *d = children[a] ; if ( d != c ) - { + { if ( d->IsShown() ) d->Hide () ; if ( d->IsEnabled() ) d->Disable () ; + } } - } if ( children.GetCount() == 0 && GetMenuBar() != menu_bar ) { //wxPrintf( "D: MyFrame::setActiveChild - setting menu bar for 0 children\n" ) ; @@ -2354,7 +2355,7 @@ void MyFrame::setActiveChild ( ChildBase * const c ) } if ( !c ) { - //wxPrintf( "D: MyFrame::setActiveChild - ret !c\n" ) ; + wxPrintf( "D: MyFrame::setActiveChild - ret !c\n" ) ; return ; } activating = true ; @@ -2408,7 +2409,7 @@ void MyFrame::BollocksMenu(wxCommandEvent& event) //wxPrintf("MyFrame::BollocksMenu\n") ; if ( !lastChild ) { - //wxPrintf("MyFrame::BollocksMenu - return - !lastChild\n") ; + wxPrintf("D: MyFrame::BollocksMenu - return - !lastChild\n") ; return ; } if ( event.GetId() == MDI_NEXT_WINDOW || event.GetId() == MDI_PREV_WINDOW ) @@ -2424,12 +2425,12 @@ void MyFrame::BollocksMenu(wxCommandEvent& event) mainTree->SelectItem ( children[a]->inMainTree ) ; children[a]->EnforceRefesh () ; } - //wxPrintf("MyFrame::BollocksMenu - return - NEXT_WINDOW\n") ; + //wxPrintf("D: MyFrame::BollocksMenu - return - NEXT_WINDOW\n") ; return ; } if ( lastChild->def != _T("dna") ) { - //wxPrintf("MyFrame::BollocksMenu - return - dna != lastChild->def\n") ; + wxPrintf("D: MyFrame::BollocksMenu - return - dna != lastChild->def\n") ; return ; } lastChild->ProcessEvent ( event ) ; @@ -2454,10 +2455,13 @@ void MyFrame::RerouteMenu(wxCommandEvent& event) /** \brief Gets the number of a child in the children list \param c Pointer to child */ -int MyFrame::getChildIndex ( ChildBase *c ) +int MyFrame::getChildIndex ( const ChildBase * const c ) const { - int a ; - for ( a = 0 ; a < children.GetCount() && children[a] != c ; a++ ) ; + int a = 0 ; + while ( a < children.GetCount() && children[a] != c ) + { + a++ ; + } return a ; } diff --git a/src/MyFrame.h b/src/MyFrame.h index e216bc0c..de6e5287 100644 --- a/src/MyFrame.h +++ b/src/MyFrame.h @@ -169,8 +169,8 @@ class MyFrame : public MyFrameType virtual ChildBase* GetActiveChild() ; virtual void setActiveChild ( ChildBase * const c ) ; virtual wxWindow* getCommonParent() const ; - virtual int getChildIndex ( ChildBase *c ) ; - virtual void activateChild ( int a ) ; + virtual int getChildIndex ( const ChildBase * const c ) const ; + virtual void activateChild ( const int childno ) ; virtual void lockDisplay ( const bool lock = true ) ; virtual bool isLocked () const ; virtual bool isActivating () const ; diff --git a/src/PlasmidCanvas.cpp b/src/PlasmidCanvas.cpp index b83ee800..889fa9cb 100644 --- a/src/PlasmidCanvas.cpp +++ b/src/PlasmidCanvas.cpp @@ -70,7 +70,7 @@ void PlasmidCanvas::OnPaint(wxPaintEvent& event) void PlasmidCanvas::setPrinting ( const bool b ) { printing = b ; - wxPrintf( "PlasmidCanvas::setPrinting ( %d )\n" , b ) ; + //wxPrintf( "D: PlasmidCanvas::setPrinting ( %d )\n" , b ) ; } void PlasmidCanvas::setLastContextItem ( const long _l ) { context_last_item = _l ; } void PlasmidCanvas::getMark ( int &i1 , int &i2 ) const { i1 = getMarkFrom() ; i2 = getMarkTo() ; } @@ -128,7 +128,7 @@ PlasmidCanvas::~PlasmidCanvas () void PlasmidCanvas::Refresh () { - wxPrintf( "D: PlasmidCanvas::Refresh - start\n" ) ; + //wxPrintf( "D: PlasmidCanvas::Refresh - start\n" ) ; if ( p && p->cSequence->getEditMode() && p->def == _T("DNA") ) return ; // if ( painting ) return ; // painting = true ; @@ -136,7 +136,7 @@ void PlasmidCanvas::Refresh () PrepareDC ( dc ) ; OnDraw ( dc ) ; // painting = false ; - wxPrintf( "D: PlasmidCanvas::Refresh - end\n" ) ; + //wxPrintf( "D: PlasmidCanvas::Refresh - end\n" ) ; } bool PlasmidCanvas::isEnzymeVisible ( const wxString& s ) const @@ -156,7 +156,7 @@ bool PlasmidCanvas::intersects ( const wxRect &a , const wxRect &b ) const // Define the repainting behaviour void PlasmidCanvas::OnDraw(wxDC& pdc) /* not const */ { - wxPrintf( "D: PlasmidCanvas::OnDraw - start\n" ) ; + //wxPrintf( "D: PlasmidCanvas::OnDraw - start\n" ) ; if ( !p || !p->vec ) { wxPrintf( "D: PlasmidCanvas::OnDraw - ret !p || !p->vec\n" ) ; @@ -236,12 +236,12 @@ void PlasmidCanvas::OnDraw(wxDC& pdc) /* not const */ pdc.Blit ( vx , vy , w , h , &dc , 0 , 0 ) ; painting = false ; } - wxPrintf( "D: PlasmidCanvas::OnDraw - end\n" ) ; + //wxPrintf( "D: PlasmidCanvas::OnDraw - end\n" ) ; } void PlasmidCanvas::OnCopyImage ( wxCommandEvent& ev ) { - wxPrintf( "D: PlasmidCanvas::OnCopyImage - start\n" ) ; + //wxPrintf( "D: PlasmidCanvas::OnCopyImage - start\n" ) ; if ( !p || !p->vec ) { @@ -295,7 +295,7 @@ void PlasmidCanvas::OnCopyImage ( wxCommandEvent& ev ) GetClientSize(&w, &h); } - wxPrintf( "D: PlasmidCanvas::OnCopyImage - end\n" ) ; + //wxPrintf( "D: PlasmidCanvas::OnCopyImage - end\n" ) ; } void PlasmidCanvas::OnSaveImage ( wxCommandEvent& ev ) @@ -400,7 +400,7 @@ void PlasmidCanvas::OnEvent(wxMouseEvent& event) { // Upon some wild double-clicks, at times a release is attempted on a window that was not captured // This demands some further investigation. - wxPrintf( "I: Prevented attempt to release a window that was not captured.\n" ) ; + wxPrintf( "D: Prevented attempt to release a window that was not captured.\n" ) ; } captured = false ; } @@ -837,23 +837,23 @@ void PlasmidCanvas::invokeVectorEditor ( const wxString& what , const int num , void PlasmidCanvas::print () { - wxPrintf( "D: PlasmidCanvas::print - start\n" ) ; + //wxPrintf( "D: PlasmidCanvas::print - start\n" ) ; wxPrintDialog pd ( this ) ; int r = pd.ShowModal () ; if ( r != wxID_OK ) return ; - wxPrintf( "D: PlasmidCanvas::print A\n" ) ; + //wxPrintf( "D: PlasmidCanvas::print A\n" ) ; wxDC *pdc = pd.GetPrintDC () ; pdc->StartDoc ( p->vec->getName() ) ; pdc->StartPage () ; printing = true ; - wxPrintf( "D: PlasmidCanvas::print B\n" ) ; + //wxPrintf( "D: PlasmidCanvas::print B\n" ) ; OnDraw ( *pdc ) ; - wxPrintf( "D: PlasmidCanvas::print C\n" ) ; + //wxPrintf( "D: PlasmidCanvas::print C\n" ) ; printing = false ; pdc->EndPage () ; pdc->EndDoc () ; - wxPrintf( "D: PlasmidCanvas::print - end\n" ) ; + //wxPrintf( "D: PlasmidCanvas::print - end\n" ) ; } void PlasmidCanvas::makeGCcolor ( const int percent , wxColour &col ) const @@ -914,6 +914,5 @@ void PlasmidCanvas::showGClegend ( wxDC &dc ) const dc.GetTextExtent ( t , &tw , &th ) ; dc.DrawText ( t , r.GetLeft() + nw2 * a + nw2/2 - tw/2 , r.GetBottom() - nw2*9/10 - th ) ; } - wxPrintf( "D: PlasmidCanvas::showGClegend Z\n" ) ; }