Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/lintest/myrulib.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKandrashin Denis <mail@lintest.ru>2013-01-22 23:59:07 +0400
committerKandrashin Denis <mail@lintest.ru>2013-01-22 23:59:07 +0400
commitc300f9e2d0a10c391c718e3d0643832caaf08f1f (patch)
tree74143fc39b8905c91fe4b039cdc9e892cb2e3fb2
parent2fa32e45c9cad6cf48e5702988663579be3b5944 (diff)
Fix FbExportDlg error
-rw-r--r--sources/MyRuLib/dialogs/FbExportDlg.cpp28
-rw-r--r--sources/MyRuLib/dialogs/FbExportDlg.h8
2 files changed, 20 insertions, 16 deletions
diff --git a/sources/MyRuLib/dialogs/FbExportDlg.cpp b/sources/MyRuLib/dialogs/FbExportDlg.cpp
index 88330170..39a83e14 100644
--- a/sources/MyRuLib/dialogs/FbExportDlg.cpp
+++ b/sources/MyRuLib/dialogs/FbExportDlg.cpp
@@ -14,17 +14,19 @@
BEGIN_EVENT_TABLE( FbExportDlg, wxDialog )
EVT_BUTTON( ID_DIR_TXT, FbExportDlg::OnSelectDir )
- EVT_CHOICE( wxID_ANY, FbExportDlg::OnChangeFormat )
+ EVT_CHOICE( ID_FORMAT, FbExportDlg::OnChangeFormat )
EVT_CHECKBOX( ID_AUTHOR, FbExportDlg::OnCheckAuthor )
EVT_CHECKBOX( ID_DIR, FbExportDlg::OnChangeFormat )
EVT_CHECKBOX( ID_FILE, FbExportDlg::OnChangeFormat )
+ EVT_COMBOBOX( ID_STRUCT, FbExportDlg::OnCheckAuthor )
EVT_TEXT( ID_STRUCT, FbExportDlg::OnCheckAuthor )
END_EVENT_TABLE()
-FbExportDlg::FbExportDlg( wxWindow* parent, const wxString & selections, int iAuthor) :
+FbExportDlg::FbExportDlg( wxWindow* parent, const wxString & selections, int author) :
FbDialog( parent, wxID_ANY, _("Export to external storage"), wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER ),
m_selections(selections),
- m_author(iAuthor),
+ m_author(author),
+ m_struct(NULL),
m_checkAuthor(NULL)
{
SetSizeHints( wxDefaultSize, wxDefaultSize );
@@ -71,7 +73,7 @@ FbExportDlg::FbExportDlg( wxWindow* parent, const wxString & selections, int iAu
bSizerMain->Add( bSizerTrans, 0, wxEXPAND, 5 );
- if (iAuthor) {
+ if (author) {
m_checkAuthor = new wxCheckBox( this, ID_AUTHOR, _("Use Author (without co-Authors)"));
bSizerMain->Add( m_checkAuthor, 0, wxALL, 5 );
m_checkAuthor->SetValue(1);
@@ -112,7 +114,7 @@ FbExportDlg::FbExportDlg( wxWindow* parent, const wxString & selections, int iAu
LoadFormats();
- m_books->AssignModel(CreateModel());
+ m_books->AssignModel(CreateModel(author, structure));
}
FbExportDlg::~FbExportDlg()
@@ -218,7 +220,7 @@ bool FbExportDlg::ExportBooks()
return true;
}
-bool FbExportDlg::Execute(wxWindow* parent, FbBookPanel * books, int iAuthor)
+bool FbExportDlg::Execute(wxWindow* parent, FbBookPanel * books, int author)
{
wxString selections = books->GetSelected();
@@ -227,20 +229,22 @@ bool FbExportDlg::Execute(wxWindow* parent, FbBookPanel * books, int iAuthor)
return false;
}
- FbExportDlg dlg(parent, selections, iAuthor);
+ FbExportDlg dlg(parent, selections, author);
return (dlg.ShowModal() == wxID_OK) && dlg.ExportBooks();
}
void FbExportDlg::OnCheckAuthor( wxCommandEvent& event )
{
- m_books->AssignModel(CreateModel());
+ if (!m_struct) return;
+ int author = 0;
+ if ( m_checkAuthor && m_checkAuthor->GetValue() ) author = m_author;
+ wxString structure = m_struct->GetValue();
+ m_books->AssignModel(CreateModel(author, structure));
}
-FbModel * FbExportDlg::CreateModel()
+FbModel * FbExportDlg::CreateModel(int author, const wxString &structure)
{
- int author = 0;
- if ( m_checkAuthor && m_checkAuthor->GetValue() ) author = m_author;
- FbExportTreeModel * model = new FbExportTreeModel(m_selections, m_struct->GetValue(), author);
+ FbExportTreeModel * model = new FbExportTreeModel(m_selections, structure, author);
ChangeFormat(model);
model->Create();
return model;
diff --git a/sources/MyRuLib/dialogs/FbExportDlg.h b/sources/MyRuLib/dialogs/FbExportDlg.h
index f620bd15..61c6d643 100644
--- a/sources/MyRuLib/dialogs/FbExportDlg.h
+++ b/sources/MyRuLib/dialogs/FbExportDlg.h
@@ -37,11 +37,11 @@ class FbExportTreeModel;
class FbExportDlg : public FbDialog
{
public:
- FbExportDlg(wxWindow* parent, const wxString & selections, int iAuthor);
+ FbExportDlg(wxWindow* parent, const wxString & selections, int author);
~FbExportDlg();
- static bool Execute(wxWindow* parent, FbBookPanel * books, int iAuthor = 0);
+ static bool Execute(wxWindow* parent, FbBookPanel * books, int author = 0);
private:
- FbModel * CreateModel();
+ FbModel * CreateModel(int author, const wxString &structure);
void FullBySequences(wxTreeItemId root, const wxString &selections, bool bUseLetter);
void FullNoSequences(wxTreeItemId root, const wxString &selections, bool bUseLetter);
wxTreeItemId AppendFolder(const wxTreeItemId &parent, const wxString & name);
@@ -59,7 +59,7 @@ class FbExportDlg : public FbDialog
private:
enum
{
- ID_DIR_TXT = 1000,
+ ID_DIR_TXT = wxID_HIGHEST + 1,
ID_STRUCT,
ID_BOOKS,
ID_FORMAT,