/* GfxEntryPanel::cbTileChecked * Called when the 'Tile' checkbox is checked/unchecked *******************************************************************/ void GfxEntryPanel::onTileChanged(wxCommandEvent& e) { choice_offset_type->Enable(!cb_tile->IsChecked()); applyViewType(); }
/* GfxEntryPanel::refresh * Reloads image data and force refresh *******************************************************************/ void GfxEntryPanel::refresh() { // Setup palette theMainWindow->getPaletteChooser()->setGlobalFromArchive(entry->getParent(), Misc::detectPaletteHack(entry)); updateImagePalette(); // Set offset text boxes spin_xoffset->SetValue(getImage()->offset().x); spin_yoffset->SetValue(getImage()->offset().y); // Get some needed menu ids int MENU_GFXEP_PNGOPT = theApp->getAction("pgfx_pngopt")->getWxId(); int MENU_GFXEP_ALPH = theApp->getAction("pgfx_alph")->getWxId(); int MENU_GFXEP_TRNS = theApp->getAction("pgfx_trns")->getWxId(); int MENU_GFXEP_EXTRACT = theApp->getAction("pgfx_extract")->getWxId(); int MENU_GFXEP_TRANSLATE = theApp->getAction("pgfx_translate")->getWxId(); int MENU_ARCHGFX_EXPORTPNG = theApp->getAction("arch_gfx_exportpng")->getWxId(); // Set PNG check menus if (this->entry->getType() != NULL && this->entry->getType()->getFormat() == "img_png") { // Check for alph alph = EntryOperations::getalPhChunk(this->entry); menu_custom->Enable(MENU_GFXEP_ALPH, true); menu_custom->Check(MENU_GFXEP_ALPH, alph); // Check for trns trns = EntryOperations::gettRNSChunk(this->entry); menu_custom->Enable(MENU_GFXEP_TRNS, true); menu_custom->Check(MENU_GFXEP_TRNS, trns); // Disable 'Export as PNG' (it already is :P) menu_custom->Enable(MENU_ARCHGFX_EXPORTPNG, false); // Add 'Optimize PNG' option menu_custom->Enable(MENU_GFXEP_PNGOPT, true); toolbar->enableGroup("PNG", true); } else { menu_custom->Enable(MENU_GFXEP_ALPH, false); menu_custom->Enable(MENU_GFXEP_TRNS, false); menu_custom->Check(MENU_GFXEP_ALPH, false); menu_custom->Check(MENU_GFXEP_TRNS, false); menu_custom->Enable(MENU_GFXEP_PNGOPT, false); menu_custom->Enable(MENU_ARCHGFX_EXPORTPNG, true); toolbar->enableGroup("PNG", false); } // Set multi-image format stuff thingies cur_index = getImage()->getIndex(); if (getImage()->getSize() > 1) menu_custom->Enable(MENU_GFXEP_EXTRACT, true); else menu_custom->Enable(MENU_GFXEP_EXTRACT, false); text_curimg->SetLabel(S_FMT("Image %d/%d", cur_index+1, getImage()->getSize())); // Update status bar in case image dimensions changed updateStatus(); // Apply offset view type applyViewType(); // Reset display offsets in graphics mode if (gfx_canvas->getViewType() != GFXVIEW_SPRITE) gfx_canvas->resetOffsets(); // Setup custom menu if (getImage()->getType() == RGBA) menu_custom->Enable(MENU_GFXEP_TRANSLATE, false); else menu_custom->Enable(MENU_GFXEP_TRANSLATE, true); // Refresh the canvas gfx_canvas->Refresh(); }
/* GfxEntryPanel::comboOffsetTypeChanged * Called when the 'type' combo box selection is changed *******************************************************************/ void GfxEntryPanel::onOffsetTypeChanged(wxCommandEvent& e) { applyViewType(); }
// ----------------------------------------------------------------------------- // Reloads image data and force refresh // ----------------------------------------------------------------------------- void GfxEntryPanel::refresh() { // Setup palette theMainWindow->paletteChooser()->setGlobalFromArchive(entry_->parent(), Misc::detectPaletteHack(entry_)); updateImagePalette(); // Set offset text boxes spin_xoffset_->SetValue(image()->offset().x); spin_yoffset_->SetValue(image()->offset().y); // Get some needed menu ids int menu_gfxep_pngopt = SAction::fromId("pgfx_pngopt")->wxId(); int menu_gfxep_alph = SAction::fromId("pgfx_alph")->wxId(); int menu_gfxep_trns = SAction::fromId("pgfx_trns")->wxId(); int menu_gfxep_extract = SAction::fromId("pgfx_extract")->wxId(); int menu_gfxep_translate = SAction::fromId("pgfx_remap")->wxId(); int menu_archgfx_exportpng = SAction::fromId("arch_gfx_exportpng")->wxId(); // Set PNG check menus if (this->entry_->type() != nullptr && this->entry_->type()->formatId() == "img_png") { // Check for alph alph_ = EntryOperations::getalPhChunk(this->entry_); menu_custom_->Enable(menu_gfxep_alph, true); menu_custom_->Check(menu_gfxep_alph, alph_); // Check for trns trns_ = EntryOperations::gettRNSChunk(this->entry_); menu_custom_->Enable(menu_gfxep_trns, true); menu_custom_->Check(menu_gfxep_trns, trns_); // Disable 'Export as PNG' (it already is :P) menu_custom_->Enable(menu_archgfx_exportpng, false); // Add 'Optimize PNG' option menu_custom_->Enable(menu_gfxep_pngopt, true); toolbar_->enableGroup("PNG", true); } else { menu_custom_->Enable(menu_gfxep_alph, false); menu_custom_->Enable(menu_gfxep_trns, false); menu_custom_->Check(menu_gfxep_alph, false); menu_custom_->Check(menu_gfxep_trns, false); menu_custom_->Enable(menu_gfxep_pngopt, false); menu_custom_->Enable(menu_archgfx_exportpng, true); toolbar_->enableGroup("PNG", false); } // Set multi-image format stuff thingies cur_index_ = image()->index(); if (image()->size() > 1) menu_custom_->Enable(menu_gfxep_extract, true); else menu_custom_->Enable(menu_gfxep_extract, false); text_curimg_->SetLabel(wxString::Format("Image %d/%d", cur_index_ + 1, image()->size())); // Update status bar in case image dimensions changed updateStatus(); // Apply offset view type applyViewType(); // Reset display offsets in graphics mode if (gfx_canvas_->viewType() != GfxCanvas::View::Sprite) gfx_canvas_->resetOffsets(); // Setup custom menu if (image()->type() == SImage::Type::RGBA) menu_custom_->Enable(menu_gfxep_translate, false); else menu_custom_->Enable(menu_gfxep_translate, true); // Refresh the canvas gfx_canvas_->Refresh(); }