54 #include <wx/msw/winundef.h>
57 #include <wx/filesys.h>
58 #include <wx/fs_zip.h>
74 #if defined(__WXGTK__) || defined(__WXMAC__)
75 #include "cn3d42App.xpm"
83 IMPLEMENT_APP(Cn3D::Cn3DApp)
110 const wxPoint& pos = wxDefaultPosition,
const wxSize&
size = wxDefaultSize) :
112 wxDEFAULT_FRAME_STYLE
113 #
if defined(__WXMSW__)
114 | wxFRAME_TOOL_WINDOW | wxFRAME_NO_TASKBAR | wxFRAME_FLOAT_ON_PARENT
119 SetIcon(wxICON(cn3d));
126 DECLARE_EVENT_TABLE()
129 BEGIN_EVENT_TABLE(
MsgFrame, wxFrame)
135 if (event.CanVeto()) {
153 diagMsg.
Write(errMsg);
159 static bool avoidRecursion =
false;
160 if (!avoidRecursion) {
161 avoidRecursion =
true;
162 wxMessageDialog dlg(
NULL, errMsg.c_str(),
"Severe Error!", wxOK | wxCENTRE | wxICON_EXCLAMATION);
164 avoidRecursion =
false;
181 backLog.push_back(errMsg.c_str());
189 logFrame =
new MsgFrame(
"Cn3D Message Log", wxPoint(500, 0), wxSize(500, 500));
193 wxMenuBar *menuBar =
new wxMenuBar;
198 wxPoint(0,0),
logFrame->GetClientSize(), wxTE_RICH | wxTE_MULTILINE | wxTE_READONLY | wxHSCROLL);
208 #if defined(__WXMSW__)
215 BEGIN_EVENT_TABLE(
Cn3DApp, wxApp )
246 INFOMSG(
"Built " << __DATE__ <<
" with wxWidgets " << wxVERSION_NUM_DOT_STRING);
249 INFOMSG(
"This is a debug build");
251 INFOMSG(
"This is a release build");
253 #ifdef _USE_TEST_MMDBSRV_
254 INFOMSG(
"This build uses a test mmdbsrv");
256 INFOMSG(
"This build uses the standard mmdbsrv");
260 static const wxCmdLineEntryDesc cmdLineDesc[] = {
261 { wxCMD_LINE_SWITCH,
"h",
"help",
"show this help message",
262 wxCMD_LINE_VAL_NONE, wxCMD_LINE_OPTION_HELP },
263 { wxCMD_LINE_SWITCH,
"r",
"readonly",
"message file is read-only",
264 wxCMD_LINE_VAL_NONE, wxCMD_LINE_PARAM_OPTIONAL },
265 { wxCMD_LINE_SWITCH,
"i",
"imports",
"show imports window on startup",
266 wxCMD_LINE_VAL_NONE, wxCMD_LINE_PARAM_OPTIONAL },
267 { wxCMD_LINE_SWITCH,
"n",
"noalign",
"do not show alignment window on startup",
268 wxCMD_LINE_VAL_NONE, wxCMD_LINE_PARAM_OPTIONAL },
269 { wxCMD_LINE_SWITCH,
"f",
"force",
"force saves to same file",
270 wxCMD_LINE_VAL_NONE, wxCMD_LINE_PARAM_OPTIONAL },
271 { wxCMD_LINE_OPTION,
"m",
"message",
"message file",
272 wxCMD_LINE_VAL_STRING, wxCMD_LINE_PARAM_OPTIONAL | wxCMD_LINE_NEEDS_SEPARATOR },
273 { wxCMD_LINE_OPTION,
"a",
"targetapp",
"messaging target application name",
274 wxCMD_LINE_VAL_STRING, wxCMD_LINE_PARAM_OPTIONAL | wxCMD_LINE_NEEDS_SEPARATOR },
275 { wxCMD_LINE_OPTION,
"o",
"model",
"model choice: alpha, single, or PDB",
276 wxCMD_LINE_VAL_STRING, wxCMD_LINE_PARAM_OPTIONAL | wxCMD_LINE_NEEDS_SEPARATOR },
277 { wxCMD_LINE_OPTION,
"d",
"id",
"MMDB/PDB ID to load via network",
278 wxCMD_LINE_VAL_STRING, wxCMD_LINE_PARAM_OPTIONAL | wxCMD_LINE_NEEDS_SEPARATOR },
279 { wxCMD_LINE_OPTION,
"s",
"style",
"preferred favorite style",
280 wxCMD_LINE_VAL_STRING, wxCMD_LINE_PARAM_OPTIONAL | wxCMD_LINE_NEEDS_SEPARATOR },
281 { wxCMD_LINE_PARAM,
NULL,
NULL,
"input file",
282 wxCMD_LINE_VAL_STRING, wxCMD_LINE_PARAM_OPTIONAL},
289 case 0:
TRACEMSG(
"command line parsed successfully");
break;
290 default:
return false;
294 wxFileSystem::AddHandler(
new wxZipFSHandler);
300 wxString dictFile = wxString(
GetDataDir().c_str()) +
"bstdt.val";
317 SetExitOnFrameDelete(
true);
321 bool showLog =
false;
334 if (modelStr ==
"alpha")
336 else if (modelStr ==
"single")
338 else if (modelStr ==
"PDB")
341 ERRORMSG(
"Model type (-o) must be one of alpha|single|PDB");
346 wxString filename =
commandLine.GetParam(0).c_str();
347 INFOMSG(
"command line file: " << filename.c_str());
366 ERRORMSG(
"-o requires either -d or Biostruc file name");
377 wxString messageFilename;
381 messageApp =
"Listener";
424 #if wxCHECK_VERSION(2,9,0)
427 wxApp::OnIdle(event);
433 void Cn3DApp::MacOpenFile(
const wxString& filename)
435 if (filename.size() > 0) {
436 INFOMSG(
"apple open event file: " << filename);
User-defined methods of the data storage class.
User-defined methods of the data storage class.
User-defined methods of the data storage class.
void LoadStandardDictionary(const char *filename)
void DeleteStandardDictionary(void)
void ShowUpdateWindow(void) const
unsigned int NUpdates(void) const
wxCmdLineParser commandLine
StructureWindow * structureWindow
void OnIdle(wxIdleEvent &event)
OpenGLRenderer * renderer
StructureSet * structureSet
void ProcessRedraws(void)
MsgFrame(const wxString &title, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize)
void OnCloseWindow(wxCloseEvent &event)
void AttachStructureSet(StructureSet *targetStructureSet)
AlignmentManager * alignmentManager
void SetPreferredFavoriteStyle(const std::string &s)
void SetupFileMessenger(const std::string &messageFilename, const std::string &messageApp, bool readOnly)
bool LoadData(const char *filename, bool force, bool noAlignmentWindow, ncbi::objects::CNcbi_mime_asn1 *mimeData=NULL)
static list< string > backLog
void DisplayDiagnostic(const SDiagMessage &diagMsg)
void SetDialogSevereErrors(bool status)
void RaiseLogWindow(void)
wxFrame * GlobalTopWindow(void)
static wxFrame * topWindow
static bool dialogSevereErrors
static MsgFrame * logFrame
bool IsWindowedMode(void)
CNcbi_mime_asn1 * LoadStructureViaCache(const std::string &uid, ncbi::objects::EModel_type modelType, int assemblyId)
Include a standard set of the NCBI C++ Toolkit most basic headers.
CNcbi_mime_asn1 * CreateMimeFromBiostruc(const string &filename, EModel_type model)
void Write(string &str, TDiagWriteFlags flags=fNone) const
Binary OR of "EDiagWriteFlags".
void SetDiagPostFlag(EDiagPostFlag flag)
Set the specified flag (globally).
EDiagSev m_Severity
Severity level.
void UnsetDiagTraceFlag(EDiagPostFlag flag)
EDiagSev SetDiagPostLevel(EDiagSev post_sev=eDiag_Error)
Set the threshold severity for posting the messages.
void SetDiagHandler(CDiagHandler *handler, bool can_delete=true)
Set the diagnostic handler using the specified diagnostic handler class.
void SetDiagTrace(EDiagTrace how, EDiagTrace dflt=eDT_Default)
Set the diagnostic trace settings.
void SetDiagStream(CNcbiOstream *os, bool quick_flush=true, FDiagCleanup cleanup=0, void *cleanup_data=0, const string &stream_name="")
Set diagnostic stream.
@ eDPF_Location
Include class and function if any.
@ eDPF_File
File name (not full path)
@ eDT_Default
Restores the default tracing context.
@ eDiag_Trace
Trace message.
@ eDiag_Info
Informational message.
@ eDiag_Error
Error message.
static void SetVerifyDataGlobal(ESerialVerifyData verify)
@ eSerialVerifyData_Always
always verify (even if set not to later on)
static void SetVerifyDataGlobal(ESerialVerifyData verify)
Set up default output data verification for streams created by the current process.
static void SetVerifyDataGlobal(ESerialVerifyData verify)
Set up default input data verification for streams created by the current process.
#define END_SCOPE(ns)
End the previously defined scope.
#define BEGIN_SCOPE(ns)
Define a new scope.
EModel_type
Access to EModel_type's attributes (values, names) as defined in spec.
@ eModel_type_ncbi_all_atom
@ eModel_type_ncbi_backbone
if(yy_accept[yy_current_state])
Messenger * GlobalMessenger(void)
const struct ncbi::grid::netcache::search::fields::SIZE size
Defines: CTimeFormat - storage class for time format.