X-Git-Url: http://git.cinelerra-gg.org/git/?a=blobdiff_plain;f=cinelerra-5.1%2Fguicast%2Fbcdragwindow.C;h=2eab2e17406d8ce4363a077675aeb8ed4a05e37b;hb=58d99c74e65066486dbebf7e1cb3087e7de1c92b;hp=16a38c4f0014441289155bfccb7566b0daa981e4;hpb=30bdb85eb33a8ee7ba675038a86c6be59c43d7bd;p=goodguy%2Fhistory.git diff --git a/cinelerra-5.1/guicast/bcdragwindow.C b/cinelerra-5.1/guicast/bcdragwindow.C index 16a38c4f..2eab2e17 100644 --- a/cinelerra-5.1/guicast/bcdragwindow.C +++ b/cinelerra-5.1/guicast/bcdragwindow.C @@ -2,21 +2,21 @@ /* * CINELERRA * Copyright (C) 2008 Adam Williams - * + * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * + * */ #include "bcdragwindow.h" @@ -30,12 +30,12 @@ #define DRAG_OFFSET_X 16 #define DRAG_OFFSET_Y 16 -BC_DragWindow::BC_DragWindow(BC_WindowBase *parent_window, - BC_Pixmap *pixmap /*, - int icon_x, +BC_DragWindow::BC_DragWindow(BC_WindowBase *parent_window, + BC_Pixmap *pixmap /*, + int icon_x, int icon_y */) - : BC_Popup(parent_window, -// icon_x, + : BC_Popup(parent_window, +// icon_x, // icon_y, parent_window->get_abs_cursor_x(0) + DRAG_OFFSET_X, parent_window->get_abs_cursor_y(0) + DRAG_OFFSET_Y, @@ -46,6 +46,7 @@ BC_DragWindow::BC_DragWindow(BC_WindowBase *parent_window, pixmap) { temp_frame = 0; + drag_pixmap = 0; // init_x = icon_x; // init_y = icon_y; init_x = parent_window->get_abs_cursor_x(0) + DRAG_OFFSET_X; @@ -59,12 +60,12 @@ BC_DragWindow::BC_DragWindow(BC_WindowBase *parent_window, } -BC_DragWindow::BC_DragWindow(BC_WindowBase *parent_window, - VFrame *frame /*, - int icon_x, +BC_DragWindow::BC_DragWindow(BC_WindowBase *parent_window, + VFrame *frame /*, + int icon_x, int icon_y */) - : BC_Popup(parent_window, -// icon_x, + : BC_Popup(parent_window, +// icon_x, // icon_y, parent_window->get_abs_cursor_x(0) + DRAG_OFFSET_X, parent_window->get_abs_cursor_y(0) + DRAG_OFFSET_Y, @@ -90,19 +91,20 @@ BC_DragWindow::BC_DragWindow(BC_WindowBase *parent_window, BC_DragWindow::~BC_DragWindow() { + delete drag_pixmap; } int BC_DragWindow::get_init_x(BC_WindowBase *parent_window, int icon_x) { int output_x, temp = 0; Window tempwin; - XTranslateCoordinates(parent_window->top_level->display, - parent_window->win, - parent_window->top_level->rootwin, - icon_x, - temp, - &output_x, - &temp, + XTranslateCoordinates(parent_window->top_level->display, + parent_window->win, + parent_window->top_level->rootwin, + icon_x, + temp, + &output_x, + &temp, &tempwin); return output_x; } @@ -111,22 +113,22 @@ int BC_DragWindow::get_init_y(BC_WindowBase *parent_window, int icon_y) { int output_y, temp = 0; Window tempwin; - XTranslateCoordinates(parent_window->top_level->display, - parent_window->win, - parent_window->top_level->rootwin, - temp, - icon_y, - &temp, - &output_y, + XTranslateCoordinates(parent_window->top_level->display, + parent_window->win, + parent_window->top_level->rootwin, + temp, + icon_y, + &temp, + &output_y, &tempwin); return output_y; } int BC_DragWindow::cursor_motion_event() { - reposition_window(get_abs_cursor_x(0) + icon_offset_x, - get_abs_cursor_y(0) + icon_offset_y, - get_w(), + reposition_window(get_abs_cursor_x(0) + icon_offset_x, + get_abs_cursor_y(0) + icon_offset_y, + get_w(), get_h()); flush(); return 1; @@ -157,9 +159,9 @@ int BC_DragWindow::drag_failure_event() int new_x = end_x + (init_x - end_x) * i / 10; int new_y = end_y + (init_y - end_y) * i / 10; - reposition_window(new_x, - new_y, - get_w(), + reposition_window(new_x, + new_y, + get_w(), get_h()); flush(); usleep(1000); @@ -175,7 +177,7 @@ void BC_DragWindow::set_animation(int value) BC_Pixmap *BC_DragWindow::prepare_frame(VFrame *frame, BC_WindowBase *parent_window) { temp_frame = 0; - + if(frame->get_color_model() == BC_RGBA8888) { temp_frame = new VFrame(*frame); @@ -184,15 +186,15 @@ BC_Pixmap *BC_DragWindow::prepare_frame(VFrame *frame, BC_WindowBase *parent_win { temp_frame = new VFrame; temp_frame->set_use_shm(0); - temp_frame->reallocate(0, + temp_frame->reallocate(0, -1, 0, 0, 0, - frame->get_w(), - frame->get_h(), + frame->get_w(), + frame->get_h(), BC_RGBA8888, - -1); + -1); BC_CModels::transfer(temp_frame->get_rows(), frame->get_rows(), 0, 0, 0, 0, 0, 0, @@ -202,11 +204,11 @@ BC_Pixmap *BC_DragWindow::prepare_frame(VFrame *frame, BC_WindowBase *parent_win 0, frame->get_w(), temp_frame->get_w()); } temp_frame->get_rows()[(temp_frame->get_h() / 2)][(temp_frame->get_w() / 2) * 4 + 3] = 0; - my_pixmap = new BC_Pixmap(parent_window, + drag_pixmap = new BC_Pixmap(parent_window, temp_frame, PIXMAP_ALPHA); - return (my_pixmap); + return drag_pixmap; }