Commit 6717e356 authored by twanvl's avatar twanvl

Same card remains selected when reloading templates;

Fixed vertical blends for non-square images
parent 1a2b1b2e
...@@ -39,7 +39,7 @@ void linear_blend(Image& img1, const Image& img2, double x1,double y1, double x2 ...@@ -39,7 +39,7 @@ void linear_blend(Image& img1, const Image& img2, double x1,double y1, double x2
double a = fixed / (sqr(width) * sqr(x1-x2) + sqr(height) * sqr(y1-y2)); double a = fixed / (sqr(width) * sqr(x1-x2) + sqr(height) * sqr(y1-y2));
int xm = to_int( (x2 - x1) * width * a ); int xm = to_int( (x2 - x1) * width * a );
int ym = to_int( (y2 - y1) * height * a ); int ym = to_int( (y2 - y1) * height * a );
int d = to_int( - (x1 * width * xm + y1 * width * ym) ); int d = to_int( - (x1 * width * xm + y1 * height * ym) );
Byte *data1 = img1.GetData(), *data2 = img2.GetData(); Byte *data1 = img1.GetData(), *data2 = img2.GetData();
// blend pixels // blend pixels
......
...@@ -509,9 +509,21 @@ void SetWindow::onFileReload(wxCommandEvent&) { ...@@ -509,9 +509,21 @@ void SetWindow::onFileReload(wxCommandEvent&) {
if (filename.empty()) return; if (filename.empty()) return;
wxBusyCursor busy; wxBusyCursor busy;
settings.write(); // save settings settings.write(); // save settings
// current card
size_t card_pos = 0;
{
vector<CardP>::const_iterator card_it = find(set->cards.begin(), set->cards.end(), current_panel->selectedCard());
if (card_it != set->cards.end()) card_pos = card_it - set->cards.begin();
}
packages.destroy(); // unload all packages packages.destroy(); // unload all packages
settings.read(); // reload settings settings.read(); // reload settings
setSet(import_set(filename)); setSet(import_set(filename));
// reselect card
if (card_pos < set->cards.size()) {
FOR_EACH(p, panels) {
p->selectCard(set->cards[card_pos]);
}
}
} }
void SetWindow::onFileRecent(wxCommandEvent& ev) { void SetWindow::onFileRecent(wxCommandEvent& ev) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment