/* ScriptEditorPanel::ScriptEditorPanel * ScriptEditorPanel class constructor *******************************************************************/ ScriptEditorPanel::ScriptEditorPanel(wxWindow* parent) : wxPanel(parent, -1) { // Init variables entry_script = new ArchiveEntry(); entry_compiled = new ArchiveEntry(); // Setup sizer wxBoxSizer* sizer = new wxBoxSizer(wxVERTICAL); SetSizer(sizer); // Toolbar SToolBar* toolbar = new SToolBar(this); sizer->Add(toolbar, 0, wxEXPAND); wxArrayString actions; actions.Add("mapw_script_save"); actions.Add("mapw_script_compile"); actions.Add("mapw_script_jumpto"); actions.Add("mapw_script_togglelanguage"); toolbar->addActionGroup("Scripts", actions); // Add text editor wxBoxSizer* hbox = new wxBoxSizer(wxHORIZONTAL); sizer->Add(hbox, 1, wxEXPAND); text_editor = new TextEditor(this, -1); hbox->Add(text_editor, 1, wxEXPAND|wxALL, 4); // Set language string lang = theGameConfiguration->scriptLanguage(); if (S_CMPNOCASE(lang, "acs_hexen")) { text_editor->setLanguage(TextLanguage::getLanguage("acs")); entry_script->setName("SCRIPTS"); entry_compiled->setName("BEHAVIOR"); } else if (S_CMPNOCASE(lang, "acs_zdoom")) { text_editor->setLanguage(TextLanguage::getLanguage("acs_z")); entry_script->setName("SCRIPTS"); entry_compiled->setName("BEHAVIOR"); } // Add function/constants list list_words = new wxTreeListCtrl(this, -1); list_words->SetInitialSize(wxSize(200, -10)); hbox->Add(list_words, 0, wxEXPAND|wxALL, 4); populateWordList(); list_words->Show(script_show_language_list); // Bind events list_words->Bind(wxEVT_TREELIST_ITEM_ACTIVATED, &ScriptEditorPanel::onWordListActivate, this); }
// ----------------------------------------------------------------------------- // ScriptEditorPanel class constructor // ----------------------------------------------------------------------------- ScriptEditorPanel::ScriptEditorPanel(wxWindow* parent) : wxPanel(parent, -1), entry_script_{ new ArchiveEntry() }, entry_compiled_{ new ArchiveEntry() } { // Setup sizer auto sizer = new wxBoxSizer(wxVERTICAL); SetSizer(sizer); // Toolbar auto toolbar = new SToolBar(this); sizer->Add(toolbar, 0, wxEXPAND); wxArrayString actions; actions.Add("mapw_script_save"); actions.Add("mapw_script_compile"); actions.Add("mapw_script_togglelanguage"); toolbar->addActionGroup("Scripts", actions); // Jump To toolbar group auto group_jump_to = new SToolBarGroup(toolbar, "Jump To", true); choice_jump_to_ = new wxChoice(group_jump_to, -1, wxDefaultPosition, WxUtils::scaledSize(200, -1)); group_jump_to->addCustomControl(choice_jump_to_); toolbar->addGroup(group_jump_to); // Add text editor auto hbox = new wxBoxSizer(wxHORIZONTAL); sizer->Add(hbox, 1, wxEXPAND); auto vbox = new wxBoxSizer(wxVERTICAL); hbox->Add(vbox, 1, wxEXPAND); text_editor_ = new TextEditorCtrl(this, -1); text_editor_->setJumpToControl(choice_jump_to_); vbox->Add(text_editor_, 1, wxEXPAND | wxALL, UI::pad()); // Set language wxString lang = Game::configuration().scriptLanguage(); if (S_CMPNOCASE(lang, "acs_hexen")) { text_editor_->setLanguage(TextLanguage::fromId("acs")); entry_script_->setName("SCRIPTS"); entry_compiled_->setName("BEHAVIOR"); } else if (S_CMPNOCASE(lang, "acs_zdoom")) { text_editor_->setLanguage(TextLanguage::fromId("acs_z")); entry_script_->setName("SCRIPTS"); entry_compiled_->setName("BEHAVIOR"); } // Add Find+Replace panel panel_fr_ = new FindReplacePanel(this, *text_editor_); text_editor_->setFindReplacePanel(panel_fr_); vbox->Add(panel_fr_, 0, wxEXPAND | wxALL, UI::pad()); panel_fr_->Hide(); // Add function/constants list list_words_ = new wxTreeListCtrl(this, -1); list_words_->SetInitialSize(WxUtils::scaledSize(200, -10)); hbox->Add(list_words_, 0, wxEXPAND | wxALL, UI::pad()); populateWordList(); list_words_->Show(script_show_language_list); // Bind events list_words_->Bind(wxEVT_TREELIST_ITEM_ACTIVATED, &ScriptEditorPanel::onWordListActivate, this); }