From: <ti...@us...> - 2007-11-10 20:37:15
|
Revision: 1466 http://wired.svn.sourceforge.net/wired/?rev=1466&view=rev Author: tinou81 Date: 2007-11-10 12:37:10 -0800 (Sat, 10 Nov 2007) Log Message: ----------- Directory for loading samples in plugins (i.e. beatbox) is now saved Modified Paths: -------------- branches/SaveAlt/wired/src/plugins/HostCallback.cpp Modified: branches/SaveAlt/wired/src/plugins/HostCallback.cpp =================================================================== --- branches/SaveAlt/wired/src/plugins/HostCallback.cpp 2007-11-09 00:51:18 UTC (rev 1465) +++ branches/SaveAlt/wired/src/plugins/HostCallback.cpp 2007-11-10 20:37:10 UTC (rev 1466) @@ -20,6 +20,10 @@ long HostCallback(Plugin *plug, long param, void *value) { + static wxString lastSaveDir; + static wxString lastOpenDir; + wxFileDialog *dlg = 0x0; + switch (param) { case wiredSendMouseEvent : @@ -94,9 +98,21 @@ wxString result; } *w; w = (s_wired_l *)value; - wxFileDialog dlg(MainWin, w->t); - if (dlg.ShowModal() == wxID_OK) - w->result = dlg.GetPath(); + + cout << "bon" << endl << endl; + if (lastOpenDir) + cout << "lastOpenDir == " << lastOpenDir.mb_str() << endl; + else + cout << "no lastOpenDir" << endl; + if (lastOpenDir && wxFileName::DirExists(lastOpenDir)) + dlg = new wxFileDialog(MainWin, w->t, lastOpenDir); + else + dlg = new wxFileDialog(MainWin, w->t); + if (dlg->ShowModal() == wxID_OK) + { + w->result = dlg->GetPath(); + lastOpenDir = dlg->GetDirectory(); + } /* FileLoader *dlg = new FileLoader(MainWin, MainWin_FileLoader, w->t, w->ak, false, w->e); if (dlg->ShowModal() == wxID_OK) @@ -114,9 +130,15 @@ wxString result; } *w; w = (s_wired_l *)value; - wxFileDialog dlg(MainWin, w->t, wxT(""), wxT(""), wxT(""), wxSAVE); - if (dlg.ShowModal() == wxID_OK) - w->result = dlg.GetPath(); + if (lastSaveDir && wxFileName::DirExists(lastSaveDir)) + dlg = new wxFileDialog(MainWin, w->t, lastSaveDir, wxT(""), wxT(""), wxSAVE); + else + dlg = new wxFileDialog(MainWin, w->t, wxT(""), wxT(""), wxT(""), wxSAVE); + if (dlg->ShowModal() == wxID_OK) + { + w->result = dlg->GetPath(); + lastSaveDir = dlg->GetDirectory(); + } /* FileLoader *dlg = new FileLoader(MainWin, MainWin_FileLoader, w->t, false, true, w->e); if (dlg->ShowModal() == wxID_OK) @@ -147,5 +169,6 @@ default: return (-1); } + delete dlg; return (1); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |