Merge lp:~ubuntu-branches/ubuntu/utopic/gentle/utopic-201408050405 into lp:ubuntu/utopic/gentle

Proposed by Ubuntu Package Importer
Status: Needs review
Proposed branch: lp:~ubuntu-branches/ubuntu/utopic/gentle/utopic-201408050405
Merge into: lp:ubuntu/utopic/gentle
Diff against target: 4082 lines (+37/-3941) (has conflicts)
11 files modified
.pc/forward_slashes.patch/MyFrame.cpp (+0/-2790)
.pc/remove_clustalw.patch/Makefile.am (+0/-244)
.pc/remove_tinyxml.patch/Makefile.am (+0/-250)
.pc/remove_tinyxml.patch/TXMLfile.cpp (+0/-256)
.pc/remove_tinyxml.patch/TXMLfile.h (+0/-40)
.pc/remove_tinyxml.patch/main.h (+0/-354)
Makefile.am (+34/-0)
MyFrame.cpp (+1/-1)
TXMLfile.cpp (+1/-1)
TXMLfile.h (+1/-1)
main.h (+0/-4)
Contents conflict in .pc/applied-patches
Text conflict in Makefile.am
To merge this branch: bzr merge lp:~ubuntu-branches/ubuntu/utopic/gentle/utopic-201408050405
Reviewer Review Type Date Requested Status
Ubuntu branches Pending
Review via email: mp+229552@code.launchpad.net

Description of the change

The package importer has detected a possible inconsistency between the package history in the archive and the history in bzr. As the archive is authoritative the importer has made lp:ubuntu/utopic/gentle reflect what is in the archive and the old bzr branch has been pushed to lp:~ubuntu-branches/ubuntu/utopic/gentle/utopic-201408050405. This merge proposal was created so that an Ubuntu developer can review the situations and perform a merge/upload if necessary. There are three typical cases where this can happen.
  1. Where someone pushes a change to bzr and someone else uploads the package without that change. This is the reason that this check is done by the importer. If this appears to be the case then a merge/upload should be done if the changes that were in bzr are still desirable.
  2. The importer incorrectly detected the above situation when someone made a change in bzr and then uploaded it.
  3. The importer incorrectly detected the above situation when someone just uploaded a package and didn't touch bzr.

If this case doesn't appear to be the first situation then set the status of the merge proposal to "Rejected" and help avoid the problem in future by filing a bug at https://bugs.launchpad.net/udd linking to this merge proposal.

(this is an automatically generated message)

To post a comment you must log in.

Unmerged revisions

8. By Luke Yelavich

