#include "cookbook.h" CookBookEditor::CookBookEditor(wxWindow* parent,Cookbook& ModBook,bool DestroyBook) : wxDialog(parent, ID_CookBookEditor, _("CookBook Editor"), wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE, _("CookBookEditor")), ModBook(ModBook), DestroyBook(DestroyBook) { Main = new wxBoxSizer(wxVERTICAL); MainPanels = new wxNotebook(this, ID_MainPanels, wxDefaultPosition, wxDefaultSize, 0, _T("MainPanels")); General = new wxPanel(MainPanels, ID_General, wxDefaultPosition, wxDefaultSize, 0, _T("General")); GeneralMainSizer = new wxBoxSizer(wxHORIZONTAL); TitleVars = new wxBoxSizer(wxVERTICAL); NameSet = new wxBoxSizer(wxHORIZONTAL); NameLabel = new wxStaticText(General, ID_NameLabel, _("Name"), wxDefaultPosition, wxDefaultSize, 0, _T("NameLabel")); Name = new wxTextCtrl(General, ID_Name, _(""), wxDefaultPosition, wxDefaultSize, 0, ModBook.name, _T("Name")); AuthorSet = new wxBoxSizer(wxHORIZONTAL); AuthorLabel = new wxStaticText(General, ID_AuthorLabel, _("Author"), wxDefaultPosition, wxDefaultSize, 0, _T("AuthorLabel")); Author = new wxTextCtrl(General, ID_Author, _(""), wxDefaultPosition, wxDefaultSize, 0, ModBook.author, _T("Author")); SubHeadingSet = new wxBoxSizer(wxHORIZONTAL); SubHeadingLabel = new wxStaticText(General, ID_SubHeadingLabel, _("Sub Heading"), wxDefaultPosition, wxDefaultSize, 0, _T("SubHeadingLabel")); SubHeading = new wxTextCtrl(General, ID_SubHeading, _(""), wxDefaultPosition, wxDefaultSize, 0, ModBook.subheading, _T("SubHeading")); DescriptionLabel = new wxStaticText(General, ID_DescriptionLabel, _("Description"), wxDefaultPosition, wxDefaultSize, 0, _T("DescriptionLabel")); Description = new wxTextCtrl(General, ID_Description, _(""), wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE, ModBook.description, _T("Description")); ConclusionVars = new wxBoxSizer(wxVERTICAL); ConclusionLabel = new wxStaticText(General, ID_ConclusionLabel, _("Conclusion"), wxDefaultPosition, wxDefaultSize, wxALIGN_CENTRE, _T("ConclusionLabel")); ConclusionTitleSet = new wxBoxSizer(wxHORIZONTAL); ConclusionTitleLabel = new wxStaticText(General, ID_ConclusionTitleLabel, _("Conclusion Title"), wxDefaultPosition, wxDefaultSize, 0, _T("ConclusionTitleLabel")); ConclusionTitle = new wxTextCtrl(General, ID_ConclusionTitle, _(""), wxDefaultPosition, wxDefaultSize, 0, ModBook.conclusion_heading, _T("ConclusionTitle")); ConclusionBody = new wxTextCtrl(General, ID_ConclusionBody, _(""), wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE, ModBook.conclusion_body, _T("ConclusionBody")); Sections = new wxPanel(MainPanels, ID_Sections, wxDefaultPosition, wxDefaultSize, 0, _T("Sections")); SectionSizer = new wxBoxSizer(wxVERTICAL); wxString Strings_SectionList[0] = {}; SectionList = new wxListBox(Sections, ID_SectionList, wxDefaultPosition, wxDefaultSize, 0, Strings_SectionList, 0, wxDefaultValidator, _T(""), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("SectionList")); SectionButtonSizer1 = new wxBoxSizer(wxHORIZONTAL); NewSection = new wxButton(Sections, ID_NewSection, _("New Section"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("NewSection")); EditSection = new wxButton(Sections, ID_EditSection, _("Edit Section"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("EditSection")); RemoveSection = new wxButton(Sections, ID_RemoveSection, _("Remove Section"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("RemoveSection")); SectionButtonSizer2 = new wxBoxSizer(wxHORIZONTAL); MoveSectionUp = new wxButton(Sections, ID_MoveSectionUp, _("Move Section Up"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("MoveSectionUp")); MoveSectionDown = new wxButton(Sections, ID_MoveSectionDown, _("Move Section Down"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("MoveSectionDown")); SectionEditSection = new wxPanel(MainPanels, ID_SectionEditSection, wxDefaultPosition, wxDefaultSize, 0, _T("SectionEditSection")); SectionEditSizer = new wxBoxSizer(wxVERTICAL); SectionEditUnder = new wxBoxSizer(wxHORIZONTAL); SectionEditColumnA = new wxBoxSizer(wxVERTICAL); SectionNameSet = new wxBoxSizer(wxHORIZONTAL); SectionNameLabel = new wxStaticText(SectionEditSection, ID_SectionNameLabel, _("Section Name"), wxDefaultPosition, wxDefaultSize, 0, _T("SectionNameLabel")); SectionName = new wxTextCtrl(SectionEditSection, ID_SectionName, _(""), wxDefaultPosition, wxDefaultSize, 0, modsec.name, _T("SectionName")); SectionCatagorySizer = new wxBoxSizer(wxHORIZONTAL); SectionChangeCatagory = new wxButton(SectionEditSection, ID_SectionChangeCatagory, _("Change Catagory"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("SectionChangeCatagory")); SectionCurrentCatagory = new wxTextCtrl(SectionEditSection, ID_SectionCurrentCatagory, _(""), wxDefaultPosition, wxDefaultSize, wxTE_READONLY, wxDefaultValidator, _T("SectionCurrentCatagory")); SectionDescriptionLabel = new wxStaticText(SectionEditSection, ID_SectionDescriptionLabel, _("Description:"), wxDefaultPosition, wxDefaultSize, 0, _T("SectionDescriptionLabel")); SectionDescription = new wxTextCtrl(SectionEditSection, ID_SectionDescription, _(""), wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE, modsec.description, _T("SectionDescription")); SectionEditColumnB = new wxBoxSizer(wxVERTICAL); SectionAuthorSet = new wxBoxSizer(wxHORIZONTAL); SectionAuthorLabel = new wxStaticText(SectionEditSection, ID_SectionAuthorLabel, _("Author"), wxDefaultPosition, wxDefaultSize, 0, _T("SectionAuthorLabel")); SectionAuthor = new wxTextCtrl(SectionEditSection, ID_SectionAuthor, _(""), wxDefaultPosition, wxDefaultSize, 0, modsec.author, _T("SectionAuthor")); SectionConclusionLabel = new wxStaticText(SectionEditSection, ID_SectionConclusionLabel, _("Conclusion Or Finishing Notes"), wxDefaultPosition, wxDefaultSize, 0, _T("SectionConclusionLabel")); SectionConclusion = new wxTextCtrl(SectionEditSection, ID_SectionConclusion, _(""), wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE, modsec.conclusion, _T("SectionConclusion")); SectionRecipeSizer = new wxBoxSizer(wxHORIZONTAL); SectionAvailableRecipeSet = new wxBoxSizer(wxVERTICAL); SectionAvailableRecipeLabel = new wxStaticText(SectionEditSection, ID_SectionAvailableRecipeLabel, _("Available Recipes"), wxDefaultPosition, wxDefaultSize, 0, _T("SectionAvailableRecipeLabel")); wxString Strings_SectionAvailableRecipes[0] = {}; SectionAvailableRecipes = new wxListBox(SectionEditSection, ID_SectionAvailableRecipes, wxDefaultPosition, wxDefaultSize, 0, Strings_SectionAvailableRecipes, 0, wxDefaultValidator, _T(""), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("SectionAvailableRecipes")); SectionRecipeButtonsSizer = new wxBoxSizer(wxVERTICAL); SectionAddRecipe = new wxButton(SectionEditSection, ID_SectionAddRecipe, _("Add"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("SectionAddRecipe")); SectionRemoveRecipe = new wxButton(SectionEditSection, ID_SectionRemoveRecipe, _("Remove"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("SectionRemoveRecipe")); SectionMoveRecipeUp = new wxButton(SectionEditSection, ID_SectionMoveRecipeUp, _("Move Up"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("SectionMoveRecipeUp")); SectionMoveRecipeDown = new wxButton(SectionEditSection, ID_SectionMoveRecipeDown, _("Move Down"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("SectionMoveRecipeDown")); SectionChosenRecipesSet = new wxBoxSizer(wxVERTICAL); SectionChosenRecipesLabel = new wxStaticText(SectionEditSection, ID_SectionChosenRecipesLabel, _("Chosen Recipes"), wxDefaultPosition, wxDefaultSize, 0, _T("SectionChosenRecipesLabel")); wxString Strings_SectionChosenRecipes[0] = {}; SectionChosenRecipes = new wxListBox(SectionEditSection, ID_SectionChosenRecipes, wxDefaultPosition, wxDefaultSize, 0, Strings_SectionChosenRecipes, 0, wxDefaultValidator, _T(""), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("SectionChosenRecipes")); BottomButtons = new wxBoxSizer(wxHORIZONTAL); Save = new wxButton(this, ID_Save, _("Save"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("Save")); Load = new wxButton(this, ID_Load, _("Load"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("Load")); Close = new wxButton(this, ID_Close, _("Close"), wxDefaultPosition, wxDefaultSize, 0, wxDefaultValidator, _T("Close")); this->SetSizer(Main); Main->Add(MainPanels, wxALL, 4); MainPanels->AddPage(General); General->SetSizer(GeneralMainSizer); GeneralMainSizer->Add(TitleVars, wxEXPAND, 4); TitleVars->Add(NameSet, wxEXPAND, 4); NameSet->Add(NameLabel, wxALL, 4); NameSet->Add(Name, wxALL|wxEXPAND, 4); TitleVars->Add(AuthorSet, wxEXPAND, 4); AuthorSet->Add(AuthorLabel, wxALL, 4); AuthorSet->Add(Author, wxALL|wxEXPAND, 4); TitleVars->Add(SubHeadingSet, wxEXPAND, 4); SubHeadingSet->Add(SubHeadingLabel, wxALL, 4); SubHeadingSet->Add(SubHeading, wxALL|wxEXPAND, 4); TitleVars->Add(DescriptionLabel, wxALL, 4); TitleVars->Add(Description, wxALL|wxEXPAND, 4); GeneralMainSizer->Add(ConclusionVars, wxEXPAND, 4); ConclusionVars->Add(ConclusionLabel, wxALL|wxEXPAND, 4); ConclusionVars->Add(ConclusionTitleSet, wxEXPAND, 4); ConclusionTitleSet->Add(ConclusionTitleLabel, wxALL, 4); ConclusionTitleSet->Add(ConclusionTitle, wxALL|wxEXPAND, 4); ConclusionVars->Add(ConclusionBody, wxALL|wxEXPAND, 4); MainPanels->AddPage(Sections); Sections->SetSizer(SectionSizer); SectionSizer->Add(SectionList, wxEXPAND|wxALL, 4); SectionSizer->Add(SectionButtonSizer1, wxEXPAND, 4); SectionButtonSizer1->Add(NewSection, wxALL, 4); SectionButtonSizer1->Add(EditSection, wxALL, 4); SectionButtonSizer1->Add(RemoveSection, wxALL, 4); SectionSizer->Add(SectionButtonSizer2, wxEXPAND, 4); SectionButtonSizer2->Add(MoveSectionUp, wxALL, 4); SectionButtonSizer2->Add(MoveSectionDown, wxALL, 4); MainPanels->AddPage(SectionEditSection); SectionEditSection->SetSizer(SectionEditSizer); SectionEditSizer->Add(SectionEditUnder, wxALL, 4); SectionEditUnder->Add(SectionEditColumnA, wxALL, 4); SectionEditColumnA->Add(SectionNameSet, wxEXPAND, 4); SectionNameSet->Add(SectionNameLabel, wxALL, 4); SectionNameSet->Add(SectionName, wxALL|wxEXPAND, 4); SectionEditColumnA->Add(SectionCatagorySizer, wxEXPAND, 4); SectionCatagorySizer->Add(SectionChangeCatagory, wxALL, 4); SectionCatagorySizer->Add(SectionCurrentCatagory, wxALL, 4); SectionEditColumnA->Add(SectionDescriptionLabel, wxALL, 4); SectionEditColumnA->Add(SectionDescription, wxEXPAND|wxALL, 4); SectionEditUnder->Add(SectionEditColumnB, wxEXPAND, 4); SectionEditColumnB->Add(SectionAuthorSet, wxEXPAND, 4); SectionAuthorSet->Add(SectionAuthorLabel, wxALL, 4); SectionAuthorSet->Add(SectionAuthor, wxEXPAND|wxALL, 4); SectionEditColumnB->Add(SectionConclusionLabel, wxALL, 4); SectionEditColumnB->Add(SectionConclusion, wxEXPAND|wxALL, 4); SectionEditSizer->Add(SectionRecipeSizer, wxALL, 4); SectionRecipeSizer->Add(SectionAvailableRecipeSet, wxEXPAND, 4); SectionAvailableRecipeSet->Add(SectionAvailableRecipeLabel, wxALL, 4); SectionAvailableRecipeSet->Add(SectionAvailableRecipes, wxEXPAND|wxALL, 4); SectionRecipeSizer->Add(SectionRecipeButtonsSizer, wxALL, 4); SectionRecipeButtonsSizer->Add(SectionAddRecipe, wxALL, 4); SectionRecipeButtonsSizer->Add(SectionRemoveRecipe, wxALL, 4); SectionRecipeButtonsSizer->Add(SectionMoveRecipeUp, wxALL, 4); SectionRecipeButtonsSizer->Add(SectionMoveRecipeDown, wxALL, 4); SectionRecipeSizer->Add(SectionChosenRecipesSet, wxEXPAND, 4); SectionChosenRecipesSet->Add(SectionChosenRecipesLabel, wxALL, 4); SectionChosenRecipesSet->Add(SectionChosenRecipes, wxEXPAND|wxALL, 4); Main->Add(BottomButtons, wxALL, 4); BottomButtons->Add(Save, wxALL, 4); BottomButtons->Add(Load, wxALL, 4); BottomButtons->Add(Close, wxALL, 4); Main->SetSizeHints(this); } void CookBookEditor::OnCloseCookBookEditor(wxCloseEvent&) { this->Destroy(); } wxString CookBookEditor::GetValueOfName() { return Name->GetValue(); } void CookBookEditor::SetValueOfName(wxString new_value) { Name->SetValue(new_value); } wxString CookBookEditor::GetValueOfAuthor() { return Author->GetValue(); } void CookBookEditor::SetValueOfAuthor(wxString new_value) { Author->SetValue(new_value); } wxString CookBookEditor::GetValueOfSubHeading() { return SubHeading->GetValue(); } void CookBookEditor::SetValueOfSubHeading(wxString new_value) { SubHeading->SetValue(new_value); } wxString CookBookEditor::GetValueOfDescription() { return Description->GetValue(); } void CookBookEditor::SetValueOfDescription(wxString new_value) { Description->SetValue(new_value); } wxString CookBookEditor::GetValueOfConclusionTitle() { return ConclusionTitle->GetValue(); } void CookBookEditor::SetValueOfConclusionTitle(wxString new_value) { ConclusionTitle->SetValue(new_value); } wxString CookBookEditor::GetValueOfConclusionBody() { return ConclusionBody->GetValue(); } void CookBookEditor::SetValueOfConclusionBody(wxString new_value) { ConclusionBody->SetValue(new_value); } int CookBookEditor::GetSelectionOfSectionList() { return SectionList->GetSelection(); } void CookBookEditor::SetValueOfSectionList(int new_value) { SectionList->SetValue(new_value); } wxString CookBookEditor::GetValueOfSectionName() { return SectionName->GetValue(); } void CookBookEditor::SetValueOfSectionName(wxString new_value) { SectionName->SetValue(new_value); } wxString CookBookEditor::GetValueOfSectionCurrentCatagory() { return SectionCurrentCatagory->GetValue(); } void CookBookEditor::SetValueOfSectionCurrentCatagory(wxString new_value) { SectionCurrentCatagory->SetValue(new_value); } wxString CookBookEditor::GetValueOfSectionDescription() { return SectionDescription->GetValue(); } void CookBookEditor::SetValueOfSectionDescription(wxString new_value) { SectionDescription->SetValue(new_value); } wxString CookBookEditor::GetValueOfSectionAuthor() { return SectionAuthor->GetValue(); } void CookBookEditor::SetValueOfSectionAuthor(wxString new_value) { SectionAuthor->SetValue(new_value); } wxString CookBookEditor::GetValueOfSectionConclusion() { return SectionConclusion->GetValue(); } void CookBookEditor::SetValueOfSectionConclusion(wxString new_value) { SectionConclusion->SetValue(new_value); } int CookBookEditor::GetSelectionOfSectionAvailableRecipes() { return SectionAvailableRecipes->GetSelection(); } void CookBookEditor::SetValueOfSectionAvailableRecipes(int new_value) { SectionAvailableRecipes->SetValue(new_value); } int CookBookEditor::GetSelectionOfSectionChosenRecipes() { return SectionChosenRecipes->GetSelection(); } void CookBookEditor::SetValueOfSectionChosenRecipes(int new_value) { SectionChosenRecipes->SetValue(new_value); } void CookBookEditor::OnPageChangedMainPanels(wxCommandEvent&) { } void CookBookEditor::OnPageChangingMainPanels(wxCommandEvent&) { } void CookBookEditor::OnDoubleClickSectionList(wxCommandEvent&) { } void CookBookEditor::OnClickNewSection(wxCommandEvent&) { } void CookBookEditor::OnClickEditSection(wxCommandEvent&) { } void CookBookEditor::OnClickRemoveSection(wxCommandEvent&) { } void CookBookEditor::OnClickMoveSectionUp(wxCommandEvent&) { } void CookBookEditor::OnClickMoveSectionDown(wxCommandEvent&) { } void CookBookEditor::OnClickSectionChangeCatagory(wxCommandEvent&) { } void CookBookEditor::OnClickSectionAddRecipe(wxCommandEvent&) { } void CookBookEditor::OnClickSectionRemoveRecipe(wxCommandEvent&) { } void CookBookEditor::OnClickSectionMoveRecipeUp(wxCommandEvent&) { } void CookBookEditor::OnClickSectionMoveRecipeDown(wxCommandEvent&) { } void CookBookEditor::OnClickSave(wxCommandEvent&) { } void CookBookEditor::OnClickLoad(wxCommandEvent&) { } void CookBookEditor::OnClickClose(wxCommandEvent&) { } BEGIN_EVENT_TABLE(CookBookEditor,wxDialog) EVT_CLOSE(CookBookEditor::OnCloseCookBookEditor) EVT_NOTEBOOK_PAGE_CHANGED(ID_MainPanels,CookBookEditor::OnPageChangedMainPanels) EVT_NOTEBOOK_PAGE_CHANGING(ID_MainPanels,CookBookEditor::OnPageChangingMainPanels) EVT_LISTBOX_DCLICK(ID_SectionList,CookBookEditor::OnDoubleClickSectionList) EVT_BUTTON(ID_NewSection,CookBookEditor::OnClickNewSection) EVT_BUTTON(ID_EditSection,CookBookEditor::OnClickEditSection) EVT_BUTTON(ID_RemoveSection,CookBookEditor::OnClickRemoveSection) EVT_BUTTON(ID_MoveSectionUp,CookBookEditor::OnClickMoveSectionUp) EVT_BUTTON(ID_MoveSectionDown,CookBookEditor::OnClickMoveSectionDown) EVT_BUTTON(ID_SectionChangeCatagory,CookBookEditor::OnClickSectionChangeCatagory) EVT_BUTTON(ID_SectionAddRecipe,CookBookEditor::OnClickSectionAddRecipe) EVT_BUTTON(ID_SectionRemoveRecipe,CookBookEditor::OnClickSectionRemoveRecipe) EVT_BUTTON(ID_SectionMoveRecipeUp,CookBookEditor::OnClickSectionMoveRecipeUp) EVT_BUTTON(ID_SectionMoveRecipeDown,CookBookEditor::OnClickSectionMoveRecipeDown) EVT_BUTTON(ID_Save,CookBookEditor::OnClickSave) EVT_BUTTON(ID_Load,CookBookEditor::OnClickLoad) EVT_BUTTON(ID_Close,CookBookEditor::OnClickClose) END_EVENT_TABLE()