/* 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::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_togglelanguage"); toolbar->addActionGroup("Scripts", actions); // Jump To toolbar group SToolBarGroup* group_jump_to = new SToolBarGroup(toolbar, "Jump To", true); choice_jump_to = new wxChoice(group_jump_to, -1, wxDefaultPosition, wxSize(200, -1)); group_jump_to->addCustomControl(choice_jump_to); toolbar->addGroup(group_jump_to); // Add text editor wxBoxSizer* hbox = new wxBoxSizer(wxHORIZONTAL); sizer->Add(hbox, 1, wxEXPAND); wxBoxSizer* vbox = new wxBoxSizer(wxVERTICAL); hbox->Add(vbox, 1, wxEXPAND); text_editor = new TextEditor(this, -1); text_editor->setJumpToControl(choice_jump_to); vbox->Add(text_editor, 1, wxEXPAND|wxALL, 4); // Set language string lang = Game::configuration().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 Find+Replace panel panel_fr = new FindReplacePanel(this, text_editor); text_editor->setFindReplacePanel(panel_fr); vbox->Add(panel_fr, 0, wxEXPAND | wxALL, 4); panel_fr->Hide(); // 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); }