Merge branch lp:~noskcaj/ubuntu/utopic/gentle/wxwidgets-3.0

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== renamed file '.pc/applied-patches' => '.pc/applied-patches.THIS'
=== removed directory '.pc/forward_slashes.patch'
=== removed file '.pc/forward_slashes.patch/MyFrame.cpp'
--- .pc/forward_slashes.patch/MyFrame.cpp 2011-06-03 21:12:05 +0000
+++ .pc/forward_slashes.patch/MyFrame.cpp 1970-01-01 00:00:00 +0000
@@ -1,2790 +0,0 @@
1#include "MyFrame.h"
2#include "SendHTTP.h"
3#include <wx/sysopt.h>
4#include "TEliteLaChromLogDialog.h"
5
6// ---------------------------------------------------------------------------
7// MyFrame
8// ---------------------------------------------------------------------------
9
10BEGIN_EVENT_TABLE(MyFrame, MyFrameType)
11EVT_MENU(MDI_ABOUT, MyFrame::OnAbout)
12EVT_MENU(MDI_HELP, MyFrame::OnHelp)
13EVT_MENU(MDI_ENZYME_EDITOR, MyFrame::OnEnzymeEditor)
14EVT_MENU(MDI_ALIGNMENT, MyFrame::OnAlignment)
15EVT_MENU(MDI_IMAGE_VIEWER, MyFrame::OnImageViewer)
16EVT_MENU(MDI_EXTERNAL_INTERFACE, MyFrame::OnExternalInterface)
17EVT_MENU(MDI_CALCULATOR, MyFrame::OnCalculator)
18EVT_MENU(MDI_GRAPH, MyFrame::OnGraph)
19EVT_MENU(MDI_FILE_OPEN, MyFrame::OnFileOpen)
20EVT_MENU(MDI_FILE_IMPORT, MyFrame::OnFileImport)
21EVT_MENU(MDI_FILE_SAVE_ALL, MyFrame::OnStoreAll)
22EVT_MENU(MDI_TEXT_IMPORT, MyFrame::OnTextImport)
23EVT_MENU(MDI_PROJECT_SAVE, MyFrame::OnProjectSave)
24EVT_MENU(MDI_PROJECT_LOAD, MyFrame::OnProjectLoad)
25EVT_MENU(MDI_PROJECT_CLOSE, MyFrame::OnProjectClose)
26EVT_MENU(MDI_QUIT, MyFrame::OnQuit)
27EVT_MENU(MDI_CLOSE, MyFrame::OnMDIClose)
28EVT_MENU(MDI_MANAGE_DATABASE, MyFrame::OnManageDatabase)
29EVT_MENU(PROGRAM_OPTIONS, MyFrame::OnProgramOptions)
30EVT_MENU(MDI_HOMEPAGE, MyFrame::OnHomepage)
31EVT_MENU(MDI_LIGATION, MyFrame::OnLigation)
32EVT_MENU(MDI_CLONING_ASSISTANT, MyFrame::OnCloningAssistant)
33EVT_MENU(MDI_SEQUENCING_ASSISTANT, MyFrame::OnSequencingAssistant)
34EVT_MENU(MDI_DOTPLOT, MyFrame::OnDotPlot)
35EVT_MENU(MDI_RESTRICTION_IDENTIFIER, MyFrame::OnRestrictionIdentifier)
36
37EVT_MENU(Y___, MyFrame::TestMenu)
38EVT_MENU(MDI_RESTRICTION, MyFrame::BollocksMenu)
39EVT_MENU(MDI_PRINT_REPORT, MyFrame::BollocksMenu)
40
41EVT_MENU(MDI_NEXT_WINDOW, MyFrame::BollocksMenu)
42EVT_MENU(MDI_PREV_WINDOW, MyFrame::BollocksMenu)
43
44EVT_MENU_RANGE(A___,Z___,MyFrame::RerouteMenu)
45EVT_MENU_RANGE(ONLINE_TOOLS_BEGIN,ONLINE_TOOLS_END,MyFrame::OnlineTools)
46
47
48EVT_SASH_DRAGGED_RANGE(FRAME_SASH_1, FRAME_SASH_TOP, MyFrame::OnSashDrag)
49
50EVT_CLOSE(MyFrame::OnClose)
51
52EVT_SIZE(MyFrame::OnSize)
53END_EVENT_TABLE()
54
55/// \brief Number of wxAcceleratorEntry entries
56#define ACC_ENT 43
57
58/** \brief Constructor
59
60 * - Initializes variables
61 * - Sets the accelerator keys
62 */
63MyFrame::MyFrame(wxWindow *parent,
64 const wxWindowID id,
65 const wxString& title,
66 const wxPoint& pos,
67 const wxSize& size,
68 const long style)
69: MyFrameType(parent, id, title, pos, size, style)
70{
71 dying = false ;
72 activating = false ;
73 locked = 0 ;
74 update_child_list = false ;
75#ifdef MYTEST
76 test_suite = NULL ;
77#endif
78
79#ifndef __WXMAC__
80 // Accelerators
81 wxAcceleratorEntry entries[ACC_ENT];
82 entries[ 0].Set(wxACCEL_CTRL, (int) 'X', MDI_CUT);
83 entries[ 1].Set(wxACCEL_CTRL, (int) 'C', MDI_COPY);
84 entries[ 2].Set(wxACCEL_CTRL, (int) 'V', MDI_PASTE);
85 entries[ 3].Set(wxACCEL_CTRL, (int) 'L', MDI_LIGATION);
86 entries[ 4].Set(wxACCEL_CTRL, (int) 'A', MDI_MARK_ALL);
87 entries[ 5].Set(wxACCEL_CTRL, (int) 'S', MDI_FILE_SAVE);
88 entries[ 6].Set(wxACCEL_CTRL, (int) 'E', MDI_EXPORT);
89 entries[ 7].Set(wxACCEL_NORMAL, WXK_F2, MDI_EDIT_MODE);
90 entries[ 8].Set(wxACCEL_CTRL, (int) '0', AA_NONE);
91 entries[ 9].Set(wxACCEL_CTRL, (int) '1', AA_THREE_1);
92 entries[10].Set(wxACCEL_CTRL, (int) '2', AA_THREE_2);
93 entries[11].Set(wxACCEL_CTRL, (int) '3', AA_THREE_3);
94 entries[12].Set(wxACCEL_CTRL, (int) '4', AA_THREE_M1);
95 entries[13].Set(wxACCEL_CTRL, (int) '5', AA_THREE_M2);
96 entries[14].Set(wxACCEL_CTRL, (int) '6', AA_THREE_M3);
97 entries[15].Set(wxACCEL_CTRL, (int) '7', AA_ALL);
98 entries[16].Set(wxACCEL_CTRL, (int) '8', AA_KNOWN);
99 entries[17].Set(wxACCEL_CTRL, (int) 'G', MDI_ALIGNMENT);
100 entries[18].Set(wxACCEL_CTRL, (int) 'F', MDI_FIND);
101 entries[19].Set(wxACCEL_NORMAL, WXK_F1, MDI_HELP);
102 entries[20].Set(wxACCEL_CTRL, (int) 'Y', AA_ONE);
103 entries[21].Set(wxACCEL_CTRL, (int) 'W', AA_THREE);
104 entries[22].Set(wxACCEL_NORMAL, WXK_F11, MDI_PROJECT_LOAD);
105 entries[23].Set(wxACCEL_NORMAL, WXK_F12, MDI_PROJECT_SAVE);
106 entries[24].Set(wxACCEL_NORMAL, WXK_F4, MDI_ORFS);
107 entries[25].Set(wxACCEL_NORMAL, WXK_F5, MDI_CIRCULAR_LINEAR);
108 entries[26].Set(wxACCEL_NORMAL, WXK_F3, MDI_VIEW_MODE);
109 entries[27].Set(wxACCEL_NORMAL, WXK_F6, MDI_TOGGLE_FEATURES);
110 entries[28].Set(wxACCEL_NORMAL, WXK_F7, MDI_TOGGLE_RESTRICTION);
111 entries[29].Set(wxACCEL_CTRL, (int) 'O', MDI_FILE_OPEN);
112 entries[30].Set(wxACCEL_CTRL, (int) 'I', MDI_FILE_IMPORT);
113 entries[31].Set(wxACCEL_CTRL, (int) 'Z', MDI_UNDO);
114 entries[32].Set(wxACCEL_CTRL, (int) 'N', MDI_TEXT_IMPORT);
115 entries[33].Set(wxACCEL_CTRL, (int) 'D', MDI_EXTERNAL_INTERFACE);
116 entries[34].Set(wxACCEL_CTRL, WXK_F4, MDI_CLOSE);
117 entries[35].Set(wxACCEL_CTRL, WXK_TAB, MDI_NEXT_WINDOW);
118 entries[36].Set(wxACCEL_CTRL|wxACCEL_SHIFT, WXK_TAB, MDI_PREV_WINDOW);
119 entries[37].Set(wxACCEL_NORMAL, WXK_F8, MDI_TOGGLE_IDNA);
120 entries[38].Set(wxACCEL_CTRL|wxACCEL_SHIFT, WXK_F12, Y___);
121 // entries[38].Set(wxACCEL_CTRL, WXK_F12, MDI_GRAPH);
122 entries[39].Set(wxACCEL_CTRL, WXK_F1, MDI_ABOUT);
123 entries[40].Set(wxACCEL_NORMAL, WXK_F9, MDI_AUTO_ANNOTATE);
124 entries[41].Set(wxACCEL_CTRL, (int) 'K', MDI_CLONING_ASSISTANT);
125 entries[42].Set(wxACCEL_CTRL|wxACCEL_SHIFT, (int) 'S', MDI_FILE_SAVE_ALL);
126
127 wxAcceleratorTable accel(ACC_ENT, entries);
128 SetAcceleratorTable(accel);
129#endif
130 html_ep = NULL ;
131 lastChild = NULL ;
132 tb_mychild = NULL ;
133 online_tools = new TOnlineTools ;
134 push_help ( _T("GENtle") ) ;
135
136 // Load DNA markers
137 wxString marker_file = myapp()->homedir + myapp()->slash + _T("marker.txt") ;
138 wxTextFile tf ( marker_file ) ;
139 if ( tf.Open ( wxConvUTF8 ) ) wxSafeShowMessage ( marker_file , marker_file ) ;
140 for ( unsigned int a = 0 ; a < tf.GetLineCount() ; a++ )
141 {
142 wxString s = tf.GetLine ( a ) ;
143 s = s.Trim().Trim(false) ;
144 if ( s.IsEmpty() ) continue ; // Skip blank lines
145 if ( s.Left ( 1 ) == _T("#") ) continue ; // Skip comments
146 dna_marker.Add ( s ) ;
147 }
148}
149
150/** \brief Destructor
151
152 * - Stores the last project used, so it can be reopened on the next program start
153 * - Clears memory
154 */
155MyFrame::~MyFrame ()
156{
157 pop_help () ;
158 if ( html_ep ) delete html_ep ;
159 rememberLastProject () ;
160 CLEAR_DELETE ( dbcache ) ;
161 // delete LS ;
162}
163
164/** \brief Initializes the frame
165
166 * - Creates frame layout
167 * - Accesses local database and imports enzyme list
168 * - Sets options
169 * - Loads language file
170 * - Checks for updates online (Windows only)
171 * - Menus
172 * - Initialized drop target
173 * - Loads bitmaps for user interface
174 * - Loads last project
175 * - Parses command line paramaters
176 */
177void MyFrame::initme ()
178{
179// myapp()->sw.Start() ;
180
181#ifdef __WXGTK__
182 SetFont ( *MYFONT ( 8 , wxSWISS , wxNORMAL , wxNORMAL ) ) ;
183#endif
184
185 int borders = wxNO_BORDER ;
186 wxFileSystem::AddHandler(new wxInternetFSHandler );
187
188 wxSashLayoutWindow* win ;
189 m_leftWindow2 = m_topWindow = m_bottomWindow = NULL ;
190
191 // A window to the left of the client window
192 // This contains the main tree
193 win = new wxSashLayoutWindow(this, FRAME_SASH_1,
194 wxDefaultPosition, wxSize(200, 30),
195 borders | wxSW_3D | wxCLIP_CHILDREN);
196 win->SetDefaultSize(wxSize(200, 1000));
197 win->SetOrientation(wxLAYOUT_VERTICAL);
198 win->SetAlignment(wxLAYOUT_LEFT);
199 win->SetSashVisible(wxSASH_RIGHT, TRUE);
200 mainTree = new TMainTree ( win , MAIN_TREE_DUMMY ) ;
201
202
203 m_leftWindow1 = win;
204
205 // The client window
206 win = new wxSashLayoutWindow(this, FRAME_SASH_2,
207 wxDefaultPosition, wxSize(500, 30),
208 borders | wxSW_3D | wxCLIP_CHILDREN);
209 win->SetDefaultSize(wxSize(500, 1000));
210 win->SetOrientation(wxLAYOUT_VERTICAL);
211 win->SetAlignment(wxLAYOUT_LEFT);
212 win->SetSashVisible(wxSASH_RIGHT, TRUE);
213 m_leftWindow2 = win;
214
215 // Database access
216 LS = new TStorage ( LOCAL_STORAGE ) ;
217 LS->createDatabase() ;
218 LS->startup () ;
219 LS->syncEnzymes () ;
220 // LS->optimizeDatabase () ; // This will VACUUM sqlite databases
221
222 // Synchronize enzymes in known databases
223 // Turned of temporarily
224 // LS->synchronize () ;
225
226 // Import enzymes from local database
227 LS->import() ;
228
229#ifndef MISER_MODE
230 bool default_update = false ;
231#else
232 bool default_update = true ;
233#endif
234
235#ifdef __WXMAC__
236 default_update = true ;
237#endif
238
239 // Loading program options from database
240 showVectorTitle = LS->getOption ( _T("SHOWVECTORTITLE") , true ) ;
241 showVectorLength = LS->getOption ( _T("SHOWVECTORLENGTH") , true ) ;
242 enhancedRefresh = LS->getOption ( _T("ENHANCEDREFRESH") , true ) ;
243 loadLastProject = LS->getOption ( _T("LOADLASTPROJECT") , true ) ;
244 useMetafile = LS->getOption ( _T("USEMETAFILE") , false ) ;
245 showSplashScreen = LS->getOption ( _T("SHOWSPLASHSCREEN") , true ) ;
246 checkUpdate = LS->getOption ( _T("CHECKUPDATE") , default_update ) ;
247 lang_string = LS->getOption ( _T("LANGUAGE") , _T("en") ) ;
248 doRegisterStuff = LS->getOption ( _T("REGISTERSTUFF") , true ) ;
249 editFeatureMode = LS->getOption ( _T("EDITFEATUREMODE") , 0 ) ;
250 showStopCodon = LS->getOption ( _T("SHOWSTOPCODON") , 0 ) ;
251 useCoolCanvas = LS->getOption ( _T("USECOOLCANVAS") , false ) ; // Ignored
252 useInternalHelp = LS->getOption ( _T("USEINTERNALHELP") , false ) ;
253 useOnlineHelp = LS->getOption ( _T("USEONLINEHELP") , true ) ;
254 showEnzymePos = LS->getOption ( _T("SHOWENZYMEPOS") , true ) ;
255 showToolTips = LS->getOption ( _T("SHOWTOOLTIPS") , true ) ;
256 showLowercaseDNA = LS->getOption ( _T("SHOWLOWERCASEDNA") , false ) ;
257 orfLength = LS->getOption ( _T("ORFLENGTH") , 100 ) ;
258 nonstandard_translation_table = LS->getOption ( _T("nonstandard_translation_table") , -1 ) ;
259 proxy = LS->getOption ( _T("PROXY") , _T("") ) ;
260 //#ifdef __WXMAC__
261 useTwoToolbars = LS->getOption ( _T("use_two_toolbars") , true ) ;
262 /*#else
263 useTwoToolbars = LS->getOption ( _T("use_two_toolbars") , false ) ;
264 #endif*/
265
266
267 int aa_red = LS->getOption ( _T("AA_RED") , wxLIGHT_GREY->Red() ) ;
268 int aa_green = LS->getOption ( _T("AA_GREEN") , wxLIGHT_GREY->Green() ) ;
269 int aa_blue = LS->getOption ( _T("AA_BLUE") , wxLIGHT_GREY->Blue() ) ;
270 aa_color.Set ( aa_red , aa_green , aa_blue ) ;
271
272 // if ( !proxy.IsEmpty() ) wxURL::SetDefaultProxy ( proxy ) ;
273
274 stopcodon = showStopCodon == 0 ? '|' : '*' ;
275
276 myapp()->init_txt ( lang_string.c_str() , _T("variables.csv") ) ;
277
278
279 global_enzyme_rules = new TEnzymeRules ;
280 global_enzyme_rules->load_global_settings() ;
281
282 // Set the DEBUGGING option in your local test database,
283 // so you won't be bothered with updates anymore :-)
284 if ( LS->getOption ( _T("DEBUGGING") , _T("") ) == _T("1") ) checkUpdate = false ;
285
286#ifndef __WXMSW__
287#ifndef __WXMAC__
288 checkUpdate = false ;
289#endif
290#endif
291
292 // Check for update online
293 if ( checkUpdate )
294 {
295// wxMessageBox ( _T("A") , wxString::Format(_T("%d"),myapp()->sw.Time())); myapp()->sw.Start() ;
296 wxString cur_update = check4update () ;
297// wxMessageBox ( _T("B") , wxString::Format(_T("%d"),myapp()->sw.Time())); myapp()->sw.Start() ;
298 if ( !cur_update.IsEmpty() )
299 {
300 update2version ( cur_update ) ;
301 return ;
302 }
303 }
304
305 project.name = txt("project") ;
306 SetTitle ( txt("gentle") ) ;
307 mainTree->initme() ;
308
309 // Give it an icon
310#ifdef __WXMSW__
311 SetIcon(wxIcon(_T("GENtle.ico"),wxBITMAP_TYPE_ICO));
312#elif __WXMAC__
313#else
314 SetIcon(wxIcon( mondrian_xpm ));
315#endif
316
317 // Make a menubar
318 wxMenu *file_menu = new wxMenu;
319
320 file_menu->Append(MDI_FILE_OPEN, txt("m_open") , txt("m_opentxt") );
321 file_menu->Append(MDI_FILE_IMPORT, txt("m_import") , txt("m_importtxt") );
322 file_menu->Append(MDI_TEXT_IMPORT, txt("m_text_import") , txt("m_text_importtxt") );
323 file_menu->AppendSeparator();
324 file_menu->Append(MDI_PROJECT_LOAD, txt("m_project_open") , txt("m_project_opentxt") );
325 file_menu->Append(MDI_PROJECT_SAVE, txt("m_project_save") , txt("m_project_savetxt") );
326 file_menu->Append(MDI_PROJECT_CLOSE, txt("m_project_close") , txt("m_project_closetxt") );
327 file_menu->AppendSeparator();
328 file_menu->Append(MDI_QUIT, txt("m_exit") , txt("m_exittxt") ) ;
329
330 wxMenu *tool_menu = getToolMenu ( false ) ;
331 wxMenu *help_menu = getHelpMenu () ;
332
333 menu_bar = new wxMenuBar;
334
335 menu_bar->Append(file_menu, txt("m_file") );
336 menu_bar->Append(tool_menu, txt("m_tools") );
337 menu_bar->Append(help_menu, txt("m_help") );
338
339 // Associate the menu bar with the frame
340 SetMenuBar(menu_bar);
341 CreateStatusBar();
342 GetStatusBar()->SetFieldsCount ( 2 ) ;
343
344 // Drag'n'drop
345 MyFrameDropTarget *dt = new MyFrameDropTarget ;
346 SetDropTarget ( dt ) ;
347
348 // Bitmap library
349 wxString icondir = myapp()->bmpdir + myapp()->slash ;
350 bitmaps.push_back ( wxBitmap (icondir + _T("document-new.png") , wxBITMAP_TYPE_PNG) ) ; // 0
351 bitmaps.push_back ( wxBitmap (icondir + _T("document-open.png") , wxBITMAP_TYPE_PNG) ) ; // 1
352 bitmaps.push_back ( wxBitmap (icondir + _T("document-save.png") , wxBITMAP_TYPE_PNG) ) ; // 2
353 bitmaps.push_back ( wxBitmap (icondir + _T("edit-undo.png") , wxBITMAP_TYPE_PNG) ) ; // 3
354 bitmaps.push_back ( wxBitmap (icondir + _T("edit-cut.png") , wxBITMAP_TYPE_PNG) ) ; // 4
355 bitmaps.push_back ( wxBitmap (icondir + _T("edit-copy.png") , wxBITMAP_TYPE_PNG) ) ; // 5
356 bitmaps.push_back ( wxBitmap (icondir + _T("edit-paste.png") , wxBITMAP_TYPE_PNG) ) ;// 6
357 bitmaps.push_back ( wxBitmap (icondir + _T("display_circular_linear.png") , wxBITMAP_TYPE_PNG) ) ; // 7
358 bitmaps.push_back ( wxBitmap (icondir + _T("display_circular_linear.png") , wxBITMAP_TYPE_PNG) ) ; // 8
359 bitmaps.push_back ( wxBitmap (icondir + _T("display_orfs.png") , wxBITMAP_TYPE_PNG) ) ; // 9
360 bitmaps.push_back ( wxBitmap (icondir + _T("display_features.png") , wxBITMAP_TYPE_PNG) ) ; // 10
361 bitmaps.push_back ( wxBitmap (icondir + _T("restriction_new.png") , wxBITMAP_TYPE_PNG) ) ; // 11
362 bitmaps.push_back ( wxBitmap (icondir + _T("view_new.png") , wxBITMAP_TYPE_PNG) ) ; // 12
363 bitmaps.push_back ( wxBitmap (icondir + _T("accessories-text-editor.png") , wxBITMAP_TYPE_PNG) ) ; // 13
364 bitmaps.push_back ( wxBitmap (icondir + _T("go-down.png") , wxBITMAP_TYPE_PNG) ) ; // 14
365 bitmaps.push_back ( wxBitmap (icondir + _T("go-up.png") , wxBITMAP_TYPE_PNG) ) ; // 15
366 bitmaps.push_back ( wxBitmap (icondir + _T("document-print.png") , wxBITMAP_TYPE_PNG) ) ; // 16
367 bitmaps.push_back ( wxBitmap (icondir + _T("alignments.png") , wxBITMAP_TYPE_PNG) ) ; // 17
368 bitmaps.push_back ( wxBitmap (icondir + _T("image_viewer.png") , wxBITMAP_TYPE_PNG) ) ; // 18
369 bitmaps.push_back ( wxBitmap (icondir + _T("applications-internet.png") , wxBITMAP_TYPE_PNG) ) ; // 19
370 bitmaps.push_back ( wxBitmap (icondir + _T("accessories-calculator.png") , wxBITMAP_TYPE_PNG) ) ; // 20
371 bitmaps.push_back ( wxBitmap (icondir + _T("preferences-desktop.png") , wxBITMAP_TYPE_PNG) ) ; // 21
372 bitmaps.push_back ( wxBitmap (icondir + _T("edit-find.png") , wxBITMAP_TYPE_PNG) ) ; // 22
373
374 bitmaps.push_back ( to_grey ( bitmaps[ 4] ) ) ; // 23 - GREY Cut
375 bitmaps.push_back ( to_grey ( bitmaps[ 5] ) ) ; // 24 - GREY Copy
376 bitmaps.push_back ( to_grey ( bitmaps[ 6] ) ) ; // 25 - GREY Paste
377 bitmaps.push_back ( to_grey ( bitmaps[22] ) ) ; // 26 - GREY Find
378 bitmaps.push_back ( to_grey ( bitmaps[ 2] ) ) ; // 27 - GREY Save
379 bitmaps.push_back ( to_grey ( bitmaps[ 3] ) ) ; // 28 - GREY Undo
380 bitmaps.push_back ( to_grey ( bitmaps[16] ) ) ; // 29 - GREY Print sequence
381
382
383 if ( useTwoToolbars )
384 {
385 mainToolBar = CreateToolBar ( wxTB_HORIZONTAL ) ;
386 InitToolBar ( mainToolBar ) ;
387 addTool ( mainToolBar , MDI_TEXT_IMPORT ) ;
388 addTool ( mainToolBar , MDI_FILE_IMPORT ) ;
389 addTool ( mainToolBar , MDI_FILE_OPEN ) ;
390 addTool ( mainToolBar , MDI_FILE_SAVE ) ;
391 addTool ( mainToolBar , SEQ_PRINT ) ;
392 addTool ( mainToolBar , MDI_UNDO ) ;
393 addCCPFTools ( mainToolBar , true ) ;
394 addDefaultTools ( mainToolBar ) ;
395 mainToolBar->Realize() ;
396 updateCCP ( NULL ) ;
397 }
398 else
399 {
400 mainToolBar = NULL ;
401 }
402
403#ifdef __WXGTK__
404 Show(TRUE);
405 int sw , sh ;
406 wxDisplaySize ( &sw , &sh ) ;
407 // SetSize ( sw/10 , sh/10 , sw*8/10 , sh*7/10 ) ;
408 SetSize ( 0 , 0 , sw , sh*9/10 ) ;
409#else
410 Show(TRUE);
411 Maximize() ;
412#endif
413
414
415 html_ep = new wxHtmlEasyPrinting ( _T("") , this ) ;
416
417 wxBeginBusyCursor() ;
418#ifndef MISER_MODE
419 lockDisplay ( true ) ;
420#endif
421
422 // Load last project?
423 // loadLastProject = false ;
424 if ( loadLastProject )
425 {
426 wxString sql , n , d ;
427 TSQLresult r ;
428 sql = _T("SELECT s_value FROM stuff WHERE s_type='LASTPROJECT' AND s_name='NAME'") ;
429 r = LS->getObject ( sql ) ;
430 if ( r.rows() > 0 ) n = r[0][0] ;
431 sql = _T("SELECT s_value FROM stuff WHERE s_type='LASTPROJECT' AND s_name='DATABASE'") ;
432 r = LS->getObject ( sql ) ;
433 if ( r.rows() > 0 ) d = r[0][0] ;
434 if ( !n.IsEmpty() && !d.IsEmpty() )
435 {
436 TManageDatabaseDialog mdb ( this , _T("dummy") , ACTION_MODE_STARTUP ) ;
437 mdb.do_load_project ( n , d ) ;
438 mainTree->Refresh () ;
439 }
440 }
441
442#ifndef MISER_MODE
443 lockDisplay ( false ) ;
444#endif
445
446 // Command line parameters?
447 if ( myapp()->argc > 1 )
448 {
449 int a ;
450
451 // Pre-cache key-value pairs
452 for ( a = 1 ; a < myapp()->argc ; a++ )
453 {
454 wxString path = myapp()->argv[a] ;
455 if ( path.Left(1) != _T("-") ) continue ; // No key/value pair
456 while ( path.Left(1) == _T("-") ) path = path.Mid ( 1 ) ;
457 wxString key = path.BeforeFirst('=').Lower().Trim().Trim(false) ;
458 wxString value = path.AfterFirst('=').Trim().Trim(false) ;
459 if ( value.IsEmpty() ) value = _T("1") ;
460 myapp()->clp[key] = value ;
461 }
462
463 // Try to import images
464 wxProgressDialog pd ( txt("t_loading") , _T("") , myapp()->argc-1 , NULL , wxPD_ALL ) ;
465 for ( a = 1 ; a < myapp()->argc ; a++ )
466 {
467 wxString path = myapp()->argv[a] ;
468 if ( !pd.Update ( a-1 , path ) ) break ;
469 if ( path.Left(1) == _T("-") ) continue ; // key/value pair, did these already
470 if ( path.Left(9).Upper() == _T("GENTLE://") )
471 {
472 path = path.Mid ( 9 ) ;
473 if ( path.GetChar ( path.length()-1 ) == '/' ) // Trailing '/'
474 path = path.Mid ( 0 , path.length() - 1 ) ;
475 wxString db = path.BeforeFirst ( ':' ) ;
476 wxString name = path.AfterFirst ( ':' ) ;
477 TManageDatabaseDialog mdb ( this , _T("dummy") , ACTION_MODE_STARTUP ) ;
478 if ( !mdb.do_load_DNA ( name , db ) ) wxMessageBox ( txt("t_not_all_files_imported") ) ;
479 mainTree->Refresh () ;
480 }
481 else
482 {
483 if ( !wxFileExists ( path ) ) continue ; // No such file
484 wxString file = path.AfterLast ( '/' ) ;
485 file = file.AfterLast ( '\\' ) ;
486 importFile ( file , path , -1 ) ;
487 wxSetWorkingDirectory ( myapp()->homedir ) ;
488 }
489 }
490 }
491
492
493 wxEndBusyCursor() ;
494 Raise () ;
495 mainTree->Refresh () ;
496
497 SetSizeHints ( 600 , 400 ) ;
498 Show(TRUE);
499 m_leftWindow2->SetFocus () ;
500}
501
502wxBitmap MyFrame::to_grey ( wxBitmap &bmp1 )
503{
504 /*#ifndef __WXMSW__
505 return wxNullBitmap ;
506 #endif*/
507 wxImage i = bmp1.ConvertToImage () ;
508#ifdef __WXMSW__
509 wxImage i2 ( i.GetWidth() , i.GetHeight() ) ;
510#endif
511 for ( int x = 0 ; x < i.GetWidth() ; x++ )
512 {
513 for ( int y = 0 ; y < i.GetHeight() ; y++ )
514 {
515 int z = ( i.GetRed(x,y) + i.GetGreen(x,y) + i.GetBlue(x,y) ) / 3 ;
516#ifndef __WXMSW__
517 z /= 2 ;
518 i.SetRGB ( x , y , z , z , z ) ;
519#else
520 if ( i.GetAlpha ( x , y ) < 255 ) z = 200 ;
521 else z /= 2 ;
522 i2.SetRGB ( x , y , z , z , z ) ;
523#endif
524 }
525 }
526#ifdef __WXMSW__
527 return wxBitmap ( i2 ) ;
528#else
529 return wxBitmap ( i ) ;
530#endif
531}
532
533
534/** \brief Handles close event
535
536 Scans through all the children; if any one is changed, ask the user the
537 darn "are you sure" question, unless in debugging mode
538 */
539void MyFrame::OnClose(wxCloseEvent& event)
540{
541 bool canclose = true ;
542 for ( unsigned int a = 0 ; canclose && a < children.GetCount() ; a++ )
543 canclose = ! ( children[a]->vec && children[a]->vec->isChanged() ) ;
544 if ( LS->getOption ( _T("DEBUGGING") , _T("") ) == _T("1") ) canclose = true ; // For debugging
545 if ( !canclose )
546 {
547 if ( wxYES == wxMessageBox ( txt("t_some_changed") , txt("msg_box") , wxICON_QUESTION | wxYES | wxNO ) )
548 canclose = true ;
549 }
550 if ( canclose )
551 {
552 dying = true ;
553 event.Skip();
554 }
555 else event.Veto() ;
556}
557
558/** \brief Handles the Quit command, closes
559 */
560void MyFrame::OnQuit(wxCommandEvent& event)
561{
562 Close();
563}
564
565/** \brief Displays "About" text
566 */
567void MyFrame::OnAbout(wxCommandEvent& event )
568{
569 wxString text = txt("t_about_txt") ;
570 (void)wxMessageBox(text + _T("\n\nV ") + myapp()->get_GENtle_version(), txt("t_about") );
571}
572
573/** \brief Invokes homepage
574 */
575void MyFrame::OnHomepage(wxCommandEvent& event )
576{
577 wxExecute ( myapp()->getHTMLCommand ( _T("http://gentle.magnusmanske.de") ) ) ;
578}
579
580/** \brief Invokes help
581 */
582void MyFrame::OnHelp(wxCommandEvent& event )
583{
584 wxString helpfile ;
585 if ( useInternalHelp )
586 {
587 wxHtmlHelpController *hc = new wxHtmlHelpController ( wxHF_DEFAULT_STYLE|wxHF_OPEN_FILES ) ;
588 helpfile += myapp()->homedir ;
589 helpfile += _T("\\help\\") ;
590 helpfile += lang_string ;
591 helpfile += _T(".hhp") ;
592 hc->AddBook ( helpfile ) ;
593 hc->DisplayContents () ;
594 }
595 else
596 {
597 helpfile = get_help() ;
598 if ( useOnlineHelp && !helpfile.IsEmpty() )
599 {
600 helpfile = _T("http://en.wikibooks.org/wiki/") + helpfile ;
601 }
602 else helpfile.Clear() ;
603
604 if ( helpfile.IsEmpty() )
605 {
606#ifdef __WXMAC__
607 helpfile = _T("\"") ;
608 helpfile += myapp()->homedir ;
609 helpfile += _T("/") ;
610 helpfile += txt("f_help").AfterFirst ( '/' ) ;
611 helpfile += _T("\"") ;
612#endif
613
614#ifdef __WXMSW__
615 helpfile = _T("\"") ;
616 helpfile += myapp()->homedir ;
617 helpfile += _T("\\") ;
618 helpfile += txt("f_help") ;
619 helpfile += _T("\"") ;
620
621 for ( int a = 0 ; a < helpfile.length() ; a++ )
622 if ( helpfile.GetChar(a) == '/' ) helpfile.SetChar ( a , '\\' ) ;
623#endif
624 }
625
626 if ( !helpfile.IsEmpty() )
627 {
628 wxString command = myapp()->getHTMLCommand ( helpfile ) ;
629 wxExecute ( command ) ;
630 }
631 }
632}
633
634/** \brief Returns pointer to last (active) child
635 */
636ChildBase *MyFrame::GetActiveChild() //SDI
637{
638 return lastChild ;
639}
640
641/** \brief Invokes the enzyme editor
642 */
643void MyFrame::OnEnzymeEditor(wxCommandEvent& event )
644{
645 TVectorEditor ee ( this , txt("t_enzymeeditor") , NULL ) ;
646 ee.ShowModal () ;
647}
648
649/** \brief Invokes the "open from database" dialog
650 */
651void MyFrame::OnFileOpen(wxCommandEvent& event )
652{
653 unsigned int i = children.GetCount() ;
654 TManageDatabaseDialog dbd ( this , txt("t_open") , ACTION_MODE_LOAD ) ;
655 dbd.ShowModal () ;
656 if ( i != children.GetCount() )
657 setActiveChild ( children[children.GetCount()-1] ) ;
658 if ( GetActiveChild() ) GetActiveChild()->SetFocus() ;
659}
660
661/** \brief Invokes the "enter sequence manually" dialog and calls the appropriate creation function
662 */
663void MyFrame::OnTextImport(wxCommandEvent& event )
664{
665 TextImportDialog d ( this , txt("m_text_importtxt") ) ;
666
667 ChildBase *c = (ChildBase*) GetActiveChild() ;
668 if ( c && c->def == _T("PrimerDesign") ) d.type->SetSelection ( 4 ) ;
669
670 if ( d.ShowModal () != wxID_OK ) return ;
671
672 int type = d.type->GetSelection () ;
673
674 if ( type == 0 ) // DNA
675 {
676 TVector *v = new TVector ;
677 v->setName ( d.sName ) ;
678 v->setSequence ( d.sSequence ) ;
679 v->setDescription ( txt("manually_entered_sequence") + wxString ( _T("\n") + wxGetUserName() ) ) ;
680 newFromVector ( v ) ;
681 }
682 else if ( type == 1 ) // Amino Acids
683 {
684 newAminoAcids ( d.sSequence , d.sName ) ;
685 }
686 else if ( type == 2 ) // GenBank
687 {
688 TGenBank gb ;
689 gb.paste ( d.sequence->GetValue() ) ;
690 newGB ( gb , d.sName ) ;
691 }
692 else if ( type == 3 ) // XML
693 {
694 // Trying XML formats
695 TXMLfile xml ;
696 xml.parse ( d.sequence->GetValue().c_str() ) ;
697 if ( xml.success() )
698 {
699 newXML ( xml , d.sName ) ;
700 return ;
701 }
702 }
703 else if ( type == 4 ) // Primer
704 {
705 TVector *v = new TVector ;
706 v->setName ( d.sName ) ;
707 v->setSequence ( d.sSequence ) ;
708 v->setType ( TYPE_PRIMER ) ;
709 v->setDescription ( txt("manually_entered_sequence") + _T("\n") + wxGetUserName() ) ;
710 newFromVector ( v , TYPE_PRIMER ) ;
711 }
712}
713
714/** \brief Saves an image (actually, a wxBitmap) to a file, with "save as" dialog
715 */
716void MyFrame::saveImage ( wxBitmap *bmp , wxString name )
717{
718 wxString wildcard ;
719 wildcard += _T("PNG (*.png)|*.png") ;
720 // wildcard += _T("|TIF (*.tif)|*.tif") ;
721 wildcard += _T("|Bitmap (*.bmp)|*.bmp") ;
722 wildcard += _T("|JPEG (*.jpg)|*.jpg") ;
723
724 name.Replace ( _T("*") , _T("") , TRUE ) ;
725 name.Replace ( _T(":") , _T("_") , TRUE ) ;
726 name.Replace ( _T("/") , _T("_") , TRUE ) ;
727 name.Replace ( _T("\\") , _T("_") , TRUE ) ;
728
729 wxString lastdir = LS->getOption ( _T("LAST_IMPORT_DIR") , _T("C:") ) ;
730 wxFileDialog d ( this , txt("t_save_image") , lastdir , name , wildcard , wxSAVE|wxOVERWRITE_PROMPT ) ;
731 if ( d.ShowModal() != wxID_OK ) return ;
732 wxString filename = d.GetPath() ;
733
734 wxBeginBusyCursor () ;
735 wxString type = filename.AfterLast('.').Upper() ;
736 if ( type == _T("BMP") ) bmp->SaveFile ( filename , wxBITMAP_TYPE_BMP ) ;
737 if ( type == _T("PNG") ) bmp->SaveFile ( filename , wxBITMAP_TYPE_PNG ) ;
738 if ( type == _T("JPG") ) bmp->SaveFile ( filename , wxBITMAP_TYPE_JPEG ) ;
739 if ( type == _T("TIF") ) bmp->SaveFile ( filename , wxBITMAP_TYPE_TIF ) ;
740 wxEndBusyCursor () ;
741}
742
743/** \brief Handles the "import from file" dialog, then calls MyFrame::importFile
744 */
745void MyFrame::OnFileImport(wxCommandEvent& event )
746{
747 wxString wcAutomatic = txt("format_filter_auto") ;
748 wxString wcClone = txt("format_filter_clone") ;
749 wxString wcGenBank = txt("format_filter_genbank") ;
750 wxString wcSequencing = txt("format_filter_fasta") ;
751 wxString wcPlainTextDNA = txt("format_filter_plain_dna") ;
752 wxString wcPlainTextAA = txt("format_filter_plain_aa") ;
753 wxString wcABIformat = txt("format_filter_abi") ;
754 wxString wcCSVformat = txt("format_filter_csv") ;
755 wxString wcCM5format = txt("format_filter_cm5") ;
756 wxString wildcard = wcAutomatic +
757 _T("|") + wcClone +
758 _T("|") + wcGenBank +
759 _T("|") + wcSequencing +
760 _T("|") + wcPlainTextDNA +
761 _T("|") + wcPlainTextAA +
762 _T("|") + wcABIformat +
763 _T("|") + wcCSVformat +
764 _T("|") + wcCM5format ;
765 wxString lastdir = LS->getOption ( _T("LAST_IMPORT_DIR") , _T("C:") ) ;
766 wxFileDialog d ( this , txt("import_file") , lastdir ,
767 _T("") , wildcard , wxOPEN | wxMULTIPLE ) ;
768 int x = d.ShowModal() ;
769 if ( x != wxID_OK ) return ;
770
771 LS->setOption ( _T("LAST_IMPORT_DIR") , d.GetDirectory() ) ;
772
773 int filter = d.GetFilterIndex () - 1 ;
774 wxArrayString files , paths ;
775 d.GetFilenames ( files ) ;
776 d.GetPaths ( paths ) ;
777 wxBeginBusyCursor();
778 wxSafeYield() ;
779 wxProgressDialog pd ( txt("t_loading") , _T("") , files.GetCount() , NULL , wxPD_ALL ) ;
780 // lockDisplay ( true ) ;
781 wxString unknown ;
782 unsigned int a ;
783 for ( a = 0 ; a < files.GetCount() ; a++ )
784 {
785 if ( !pd.Update ( a , files[a] ) ) break ;
786 if ( !importFile ( files[a] , paths[a] , filter ) )
787 {
788 if ( !unknown.IsEmpty() ) unknown += _T("\n ") ;
789 unknown += files[a] ;
790 }
791 }
792 if ( a == files.GetCount() ) pd.Update ( a ) ; // Hide progress dialog
793 if ( !unknown.IsEmpty() )
794 wxMessageBox ( unknown , txt("t_unable_to_detect_file_type") ) ;
795 // lockDisplay ( false ) ;
796 SetFocus () ;
797 wxEndBusyCursor();
798 mainTree->Refresh () ;
799 Refresh () ;
800 activateChild ( getChildIndex ( lastChild ) ) ;
801}
802
803/** \brief Imports a file
804
805 If a "filter" number is given, only the matching file type is tried.
806 If "filter" is not given (-1), it tries to detect the type
807 by opening it with all import modules until there is a match.
808 */
809bool MyFrame::importFile ( wxString file , wxString path , int filter )
810{
811 wxString end = path.AfterLast('.').Lower() ;
812
813 // Trying Elite LaChrom chromatogram software
814 if ( filter == -1 && ( end == _T("apex") || end == _T("area") || end == _T("estdconc") ) )
815 {
816 TEliteLaChromLogDialog *eld = new TEliteLaChromLogDialog ( this , txt("t_eld_dialog_title") , path ) ;
817 eld->Show ( TRUE ) ;
818 //eld.ShowModal() ;
819 return true ;
820 }
821
822
823 // Trying XML formats
824 if ( filter == -1 )
825 {
826 TXMLfile xml ;
827 xml.load ( path ) ;
828 if ( xml.success() )
829 {
830 newXML ( xml ) ;
831 return true ;
832 }
833 }
834
835 // Trying GenBank format
836 if ( filter == 1 || filter == -1 )
837 {
838// wxStartTimer () ;
839 TGenBank gb ;
840 gb.load ( path ) ;
841 mylog ( "GenBank import" , "loaded" ) ;
842 if ( gb.success )
843 {
844 newGB ( gb , file ) ;
845 return true ;
846 }
847 }
848
849 // Trying ABI format
850 if ( filter == 5 || filter == -1 )
851 {
852 ABItype dummy ;
853 dummy.parse ( path ) ;
854 if ( dummy.vf.size() > 0 ) // Success
855 {
856 newABI ( path , file ) ;
857 return true ;
858 }
859 }
860
861 // Trying SCF format
862 if ( filter == 5 || filter == -1 )
863 {
864 SCFtype dummy ;
865 if ( dummy.parse ( path ) ) // Success
866 {
867 newABI ( path , file ) ;
868 return true ;
869 }
870 }
871
872 // Trying Clone Manager 5 format
873 if ( filter == -1 || filter == 7 )
874 {
875 TCloneManager cm ;
876 cm.load ( path ) ;
877 if ( cm.success() )
878 {
879 for ( int a = 0 ; a < cm.countVectors() ; a++ )
880 newFromVector ( cm.getVector ( a ) ) ;
881 return true ;
882 }
883 }
884
885 // Trying PDB format
886 if ( filter == -1 )
887 {
888 TPDB pdb ;
889 pdb.load ( path ) ;
890 if ( pdb.success )
891 {
892 newPDB ( pdb , file ) ;
893 return true ;
894 }
895 }
896
897
898 // Trying spectra
899 if ( filter == 6 || filter == -1 )
900 {
901 wxEndBusyCursor();
902 TGraph *g = RunGraph() ;
903 if ( filter == -1 && g->gd && g->gd->tryall ( path ) == _T("") )
904 {
905 wxBeginBusyCursor();
906 g->Close () ;
907 }
908 else if ( g->gd->SetupFromFile ( path ) )
909 {
910 wxBeginBusyCursor();
911 g->gd->AutoScale () ;
912 g->gd->UpdateDisplay () ;
913 wxEndBusyCursor();
914 /*if ( filter == 6 ) */return true ;
915 }
916 else
917 {
918 wxBeginBusyCursor();
919 g->Close () ;
920 wxEndBusyCursor();
921 if ( filter == 6 ) return false ;
922 }
923 }
924
925 // Trying UReadSeq package
926 if ( filter == 2 || filter == 3 || filter == 4 || filter == -1 )
927 {
928 TUReadSeq u ( path ) ;
929 // if ( u.error == 0 && u.seqs.GetCount() > 0 )
930 if ( u.error == 0 )
931 {
932 TGenBank gb ;
933 u.convert ( gb ) ;
934 newGB ( gb ) ;
935 return true ;
936 }
937 }
938
939 // Trying CLONE format
940 if ( filter == 0 || filter == -1 )
941 {
942 TClone clone ;
943 clone.LS = LS ;
944 clone.load ( path ) ;
945 if ( clone.success )
946 {
947 newCLONE ( clone ) ;
948 return true ;
949 }
950 }
951
952 return false ;
953}
954
955/** \brief Creates a new module with a phylogenetic tree
956 */
957TPhyloTree *MyFrame::newPhyloTree ( wxString title )
958{
959 TPhyloTree *subframe = new TPhyloTree(getCommonParent(), txt("t_phylogenetic_tree")) ;
960
961 setChild ( subframe ) ;
962
963 // Give it an icon
964#ifdef __WXMSW__
965 subframe->SetIcon(wxIcon(_T("chrt_icn")));
966#elif __WXMAC__
967#else
968 subframe->SetIcon(wxIcon( mondrian_xpm ));
969#endif
970
971
972 subframe->initme() ;
973 mainTree->addChild(subframe,TYPE_MISC) ;
974 subframe->Maximize() ;
975 return subframe ;
976}
977
978/** \brief Creates a new entry from an XML file (GenBankXML; DNA or amino acids)
979 */
980void MyFrame::newXML ( TXMLfile &xml , wxString title )
981{
982 int n ;
983 for ( n = 0 ; n < xml.countVectors() ; n++ )
984 {
985 TVector *nv = xml.getVector ( n ) ;
986 short type = nv->getType() ;
987 if ( !title.IsEmpty() ) nv->setName ( title ) ;
988 nv->addDescription ( _T("\n") + wxGetUserName() ) ;
989 if ( type == TYPE_AMINO_ACIDS )
990 newAminoAcids ( nv , nv->getName() ) ;
991 else
992 newFromVector ( nv , type ) ;
993 }
994}
995
996/** \brief Creates a new entry from a CLONE import
997 */
998MyChild *MyFrame::newCLONE ( TClone &clone )
999{
1000 MyChild *subframe = new MyChild(getCommonParent(), txt("imported_vector"),
1001 wxPoint(-1, -1), wxSize(-1, -1),
1002 wxDEFAULT_FRAME_STYLE);
1003 setChild ( subframe ) ;
1004
1005 // Give it an icon
1006#ifdef __WXMSW__
1007 subframe->SetIcon(wxIcon(_T("chrt_icn")));
1008#elif __WXMAC__
1009#else
1010 subframe->SetIcon(wxIcon( mondrian_xpm ));
1011#endif
1012
1013
1014 subframe->initme() ;
1015 int type = TYPE_VECTOR ;
1016 clone.remap ( subframe->vec ) ;
1017 subframe->vec->setDescription ( subframe->vec->getDescription() + _T("\n") + wxGetUserName() ) ;
1018 subframe->vec->setWindow ( subframe ) ;
1019 subframe->initPanels() ;
1020 mainTree->addChild(subframe,type) ;
1021 subframe->Maximize() ;
1022 return subframe ;
1023}
1024
1025/** \brief Creates a new entry from a PDB import
1026 */
1027void MyFrame::newPDB ( TPDB &pdb , wxString title )
1028{
1029 pdb.remap () ;
1030 for ( int a = 0 ; a < pdb.seqres.size() ; a++ )
1031 {
1032 newAminoAcids ( pdb.seqres[a].v , pdb.seqres[a].v->getName() ) -> Activate () ;
1033 delete pdb.seqres[a].v ;
1034 }
1035}
1036
1037/** \brief Creates a new entry from a GenBank import
1038
1039 This function can actually open multiple sequences from one and the same
1040 GenBank structure. This is used, for example, when opening alignments.
1041 */
1042void MyFrame::newGB ( TGenBank &gb , wxString title )
1043{
1044 int n ;
1045 TVector *nv ;
1046 wxArrayTVector vv ;
1047 wxArrayChildBase vc ;
1048 wxArrayString vs ;
1049 bool alignment = false ;
1050 // wxStartTimer () ;
1051 gb.vs.Clear () ;
1052 gb.vi.Clear () ;
1053
1054 for ( n = 0 ; n < gb.vs_l.size() ; n++ )
1055 {
1056 nv = new TVector ;
1057 gb.remap ( nv , gb.vs_l[n] , gb.vi_l[n] ) ;
1058 gb.vs_l[n].Clear () ;
1059 gb.vi_l[n].Clear () ;
1060
1061 mylog ( "GenBank import" , "remapped " + nv->getName() ) ;
1062 vs.Add ( nv->getSequence() ) ;
1063 vv.Add ( nv ) ;
1064 nv->setDescription ( nv->getDescription() + _T("\n") + wxGetUserName() ) ;
1065 if ( nv->getSequenceLength() != vv[0]->getSequenceLength() ) alignment = false ;
1066 else if ( nv->getSequence().find ( '-' ) != -1 ) alignment = true ;
1067 mylog ( "GenBank import" , "added " + nv->getName() ) ;
1068 }
1069 if ( gb.vs_l.size() == 1 ) alignment = false ;
1070
1071 // Removing alignment artifacts from sequences
1072 for ( n = 0 ; n < vv.GetCount() ; n++ )
1073 vv[n]->removeAlignmentArtifacts () ;
1074 mylog ( "GenBank import" , "artifacts removed" ) ;
1075
1076 /*
1077 // Ask if GenBank alignment should be opened as such (not using this right now)
1078 if ( alignment )
1079 {
1080 if ( wxYES != wxMessageBox ( txt("t_possible_alignment") ,
1081 title , wxYES_NO|wxICON_QUESTION ) )
1082 {
1083 alignment = false ;
1084 }
1085 }*/
1086
1087 wxBeginBusyCursor() ;
1088 for ( n = 0 ; n < gb.vs_l.size() ; n++ )
1089 {
1090 nv = vv[n] ;
1091 if ( gb.vs_l.size() == 1 && !title.IsEmpty() && nv->getName().IsEmpty() )
1092 nv->setName ( title ) ;
1093 short type = TUReadSeq::getSeqType ( nv->getSequence() ) ;
1094 if ( type == TYPE_AMINO_ACIDS )
1095 vc.Add ( newAminoAcids ( nv , nv->getName() ) ) ;
1096 else
1097 vc.Add ( newFromVector ( nv , type ) ) ;
1098 mylog ( "GenBank import" , "child added" ) ;
1099 }
1100 vv.Clear () ;
1101
1102 if ( alignment )
1103 {
1104 runAlignment ( vs , vc ) ;
1105 }
1106 // wxMessageBox ( wxString::Format ( "%dms" , wxGetElapsedTime() ) ) ;
1107 wxEndBusyCursor() ;
1108}
1109
1110
1111/** \brief Creates a new DNA entry from a TVector structure
1112
1113 This is a very important function. Virtually all import/open/enter
1114 functions call this one to create the actual window containing
1115 that data.
1116 */
1117MyChild* MyFrame::newFromVector ( TVector *nv , int type )
1118{
1119 if ( !nv ) return NULL ;
1120 myapp()->sw.Start () ;
1121 MyChild *subframe = new MyChild(getCommonParent(), _T(""),
1122 wxPoint(-1, -1), wxSize(-1, -1),
1123 wxDEFAULT_FRAME_STYLE);
1124 myass ( subframe , "MyFrame::newFromVector" ) ;
1125 setChild ( subframe ) ;
1126
1127 // Give it an icon
1128#ifdef __WXMSW__
1129 subframe->SetIcon(wxIcon(_T("chrt_icn")));
1130#elif __WXMAC__
1131#else
1132 subframe->SetIcon(wxIcon( mondrian_xpm ));
1133#endif
1134
1135 subframe->initme() ;
1136 delete subframe->vec ;
1137 subframe->vec = nv ;
1138 subframe->vec->setWindow ( subframe ) ;
1139
1140 subframe->initPanels() ;
1141 mainTree->addChild(subframe,type) ;
1142 children.Last()->Activate () ;
1143
1144 return subframe ;
1145}
1146
1147
1148/** \brief Handles OnSize events
1149 */
1150void MyFrame::OnSize(wxSizeEvent& event)
1151{
1152 wxLayoutAlgorithm layout;
1153 layout.LayoutFrame(this);
1154 /*#ifdef __WXMSW__
1155 if ( lastChild )
1156 {
1157 setActiveChild ( lastChild ) ;
1158 lastChild->Refresh() ;
1159 }
1160 #endif*/
1161}
1162
1163
1164/** \brief Sets the icon size for the toolbar
1165 */
1166void MyFrame::InitToolBar(wxToolBar* toolBar)
1167{
1168 wxSize ns ;
1169 if ( useTwoToolbars )
1170 {
1171#ifdef __WXMSW__
1172 ns = wxSize ( 22 , 22 ) ;
1173#else
1174 if ( toolBar == mainToolBar ) ns = wxSize ( 48 , 48 ) ;
1175 else ns = wxSize ( 36 , 36 ) ;
1176#endif
1177 }
1178 else
1179 {
1180#ifdef __WXMSW__
1181 ns = wxSize ( 22 , 22 ) ;
1182#else
1183 ns = wxSize ( 32 , 32 ) ;
1184#endif
1185 }
1186
1187 toolBar->SetToolBitmapSize ( ns ) ;
1188}
1189
1190wxChoice *MyFrame::AddFontsizeTool ( wxToolBar* toolBar , int id )
1191{
1192 toolBar->AddControl ( new wxStaticText ( toolBar , -1 , txt("t_fontsize") ) ) ;
1193#ifdef __WXMSW__
1194 int width = 40 ;
1195#else
1196 int width = 60 ;
1197#endif
1198 wxChoice *fontsize = new wxChoice ( toolBar , id , wxDefaultPosition , wxSize ( width , -1 ) ) ;
1199 toolBar->AddControl ( fontsize ) ;
1200 fontsize->Append ( _T(" 6") ) ;
1201 fontsize->Append ( _T(" 8") ) ;
1202 fontsize->Append ( _T("10") ) ;
1203 fontsize->Append ( _T("12") ) ;
1204 fontsize->Append ( _T("14") ) ;
1205 fontsize->Append ( _T("16") ) ;
1206 fontsize->Append ( _T("18") ) ;
1207 fontsize->Append ( _T("20") ) ;
1208 fontsize->Append ( _T("22") ) ;
1209 fontsize->Append ( _T("24") ) ;
1210 fontsize->Append ( _T("26") ) ;
1211 fontsize->Append ( _T("28") ) ;
1212 fontsize->Append ( _T("36") ) ;
1213 fontsize->Append ( _T("48") ) ;
1214 fontsize->SetStringSelection ( _T("12") ) ;
1215 return fontsize ;
1216}
1217
1218/** \brief Adds a tool to a given toolbar
1219 */
1220void MyFrame::addTool ( wxToolBar* toolBar , int id )
1221{
1222 if ( mainToolBar && toolBar != mainToolBar ) return ;
1223
1224 if ( id == MDI_TEXT_IMPORT )
1225 toolBar->AddTool( MDI_TEXT_IMPORT ,
1226 bitmaps[0],
1227 txt("m_new_sequence") ) ;
1228 else if ( id == MDI_FILE_IMPORT )
1229 toolBar->AddTool( MDI_FILE_IMPORT,
1230 bitmaps[14],
1231 txt("m_importtxt") );
1232 else if ( id == MDI_FILE_OPEN )
1233 toolBar->AddTool( MDI_FILE_OPEN,
1234 bitmaps[1],
1235 txt("m_opentxt") );
1236 else if ( id == MDI_FILE_SAVE )
1237 toolBar->AddTool( MDI_FILE_SAVE,
1238 txt("m_txt_store_in_db"),
1239 myapp()->frame->bitmaps[2] ,
1240 myapp()->frame->bitmaps[27] ,
1241 wxITEM_NORMAL , txt("m_txt_store_in_db") ) ;
1242 else if ( id == SEQ_PRINT )
1243 toolBar->AddTool( SEQ_PRINT,
1244 txt("m_print_sequence"),
1245 myapp()->frame->bitmaps[16] ,
1246 myapp()->frame->bitmaps[29] ,
1247 wxITEM_NORMAL , txt("m_print_sequence") ) ;
1248 else if ( id == MDI_UNDO )
1249 {
1250 toolBar->AddSeparator() ;
1251 toolBar->AddTool( MDI_UNDO, txt("m_undo_text"),
1252 myapp()->frame->bitmaps[3] ,
1253 myapp()->frame->bitmaps[28] ,
1254 wxITEM_NORMAL , txt("m_undo_text") ) ;
1255 }
1256 else if ( id == MDI_COPY )
1257 toolBar->AddTool( MDI_COPY, txt("m_copy_text") ,
1258 myapp()->frame->bitmaps[5] ,
1259 myapp()->frame->bitmaps[24] ,
1260 wxITEM_NORMAL , txt("m_copy_text") ) ;
1261}
1262
1263/** \brief Adds default tools to a given toolbar
1264 */
1265void MyFrame::addDefaultTools(wxToolBar* toolBar)
1266{
1267 if ( mainToolBar && toolBar != mainToolBar ) return ;
1268 toolBar->AddSeparator() ;
1269 toolBar->AddTool( MDI_ALIGNMENT, myapp()->frame->bitmaps[17] , txt("m_alignment_text") ) ;
1270 toolBar->AddTool( MDI_IMAGE_VIEWER, myapp()->frame->bitmaps[18] , txt("m_imageviewer_text") ) ;
1271 toolBar->AddTool( MDI_CALCULATOR, myapp()->frame->bitmaps[20] , txt("m_calculator_text") ) ;
1272 toolBar->AddTool( PROGRAM_OPTIONS, myapp()->frame->bitmaps[21] , txt("m_options_text") ) ;
1273 toolBar->AddTool( MDI_EXTERNAL_INTERFACE, myapp()->frame->bitmaps[19] , txt("m_external_text") ) ;
1274}
1275
1276/** \brief Adds cut,copy,paste (and find) tools to a given toolbar
1277 */
1278void MyFrame::addCCPFTools(wxToolBar* toolBar, bool findbutton )
1279{
1280 if ( mainToolBar && toolBar != mainToolBar ) return ;
1281 toolBar->AddSeparator() ;
1282 toolBar->AddTool( MDI_CUT, txt("m_cut_text") ,
1283 myapp()->frame->bitmaps[4] , myapp()->frame->bitmaps[23] ,
1284 wxITEM_NORMAL , txt("m_cut_text") ) ;
1285 toolBar->AddTool( MDI_COPY, txt("m_copy_text") ,
1286 myapp()->frame->bitmaps[5] , myapp()->frame->bitmaps[24] ,
1287 wxITEM_NORMAL , txt("m_copy_text") ) ;
1288 toolBar->AddTool( MDI_PASTE, txt("m_paste_text") ,
1289 myapp()->frame->bitmaps[6] , myapp()->frame->bitmaps[25] ,
1290 wxITEM_NORMAL , txt("m_paste_text") ) ;
1291 if ( findbutton )
1292 toolBar->AddTool( MDI_FIND, txt("m_find_text") ,
1293 myapp()->frame->bitmaps[22] , myapp()->frame->bitmaps[26] ,
1294 wxITEM_NORMAL , txt("m_find_text") ) ;
1295 if ( !mainToolBar ) toolBar->AddSeparator () ;
1296}
1297
1298#define UGLY_MENU_UPDATE(x,y) if(GetMenuBar()&&GetMenuBar()->FindItem(x))GetMenuBar()->FindItem(x)->Enable(y);
1299
1300/** \brief Updates cut, copy, paste, find icons
1301 */
1302void MyFrame::updateCCP ( ChildBase *c )
1303{
1304 if ( !mainToolBar && !c ) return ;
1305 wxToolBar *tb = mainToolBar ? mainToolBar : c->toolbar ;
1306 tb->EnableTool ( MDI_FILE_SAVE , c ? c->allow_save : false ) ;
1307 tb->EnableTool ( MDI_UNDO , c ? c->allow_undo : false ) ;
1308 tb->EnableTool ( SEQ_PRINT , c ? c->allow_print : false ) ;
1309 tb->EnableTool ( MDI_CUT , c ? c->allow_cut : false ) ;
1310 tb->EnableTool ( MDI_COPY , c ? c->allow_copy : false ) ;
1311 tb->EnableTool ( MDI_PASTE , c ? c->allow_paste : false ) ;
1312 tb->EnableTool ( MDI_FIND , c ? c->allow_find : false ) ;
1313
1314 UGLY_MENU_UPDATE ( MDI_FILE_SAVE , c ? c->allow_save : false ) ;
1315 UGLY_MENU_UPDATE ( SEQ_PRINT , c ? c->allow_print : false ) ;
1316 UGLY_MENU_UPDATE ( MDI_CUT , c ? c->allow_cut : false ) ;
1317 UGLY_MENU_UPDATE ( MDI_COPY , c ? c->allow_copy : false ) ;
1318 UGLY_MENU_UPDATE ( MDI_PASTE , c ? c->allow_paste : false ) ;
1319 UGLY_MENU_UPDATE ( MDI_MARK_ALL , c ? !c->allow_paste : false ) ;
1320 UGLY_MENU_UPDATE ( MDI_COPY_TO_NEW , c ? !c->allow_paste : false ) ;
1321 UGLY_MENU_UPDATE ( MDI_AS_NEW_FEATURE , c ? !c->allow_paste : false ) ;
1322 UGLY_MENU_UPDATE ( MDI_FIND , c ? c->allow_find : false ) ;
1323}
1324
1325/** \brief Generates a basic tooblar
1326 */
1327void MyFrame::setDummyToolbar ( ChildBase *c )
1328{
1329 wxToolBar *toolBar = c->CreateToolBar(wxNO_BORDER | wxTB_FLAT | wxTB_HORIZONTAL |wxTB_DOCKABLE);
1330 toolBar->Reparent ( c ) ;
1331 c->toolbar = toolBar ;
1332 myapp()->frame->InitToolBar(toolBar);
1333 addTool ( toolBar , MDI_TEXT_IMPORT ) ;
1334 addTool ( toolBar , MDI_FILE_OPEN ) ;
1335 c->toolbar = toolBar ;
1336}
1337
1338/** \brief Creates a new alignment window
1339 */
1340TAlignment *MyFrame::runAlignment ( wxArrayString &vs , wxArrayChildBase &vc , TVector *nv )
1341{
1342 // Thaw () ;
1343 TAlignment *subframe = new TAlignment ( getCommonParent() , _T("Alignment") ) ;
1344 setChild ( subframe ) ;
1345
1346 // Give it an icon
1347#ifdef __WXMSW__
1348 subframe->SetIcon(wxIcon(_T("chrt_icn")));
1349#elif __WXMAC__
1350#else
1351 subframe->SetIcon(wxIcon( mondrian_xpm ));
1352#endif
1353
1354 subframe->initme () ;
1355 if ( locked == 0 ) subframe->Activate () ;
1356
1357 if ( nv )
1358 {
1359 subframe->fromVector ( nv ) ;
1360 }
1361 else if ( vs.GetCount() == 0 )
1362 {
1363 wxCommandEvent ev ;
1364 subframe->OnSettings ( ev ) ;
1365 }
1366 else
1367 {
1368 subframe->prealigned ( vs , vc ) ;
1369 }
1370
1371 if ( locked == 0 ) subframe->Show() ;
1372
1373 mainTree->addChild ( subframe , TYPE_ALIGNMENT ) ;
1374 mainTree->Refresh () ;
1375 activateChild ( children.GetCount()-1 ) ;
1376 return subframe ;
1377}
1378
1379/** \brief Handles the Alignment menu event, calls MyFrame::runAlignment
1380 */
1381void MyFrame::OnAlignment(wxCommandEvent& event)
1382{
1383 wxArrayString vs ; // Dummy
1384 wxArrayChildBase vc ; // Dummy
1385 runAlignment ( vs , vc ) ;
1386}
1387
1388/** \brief Handles the Manage Database menu event
1389 */
1390void MyFrame::OnManageDatabase(wxCommandEvent& event)
1391{
1392 TManageDatabaseDialog mdd ( this , txt("m_manage_dbtxt") ) ;
1393 mdd.ShowModal () ;
1394}
1395
1396/** \brief Handles the Program Options menu event, and stores the options in the local database
1397 */
1398void MyFrame::OnProgramOptions(wxCommandEvent& event)
1399{
1400 ProgramOptionsDialog pod ( this , txt("t_program_options" ) ) ;
1401 global_enzyme_rules->setup_options ( pod.globalEnzymesPanel ) ;
1402 int r = pod.ShowModal() ;
1403 if ( r != wxID_OK ) return ;
1404
1405 wxBeginBusyCursor() ;
1406
1407 bool useTwoToolbarsBefore = useTwoToolbars ;
1408
1409 // retrieving options
1410 // TEnzymeRules oo == *global_enzyme_rules ;
1411 global_enzyme_rules->lookup_options ( pod.globalEnzymesPanel ) ;
1412 enhancedRefresh = pod.enhancedDisplay->GetValue() ;
1413 showVectorTitle = pod.vectorTitle->GetValue() ;
1414 showVectorLength = pod.vectorLength->GetValue() ;
1415 loadLastProject = pod.loadLastProject->GetValue() ;
1416 useMetafile = pod.useMetafile->GetValue() ;
1417 showSplashScreen = pod.showSplashScreen->GetValue() ;
1418 checkUpdate = pod.checkUpdate->GetValue() ;
1419 useInternalHelp = pod.useInternalHelp->GetValue() ;
1420 useOnlineHelp = pod.useOnlineHelp->GetValue() ;
1421 doRegisterStuff = pod.doRegisterStuff->GetValue() ;
1422 editFeatureMode = pod.editFeatureMode->GetSelection() ;
1423 showStopCodon = pod.showStopCodon->GetSelection() ;
1424 showEnzymePos = pod.showEnzymePos->GetValue() ;
1425 useTwoToolbars = pod.useTwoToolbars->GetValue() ;
1426 showToolTips = pod.showToolTips->GetValue() ;
1427 showLowercaseDNA = pod.showLowercaseDNA->GetValue() ;
1428
1429 long l ;
1430 pod.orfLength->GetValue().ToLong ( &l ) ;
1431 if ( l < 10 ) l = 10 ;
1432 orfLength = l ;
1433
1434 proxy = pod.proxyName->GetValue() + _T(":") + pod.proxyPort->GetValue() ;
1435 if ( proxy == _T(":") ) proxy = _T("") ;
1436 wxURL::SetDefaultProxy ( proxy ) ;
1437
1438 wxToolTip::Enable ( showToolTips ) ;
1439 if ( pod.use_nonstandard_translation_table->GetValue() )
1440 nonstandard_translation_table = pod.translation_tables[pod.nonstandard_translation_table->GetSelection()] ;
1441 else nonstandard_translation_table = -1 ;
1442 aa_color = pod.aacol ;
1443 stopcodon = showStopCodon == 0 ? '|' : '*' ;
1444 wxString lang = pod.language->GetStringSelection() ;
1445 if ( lang != lang_string || useTwoToolbars != useTwoToolbarsBefore )
1446 {
1447 wxMessageDialog md ( this , txt("t_effect_after_restart" ) ) ;
1448 md.ShowModal () ;
1449 }
1450
1451 // Storing options
1452 LS->startRecord() ;
1453 LS->setOption ( _T("USEMETAFILE") , useMetafile ) ;
1454 LS->setOption ( _T("ENHANCEDREFRESH") , enhancedRefresh ) ;
1455 LS->setOption ( _T("LANGUAGE") , lang ) ;
1456 LS->setOption ( _T("SHOWVECTORTITLE") , showVectorTitle ) ;
1457 LS->setOption ( _T("SHOWVECTORLENGTH") , showVectorLength ) ;
1458 LS->setOption ( _T("LOADLASTPROJECT") , loadLastProject ) ;
1459 LS->setOption ( _T("SHOWSPLASHSCREEN") , showSplashScreen ) ;
1460 LS->setOption ( _T("CHECKUPDATE") , checkUpdate ) ;
1461 LS->setOption ( _T("USEINTERNALHELP") , useInternalHelp ) ;
1462 LS->setOption ( _T("USEONLINEHELP") , useOnlineHelp ) ;
1463 LS->setOption ( _T("REGISTERSTUFF") , doRegisterStuff ) ;
1464 LS->setOption ( _T("EDITFEATUREMODE") , editFeatureMode ) ;
1465 LS->setOption ( _T("SHOWSTOPCODON") , showStopCodon ) ;
1466 LS->setOption ( _T("SHOWENZYMEPOS") , showEnzymePos ) ;
1467 LS->setOption ( _T("AA_RED") , aa_color.Red() ) ;
1468 LS->setOption ( _T("AA_GREEN") , aa_color.Green() ) ;
1469 LS->setOption ( _T("AA_BLUE") , aa_color.Blue() ) ;
1470 LS->setOption ( _T("nonstandard_translation_table") , nonstandard_translation_table ) ;
1471 LS->setOption ( _T("use_two_toolbars") , useTwoToolbars ) ;
1472 LS->setOption ( _T("SHOWTIP") , pod.showTips->GetValue() ) ;
1473 LS->setOption ( _T("SHOWTOOLTIPS") , pod.showToolTips->GetValue() ) ;
1474 LS->setOption ( _T("SHOWLOWERCASEDNA") , showLowercaseDNA ) ;
1475 LS->setOption ( _T("ORFLENGTH") , orfLength ) ;
1476 LS->setOption ( _T("PROXY") , proxy ) ;
1477 global_enzyme_rules->save_global_settings() ; //!!!!!!! fix this!
1478 LS->endRecord() ;
1479 for ( int a = 0 ; a < children.GetCount() ; a++ )
1480 {
1481 if ( !children[a]->vec ) continue ;
1482 children[a]->vec->recalculateCuts() ;
1483 // children[a]->vec->updateDisplay() ;
1484 children[a]->EnforceRefesh () ;
1485 }
1486 // if ( GetActiveChild() ) GetActiveChild()->EnforceRefesh () ;
1487 wxEndBusyCursor() ;
1488}
1489
1490/** \brief Handles the Load Project menu event
1491 */
1492void MyFrame::OnProjectLoad(wxCommandEvent& event)
1493{
1494 // Are all objects stored in a database?
1495 int a ;
1496 wxString notindb ;
1497 for ( a = 0 ; a < children.GetCount() ; a++ )
1498 {
1499 if ( children[a]->def == _T("dna") )
1500 {
1501 MyChild *c = (MyChild*) children[a] ;
1502 if ( c->vec->getDatabase().IsEmpty() )
1503 notindb += _T("\n") + c->getName() ;
1504 }
1505 }
1506 if ( !notindb.IsEmpty() )
1507 {
1508 notindb = txt("t_following_not_in_db_open") +
1509 notindb + txt("t_following_end_open") ;
1510 wxMessageDialog md ( this , notindb ,
1511 txt("msg_box") , wxICON_EXCLAMATION|wxYES|wxNO ) ;
1512 if ( md.ShowModal() != wxID_YES ) return ;
1513 }
1514
1515 // All are stored, or loading anyway
1516 TManageDatabaseDialog mdd ( this , txt("m_project_opentxt") ,
1517 ACTION_MODE_LOAD|ACTION_MODE_PROJECT ) ;
1518 mdd.ShowModal () ;
1519}
1520
1521/** \brief Handles the Save Project menu event
1522 */
1523void MyFrame::OnProjectSave(wxCommandEvent& event)
1524{
1525 // Are all objects stored in a database?
1526 int a ;
1527 wxString notindb ;
1528 for ( a = 0 ; a < children.GetCount() ; a++ )
1529 {
1530 if ( children[a]->def == _T("dna") )
1531 {
1532 MyChild *c = (MyChild*) children[a] ;
1533 if ( c->vec->getDatabase().IsEmpty() )
1534 notindb += _T("\n") + c->getName() ;
1535 }
1536 }
1537 if ( !notindb.IsEmpty() )
1538 {
1539 notindb = txt("t_following_not_in_db") + notindb + txt("t_following_end") ;
1540 wxMessageDialog md ( this , notindb ,
1541 txt("msg_box") , wxICON_EXCLAMATION|wxYES|wxNO ) ;
1542 if ( md.ShowModal() != wxID_YES ) return ;
1543 }
1544
1545 // All are stored, or saving anyway
1546 TManageDatabaseDialog mdd ( this , txt("m_project_savetxt") ,
1547 ACTION_MODE_SAVE|ACTION_MODE_PROJECT ) ;
1548 mdd.ShowModal () ;
1549}
1550
1551/** \brief Handles the Close Project menu event
1552 */
1553void MyFrame::OnProjectClose(wxCommandEvent& event)
1554{
1555 int a ;
1556 if ( tb_mychild )
1557 {
1558 tb_mychild->Close ( TRUE ) ;
1559 delete tb_mychild ;
1560 tb_mychild = NULL ;
1561 }
1562 lastChild = NULL ;
1563 for ( a = 0 ; a < children.GetCount() ; a++ )
1564 {
1565 // children[a]->Close() ;
1566 delete children[a] ;
1567 }
1568 children.Clear() ;
1569 project.name = txt("project") ;
1570 project.desc = _T("") ;
1571 project.db = _T("") ;
1572 mainTree->initme() ;
1573 Refresh () ;
1574}
1575
1576/** \brief Stores the last open project for reopening on program start
1577 */
1578void MyFrame::rememberLastProject ()
1579{
1580 wxString sql ;
1581
1582 sql = _T("DELETE FROM stuff WHERE s_type='LASTPROJECT'") ;
1583 LS->getObject ( sql ) ;
1584 LS->getObject ( wxString::Format ( _T("INSERT INTO stuff (s_type,s_name,s_value) VALUES ('LASTPROJECT','NAME','%s')") , project.name.c_str() ) ) ;
1585 LS->getObject ( wxString::Format ( _T("INSERT INTO stuff (s_type,s_name,s_value) VALUES ('LASTPROJECT','DATABASE','%s')") , project.db.c_str() ) ) ;
1586}
1587
1588/** \brief Creates a new amino acid entry from a string
1589 */
1590TAminoAcids *MyFrame::newAminoAcids ( wxString aa , wxString title )
1591{
1592 TVector nv ;
1593 nv.setSequence ( aa ) ;
1594 return newAminoAcids ( &nv , title ) ;
1595}
1596
1597/** \brief Creates a new amino acid entry from a TVector structure
1598
1599 This function basically does the same as MyFrame::newFromVector,
1600 but for amino acid sequences instead of DNA
1601 */
1602TAminoAcids *MyFrame::newAminoAcids ( TVector *nv , wxString title )
1603{
1604 int a ;
1605 if ( title.IsEmpty() ) title = _T("Surprise!") ;
1606
1607 mylog ( "MyFrame::newAminoAcids" , "1" ) ;
1608 TAminoAcids *subframe = new TAminoAcids ( (wxWindow*) getCommonParent() , title ) ;
1609 setChild ( subframe ) ;
1610
1611 mylog ( "MyFrame::newAminoAcids" , "2" ) ;
1612 subframe->vec->setFromVector ( *nv ) ;
1613
1614 mylog ( "MyFrame::newAminoAcids" , "3" ) ;
1615 wxString seq = subframe->vec->getSequence() ;
1616 seq.Replace ( _T("|") , _T("") , true ) ;
1617 subframe->vec->setSequence ( seq ) ;
1618
1619 mylog ( "MyFrame::newAminoAcids" , "4" ) ;
1620 subframe->vec->setWindow ( subframe ) ;
1621 subframe->vec->setType ( TYPE_AMINO_ACIDS ) ;
1622 subframe->vec->setName ( title ) ;
1623 subframe->vec->undo.clear() ;
1624
1625 mylog ( "MyFrame::newAminoAcids" , "5" ) ;
1626 for ( a = 0 ; a < nv->items.size() ; a++ )
1627 {
1628 nv->items[a].setType ( VIT_MISC ) ;
1629 nv->items[a].setDirection ( 1 ) ;
1630 }
1631
1632 // Give it an icon
1633#ifdef __WXMSW__
1634 subframe->SetIcon(wxIcon(_T("chrt_icn")));
1635#elif __WXMAC__
1636#else
1637 subframe->SetIcon(wxIcon( mondrian_xpm ));
1638#endif
1639
1640 mylog ( "MyFrame::newAminoAcids" , "6" ) ;
1641 mainTree->addChild ( subframe , TYPE_AMINO_ACIDS ) ;
1642 mylog ( "MyFrame::newAminoAcids" , "6a" ) ;
1643 subframe->initme () ;
1644 mylog ( "MyFrame::newAminoAcids" , "7" ) ;
1645 if ( locked != 0 ) return subframe ;
1646 subframe->Show() ;
1647 subframe->Maximize() ;
1648 subframe->showName() ;
1649 subframe->Activate () ;
1650 children.Last()->Activate () ;
1651 mylog ( "MyFrame::newAminoAcids" , "8" ) ;
1652 return subframe ;
1653}
1654
1655/** \brief Creates a new sequencing entry from an ABI file
1656 */
1657TABIviewer *MyFrame::newABI ( wxString filename , wxString title )
1658{
1659 if ( title.IsEmpty() ) title = _T("Surprise!") ;
1660 TABIviewer *subframe = new TABIviewer ( getCommonParent() , title ) ;
1661 subframe->filename = filename ;
1662 subframe->vec->setType ( TYPE_SEQUENCE ) ;
1663 subframe->vec->addDescription ( _T("\n") + wxGetUserName() ) ;
1664
1665 // Give it an icon
1666#ifdef __WXMSW__
1667 subframe->SetIcon(wxIcon(_T("chrt_icn")));
1668#elif __WXMAC__
1669#else
1670 subframe->SetIcon(wxIcon( mondrian_xpm ));
1671#endif
1672
1673 subframe->initme () ;
1674
1675 subframe->Show() ;
1676 subframe->Maximize() ;
1677 subframe->showName() ;
1678
1679 setChild ( subframe ) ;
1680 mainTree->addChild ( subframe , TYPE_SEQUENCE ) ;
1681
1682 if ( LS->getOption ( _T("SHOWABIHORIZONTAL") , false ) )
1683 {
1684 subframe->sc->SilentRefresh () ;
1685 wxCheckBox *horiz = (wxCheckBox*) subframe->FindWindowById ( ALIGN_HORIZ ) ;
1686 myass ( horiz , _T("NULL") ) ;
1687 if ( horiz ) horiz->SetValue ( true ) ;
1688 wxCommandEvent event ;
1689 subframe->OnHorizontal(event) ;
1690 }
1691
1692 if ( myapp()->clp[_T("view-sequencing-reverse-complement")] == _T("1") )
1693 {
1694 subframe->toggle_inv_compl () ;
1695 myapp()->clp.erase(_T("view-sequencing-reverse-complement")) ;
1696 }
1697
1698 subframe->Activate () ;
1699 children.Last()->Activate () ;
1700
1701 return subframe ;
1702}
1703
1704/** \brief Runs a blast search by invoking MyFrame::OnExternalInterface
1705 */
1706void MyFrame::blast ( wxString seq , wxString prg )
1707{
1708 int a ;
1709 for ( a = 0 ; a < children.GetCount() && children[a]->getName() != _T("External Interface") ; a++ ) ;
1710 if ( a == children.GetCount() ) // Create new external interface
1711 {
1712 wxCommandEvent event ;
1713 OnExternalInterface ( event ) ;
1714 }
1715 activateChild ( a ) ;
1716 ExternalInterface *ei = (ExternalInterface*) children[a] ;
1717 ei->runBlast ( seq , prg ) ;
1718 return ;
1719
1720 /*
1721 // Obsolete
1722 #ifdef __WXMSW__
1723 wxString unique = wxNow() ;
1724 unique.Replace ( ":" , "_" ) ;
1725 unique.Replace ( "/" , "_" ) ;
1726 unique.Replace ( " " , "_" ) ;
1727
1728 wxString hd = myapp()->homedir ;
1729 wxString exe = hd + "\\blastcl3.exe" ; // WINDOWS-SPECIFIC!
1730 wxString ifile = hd + "\\blasts\\temp_" + unique + ".tmp" ;
1731 wxString ofile = hd + "\\blasts\\blast_results_" + unique + ".html" ;
1732 wxString bfile = hd + "\\blasts\\batch_" + unique + ".bat" ;
1733
1734 wxString blast_dir = hd + "\\blasts" ;
1735 if ( !wxDir::Exists ( blast_dir ) )
1736 wxMkdir ( blast_dir ) ;
1737
1738 // Writing temporary blast file
1739 wxFile out ( ifile , wxFile::write ) ;
1740 out.Write ( seq ) ;
1741 out.Close () ;
1742
1743 wxFile batch ( bfile , wxFile::write ) ;
1744 batch.Write ( "@echo off\n" ) ;
1745
1746 // Creating blast command line
1747 exe += " -p \"" + prg + "\"" ;
1748 exe += " -i \"" + ifile + "\"" ;
1749 exe += " -o \"" + ofile + "\"" ;
1750 exe += " -Tt" ; // Create HTML
1751 batch.Write ( exe + "\n" ) ;
1752
1753 // Starting browser
1754 exe = "start " ;
1755 exe += myapp()->getHTMLCommand ( ofile ) ;
1756 batch.Write ( exe + "\n" ) ;
1757
1758 // Delete temporary files
1759 batch.Write ( "del \"" + ifile + "\"\n" ) ;
1760 batch.Write ( "del \"" + bfile + "\"\n" ) ;
1761
1762 // Run it
1763 batch.Close() ;
1764 wxExecute ( bfile ) ;
1765 #endif
1766 */
1767}
1768
1769/** \brief Creates a new external interface for NCBI/BLAST searching
1770 */
1771void MyFrame::OnExternalInterface(wxCommandEvent& event)
1772{
1773 ExternalInterface *subframe = new ExternalInterface ( getCommonParent() , txt("t_external_interface") ) ;
1774
1775 // Give it an icon
1776#ifdef __WXMSW__
1777 subframe->SetIcon(wxIcon(_T("chrt_icn")));
1778#elif __WXMAC__
1779#else
1780 subframe->SetIcon(wxIcon( mondrian_xpm ));
1781#endif
1782
1783 subframe->initme () ;
1784
1785 subframe->Show() ;
1786 subframe->Maximize() ;
1787 subframe->showName() ;
1788
1789 mainTree->addChild ( subframe , TYPE_MISC ) ;
1790 setChild ( subframe ) ;
1791 activateChild ( children.GetCount()-1 ) ;
1792}
1793
1794/** \brief Invokes the image viewer module
1795 */
1796void MyFrame::OnImageViewer(wxCommandEvent& event)
1797{
1798 TImageDisplay *subframe = new TImageDisplay ( getCommonParent() , txt("t_image_viewer") ) ;
1799
1800 // Give it an icon
1801#ifdef __WXMSW__
1802 subframe->SetIcon(wxIcon(_T("chrt_icn")));
1803#elif __WXMAC__
1804#else
1805 subframe->SetIcon(wxIcon( mondrian_xpm ));
1806#endif
1807
1808 subframe->initme () ;
1809
1810 subframe->Show() ;
1811 subframe->Maximize() ;
1812 subframe->showName() ;
1813
1814 mainTree->addChild ( subframe , TYPE_MISC ) ;
1815 setChild ( subframe ) ;
1816 activateChild ( children.GetCount()-1 ) ;
1817}
1818
1819/** \brief Handles the Calculator menu event by calling MyFrame::RunCalculator
1820 */
1821void MyFrame::OnCalculator(wxCommandEvent& event)
1822{
1823 RunCalculator () ;
1824}
1825
1826/** \brief Handles the Dot plot menu event
1827 */
1828void MyFrame::OnDotPlot(wxCommandEvent& event)
1829{
1830 TDotPlot *subframe = new TDotPlot ( getCommonParent() , txt("t_dotplot") ) ;
1831
1832 // Give it an icon
1833#ifdef __WXMSW__
1834 subframe->SetIcon(wxIcon(_T("chrt_icn")));
1835#elif __WXMAC__
1836#else
1837 subframe->SetIcon(wxIcon( mondrian_xpm ));
1838#endif
1839
1840 subframe->initme () ;
1841
1842 subframe->Show() ;
1843 subframe->Maximize() ;
1844 subframe->showName() ;
1845
1846 mainTree->addChild ( subframe , TYPE_MISC ) ;
1847 setChild ( subframe ) ;
1848 activateChild ( children.GetCount()-1 ) ;
1849
1850 // return subframe ;
1851}
1852
1853
1854
1855/** \brief Handles the Graph menu event by calling MyFrame::RunGraph
1856 */
1857void MyFrame::OnGraph(wxCommandEvent& event)
1858{
1859 wxString seq = _T("MSPILGYWKIKGLVQPTRLLLEYLEEKYEEHLYERDEGDKWRNKKFELGLEFPNLPYYIDGDVKLTQSMAIIRYIADKHNMLGGCPKERAEISMLEGAVLDIRYGVSRIAYSKDFETLKVDFLSKLPEMLKMFEDRLCHKTYLNGDHVTHPDFMLYDALDVVLYMDPMCLDAFPKLVCFKKRIEAIPQIDKYLKSSKYIAWPLQGWQATFGGGDHPPKSDLIEGRGIPGNSS") ; // GST
1860 // char *s2 = new char[seq.length()+5] ;
1861 // strcpy ( s2 , seq.mb_str() ) ;
1862
1863 wxString ret ;
1864 wxArrayFloat af[3] ;
1865 for ( int a = 0 ; a < 3 ; a++ )
1866 {
1867 int b = a==0?14:(a==1?21:28) ;
1868 string s = ncoils_function ( seq.mb_str() , b ) ;
1869 wxString t ( s.c_str() , wxConvUTF8 ) ;
1870 wxArrayString ta ;
1871 explode ( _T("\n") , t , ta ) ;
1872 for ( b = 0 ; b < seq.length() ; b++ )
1873 {
1874 if ( b >= ta.GetCount() ) break ;
1875 t = ta[b].Mid ( 18 ) ;
1876 double prob ;
1877 t.ToDouble ( &prob ) ;
1878 af[a].Add ( (float) prob ) ;
1879 ret += wxString::Format ( _T("%1.4f, ") , (float) prob ) ;
1880 }
1881 ret += _T("\n") ;
1882 }
1883 wxMessageBox ( ret ) ;
1884
1885 /* TGraph *g = RunGraph() ;
1886 g->gd->SetupDummy() ;
1887 g->gd->AutoScale () ;
1888 g->gd->UpdateDisplay () ;*/
1889}
1890
1891/** \brief Invokes the calculator module
1892 */
1893TCalculator *MyFrame::RunCalculator ()
1894{
1895 TCalculator *subframe = new TCalculator ( getCommonParent() , txt("t_calculator") ) ;
1896
1897 // Give it an icon
1898#ifdef __WXMSW__
1899 subframe->SetIcon(wxIcon(_T("chrt_icn")));
1900#elif __WXMAC__
1901#else
1902 subframe->SetIcon(wxIcon( mondrian_xpm ));
1903#endif
1904
1905 subframe->initme () ;
1906
1907 subframe->Show() ;
1908 subframe->Maximize() ;
1909 subframe->showName() ;
1910
1911 mainTree->addChild ( subframe , TYPE_MISC ) ;
1912 setChild ( subframe ) ;
1913 activateChild ( children.GetCount()-1 ) ;
1914 return subframe ;
1915}
1916
1917/** \brief Invokes the graph module
1918 */
1919TGraph *MyFrame::RunGraph ()
1920{
1921 TGraph *subframe = new TGraph ( getCommonParent() , txt("t_graph") ) ;
1922
1923 // Give it an icon
1924#ifdef __WXMSW__
1925 subframe->SetIcon(wxIcon(_T("chrt_icn")));
1926#elif __WXMAC__
1927#else
1928 subframe->SetIcon(wxIcon( mondrian_xpm ));
1929#endif
1930
1931 subframe->initme () ;
1932
1933 subframe->Show() ;
1934 subframe->Maximize() ;
1935 subframe->showName() ;
1936
1937 mainTree->addChild ( subframe , TYPE_MISC ) ;
1938 setChild ( subframe ) ;
1939 activateChild ( children.GetCount()-1 ) ;
1940 return subframe ;
1941}
1942
1943/** \brief Returns the standard File menu, with variations
1944 \param _save Include "Save" menu option
1945 \param _exp Include "Export" menu option
1946 \param _print Include "Print" menu option
1947 */
1948wxMenu *MyFrame::getFileMenu ( int options )
1949{
1950 wxMenu *file_menu = new wxMenu;
1951 file_menu->Append(MDI_FILE_OPEN, txt("m_open") , txt("m_opentxt") );
1952 if ( 0 < ( options & FILE_MENU_SAVE ) ) file_menu->Append(MDI_FILE_SAVE, txt("m_store_in_db") , txt("m_txt_store_in_db") ) ;
1953 file_menu->Append(MDI_FILE_SAVE_ALL, txt("m_store_in_db_all") ) ;
1954 file_menu->Append(MDI_FILE_IMPORT, txt("m_import") , txt("m_importtxt") );
1955 file_menu->Append(MDI_TEXT_IMPORT, txt("m_text_import") , txt("m_text_importtxt") );
1956 if ( 0 < ( options & FILE_MENU_EXPORT ) ) file_menu->Append(MDI_EXPORT, txt("m_export") , txt("m_export_txt") );
1957 file_menu->AppendSeparator();
1958 file_menu->Append(MDI_PROJECT_LOAD, txt("m_project_open") , txt("m_project_opentxt") );
1959 file_menu->Append(MDI_PROJECT_SAVE, txt("m_project_save") , txt("m_project_savetxt") );
1960 file_menu->Append(MDI_PROJECT_CLOSE, txt("m_project_close") , txt("m_project_closetxt") );
1961 file_menu->AppendSeparator();
1962 if ( 0 < ( options & FILE_MENU_PRINT ) ) file_menu->Append(MDI_PRINT_IMAGE, txt("m_print_image") , txt("m_print_image_txt") );
1963 if ( 0 < ( options & FILE_MENU_PRINT_RESTRICTIONS ) ) file_menu->Append(MDI_PRINT_RESTRICTION_LIST, txt("m_print_restrictions") , txt("m_print_restrictions_txt") );
1964 file_menu->Append(SEQ_PRINT, txt("m_print_sequence") ) ;
1965 file_menu->Append(MDI_PRINT_REPORT, txt("m_print_report") , txt("m_print_report_txt") );
1966 file_menu->AppendSeparator();
1967 file_menu->Append(MDI_QUIT, txt("m_exit") , txt("m_exittxt") ) ;
1968 return file_menu ;
1969}
1970
1971/** \brief Returns the standard Tools menu, with variations
1972 \param _pcr Include PCR menu option
1973 */
1974wxMenu *MyFrame::getToolMenu ( bool _pcr )
1975{
1976 wxMenu *tool_menu = new wxMenu;
1977 tool_menu->Append(MDI_ENZYME_EDITOR, txt("m_enzyme") ) ;
1978 tool_menu->Append(MDI_ALIGNMENT, txt("m_alignment") , txt("m_alignmenttxt") ) ;
1979 tool_menu->Append(MDI_RESTRICTION, txt("m_enzymeeditor") , txt("m_enzymeeditortxt") ) ;
1980 tool_menu->Append(MDI_LIGATION, txt("m_ligation") );
1981 if ( _pcr ) tool_menu->Append(MDI_RUN_PCR, txt("m_pcr") );
1982 tool_menu->Append(MDI_MANAGE_DATABASE, txt("m_manage_db") , txt("m_manage_dbtxt") ) ;
1983 tool_menu->Append(MDI_IMAGE_VIEWER, txt("m_image_viewer") , txt("m_image_viewer_txt") ) ;
1984 tool_menu->Append(MDI_EXTERNAL_INTERFACE, txt("m_external_interface") ) ;
1985 tool_menu->Append(MDI_CALCULATOR, txt("m_calculator") , txt("m_calculator_txt") ) ;
1986 tool_menu->Append(MDI_SEQUENCING_ASSISTANT, txt("m_sequencing_assistant") ) ;
1987 tool_menu->Append(MDI_DOTPLOT, txt("m_dotplot") ) ;
1988 tool_menu->Append(MDI_RESTRICTION_IDENTIFIER, txt("m_restriction_identifier") ) ;
1989 // tool_menu->Append(MDI_GRAPH, txt("m_graph") , txt("m_graph_txt") ) ; // TESTING, Deactivated in release
1990 // tool_menu->Append(MDI_CLONING_ASSISTANT, txt("m_cloning_assistant") ) ; // Deactivated in release
1991 tool_menu->Append(PROGRAM_OPTIONS, txt("m_options") , txt("m_options_txt") ) ;
1992 return tool_menu ;
1993}
1994
1995/** \brief Returns the standard Help menu
1996 */
1997wxMenu *MyFrame::getHelpMenu ()
1998{
1999 wxMenu *help_menu = new wxMenu;
2000 help_menu->Append(MDI_HELP, txt("m_help_content") ) ;
2001 help_menu->Append(MDI_ABOUT, txt("m_about") );
2002 help_menu->Append(MDI_HOMEPAGE, txt("m_homepage") );
2003 return help_menu ;
2004}
2005
2006/** \brief Adds a child, if it is not already in the children list
2007 \param ch Pointer to child
2008 */
2009void MyFrame::setChild ( ChildBase *ch )
2010{
2011 int a ;
2012 for ( a = 0 ; a < children.GetCount() && children[a] != ch ; a++ ) ;
2013 if ( a == children.GetCount() )
2014 {
2015 children.Add ( ch ) ;
2016 update_child_list = true ;
2017 }
2018}
2019
2020/** \brief Safely removes a child from the children list
2021 \param ch Pointer to child
2022 */
2023void MyFrame::removeChild ( ChildBase *ch )
2024{
2025 unsigned int a ;
2026 for ( a = 0 ; a < children.GetCount() && children[a] != ch ; a++ ) ;
2027 if ( a == children.GetCount() ) return ;
2028 children[a]->Disable () ;
2029 children[a]->Hide() ;
2030 // children[a] = children[children.GetCount()-1] ;
2031 // children.pop_back () ;
2032 children.RemoveAt ( a ) ;
2033 lastChild = NULL ;
2034 activateChild ( 0 ) ;
2035
2036 if ( children.size() == 0 )
2037 {
2038 while ( count_help () > 1 ) pop_help() ;
2039 ChildBase c ;
2040 updateCCP ( &c ) ;
2041 }
2042 notifyChildrenChanged() ;
2043}
2044
2045/** \brief Activates a child (brings to front, makes visible, etc.)
2046 \param a Number of child in children list
2047 */
2048void MyFrame::activateChild ( int a )
2049{
2050 if ( a >= children.GetCount() ) a = 0 ;
2051 if ( children.GetCount() )
2052 {
2053 children[a]->Activate () ;
2054 mainTree->EnsureVisible ( children[a]->inMainTree ) ;
2055 mainTree->SelectItem ( children[a]->inMainTree ) ;
2056 }
2057 else setActiveChild ( NULL ) ;
2058 wxSafeYield () ;
2059}
2060
2061/** \brief Locks/unlocks display, counts (un)lock requests
2062 \param lock Lock if true, unlock if not
2063 */
2064void MyFrame::lockDisplay ( bool lock )
2065{
2066 if ( lock )
2067 {
2068 if ( locked == 0 ) { mainTree->Freeze() ; Freeze() ; }
2069 locked++ ;
2070 }
2071 else
2072 {
2073 locked-- ;
2074 if ( locked == 0 )
2075 {
2076 mainTree->Thaw() ;
2077 Thaw() ;
2078 if ( !children.IsEmpty() )
2079 {
2080 if ( GetActiveChild() ) GetActiveChild()->Activate() ;
2081 else children.Last()->Activate () ;
2082 }
2083 }
2084 }
2085}
2086
2087/** \brief Is display locked?
2088 */
2089bool MyFrame::isLocked ()
2090{
2091 return ( locked != 0 ) ;
2092}
2093
2094/** \brief Is a child activation sequence running?
2095 */
2096bool MyFrame::isActivating ()
2097{
2098 return activating ;
2099}
2100
2101/** \brief Is a new version available online?
2102
2103 This function is currently a mess, due to bugs in wxWidgets,
2104 but it basically works...
2105 */
2106wxString MyFrame::check4update ()
2107{
2108 wxString text , file ;
2109 myExternal ex ;
2110
2111#ifdef __WXMSW__
2112 file = _T("currentversion.txt") ;
2113#endif
2114
2115#ifdef __WXMAC__
2116 file = _T("mac_currentversion.txt") ;
2117#endif
2118
2119 text = check4update_sub ( ex.getText ( _T("http://gentle.magnusmanske.de/") + file ) ) ;
2120// if ( text.IsEmpty() ) // Fallback
2121// text = check4update_sub ( ex.getText ( _T("http://www.uni-koeln.de/math-nat-fak/biochemie/klein/gentle/") + file ) ) ;
2122
2123 if ( text == _T("-") ) text = _T("") ;
2124 return text ;
2125}
2126
2127wxString MyFrame::check4update_sub ( wxString text )
2128{
2129 bool error = true ;
2130 if ( !text.IsEmpty() ) error = false ;
2131
2132 if ( !error )
2133 {
2134 wxString it = text ;
2135 wxString td = text ;
2136 td = td.BeforeFirst ( '\n' ) ;
2137 td = td.BeforeFirst ( '\r' ) ;
2138
2139 wxString lu = LS->getOption ( _T("LAST_UPDATE") , _T("") ) ;
2140 if ( lu.IsEmpty() ) // Assuming new installation of the latest version, so no update
2141 {
2142 lu = td ;
2143 LS->setOption ( _T("LAST_UPDATE") , lu ) ;
2144 }
2145
2146 if ( td > lu )
2147 {
2148 wxString msg = it.AfterFirst ( '\n' ) ;
2149 msg += _T("\n(") + wxString ( txt("t_you_use_version") ) + myapp()->get_GENtle_version() + _T(")") ;
2150 wxMessageDialog md ( this , msg , txt("t_new_version" ) ,
2151 wxOK | wxCANCEL | wxCENTRE | wxICON_INFORMATION ) ;
2152 if ( wxID_OK != md.ShowModal() )
2153 return _T("-") ;
2154
2155 return td ;
2156 }
2157 }
2158 else
2159 {
2160 // Cannot connect to check for update
2161 // SetStatusText ( txt("t_update_warning") , 1 ) ;
2162 // wxMessageBox ( _T("Error") , text ) ;
2163 }
2164 return _T("") ;
2165}
2166
2167/** \brief Download the new version of GENtle
2168 \param ver New version
2169 */
2170void MyFrame::update2version ( wxString ver )
2171{
2172 wxString do_run ;
2173 wxProgressDialog pd ( _T("Updating...") , _T("Downloading installer...") , 2 , NULL , 0 ) ;
2174 myExternal ex ;
2175 ex.pd = &pd ;
2176
2177 wxString sourcefile , sourcefile2 , localfile ;
2178
2179#ifdef __WXMSW__
2180 localfile = myapp()->homedir + _T("\\GENtleSetup.exe") ;
2181 sourcefile = _T("http://gentle.magnusmanske.de/GENtleSetup.exe") ;
2182 sourcefile2 = _T("http://www.uni-koeln.de/math-nat-fak/biochemie/klein/gentle/GENtleSetup.exe") ; // Fallback
2183#endif
2184
2185#ifdef __WXMAC__
2186 localfile = wxString(wxGetUserHome()) + _T("/Desktop/GENtle.pkg.zip") ;
2187 sourcefile = _T("http://gentle.magnusmanske.de/GENtle.pkg.zip") ;
2188 sourcefile2 = _T("http://www.uni-koeln.de/math-nat-fak/biochemie/klein/gentle/GENtle.pkg.zip") ; // Fallback
2189#endif
2190
2191 if ( ex.copyFile ( sourcefile , localfile ) > 0 )
2192 {
2193 if ( ex.copyFile ( sourcefile2 , localfile ) > 0 )
2194 {
2195 wxMessageBox ( _T("Couldn't read setup file") ) ;
2196 wxExit() ; // Hard exit
2197 }
2198 }
2199
2200#ifdef __WXMSW__
2201 do_run = _T("\"") + localfile + _T("\" /D=\"") ;
2202 do_run += myapp()->homedir ;
2203 do_run += _T("\"") ;
2204 LS->setOption ( _T("LAST_UPDATE") , ver ) ;
2205 dying = true ;
2206 if ( 0 == wxExecute ( do_run , wxEXEC_ASYNC ) ) return ; // 0 means the process couldn't start :-(
2207 wxExit() ; // Hard exit
2208#endif
2209
2210#ifdef __WXMAC__
2211 do_run = _T("unzip -o ") + localfile + _T(" -d ") + wxGetUserHome() + _T("/Desktop") ;
2212 wxExecute ( do_run , wxEXEC_SYNC ) ;
2213 wxRemoveFile ( localfile ) ;
2214 localfile = wxString(wxGetUserHome()) + _T("/Desktop/GENtle_package.pkg") ;
2215 do_run = _T("open ") + localfile ;
2216 LS->setOption ( _T("LAST_UPDATE") , ver ) ;
2217 dying = true ;
2218 wxExecute ( do_run , wxEXEC_ASYNC ) ;
2219 Destroy() ;
2220#endif
2221}
2222
2223/** \brief Handles SashDrag events (sash between the main tree and the current child
2224 */
2225void MyFrame::OnSashDrag(wxSashEvent& event)
2226{
2227 if (event.GetDragStatus() == wxSASH_STATUS_OUT_OF_RANGE)
2228 return;
2229
2230 switch (event.GetId())
2231 {
2232 case FRAME_SASH_TOP:
2233 {
2234 m_topWindow->SetDefaultSize(wxSize(1000, event.GetDragRect().height));
2235 break;
2236 }
2237 case FRAME_SASH_1:
2238 {
2239 m_leftWindow1->SetDefaultSize(wxSize(event.GetDragRect().width, 1000));
2240 break;
2241 }
2242 case FRAME_SASH_2:
2243 {
2244 m_leftWindow2->SetDefaultSize(wxSize(event.GetDragRect().width, 1000));
2245 break;
2246 }
2247 case FRAME_SASH_BOTTOM:
2248 {
2249 m_bottomWindow->SetDefaultSize(wxSize(1000, event.GetDragRect().height));
2250 break;
2251 }
2252 }
2253 wxLayoutAlgorithm layout;
2254 layout.LayoutFrame(this);
2255 Refresh () ;
2256
2257 // Leaves bits of itself behind sometimes
2258 // GetClientWindow()->Refresh();
2259}
2260
2261/** \brief Creates a temporary database, or uses one from the cache
2262 \param name Name of the database to use
2263 */
2264TStorage *MyFrame::getTempDB ( wxString name )
2265{
2266 unsigned int a ;
2267 for ( a = 0 ; a < dbcache.GetCount() && dbcache[a]->getDBname() != name ; a++ ) ;
2268 if ( a == dbcache.GetCount() )
2269 dbcache.Add ( new TStorage ( TEMP_STORAGE , name ) ) ;
2270 return dbcache[a] ;
2271}
2272
2273/** \brief Sets the active child
2274 \param c Pointer to the child
2275 */
2276void MyFrame::setActiveChild ( ChildBase *c )
2277{
2278 lastChild = c ;
2279 if ( !IsShown() ) return ;
2280 if ( locked != 0 ) return ;
2281 if ( activating ) return ;
2282 unsigned int a ;
2283 for ( a = 0 ; a < children.GetCount() ; a++ )
2284 {
2285 ChildBase *d = children[a] ;
2286 if ( d != c )
2287 {
2288 if ( d->IsShown() ) d->Hide () ;
2289 if ( d->IsEnabled() ) d->Disable () ;
2290 }
2291 }
2292 if ( children.GetCount() == 0 && GetMenuBar() != menu_bar ) SetMenuBar ( menu_bar ) ;
2293 if ( !c ) return ;
2294 activating = true ;
2295 // wxSafeYield() ;
2296 if ( !c->IsEnabled() ) c->Enable() ;
2297 if ( c->menubar && GetMenuBar() != c->menubar )
2298 c->SetMyMenuBar () ;
2299 //SetMenuBar ( c->menubar ) ;
2300 wxSize s = c->GetParent()->GetClientSize() ;
2301 if ( c->GetSize() != s )
2302 {
2303 if ( c->vec ) c->vec->updateDisplay() ;
2304 c->SetSize ( s ) ;
2305 }
2306 if ( mainTree && c->inMainTree.IsOk() && mainTree->GetSelection() != c->inMainTree )
2307 mainTree->SelectItem ( c->inMainTree ) ;
2308 if ( !c->IsShown() ) c->Show() ;
2309 // c->Refresh () ;
2310 wxSafeYield () ;
2311 activating = false ;
2312}
2313
2314/** \brief Returns the base window for all children
2315 */
2316wxWindow *MyFrame::getCommonParent()
2317{
2318 return m_leftWindow2 ;
2319}
2320
2321/** \brief Bug-patch function to catch illegal events
2322 */
2323void MyFrame::BollocksMenu(wxCommandEvent& event)
2324{
2325 if ( !lastChild ) return ;
2326 if ( event.GetId() == MDI_NEXT_WINDOW ||
2327 event.GetId() == MDI_PREV_WINDOW )
2328 {
2329 int a = getChildIndex ( lastChild ) ;
2330 if ( event.GetId() == MDI_NEXT_WINDOW ) a++ ;
2331 else a-- ;
2332 if ( a < 0 ) a = children.GetCount()-1 ;
2333 if ( a >= children.GetCount() ) a = 0 ;
2334 if ( a >= 0 && a <= children.GetCount() )
2335 {
2336 mainTree->EnsureVisible ( children[a]->inMainTree ) ;
2337 mainTree->SelectItem ( children[a]->inMainTree ) ;
2338 children[a]->EnforceRefesh () ;
2339 }
2340 return ;
2341 }
2342 if ( lastChild->def != _T("dna") ) return ;
2343 lastChild->ProcessEvent ( event ) ;
2344}
2345
2346/** \brief Reroutes context menu events to online tools
2347 */
2348void MyFrame::OnlineTools(wxCommandEvent& event)
2349{
2350 online_tools->take_event ( event ) ;
2351}
2352
2353/** \brief Reroutes menu events from the frame to the active child
2354 */
2355void MyFrame::RerouteMenu(wxCommandEvent& event)
2356{
2357 bool b = false ;
2358 if ( lastChild ) b = lastChild->ProcessEvent ( event ) ;
2359 // if ( !b ) ProcessEvent ( event ) ;
2360}
2361
2362/** \brief Gets the number of a child in the children list
2363 \param c Pointer to child
2364 */
2365int MyFrame::getChildIndex ( ChildBase *c )
2366{
2367 int a ;
2368 for ( a = 0 ; a < children.GetCount() && children[a] != c ; a++ ) ;
2369 return a ;
2370}
2371
2372
2373/** \brief Closes MDI child via (Crtl-F4)
2374 */
2375void MyFrame::OnMDIClose(wxCommandEvent& event)
2376{
2377 if ( lastChild ) lastChild->Close ( TRUE ) ;
2378}
2379
2380/** \brief Creates/reuses a virtual gel
2381 */
2382TVirtualGel *MyFrame::useGel ( wxString type )
2383{
2384 int a ;
2385 TVirtualGel *gel ;
2386 for ( a = 0 ; a < children.GetCount() ; a++ )
2387 {
2388 if ( children[a]->def != _T("GEL") ) continue ;
2389 gel = (TVirtualGel*) children[a] ;
2390 if ( gel->type == type ) return gel ;
2391 }
2392
2393 gel = new TVirtualGel ( getCommonParent() , _T("GEL ") + type ) ;
2394 gel->type = type ;
2395
2396 // Give it an icon
2397#ifdef __WXMSW__
2398 gel->SetIcon(wxIcon(_T("chrt_icn")));
2399#elif __WXMAC__
2400#else
2401 gel->SetIcon(wxIcon( mondrian_xpm ));
2402#endif
2403
2404 gel->initme () ;
2405
2406 gel->Show() ;
2407 gel->Maximize() ;
2408 gel->showName() ;
2409
2410 mainTree->addChild ( gel , TYPE_MISC ) ;
2411 setChild ( gel ) ;
2412 activateChild ( children.GetCount()-1 ) ;
2413 return gel ;
2414}
2415
2416/** \brief Handles the menu request for running the test suite
2417 */
2418void MyFrame::TestMenu(wxCommandEvent& event)
2419{
2420#ifdef MYTEST
2421 if ( test_suite == NULL ) test_suite = new TTestSuite ;
2422 test_suite->Step () ;
2423 wxCommandEvent ev ( wxEVT_COMMAND_MENU_SELECTED , Y___ ) ;
2424 wxPostEvent ( this , ev ) ;
2425#endif
2426}
2427
2428
2429void MyFrame::push_help ( wxString name )
2430{
2431 help_name.push_back ( name ) ;
2432}
2433
2434void MyFrame::pop_help ()
2435{
2436 if ( help_name.size() == 0 ) return ;
2437 help_name.pop_back() ;
2438}
2439
2440wxString MyFrame::get_help ()
2441{
2442 if ( help_name.size() == 0 ) return _T("") ;
2443 return help_name[help_name.size()-1] ;
2444}
2445
2446void MyFrame::OnSequencingAssistant(wxCommandEvent& event)
2447{
2448 TSequencingAssistantDialog sa ( getCommonParent(), txt("t_sequencing_assistant") );
2449 if ( wxID_OK != sa.ShowModal() ) return ; // Cancel
2450
2451 int sel_seq = sa.sequence->GetSelection() ;
2452 int sel_abi1 = sa.abi1->GetSelection() ;
2453 int sel_abi2 = sa.abi2->GetSelection() ;
2454
2455 if ( sel_seq == wxNOT_FOUND || sel_seq == 0 ) return ; // No sequence selected
2456 if ( sel_abi1 <= 0 && sel_abi2 <= 0 ) return ; // No ABI selected
2457 sa.fix_rev_compl () ;
2458
2459 // Alignment call
2460 wxArrayString vs ;
2461 wxArrayChildBase vc ;
2462 ChildBase *seq = sa.dna[sel_seq] ;
2463 ChildBase *abi1 = sel_abi1 <= 0 ? NULL : sa.abi[sa.abi1->GetSelection()] ;
2464 ChildBase *abi2 = sel_abi2 <= 0 ? NULL : sa.abi[sa.abi2->GetSelection()] ;
2465
2466 // Put 5'->3' first
2467 if ( abi1 && abi2 && ((TABIviewer*)abi1)->get_inv_compl() && !((TABIviewer*)abi2)->get_inv_compl() )
2468 {
2469 ChildBase *abi3 = abi1 ;
2470 abi1 = abi2 ;
2471 abi2 = abi3 ;
2472 }
2473
2474 vs.Add ( seq->getName() ) ;
2475 vc.Add ( seq ) ;
2476 if ( abi1 )
2477 {
2478 vs.Add ( abi1->getName() ) ;
2479 vc.Add ( abi1 ) ;
2480 }
2481 if ( abi2 )
2482 {
2483 vs.Add ( abi2->getName() ) ;
2484 vc.Add ( abi2 ) ;
2485 }
2486
2487 TAlignment *ali = runAlignment ( vs , vc , NULL ) ;
2488 ali->algorithm = 1 ;
2489 ali->redoAlignments () ;
2490}
2491
2492void MyFrame::OnCloningAssistant(wxCommandEvent& event)
2493{
2494 TCloningAssistant *subframe = new TCloningAssistant(getCommonParent(), txt("t_cloning_assistant") );
2495 myass ( subframe , "MyFrame::OnCloningAssistant" ) ;
2496 setChild ( subframe ) ;
2497
2498 // Give it an icon
2499#ifdef __WXMSW__
2500 subframe->SetIcon(wxIcon(_T("chrt_icn")));
2501#elif __WXMAC__
2502#else
2503 subframe->SetIcon(wxIcon( mondrian_xpm ));
2504#endif
2505
2506 subframe->initme() ;
2507 mainTree->addChild(subframe,TYPE_MISC) ;
2508 children.Last()->Activate () ;
2509 // subframe->Show ( TRUE ) ;
2510 // subframe->EnforceRefesh () ;
2511 // subframe->Activate () ;
2512}
2513
2514void MyFrame::OnLigation(wxCommandEvent& event)
2515{
2516 TLigationDialog ld ( this , txt("t_ligation") ) ;
2517 long l ;
2518 for ( l = 0 ; l < myapp()->frame->children.GetCount() ; l++ )
2519 {
2520 MyChild *p = (MyChild*) myapp()->frame->children[l] ;
2521 if ( p->def == _T("dna") && !p->vec->isCircular() )
2522 {
2523 ld.vv.Add ( p->vec ) ;
2524 }
2525 }
2526
2527 ld.init () ;
2528 ld.ShowModal() ;
2529 if ( !ld.doLigate ) return ;
2530 for ( l = 0 ; l < ld.ligates.size() ; l++ )
2531 {
2532 if ( !ld.ligates[l].getSequence().IsEmpty() )
2533 {
2534 TVector *v = new TVector ;
2535 v->setFromVector ( ld.ligates[l] ) ;
2536 for ( int a = 0 ; a < v->items.size() ; a++ )
2537 v->items[a].r1 = -1 ; // Resetting item radius to "recalc"
2538 myapp()->frame->newFromVector ( v ) ;
2539 }
2540 }
2541 myapp()->frame->lastCocktail.Clear () ;
2542}
2543
2544void MyFrame::OnStoreAll(wxCommandEvent& event)
2545{
2546 TStoreAllDialog dlg ( this , txt("t_store_all_dialog") ) ;
2547 dlg.ShowModal() ;
2548}
2549
2550void MyFrame::notifyChildrenChanged()
2551{
2552 int a ;
2553 for ( a = 0 ; a < children.GetCount() ; a++ )
2554 {
2555 children[a]->otherChildrenChanged() ;
2556 }
2557}
2558
2559//******************************************************************* TTestSuite
2560
2561#ifdef MYTEST
2562
2563TTestSuite::TTestSuite ()
2564{
2565 srand ( time(NULL) );
2566 cnt = 0 ;
2567}
2568
2569void TTestSuite::pressKey ( ChildBase *ac )
2570{
2571 if ( ac->def == _T("dna") ) vectorPressKey ( ac ) ;
2572 if ( ac->def == _T("AminoAcids") ) vectorPressKey ( ac ) ;
2573 if ( ac->def == _T("PrimerDesign") ) vectorPressKey ( ac ) ;
2574}
2575
2576void TTestSuite::action ( ChildBase *ac )
2577{
2578 if ( ac->def == _T("dna") ) vectorAction ( ac ) ;
2579 if ( ac->def == _T("AminoAcids") ) aaAction ( ac ) ;
2580}
2581
2582void TTestSuite::editMode ( ChildBase *ac )
2583{
2584 wxCommandEvent event ;
2585 mylog ( "Testsuite:Edit mode" , "" ) ;
2586 if ( ac->def == _T("dna") ) ((MyChild*)ac)->OnEditMode(event) ;
2587 if ( ac->def == _T("PrimerDesign") ) ((TPrimerDesign*)ac)->OnEditMode(event) ;
2588 if ( ac->def == _T("AminoAcids") )
2589 {
2590 ((TAminoAcids*)ac)->OnEditMode(event) ;
2591 }
2592}
2593
2594void TTestSuite::vectorPressKey ( ChildBase *ac )
2595{
2596 // if ( !ac->cSequence ) { mylog ("D'oh!",""); return ;}
2597 wxKeyEvent ev ( wxEVT_CHAR_HOOK ) ;
2598 ev.m_altDown = false ;
2599 ev.m_controlDown = rand() % 2 ;
2600 ev.m_metaDown = false ;
2601 ev.m_shiftDown = rand() % 2 ;
2602 int r = rand () % 40 ;
2603 if ( r > 14 ) r = 9 + r % 6 ;
2604 wxString msg ;
2605 ev.m_keyCode = 'A' ; // Default
2606 if ( r == 0 ) { ev.m_keyCode = 'A' ; msg = _T("A") ; }
2607 if ( r == 1 ) { ev.m_keyCode = 'C' ; msg = _T("C") ; }
2608 if ( r == 2 ) { ev.m_keyCode = 'T' ; msg = _T("G") ; }
2609 if ( r == 3 ) { ev.m_keyCode = 'G' ; msg = _T("T") ; }
2610 if ( r == 4 ) { ev.m_keyCode = WXK_BACK ; msg = _T("BACK") ; }
2611 if ( r == 5 ) { ev.m_keyCode = WXK_DELETE ; msg = _T("DEL") ; }
2612 if ( r == 6 ) { ev.m_keyCode = WXK_HOME ; msg = _T("HOME") ; }
2613 if ( r == 7 ) { ev.m_keyCode = WXK_END ; msg = _T("END") ; }
2614 if ( r == 8 ) { ev.m_keyCode = WXK_INSERT ; msg = _T("INSERT") ; }
2615 if ( r == 9 ) { ev.m_keyCode = WXK_RIGHT ; msg = _T("RIGHT") ; }
2616 if ( r == 10 ) { ev.m_keyCode = WXK_LEFT ; msg = _T("LEFT") ; }
2617 if ( r == 11 ) { ev.m_keyCode = WXK_UP ; msg = _T("UP") ; }
2618 if ( r == 12 ) { ev.m_keyCode = WXK_DOWN ; msg = _T("DOWN") ; }
2619 if ( r == 13 ) { ev.m_keyCode = WXK_PRIOR ; msg = _T("PRIOR") ; }
2620 if ( r == 14 ) { ev.m_keyCode = WXK_NEXT ; msg = _T("NEXT") ; }
2621 mylog ( "Testsuite:Key" , wxString::Format ( "%s" , msg.c_str() ) ) ;
2622 if ( ac->def == _T("PrimerDesign") ) ((TPrimerDesign*)ac)->sc->OnCharHook(ev) ;
2623 else ac->cSequence->OnCharHook(ev) ;
2624}
2625
2626void TTestSuite::vectorAction ( ChildBase *ac )
2627{
2628 MyChild *c = (MyChild*) ac ;
2629 wxCommandEvent ev ;
2630 int r = rand() % 24 ;
2631 mylog ( "Testsuite:Message" , wxString::Format ( "%d" , r ) ) ;
2632 switch ( r )
2633 {
2634 case 0 : c->OnAA_none ( ev ) ; break ;
2635 case 1 : c->OnAA_known ( ev ) ; break ;
2636 case 2 : c->OnAA_all ( ev ) ; break ;
2637 case 3 : c->OnAA_three ( ev ) ; break ;
2638 case 4 : c->OnAA_one ( ev ) ; break ;
2639 case 5 : c->OnAA_three_1 ( ev ) ; break ;
2640 case 6 : c->OnAA_three_2 ( ev ) ; break ;
2641 case 7 : c->OnAA_three_3 ( ev ) ; break ;
2642 case 8 : c->OnAA_three_M1 ( ev ) ; break ;
2643 case 9 : c->OnAA_three_M2 ( ev ) ; break ;
2644 case 10 : c->OnAA_three_M3 ( ev ) ; break ;
2645 case 11 : c->OnCircularLinear ( ev ) ; break ;
2646 case 12 : c->OnMarkAll ( ev ) ; break ;
2647 case 13 : c->OnCut ( ev ) ; break ;
2648 case 14 : c->OnCopy ( ev ) ; break ;
2649 // case 15 : c->OnPaste ( ev ) ; break ; // Might paste *real* clipboard;-)
2650 case 16 : c->OnCopyToNew ( ev ) ; break ;
2651 case 17 : c->OnViewMode ( ev ) ; break ;
2652 case 18 : c->OnORFs ( ev ) ; break ;
2653 case 19 : c->OnToggleFeatures ( ev ) ; break ;
2654 case 20 : c->OnToggleRestriction ( ev ) ; break ;
2655 case 21 : c->OnToggleIDNA ( ev ) ; break ;
2656 case 22 : c->Undo ( ev ) ; break ;
2657 case 23 : if ( c->cSequence ) c->OnRunPCR ( ev ) ; break ;
2658 }
2659}
2660
2661void TTestSuite::aaAction ( ChildBase *ac )
2662{
2663 wxCommandEvent ev ;
2664 TAminoAcids *aa = (TAminoAcids*) ac ;
2665
2666 int r = rand() % 15 ;
2667 if ( r == 0 )
2668 {
2669 int num = aa->inlinePlot->GetCount() ;
2670 num = rand() % num ;
2671 mylog ( "TTestSuite::aaAction" , wxString::Format ( "Inline plot to %d" , num ) ) ;
2672 aa->inlinePlot->SetSelection ( num ) ;
2673 aa->OnIP ( ev ) ;
2674 }
2675 else if ( r == 1 ) { mylog ( "TTestSuite::aaAction" , "OnHorizontal" ) ; aa->OnHorizontal ( ev ) ; }
2676 else if ( r == 2 ) { mylog ( "TTestSuite::aaAction" , "MarkAll" ) ; aa->OnMarkAll ( ev ) ; }
2677 else if ( r == 3 ) { mylog ( "TTestSuite::aaAction" , "Cut" ) ; aa->OnCut ( ev ) ; }
2678 // else if ( r == 4 ) aa->OnPhotometer ( ev ) ; // Works, too many boring calculators ;-)
2679 else
2680 {
2681 int num = aa->lb->GetCount() ;
2682 num = rand() % num ;
2683 mylog ( "TTestSuite::aaAction" , wxString::Format ( "ListBox to %d" , num ) ) ;
2684 aa->lb->SetSelection ( num , true ) ;
2685 aa->OnListBox ( ev ) ;
2686 }
2687}
2688
2689void TTestSuite::mouseEvent ( ChildBase *ac )
2690{
2691 SequenceCanvas *can = ac->cSequence ;
2692 if ( !can && ac->def == _T("PrimerDesign") ) can = ((TPrimerDesign*)ac)->sc ;
2693 if ( !can ) return ;
2694
2695 wxArrayInt vi ;
2696 vi.Add ( wxEVT_ENTER_WINDOW ) ;
2697 vi.Add ( wxEVT_LEAVE_WINDOW ) ;
2698 vi.Add ( wxEVT_LEFT_DOWN ) ;
2699 vi.Add ( wxEVT_LEFT_UP ) ;
2700 // vi.Add ( wxEVT_LEFT_DCLICK ) ;
2701 vi.Add ( wxEVT_MIDDLE_DOWN ) ;
2702 vi.Add ( wxEVT_MIDDLE_UP ) ;
2703 vi.Add ( wxEVT_MIDDLE_DCLICK ) ;
2704 // vi.Add ( wxEVT_RIGHT_DOWN ) ;
2705 vi.Add ( wxEVT_RIGHT_UP ) ;
2706 vi.Add ( wxEVT_RIGHT_DCLICK ) ;
2707 vi.Add ( wxEVT_MOTION ) ;
2708 vi.Add ( wxEVT_MOUSEWHEEL ) ;
2709
2710 int et = vi[rand()%vi.GetCount()] ;
2711
2712 wxMouseEvent event ( et ) ;
2713 int w , h ;
2714 can->GetClientSize ( &w , &h ) ;
2715 event.m_x = rand() % w ;
2716 event.m_y = rand() % h ;
2717 can->OnEvent ( event ) ;
2718}
2719
2720void TTestSuite::Step()
2721{
2722 if ( cnt == 0 ) start = wxGetLocalTime() ;
2723 MyFrame *f = myapp()->frame ;
2724
2725 ChildBase *ac = f->GetActiveChild () ;
2726 if ( !ac ) return ; // No child open
2727
2728 cnt++ ;
2729 if ( cnt > 1000000 )
2730 {
2731 wxMessageBox ( _T("1000K") ) ;
2732 wxExit() ;
2733 }
2734 int r = rand() ;
2735 r %= 10 ;
2736
2737 wxString x ;
2738 x = ac->getName() ;
2739 x += _T(" [") + ac->def + _T("] ") ;
2740 x += wxString::Format ( _T(" [%ds, #%d]") , wxGetLocalTime()-start , cnt ) ;
2741 if ( ac->vec ) x += wxString::Format ( _T(", seq : %d") , ac->vec->getSequenceLength() ) ;
2742 if ( ac->cSequence ) x += wxString::Format ( _T(", EditMode : %d") , ac->cSequence->getEditMode() ) ;
2743 if ( ac->cSequence ) x += wxString::Format ( _T(", Overwrite : %d") , ac->cSequence->doOverwrite() ) ;
2744 if ( ac->cSequence ) x += wxString::Format ( _T(", Mark %d-%d") , ac->cSequence->markedFrom() , ac->cSequence->markedTo() ) ;
2745 x += wxString::Format ( _T(", r=%d") , r ) ;
2746 mylog ( "Testsuite:Status" , x ) ;
2747
2748 if ( r < 6 ) pressKey ( ac ) ;
2749 // else if ( r == 6 ) mouseEvent ( ac ) ;
2750 else if ( r == 7 ) editMode ( ac ) ;
2751 else if ( r == 8 )
2752 {
2753 r = rand() % f->children.GetCount() ;
2754 mylog ( "Testsuite:Activate" , wxString::Format ( "%d" , r ) ) ;
2755 f->activateChild ( r ) ;
2756 }
2757 else if ( r == 9 ) action ( ac ) ;
2758}
2759
2760#endif
2761
2762// DROP TARGET
2763
2764/** \brief Handles dropped file name(s)
2765 */
2766bool MyFrameDropTarget::OnDropFiles(wxCoord x, wxCoord y, const wxArrayString& filenames)
2767{
2768 int a , b ;
2769 for ( a = 0 ; a < filenames.GetCount() ; a++ )
2770 {
2771 wxString path = filenames[a] ;
2772 for ( b = path.length() - 1 ; path.GetChar(b) != '\\' && path.GetChar(b) != '/' ; b-- ) ;
2773 wxString file = path.substr ( b+1 ) ;
2774 myapp()->frame->importFile ( file , path , -1 ) ;
2775 }
2776 return true ;
2777}
2778
2779// Project
2780
2781/** \brief Constructor
2782 */
2783TProject::TProject ()
2784{
2785 enzyme_rules = NULL ;
2786}
2787
2788TEnzymeRules *TProject::getEnzymeRules () { return enzyme_rules ; }
2789void TProject::setEnzymeRules ( TEnzymeRules *er ) { enzyme_rules = er ; }
2790
27910
=== removed directory '.pc/remove_clustalw.patch'
=== removed file '.pc/remove_clustalw.patch/Makefile.am'
--- .pc/remove_clustalw.patch/Makefile.am 2010-06-15 16:38:33 +0000
+++ .pc/remove_clustalw.patch/Makefile.am 1970-01-01 00:00:00 +0000
@@ -1,244 +0,0 @@
1SUFFIXES=.cpp .rc
2
3bin_PROGRAMS = GENtle
4
5EXTRA_DIST = mondrian.xpm \
6variables.csv \
7blank.db \
8default.tab \
9marker.txt \
10bitmaps/align.bmp \
11bitmaps/cocktail.bmp \
12bitmaps/display_features.bmp \
13bitmaps/helpcs.bmp \
14bitmaps/new.xpm \
15bitmaps/plasmid_linear.bmp \
16bitmaps/print.xpm \
17bitmaps/settings_tool.bmp \
18bitmaps/alignment.bmp \
19bitmaps/copy.bmp \
20bitmaps/display_restriction.bmp \
21bitmaps/help.xpm \
22bitmaps/open.bmp \
23bitmaps/preview.bmp \
24bitmaps/project.bmp \
25bitmaps/splash.bmp \
26bitmaps/align_tool.bmp \
27bitmaps/copy.xpm \
28bitmaps/draft.xbm \
29bitmaps/image.bmp \
30bitmaps/open.xpm \
31bitmaps/preview.xpm \
32bitmaps/protein.bmp \
33bitmaps/tick.bmp \
34bitmaps/bitmap1.bmp \
35bitmaps/cut.bmp \
36bitmaps/drawing.xbm\
37bitmaps/mode_both.bmp \
38bitmaps/orfs.bmp \
39bitmaps/primer.bmp \
40bitmaps/redo.bmp \
41bitmaps/undo.bmp \
42bitmaps/bitmap2.bmp \
43bitmaps/cut.xpm \
44bitmaps/flowchar.xbm \
45bitmaps/mode_edit.bmp \
46bitmaps/paste.bmp \
47bitmaps/primer_export.bmp \
48bitmaps/save.bmp \
49bitmaps/web.bmp \
50bitmaps/calc.bmp \
51bitmaps/Helix.bmp \
52bitmaps/mode_view.bmp \
53bitmaps/paste.xpm \
54bitmaps/primer_import.bmp \
55bitmaps/save.xpm \
56bitmaps/write.xbm\
57bitmaps/calc_tool.bmp \
58bitmaps/dirplain.xbm \
59bitmaps/help.bmp \
60bitmaps/new.bmp \
61bitmaps/plasmid_circular.bmp \
62bitmaps/print.bmp \
63bitmaps/scissors.bmp
64
65
66GENtle_LDADD = $(WX_LIBS) -L/usr/lib -L/usr/local/lib -lsqlite -lsqlite3 -lmysqlclient -ltinyxml
67GENtle_LDFLAGS = -s
68GENtle_SOURCES = TXMLfile.cpp\
69TVectorTree.cpp\
70TVirtualGel.cpp\
71TVectorEditorItems.cpp\
72TVectorEditorEnzymes.cpp\
73TVectorEditor.cpp\
74TVector.cpp\
75SCFtype.cpp\
76TStoreAllDialog.cpp\
77TDotPlot.cpp\
78TUndo.cpp\
79TUReadSeq.cpp\
80TStorage.cpp\
81TSilmutDialog.cpp\
82TRestrictionEditor.cpp\
83TPrimer.cpp\
84TPrimerDialog.cpp\
85TPDB.cpp\
86TLigationDialog.cpp\
87TMainTree.cpp\
88todo.cpp\
89TItemEditDialog.cpp\
90TImageDisplay.cpp\
91TIMGreader.cpp\
92TextImportDialog.cpp\
93TClone.cpp\
94SequenceTypes.cpp\
95TCalculator.cpp\
96SequenceTypeRestriction.cpp\
97SequenceTypePlot.cpp\
98SequenceTypeFeature.cpp\
99SequenceTypeDNA.cpp\
100SequenceTypeAlign.cpp\
101SequenceTypeABI.cpp\
102SequenceTypeAA.cpp\
103SequenceCanvas.cpp\
104SendHTTP.cpp\
105RestrictionEnzymes.cpp\
106ProgramOptionsDialog.cpp\
107PlasmidCanvasLinear.cpp\
108PrimerDesign.cpp\
109PlasmidCanvasHandlers.cpp\
110PlasmidCanvasCircular.cpp\
111PlasmidCanvas.cpp\
112MyFrame.cpp\
113MyChild.cpp\
114MiscDialogs.cpp\
115ManageDatabase.cpp\
116main.cpp\
117GenBank.cpp\
118FindSequenceDialog.cpp\
119ExternalNCBI.cpp\
120ExternalInterface.cpp\
121ExternalBLAST.cpp\
122ChildBase.cpp\
123CoolCanvas.cpp\
124AminoAcids.cpp\
125Alignment.cpp\
126ABIviewer.cpp\
127ABItype.cpp\
128TAlignmentDialog.cpp\
129AutoAnnotate.cpp\
130TGraph.cpp\
131TGraphDisplay.cpp\
132TGraphScale.cpp\
133CGview.cpp\
134ureadseq.c\
135ncoils.cpp\
136TPhylip.cpp\
137TPhyloTree.cpp\
138PCR_Troubleshoot.cpp\
139TProteolysis.cpp\
140clustalw/alnscore.cpp\
141clustalw/amenu.cpp\
142clustalw/calcgap.cpp\
143clustalw/calcprf1.cpp\
144clustalw/calcprf2.cpp\
145clustalw/calctree.cpp\
146clustalw/clustalw.cpp\
147clustalw/gcgcheck.cpp\
148clustalw/interfac.cpp\
149clustalw/malign.cpp\
150clustalw/palign.cpp\
151clustalw/prfalign.cpp\
152clustalw/random.cpp\
153clustalw/readmat.cpp\
154clustalw/sequence.cpp\
155clustalw/showpair.cpp\
156clustalw/trees.cpp\
157clustalw/util.cpp\
158ipc/element.cpp\
159ipc/gp_out.cpp\
160ipc/ipc.cpp\
161ipc/pars.cpp\
162CloneManager.cpp\
163CloningAssistant.cpp\
164TSequencingAssistantDialog.cpp\
165AlignmentAppearanceDialog.cpp\
166SequenceTypeAAstructure.cpp\
167OnlineTools.cpp\
168TEliteLaChromLogDialog.cpp\
169TRestrictionIdentifier.cpp\
170TRestrictionIdentifier.h\
171CloningAssistant.h\
172AlignmentAppearanceDialog.h\
173TSequencingAssistantDialog.h\
174OnlineTools.h\
175CloneManager.h\
176enums.h \
177lin_sqlite.h \
178lin_sqlite3.h \
179TXMLfile.h\
180SCFtype.h\
181TStoreAllDialog.h\
182TDotPlot.h\
183AutoAnnotate.h\
184CGview.h\
185TAlignmentDialog.h\
186TGraph.h\
187TVectorTree.h\
188TVirtualGel.h\
189TVectorEditor.h\
190TVector.h\
191TUndo.h\
192TUReadSeq.h\
193TStorage.h\
194TSilmutDialog.h\
195TRestrictionEditor.h\
196TPrimer.h\
197TPrimerDialog.h\
198TPDB.h\
199TLigationDialog.h\
200TMainTree.h\
201TItemEditDialog.h\
202TImageDisplay.h\
203TIMGreader.h\
204TextImportDialog.h\
205TClone.h\
206TCalculator.h\
207SequenceCanvas.h\
208SendHTTP.h\
209RestrictionEnzymes.h\
210ProgramOptionsDialog.h\
211PrimerDesign.h\
212PlasmidCanvas.h\
213MyFrame.h\
214MyChild.h\
215MiscDialogs.h\
216ManageDatabase.h\
217main.h\
218GenBank.h\
219FindSequenceDialog.h\
220ExternalInterface.h\
221TProteolysis.h\
222PCR_Troubleshoot.h\
223ChildBase.h\
224CoolCanvas.h\
225AminoAcids.h\
226Alignment.h\
227ABIviewer.h\
228ABItype.h\
229ureadseq.h\
230TPhylip.h\
231TPhyloTree.h\
232TEliteLaChromLogDialog.h\
233ncoils.h\
234clustalw/clustalw.h\
235clustalw/dayhoff.h \
236clustalw/general.h \
237clustalw/matrices.h \
238clustalw/param.h \
239clustalw/xmenu.h\
240ipc/element.h\
241ipc/global.h\
242ipc/gp_out.h\
243ipc/ipc.h\
244ipc/parse.h
2450
=== removed directory '.pc/remove_tinyxml.patch'
=== removed file '.pc/remove_tinyxml.patch/Makefile.am'
--- .pc/remove_tinyxml.patch/Makefile.am 2010-06-15 16:38:33 +0000
+++ .pc/remove_tinyxml.patch/Makefile.am 1970-01-01 00:00:00 +0000
@@ -1,250 +0,0 @@
1SUFFIXES=.cpp .rc
2
3bin_PROGRAMS = GENtle
4
5EXTRA_DIST = mondrian.xpm \
6variables.csv \
7blank.db \
8default.tab \
9marker.txt \
10bitmaps/align.bmp \
11bitmaps/cocktail.bmp \
12bitmaps/display_features.bmp \
13bitmaps/helpcs.bmp \
14bitmaps/new.xpm \
15bitmaps/plasmid_linear.bmp \
16bitmaps/print.xpm \
17bitmaps/settings_tool.bmp \
18bitmaps/alignment.bmp \
19bitmaps/copy.bmp \
20bitmaps/display_restriction.bmp \
21bitmaps/help.xpm \
22bitmaps/open.bmp \
23bitmaps/preview.bmp \
24bitmaps/project.bmp \
25bitmaps/splash.bmp \
26bitmaps/align_tool.bmp \
27bitmaps/copy.xpm \
28bitmaps/draft.xbm \
29bitmaps/image.bmp \
30bitmaps/open.xpm \
31bitmaps/preview.xpm \
32bitmaps/protein.bmp \
33bitmaps/tick.bmp \
34bitmaps/bitmap1.bmp \
35bitmaps/cut.bmp \
36bitmaps/drawing.xbm\
37bitmaps/mode_both.bmp \
38bitmaps/orfs.bmp \
39bitmaps/primer.bmp \
40bitmaps/redo.bmp \
41bitmaps/undo.bmp \
42bitmaps/bitmap2.bmp \
43bitmaps/cut.xpm \
44bitmaps/flowchar.xbm \
45bitmaps/mode_edit.bmp \
46bitmaps/paste.bmp \
47bitmaps/primer_export.bmp \
48bitmaps/save.bmp \
49bitmaps/web.bmp \
50bitmaps/calc.bmp \
51bitmaps/Helix.bmp \
52bitmaps/mode_view.bmp \
53bitmaps/paste.xpm \
54bitmaps/primer_import.bmp \
55bitmaps/save.xpm \
56bitmaps/write.xbm\
57bitmaps/calc_tool.bmp \
58bitmaps/dirplain.xbm \
59bitmaps/help.bmp \
60bitmaps/new.bmp \
61bitmaps/plasmid_circular.bmp \
62bitmaps/print.bmp \
63bitmaps/scissors.bmp
64
65
66GENtle_LDADD = $(WX_LIBS) -L/usr/lib -L/usr/local/lib -lsqlite -lsqlite3 -lmysqlclient
67GENtle_LDFLAGS = -s
68GENtle_SOURCES = TXMLfile.cpp\
69TVectorTree.cpp\
70TVirtualGel.cpp\
71TVectorEditorItems.cpp\
72TVectorEditorEnzymes.cpp\
73TVectorEditor.cpp\
74TVector.cpp\
75SCFtype.cpp\
76TStoreAllDialog.cpp\
77TDotPlot.cpp\
78TUndo.cpp\
79TUReadSeq.cpp\
80TStorage.cpp\
81TSilmutDialog.cpp\
82TRestrictionEditor.cpp\
83TPrimer.cpp\
84TPrimerDialog.cpp\
85TPDB.cpp\
86TLigationDialog.cpp\
87TMainTree.cpp\
88todo.cpp\
89TItemEditDialog.cpp\
90TImageDisplay.cpp\
91TIMGreader.cpp\
92TextImportDialog.cpp\
93TClone.cpp\
94SequenceTypes.cpp\
95TCalculator.cpp\
96SequenceTypeRestriction.cpp\
97SequenceTypePlot.cpp\
98SequenceTypeFeature.cpp\
99SequenceTypeDNA.cpp\
100SequenceTypeAlign.cpp\
101SequenceTypeABI.cpp\
102SequenceTypeAA.cpp\
103SequenceCanvas.cpp\
104SendHTTP.cpp\
105RestrictionEnzymes.cpp\
106ProgramOptionsDialog.cpp\
107PlasmidCanvasLinear.cpp\
108PrimerDesign.cpp\
109PlasmidCanvasHandlers.cpp\
110PlasmidCanvasCircular.cpp\
111PlasmidCanvas.cpp\
112MyFrame.cpp\
113MyChild.cpp\
114MiscDialogs.cpp\
115ManageDatabase.cpp\
116main.cpp\
117GenBank.cpp\
118FindSequenceDialog.cpp\
119ExternalNCBI.cpp\
120ExternalInterface.cpp\
121ExternalBLAST.cpp\
122ChildBase.cpp\
123CoolCanvas.cpp\
124AminoAcids.cpp\
125Alignment.cpp\
126ABIviewer.cpp\
127ABItype.cpp\
128TAlignmentDialog.cpp\
129AutoAnnotate.cpp\
130TGraph.cpp\
131TGraphDisplay.cpp\
132TGraphScale.cpp\
133CGview.cpp\
134ureadseq.c\
135ncoils.cpp\
136TPhylip.cpp\
137TPhyloTree.cpp\
138PCR_Troubleshoot.cpp\
139TProteolysis.cpp\
140tinyxml/tinyxmlparser.cpp\
141tinyxml/tinyxmlerror.cpp\
142tinyxml/tinyxml.cpp\
143tinyxml/tinystr.cpp\
144clustalw/alnscore.cpp\
145clustalw/amenu.cpp\
146clustalw/calcgap.cpp\
147clustalw/calcprf1.cpp\
148clustalw/calcprf2.cpp\
149clustalw/calctree.cpp\
150clustalw/clustalw.cpp\
151clustalw/gcgcheck.cpp\
152clustalw/interfac.cpp\
153clustalw/malign.cpp\
154clustalw/palign.cpp\
155clustalw/prfalign.cpp\
156clustalw/random.cpp\
157clustalw/readmat.cpp\
158clustalw/sequence.cpp\
159clustalw/showpair.cpp\
160clustalw/trees.cpp\
161clustalw/util.cpp\
162ipc/element.cpp\
163ipc/gp_out.cpp\
164ipc/ipc.cpp\
165ipc/pars.cpp\
166CloneManager.cpp\
167CloningAssistant.cpp\
168TSequencingAssistantDialog.cpp\
169AlignmentAppearanceDialog.cpp\
170SequenceTypeAAstructure.cpp\
171OnlineTools.cpp\
172TEliteLaChromLogDialog.cpp\
173TRestrictionIdentifier.cpp\
174TRestrictionIdentifier.h\
175CloningAssistant.h\
176AlignmentAppearanceDialog.h\
177TSequencingAssistantDialog.h\
178OnlineTools.h\
179CloneManager.h\
180enums.h \
181lin_sqlite.h \
182lin_sqlite3.h \
183TXMLfile.h\
184SCFtype.h\
185TStoreAllDialog.h\
186TDotPlot.h\
187AutoAnnotate.h\
188CGview.h\
189TAlignmentDialog.h\
190TGraph.h\
191TVectorTree.h\
192TVirtualGel.h\
193TVectorEditor.h\
194TVector.h\
195TUndo.h\
196TUReadSeq.h\
197TStorage.h\
198TSilmutDialog.h\
199TRestrictionEditor.h\
200TPrimer.h\
201TPrimerDialog.h\
202TPDB.h\
203TLigationDialog.h\
204TMainTree.h\
205TItemEditDialog.h\
206TImageDisplay.h\
207TIMGreader.h\
208TextImportDialog.h\
209TClone.h\
210TCalculator.h\
211SequenceCanvas.h\
212SendHTTP.h\
213RestrictionEnzymes.h\
214ProgramOptionsDialog.h\
215PrimerDesign.h\
216PlasmidCanvas.h\
217MyFrame.h\
218MyChild.h\
219MiscDialogs.h\
220ManageDatabase.h\
221main.h\
222GenBank.h\
223FindSequenceDialog.h\
224ExternalInterface.h\
225TProteolysis.h\
226PCR_Troubleshoot.h\
227ChildBase.h\
228CoolCanvas.h\
229AminoAcids.h\
230Alignment.h\
231ABIviewer.h\
232ABItype.h\
233ureadseq.h\
234TPhylip.h\
235TPhyloTree.h\
236TEliteLaChromLogDialog.h\
237ncoils.h\
238tinyxml/tinyxml.h\
239tinyxml/tinystr.h\
240clustalw/clustalw.h\
241clustalw/dayhoff.h \
242clustalw/general.h \
243clustalw/matrices.h \
244clustalw/param.h \
245clustalw/xmenu.h\
246ipc/element.h\
247ipc/global.h\
248ipc/gp_out.h\
249ipc/ipc.h\
250ipc/parse.h
2510
=== removed file '.pc/remove_tinyxml.patch/TXMLfile.cpp'
--- .pc/remove_tinyxml.patch/TXMLfile.cpp 2010-06-15 16:38:33 +0000
+++ .pc/remove_tinyxml.patch/TXMLfile.cpp 1970-01-01 00:00:00 +0000
@@ -1,256 +0,0 @@
1/** \file
2 \brief The TXMLfile class
3*/
4#include "TXMLfile.h"
5
6TXMLfile::TXMLfile ()
7 {
8 TiXmlBase::SetCondenseWhiteSpace ( true ) ;
9 _success = false ;
10 }
11
12void TXMLfile::parse ( wxString text )
13 {
14 TiXmlDocument doc ;
15 doc.Parse ( text.mb_str() ) ;
16 if ( doc.Error() )
17 {
18 _success = false ;
19 return ;
20 }
21 analyze ( doc ) ;
22 }
23
24void TXMLfile::load ( wxString file )
25 {
26// wxStartTimer() ;
27 TiXmlDocument doc ( file.mb_str() );
28 bool ok = doc.LoadFile();
29/*
30 // Alternative (faster?) opening method
31 char *x ;
32 wxFile f ( file ) ;
33 if ( !f.IsOpened() ) { _success = false ; return ; }
34 x = new char [ f.Length() + 5 ] ;
35 f.Read ( x , f.Length() ) ;
36 x[f.Length()] = 0 ;
37 if ( *x != '<' ) { delete x ; _success = false ; return ; }
38 TiXmlDocument doc ( "" );
39 doc.Parse ( (const char*) x ) ;
40 bool ok = !doc.Error() ;
41 delete x ;
42*/
43// cout << "Done in " << wxGetElapsedTime() << " ms\n" ;
44 if ( !ok || doc.Error() )
45 {
46 _success = false ;
47 return ;
48 }
49
50 analyze ( doc ) ;
51 }
52
53void TXMLfile::analyze ( const TiXmlDocument &doc )
54 {
55 if ( doc.FirstChild ( "GBSeq" ) )
56 {
57 readGBSeq ( doc.FirstChild ( "GBSeq" ) ) ;
58 }
59 else if ( doc.FirstChild ( "GBSet" ) )
60 {
61 TiXmlNode *x = doc.RootElement() ;// ( _T("GBSet") ) ;
62 for ( x = x->FirstChild ( "GBSeq" ) ; x ; x = x->NextSibling ( "GBSeq" ) )
63 readGBSeq ( x ) ;
64 }
65 _success = _v.GetCount() > 0 ;
66 }
67
68int TXMLfile::countVectors ()
69 {
70 return _v.GetCount() ;
71 }
72
73TVector *TXMLfile::getVector ( int a )
74 {
75 return _v[a] ;
76 }
77
78
79// private
80
81wxString TXMLfile::t ( const char *txt )
82 {
83 return txt ? wxString ( txt , wxConvUTF8 ) : _T("") ;
84 }
85
86wxString TXMLfile::t ( TiXmlText *txt )
87 {
88 return txt && txt->Value() ? wxString ( txt->Value() , wxConvUTF8 ) : wxString() ;
89 }
90
91void TXMLfile::readGBSeq ( TiXmlNode *base )
92 {
93 myass ( base , _T("TXMLfile::readGBSeq") ) ;
94 TVector *v = new TVector ;
95 v->setType ( TYPE_VECTOR ) ; // Dummy
96
97 int a ;
98 TiXmlNode *n ;
99 TiXmlElement *e ;
100 wxString s ;
101 TiXmlHandle h ( base ) ;
102
103 wxString n1 = t ( h.FirstChild("GBSeq_definition").FirstChild().Text() ) ;
104 wxString n2 = t ( h.FirstChild("GBSeq_locus").FirstChild().Text() ) ;
105 if ( !n1.IsEmpty() && n1.Freq ( '\n' ) == 0 && n2.Freq ( ' ' ) == 0 )
106 n2 = n1 + _T("(") + n2 + _T("))") ;
107
108 v->setName ( n2 ) ;
109 v->setSequence ( t ( h.FirstChild("GBSeq_sequence").FirstChild().Text() ) . MakeUpper() ) ;
110
111 e = h.FirstChild("GBSeq_topology").Element() ;
112 if ( e ) // topology
113 {
114 s = t ( e->Attribute ( "value" ) ) . MakeUpper() ;
115 if ( s == _T("CIRCULAR") ) v->setCircular ( true ) ;
116 }
117// cout << "Up to features took " << wxGetElapsedTime() << " ms\n" ;
118
119 // Features
120 for ( n = h.FirstChild("GBSeq_feature-table").FirstChild("GBFeature").Node() ; n ;
121 n = n->NextSibling("GBFeature") )
122 {
123 TVectorItem i ;
124 TiXmlHandle h2 ( n ) ;
125 s = t ( h2.FirstChild("GBFeature_key").FirstChild().Text() ) . MakeUpper() ;
126
127 // Dummy values
128 i.name = _T("") ;
129 i.from = 1 ;
130 i.to = 1 ;
131 i.setType ( 0 ) ;
132 i.setDirection ( 1 ) ;
133 i.setType ( s ) ;
134 readGBqualifiers ( i , n ) ;
135
136 vector <TVectorItem> vi ;
137 readGBintervals ( vi , i , n ) ;
138 for ( a = 0 ; a < vi.size() ; a++ )
139 v->items.push_back ( vi[a] ) ;
140 }
141// cout << "Features took " << wxGetElapsedTime() << " ms\n" ;
142
143 // The rest
144 for ( n = h.Node()->FirstChild() ; n ; n = n->NextSibling() )
145 {
146 wxString x = t ( n->Value() ) ;
147 if ( x == _T("GBSeq_definition") ) continue ;
148 if ( x == _T("GBSeq_locus") ) continue ;
149 if ( x == _T("GBSeq_sequence") ) continue ;
150 if ( x == _T("GBSeq_feature-table") ) continue ;
151 x = get_sub_desc ( n ) ;
152 v->addDescription ( x ) ;
153 }
154
155 // Sorting by size, just for fun
156 // Only for less than 100 items
157 for ( a = 1 ; v->items.size() < 100 && a < v->items.size() ; a++ )
158 {
159 if ( v->getItemLength(a-1) < v->getItemLength(a) )
160 {
161 TVectorItem i = v->items[a] ;
162 v->items[a] = v->items[a-1] ;
163 v->items[a-1] = i ;
164 a = 0 ;
165 }
166 }
167
168 v->updateDisplay() ;
169 v->recalculateCuts () ;
170 _v.Add ( v ) ;
171// cout << "The rest took " << wxGetElapsedTime() << " ms\n" ;
172 }
173
174wxString TXMLfile::get_sub_desc ( TiXmlNode *base , int depth )
175 {
176 if ( !base ) return _T("") ; // Just fore safety...
177 wxString name = t ( base->Value() ) ;
178 if ( name.Left ( 6 ) == _T("GBSeq_") ) name = name.Mid(6,1).Upper() + name.Mid ( 7 ) ;
179 wxString ret ;
180 ret = wxString ( (wxChar)' ' , depth * 2 ) ;
181 ret += name ;
182 ret += _T("\n") ;
183 TiXmlNode *n ;
184 for ( n = base->FirstChild() ; n ; n = n->NextSibling() )
185 ret += get_sub_desc ( n , depth + 1 ) ;
186 return ret ;
187 }
188
189void TXMLfile::readGBqualifiers ( TVectorItem &i , TiXmlNode *n )
190 {
191 TiXmlNode *n2 = n->FirstChild("GBFeature_quals") ;
192 if ( !n2 ) return ;
193 for ( n2 = n2->FirstChild("GBQualifier") ; n2 ; n2 = n2->NextSibling("GBQualifier") )
194 {
195 TiXmlHandle h ( n2 ) ;
196 wxString name = t ( h.FirstChild("GBQualifier_name").FirstChild().Text() ) . MakeUpper() ;
197 wxString value = t ( h.FirstChild("GBQualifier_value").FirstChild().Text() ) ;
198 if ( name.IsEmpty() ) continue ;
199 i.setParam ( _T("/") + name , value ) ;
200 if ( name == _T("CODON_START") ) i.setRF ( atoi ( value.mb_str() ) ) ;
201 if ( name == _T("GENE") || name == _T("LABEL") ) i.name = value ;
202 if ( name == _T("PRODUCT") || name == _T("NOTE") || name == _T("REGION_NAME") )
203 {
204 if ( !i.desc.IsEmpty() ) i.desc += _T("\n") ;
205 i.desc += value ;
206 }
207 }
208 if ( i.name.IsEmpty() && i.desc.length() < 10 )
209 {
210 i.name = i.desc ;
211 i.desc = _T("") ;
212 }
213 if ( i.name.IsEmpty() )
214 {
215 wxString try2 = i.desc ;
216 while ( try2.Right ( 1 ) == _T("\n") ) try2 = try2.Left ( try2.length() - 1 ) ;
217 try2 = try2.AfterLast('\n').AfterLast('\r') ;
218 if ( !try2.IsEmpty() && try2.length() < 20 ) i.name = try2 ;
219 }
220 if ( i.name.IsEmpty() )
221 {
222 char u[100] ;
223 sprintf ( u , "short_itemtype%d" , i.getType() ) ;
224 i.name = wxString ( txt(u) , wxConvUTF8 ) ;
225 wxString d2 = i.desc ;
226 int k = d2.find ( _T("\n") ) ;
227 if ( k > -1 ) d2.erase ( k ) ;
228 if ( i.name.length() * 2 >= d2.length() )
229 i.name = d2 ;
230 }
231 }
232
233void TXMLfile::readGBintervals ( vector <TVectorItem> &vi , const TVectorItem &i , TiXmlNode *n )
234 {
235 TiXmlNode *n2 = n->FirstChild("GBFeature_intervals") ;
236 if ( !n2 ) return ;
237 for ( n2 = n2->FirstChild("GBInterval") ; n2 ; n2 = n2->NextSibling("GBInterval") )
238 {
239 TiXmlHandle h ( n2 ) ;
240 wxString from = t ( h.FirstChild("GBInterval_from").FirstChild().Text() ) ;
241 wxString to = t ( h.FirstChild("GBInterval_to").FirstChild().Text() ) ;
242 if ( from.IsEmpty() || to.IsEmpty() ) continue ;
243 TVectorItem j = i ;
244 j.from = atoi ( from.mb_str() ) ;
245 j.to = atoi ( to.mb_str() ) ;
246 if ( j.from > j.to )
247 {
248 int o = j.from ;
249 j.from = j.to ;
250 j.to = o ;
251 j.setDirection ( -1 ) ;
252 }
253 vi.push_back ( j ) ;
254 }
255 }
256
2570
=== removed file '.pc/remove_tinyxml.patch/TXMLfile.h'
--- .pc/remove_tinyxml.patch/TXMLfile.h 2010-06-15 16:38:33 +0000
+++ .pc/remove_tinyxml.patch/TXMLfile.h 1970-01-01 00:00:00 +0000
@@ -1,40 +0,0 @@
1/** \file
2 \brief The TXMLfile class
3*/
4#ifndef _TXMLFILE_H_
5#define _TXMLFILE_H_
6
7#include "main.h"
8
9class TVector ;
10class TiXmlNode ;
11class TVectorItem ;
12class TiXmlDocument ;
13
14/// This class is a wrapper around the tinyxml software, specialized for GenBankXML format
15class TXMLfile
16 {
17 public :
18 TXMLfile () ; ///< Constructor
19 ~TXMLfile () {} ; ///< Dummy destructor
20
21 void load ( wxString file ) ; ///< Load XML from file
22 void parse ( wxString text ) ; ///< Pass XML as string
23 bool success () { return _success ; } ///< Errors during parsing?
24 int countVectors () ; ///< How many vectors were made from the XML?
25 TVector *getVector ( int a ) ; ///< Returns pointer to one of the vectors
26
27 private :
28 void analyze ( const TiXmlDocument &doc ) ; ///< Parse single/multiple sequences
29 void readGBSeq ( TiXmlNode *base ) ; ///< The actual parser
30 wxString t ( TiXmlText *txt ) ; ///< Safe text conversion
31 wxString t ( const char *txt ) ; ///< Safe text conversion
32 void readGBqualifiers ( TVectorItem &i , TiXmlNode *n ) ; ///< Part of the parser
33 void readGBintervals ( vector <TVectorItem> &vi , const TVectorItem &i , TiXmlNode *n ) ; ///< Part of the parser
34 wxString get_sub_desc ( TiXmlNode *base , int depth = 0 ) ;
35 bool _success ; ///< Internal success marker
36 wxArrayTVector _v ; ///< The generated vectors
37 } ;
38
39#endif
40
410
=== removed file '.pc/remove_tinyxml.patch/main.h'
--- .pc/remove_tinyxml.patch/main.h 2010-06-15 16:38:33 +0000
+++ .pc/remove_tinyxml.patch/main.h 1970-01-01 00:00:00 +0000
@@ -1,354 +0,0 @@
1/** \file
2 \brief Contains defines, global functions, includes, and the MyApp class
3*/
4#ifndef _MAIN_H_
5#define _MAIN_H_
6
7//#define __DEBIAN__
8
9#define GENTLE_VERSION_MAJOR 1
10#define GENTLE_VERSION_MINOR 9
11#define GENTLE_VERSION_SUB 4
12
13typedef unsigned int uint ;
14
15/** \fn myass ( bool b , wxString msg )
16 \brief "My assertion" - little inside joke...
17 \param b The condition given in the call. No assertion when b is FALSE.
18 \param msg The message string to write into errout.
19*/
20
21/** \def MYDEBUG
22 \brief Turns on output of the myass function; should not be used for releases
23*/
24
25/** \def MYLOG
26 \brief Turns on output of logging; should not be used for releases
27*/
28
29/** \def MYTEST
30 \brief Turns on both MYDEBUG and MYLOG; should not be used for releases
31*/
32
33//#define MYDEBUG
34//#define MYLOG
35//#define MYTEST
36
37#ifdef MYTEST
38 #ifndef MYLOG
39 #define MYLOG
40 #endif // MYLOG
41 #ifndef MYDEBUG
42 #define MYDEBUG
43 #endif // MYDEBUG
44#endif // MYTEST
45
46/** \def MYSPINBOXSIZE
47 \brief Width of spin box, for windows only
48*/
49#ifdef __WXMSW__
50 #define MYSPINBOXSIZE 80
51#else
52 #define MYSPINBOXSIZE -1
53#endif
54
55#include "wx/wxprec.h"
56
57/** \def MYFONTSIZE
58 \brief Main tree font size
59*/
60#ifdef __WXMAC__
61 #define MYFONTSIZE 10
62#else
63 #define MYFONTSIZE 8
64#endif
65
66/** \def MYSPINBOXSIZE
67 \brief List box style, for GTK only
68*/
69#ifdef __WXGTK__
70 #define MYLISTBORDER wxSIMPLE_BORDER
71#else
72 #define MYLISTBORDER 0
73#endif
74
75#ifdef __BORLANDC__
76 #pragma hdrstop
77#endif
78
79#ifndef WX_PRECOMP
80 #include "wx/wx.h"
81 #include "wx/notebook.h"
82#endif
83
84#include <wx/toolbar.h>
85#include <wx/filesys.h>
86#include <wx/fs_inet.h>
87#include <wx/file.h>
88#include <wx/dialup.h>
89#include <wx/utils.h>
90#include <wx/numdlg.h>
91#include <wx/timer.h>
92
93#ifdef _UNICODE
94 #define wxUSE_UNICODE 1
95#endif
96
97#if defined(__WXGTK__) || defined(__WXMOTIF__)
98 #include "mondrian.xpm"
99 #include "bitmaps/new.xpm"
100 #include "bitmaps/open.xpm"
101 #include "bitmaps/save.xpm"
102 #include "bitmaps/copy.xpm"
103 #include "bitmaps/cut.xpm"
104 #include "bitmaps/paste.xpm"
105 #include "bitmaps/print.xpm"
106 #include "bitmaps/help.xpm"
107#endif
108
109#include <math.h>
110#include <vector>
111
112using namespace std ;
113
114/** \def MYPEN(_a)
115 \brief Creates or reuses a solid pen with size 1. _a is of type wxColour
116*/
117
118/** \def MYBRUSH(_a)
119 \brief Creates or reuses a solid brush. _a is of type wxColour
120*/
121
122/** \def MYFONT(_a,_b,_c,_d)
123 \brief Creates or reuses a font. Parameters are the same as wxCreateFont
124*/
125
126#define MYPEN(_a) (wxThePenList->FindOrCreatePen ( _a , 1 , wxSOLID ) )
127#define MYBRUSH(_a) (wxTheBrushList->FindOrCreateBrush ( _a , wxSOLID ) )
128#define MYFONT(_a,_b,_c,_d) (wxTheFontList->FindOrCreateFont(_a,_b,_c,_d) )
129
130// Don't you *EVER* turn this on again!!!!
131//#define TIXML_USE_STL
132#include "tinyxml/tinyxml.h"
133
134#include <wx/wx.h>
135#include <wx/toolbar.h>
136#include <wx/treectrl.h>
137#include <wx/listctrl.h>
138#include <wx/snglinst.h>
139#include <wx/laywin.h>
140#include <wx/progdlg.h>
141#include <wx/mimetype.h>
142#include <wx/textfile.h>
143#include <wx/dir.h>
144#include <wx/html/helpctrl.h>
145#include <wx/url.h>
146#include <wx/protocol/http.h>
147WX_DECLARE_STRING_HASH_MAP( wxString, wxHashString );
148
149/** \brief Style for Process Dialog */
150#define wxPD_ALL (wxPD_AUTO_HIDE|wxPD_APP_MODAL|wxPD_CAN_ABORT|wxPD_ELAPSED_TIME|wxPD_ESTIMATED_TIME|wxPD_REMAINING_TIME)
151
152#define TYPE_VECTOR 0 /**< \brief Vector type */
153#define TYPE_FRAGMENT 1 /**< \brief Fragment type */
154#define TYPE_SEQUENCE 2 /**< \brief Sequence type */
155#define TYPE_PRIMER 3 /**< \brief Primer type */
156#define TYPE_ALIGNMENT 4 /**< \brief Alignment type */
157#define TYPE_AMINO_ACIDS 5 /**< \brief Amino acid type */
158#define TYPE_MISC 6 /**< \brief Misc type */
159
160#define FEAT_NONE 0 /**< \brief Do not draw feature */
161#define FEAT_ALPHA 1 /**< \brief Draw feature as alpha helix */
162#define FEAT_BETA 2 /**< \brief Draw feature as beta sheet */
163#define FEAT_MUT 3 /**< \brief Draw feature as mutation */
164#define FEAT_NOLINE 4 /**< \brief Draw feature without line */
165#define FEAT_VLINE 5 /**< \brief Draw feature as vertical line */
166
167#define DAM_METHYLATION 1 /**< \brief Show DAM methylation */
168#define DCM_METHYLATION 2 /**< \brief Show DCM methylation */
169#define ALL_METHYLATION_ENZYMES ( DAM_METHYLATION + DCM_METHYLATION ) /**< \brief Show all methylations */
170
171class MyFrame ;
172
173/** \class MyApp
174 \brief Application class
175*/
176class MyApp : public wxApp
177 {
178 public:
179 virtual bool OnInit();
180 virtual int OnExit () ;
181 virtual void init_txt ( wxString lang , wxString csv , wxHashString *target = NULL , int ln = 1 ) ;
182 virtual void do_my_ass ( bool b , wxString msg = _T("") ) ;
183 virtual void do_my_log ( wxString function , wxString msg = _T("") ) ;
184 virtual wxString getHTMLCommand ( wxString command ) ; ///< Returns the command line for running a browser
185 virtual wxString getFileFormatApplication ( wxString type ) ; ///< Returns application associated with a file type
186 virtual wxString getFileFormatCommand ( wxString type , wxString file ) ; ///< Returns the command line for running this file
187 virtual wxString get_GENtle_version () ; ///< Returns the GENtle version string
188 virtual wxString getLocalDBname () ; ///< Returns the filename of the default local database
189 virtual void launchBrowser ( wxString url ) ;
190
191 MyFrame *frame; ///< The application frame
192 wxMimeTypesManager mtm ; ///< The MIME types manager
193 wxString homedir ; ///< Directory of the application
194 wxString bmpdir ; ///< Directory of the bitmaps
195 wxString slash ; ///< The platform-dependent directory separator slash
196 int programVersion ; ///< The database access program version
197 int dbWarningIssued ; ///< Was a database warning issued?
198 wxHashString _text ; ///< Contains the current GUI translation.
199 wxHashString clp ; ///< Command line parameters
200 wxCSConv *isoconv ; ///< UTF-8 conversion helper
201 wxStopWatch sw ;
202
203 private :
204 virtual void registerFileExtension ( wxString extension ) ; ///< Registers a file extension to GENtle (windows only).
205 virtual void registerProtocol ( wxString extension ) ; ///< Registers a protocol to GENtle (windows only).
206 wxFile *errout ; ///< The ERROR.txt file handler for do_my_ass
207 wxFile *logout ; ///< The LOG.txt file handler for do_my_log
208 int total_log_time ; ///< The log timer for do_my_log
209 int total_log_counter ; ///< The log counter for do_my_log
210 wxSingleInstanceChecker *m_checker ; ///< Checks if another instance is running
211 wxString theRealLocalDb ;
212 };
213
214class TUndo ;
215class ChildBase ;
216class TVector ;
217class TRestrictionEnzyme ;
218class TStorage ;
219class TProtease ;
220class TVectorItem ;
221class SeqBasic ;
222class TProteaseCut ;
223
224WX_DEFINE_ARRAY(ChildBase *, wxArrayChildBase);
225WX_DEFINE_ARRAY(TRestrictionEnzyme *, wxArrayTRestrictionEnzyme);
226WX_DEFINE_ARRAY(TStorage *, wxArrayTStorage);
227WX_DEFINE_ARRAY(TProtease *,wxArrayTProtease);
228WX_DEFINE_ARRAY(TVectorItem *,wxArrayTVectorItem);
229WX_DEFINE_ARRAY(SeqBasic *,wxArraySeqBasic);
230WX_DEFINE_ARRAY(TProteaseCut *,wxArrayTProteaseCut);
231WX_DECLARE_OBJARRAY(float, wxArrayFloat);
232
233#ifndef _wxArrayTVector
234 #define _wxArrayTVector
235 WX_DEFINE_ARRAY(TVector *, wxArrayTVector);
236#endif
237
238/** \brief Clear wxArray of pointers and delete the not-NULL-pointer objects */
239#define CLEAR_DELETE(__x) { while ( !__x.IsEmpty() ) { if ( __x[0] ) { delete __x[0] ; } __x.RemoveAt ( 0 ) ; } }
240
241/** \brief Create a wxString of __l times the __c char */
242#define FILLSTRING(__x,__c,__l) { __x = wxString ( __c , __l ) ; }
243
244
245#include "enums.h"
246#include "TVector.h"
247#include "TUReadSeq.h"
248#include "TPhylip.h"
249#include "ipc/ipc.h"
250#include "ncoils.h"
251#include "CGview.h"
252#include "AutoAnnotate.h"
253#include "ChildBase.h"
254#include "OnlineTools.h"
255#include "TSequencerData.h"
256#include "ABItype.h"
257#include "SCFtype.h"
258#include "CloningAssistant.h"
259#include "MiscDialogs.h"
260#include "TStorage.h"
261#include "TPrimer.h"
262#include "TIMGreader.h"
263#include "PlasmidCanvas.h"
264#include "SequenceCanvas.h"
265#include "TDotPlot.h"
266#include "TStoreAllDialog.h"
267#include "TSequencingAssistantDialog.h"
268#include "MyFrame.h"
269#include "MyChild.h"
270#include "TRestrictionEditor.h"
271#include "TClone.h"
272#include "GenBank.h"
273#include "TPDB.h"
274#include "CloneManager.h"
275#include "TXMLfile.h"
276#include "TVectorTree.h"
277#include "TMainTree.h"
278#include "RestrictionEnzymes.h"
279#include "TImageDisplay.h"
280#include "TVirtualGel.h"
281//#include "TRestrictionIdentifier.h"
282#include "TCalculator.h"
283#include "TGraph.h"
284#include "TPhyloTree.h"
285#include "Alignment.h"
286#include "AminoAcids.h"
287#include "ABIviewer.h"
288#include "ExternalInterface.h"
289#include "TItemEditDialog.h"
290#include "PrimerDesign.h"
291
292#define PI 3.14 /**< \brief Just PI */
293#define IUPAC_A 1 /**< \brief IUPAC bit for A */
294#define IUPAC_C 2 /**< \brief IUPAC bit for C */
295#define IUPAC_G 4 /**< \brief IUPAC bit for G */
296#define IUPAC_T 8 /**< \brief IUPAC bit for T */
297
298#define MINI_DISPLAY_ORIGINAL 0 /**< \brief Display mini-canvas at original width */
299#define MINI_DISPLAY_REAL 1 /**< \brief Display mini-canvas at real width */
300#define MINI_DISPLAY_CONDENSED 2 /**< \brief Display mini-canvas as condensed width */
301
302#include "ureadseq.h"
303
304
305// ---------------------------------------------------------------------------
306// global functions
307// ---------------------------------------------------------------------------
308
309#ifdef MYDEBUG
310 #define myass(a,b) myapp()->do_my_ass(a,b)
311#else
312 #define myass(a,b)
313#endif
314
315#ifdef MYLOG
316 #define mylog(a,b) myapp()->do_my_log(a,b)
317#else
318 #define mylog(a,b)
319#endif
320
321#define CHAR2WX(__c) wxString((char*)l,wxConvUTF8)
322
323/** \brief Insert wxString "t" into wxString "s" at position "from" */
324void wxStringInsert ( wxString &s , int from , wxString t ) ;
325
326/** \brief Chop wxString "s" into parts "r" separated by "sep" */
327void explode ( wxString sep , wxString s , wxArrayString &r ) ;
328
329/** \brief Join wxStrings in "r" while putting "sep"s between them */
330wxString implode ( wxString sep , wxArrayString &r ) ;
331/*
332/** \brief Returns the current language version of the "item" /
333char* txt ( wxString item ) ;
334
335/** \brief Returns the current language version of the "item" /
336char* txt ( char *item ) ;
337*/
338/** \brief Returns the current language version of the "item" */
339wxString txt ( wxString item ) ;
340
341/** \brief Returns the current language version of the "item" */
342wxString txt ( char *item ) ;
343
344/** \brief Returns a pointer to the application */
345MyApp *myapp () ;
346
347/** \brief Compares the values of two int pointers */
348int cmpint(int *first, int *second) ;
349
350/** \brief Compares the values of two TRestrictionEnzyme pointers */
351int cmpre(TRestrictionEnzyme *first, TRestrictionEnzyme *second) ;
352
353#endif
354// _MAIN_H__
3550
=== modified file 'Makefile.am'
--- Makefile.am 2013-03-16 14:37:00 +0000
+++ Makefile.am 2014-08-05 04:14:21 +0000
@@ -63,7 +63,11 @@
63bitmaps/scissors.bmp63bitmaps/scissors.bmp
6464
6565
66<<<<<<< TREE
66GENtle_LDADD = $(WX_LIBS) -L/usr/lib -L/usr/local/lib -lsqlite3 -lmysqlclient -ltinyxml67GENtle_LDADD = $(WX_LIBS) -L/usr/lib -L/usr/local/lib -lsqlite3 -lmysqlclient -ltinyxml
68=======
69GENtle_LDADD = $(WX_LIBS) -L/usr/lib -L/usr/local/lib -lsqlite -lsqlite3 -lmysqlclient
70>>>>>>> MERGE-SOURCE
67GENtle_LDFLAGS = -s71GENtle_LDFLAGS = -s
68GENtle_SOURCES = TXMLfile.cpp\72GENtle_SOURCES = TXMLfile.cpp\
69TVectorTree.cpp\73TVectorTree.cpp\
@@ -137,6 +141,28 @@
137TPhyloTree.cpp\141TPhyloTree.cpp\
138PCR_Troubleshoot.cpp\142PCR_Troubleshoot.cpp\
139TProteolysis.cpp\143TProteolysis.cpp\
144tinyxml/tinyxmlparser.cpp\
145tinyxml/tinyxmlerror.cpp\
146tinyxml/tinyxml.cpp\
147tinyxml/tinystr.cpp\
148clustalw/alnscore.cpp\
149clustalw/amenu.cpp\
150clustalw/calcgap.cpp\
151clustalw/calcprf1.cpp\
152clustalw/calcprf2.cpp\
153clustalw/calctree.cpp\
154clustalw/clustalw.cpp\
155clustalw/gcgcheck.cpp\
156clustalw/interfac.cpp\
157clustalw/malign.cpp\
158clustalw/palign.cpp\
159clustalw/prfalign.cpp\
160clustalw/random.cpp\
161clustalw/readmat.cpp\
162clustalw/sequence.cpp\
163clustalw/showpair.cpp\
164clustalw/trees.cpp\
165clustalw/util.cpp\
140ipc/element.cpp\166ipc/element.cpp\
141ipc/gp_out.cpp\167ipc/gp_out.cpp\
142ipc/ipc.cpp\168ipc/ipc.cpp\
@@ -213,6 +239,14 @@
213TPhyloTree.h\239TPhyloTree.h\
214TEliteLaChromLogDialog.h\240TEliteLaChromLogDialog.h\
215ncoils.h\241ncoils.h\
242tinyxml/tinyxml.h\
243tinyxml/tinystr.h\
244clustalw/clustalw.h\
245clustalw/dayhoff.h \
246clustalw/general.h \
247clustalw/matrices.h \
248clustalw/param.h \
249clustalw/xmenu.h\
216ipc/element.h\250ipc/element.h\
217ipc/global.h\251ipc/global.h\
218ipc/gp_out.h\252ipc/gp_out.h\
219253
=== modified file 'MyFrame.cpp'
--- MyFrame.cpp 2014-06-25 13:55:53 +0000
+++ MyFrame.cpp 2014-08-05 04:14:21 +0000
@@ -586,7 +586,7 @@
586 {586 {
587 wxHtmlHelpController *hc = new wxHtmlHelpController ( wxHF_DEFAULT_STYLE|wxHF_OPEN_FILES ) ;587 wxHtmlHelpController *hc = new wxHtmlHelpController ( wxHF_DEFAULT_STYLE|wxHF_OPEN_FILES ) ;
588 helpfile += myapp()->homedir ;588 helpfile += myapp()->homedir ;
589 helpfile += _T("/help/") ;589 helpfile += _T("\\help\\") ;
590 helpfile += lang_string ;590 helpfile += lang_string ;
591 helpfile += _T(".hhp") ;591 helpfile += _T(".hhp") ;
592 hc->AddBook ( helpfile ) ;592 hc->AddBook ( helpfile ) ;
593593
=== modified file 'TXMLfile.cpp'
--- TXMLfile.cpp 2014-06-25 13:55:53 +0000
+++ TXMLfile.cpp 2014-08-05 04:14:21 +0000
@@ -50,7 +50,7 @@
50 analyze ( doc ) ;50 analyze ( doc ) ;
51 }51 }
5252
53void TXMLfile::analyze ( TiXmlDocument &doc )53void TXMLfile::analyze ( const TiXmlDocument &doc )
54 {54 {
55 if ( doc.FirstChild ( "GBSeq" ) )55 if ( doc.FirstChild ( "GBSeq" ) )
56 {56 {
5757
=== modified file 'TXMLfile.h'
--- TXMLfile.h 2010-06-15 16:38:33 +0000
+++ TXMLfile.h 2014-08-05 04:14:21 +0000
@@ -25,7 +25,7 @@
25 TVector *getVector ( int a ) ; ///< Returns pointer to one of the vectors25 TVector *getVector ( int a ) ; ///< Returns pointer to one of the vectors
26 26
27 private :27 private :
28 void analyze ( TiXmlDocument &doc ) ; ///< Parse single/multiple sequences28 void analyze ( const TiXmlDocument &doc ) ; ///< Parse single/multiple sequences
29 void readGBSeq ( TiXmlNode *base ) ; ///< The actual parser29 void readGBSeq ( TiXmlNode *base ) ; ///< The actual parser
30 wxString t ( TiXmlText *txt ) ; ///< Safe text conversion30 wxString t ( TiXmlText *txt ) ; ///< Safe text conversion
31 wxString t ( const char *txt ) ; ///< Safe text conversion31 wxString t ( const char *txt ) ; ///< Safe text conversion
3232
=== modified file 'main.h'
--- main.h 2010-06-15 16:38:33 +0000
+++ main.h 2014-08-05 04:14:21 +0000
@@ -129,11 +129,7 @@
129129
130// Don't you *EVER* turn this on again!!!!130// Don't you *EVER* turn this on again!!!!
131//#define TIXML_USE_STL131//#define TIXML_USE_STL
132#ifndef __DEBIAN__
133#include "tinyxml/tinyxml.h"132#include "tinyxml/tinyxml.h"
134#else
135#include "tinyxml.h"
136#endif
137133
138#include <wx/wx.h>134#include <wx/wx.h>
139#include <wx/toolbar.h>135#include <wx/toolbar.h>

Subscribers

People subscribed via source and target branches

to all changes: