/* TranslationEditorDialog::onPalTargetLeftUp * Called when the left mouse button is released in the target * palette range canvas *******************************************************************/ void TranslationEditorDialog::onPalTargetLeftUp(wxMouseEvent& e) { // Get current translation range TransRange* tr = translation.getRange(list_translations->GetSelection()); // Update its target range if it's a palette translation if (tr && tr->getType() == TRANS_PALETTE) { TransRangePalette* tpr = (TransRangePalette*)tr; if (cb_target_reverse->GetValue()) { tpr->setDEnd(pal_canvas_target->getSelectionStart()); tpr->setDStart(pal_canvas_target->getSelectionEnd()); } else { tpr->setDStart(pal_canvas_target->getSelectionStart()); tpr->setDEnd(pal_canvas_target->getSelectionEnd()); } } // Update UI updateListItem(list_translations->GetSelection()); updatePreviews(); }
/* TranslationEditorDialog::onRBPaletteSelected * Called when the 'palette range' translation type radio button is * selected *******************************************************************/ void TranslationEditorDialog::onRBPaletteSelected(wxCommandEvent& e) { // Swap to target palette panel showPaletteTarget(); // If a range is selected int index = list_translations->GetSelection(); if (index >= 0) { // Remove it translation.removeRange(index); // Recreate it translation.addRange(TRANS_PALETTE, index); TransRangePalette* tr = (TransRangePalette*)translation.getRange(index); // Origin range tr->setOStart(pal_canvas_original->getSelectionStart()); tr->setOEnd(pal_canvas_original->getSelectionEnd()); // Target range if (cb_target_reverse->GetValue()) { tr->setDEnd(pal_canvas_target->getSelectionStart()); tr->setDStart(pal_canvas_target->getSelectionEnd()); } else { tr->setDStart(pal_canvas_target->getSelectionStart()); tr->setDEnd(pal_canvas_target->getSelectionEnd()); } // Update UI updateListItem(index); openRange(index); updatePreviews(); } }