|
Lines 517-522
Link Here
|
| 517 |
mFilterIndex = 0; |
517 |
mFilterIndex = 0; |
| 518 |
} |
518 |
} |
| 519 |
maskString.RemoveLast(); |
519 |
maskString.RemoveLast(); |
|
|
520 |
wxString defext = mPlugins[mFormat]->GetExtension(mSubFormat).Lower(); |
| 520 |
|
521 |
|
| 521 |
//Bug 1304: Set a default path if none was given. For Export. |
522 |
//Bug 1304: Set a default path if none was given. For Export. |
| 522 |
#ifdef __WIN32__ |
523 |
#ifdef __WIN32__ |
|
Lines 532-568
Link Here
|
| 532 |
mFilename.SetPath(gPrefs->Read(wxT("/Export/Path"), wxT("~/Documents"))); |
533 |
mFilename.SetPath(gPrefs->Read(wxT("/Export/Path"), wxT("~/Documents"))); |
| 533 |
#endif |
534 |
#endif |
| 534 |
mFilename.SetName(mProject->GetName()); |
535 |
mFilename.SetName(mProject->GetName()); |
|
|
536 |
if (mFilename.GetName().empty()) |
| 537 |
mFilename.SetName(_("untitled")); |
| 535 |
while (true) { |
538 |
while (true) { |
| 536 |
// Must reset each iteration |
539 |
// Must reset each iteration |
| 537 |
mBook = NULL; |
540 |
mBook = NULL; |
| 538 |
|
541 |
|
| 539 |
FileDialog fd(mProject, |
542 |
{ |
| 540 |
mFileDialogTitle, |
543 |
auto useFileName = mFilename; |
| 541 |
mFilename.GetPath(), |
544 |
if (!useFileName.HasExt()) |
| 542 |
mFilename.GetFullName(), |
545 |
useFileName.SetExt(defext); |
| 543 |
maskString, |
546 |
FileDialog fd(mProject, |
| 544 |
wxFD_SAVE | wxRESIZE_BORDER); |
547 |
mFileDialogTitle, |
| 545 |
mDialog = &fd; |
548 |
mFilename.GetPath(), |
| 546 |
mDialog->PushEventHandler(this); |
549 |
useFileName.GetFullName(), |
| 547 |
|
550 |
maskString, |
| 548 |
fd.SetUserPaneCreator(CreateUserPaneCallback, (wxUIntPtr) this); |
551 |
wxFD_SAVE | wxRESIZE_BORDER); |
| 549 |
fd.SetFilterIndex(mFilterIndex); |
552 |
mDialog = &fd; |
|
|
553 |
mDialog->PushEventHandler(this); |
| 554 |
|
| 555 |
fd.SetUserPaneCreator(CreateUserPaneCallback, (wxUIntPtr) this); |
| 556 |
fd.SetFilterIndex(mFilterIndex); |
| 550 |
|
557 |
|
| 551 |
int result = fd.ShowModal(); |
558 |
int result = fd.ShowModal(); |
| 552 |
|
559 |
|
| 553 |
mDialog->PopEventHandler(); |
560 |
mDialog->PopEventHandler(); |
| 554 |
|
561 |
|
| 555 |
if (result == wxID_CANCEL) { |
562 |
if (result == wxID_CANCEL) { |
| 556 |
return false; |
563 |
return false; |
| 557 |
} |
564 |
} |
| 558 |
|
565 |
|
| 559 |
mFilename = fd.GetPath(); |
566 |
mFilename = fd.GetPath(); |
| 560 |
if (mFilename == wxT("")) { |
567 |
if (mFilename == wxT("")) { |
| 561 |
return false; |
568 |
return false; |
| 562 |
} |
569 |
} |
| 563 |
|
570 |
|
| 564 |
mFormat = fd.GetFilterIndex(); |
571 |
mFormat = fd.GetFilterIndex(); |
| 565 |
mFilterIndex = fd.GetFilterIndex(); |
572 |
mFilterIndex = fd.GetFilterIndex(); |
|
|
573 |
} |
| 566 |
|
574 |
|
| 567 |
int c = 0; |
575 |
int c = 0; |
| 568 |
int i = -1; |
576 |
int i = -1; |
|
Lines 581-587
Link Here
|
| 581 |
} |
589 |
} |
| 582 |
|
590 |
|
| 583 |
wxString ext = mFilename.GetExt(); |
591 |
wxString ext = mFilename.GetExt(); |
| 584 |
wxString defext = mPlugins[mFormat]->GetExtension(mSubFormat).Lower(); |
592 |
defext = mPlugins[mFormat]->GetExtension(mSubFormat).Lower(); |
| 585 |
|
593 |
|
| 586 |
// |
594 |
// |
| 587 |
// Check the extension - add the default if it's not there, |
595 |
// Check the extension - add the default if it's not there, |