/* Copyright (C) 1999 Southern Gold Development * * 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 "gview.h" gint doDragPic(GtkWidget *widget, GdkEventMotion *event, gpointer data) { sgview *view; gint inX, inY, val; GtkAdjustment *adj; view = (sgview *) data; if ((event->type == GDK_MOTION_NOTIFY) && (view->statCh & 0x04)) { inX = event->x_root; inY = event->y_root; if (inY != view->currY) { adj = gtk_scrolled_window_get_vadjustment(GTK_SCROLLED_WINDOW (view->scr)); val = adj->value; val = val - (inY - view->currY); if (val > adj->upper - adj->page_size) val = adj->upper - adj->page_size; if (val < adj->lower) val = adj->lower; gtk_adjustment_set_value(adj, val); } if (inX != view->currX) { adj = gtk_scrolled_window_get_hadjustment(GTK_SCROLLED_WINDOW (view->scr)); val = adj->value; val = val - (inX - view->currX); if (val > adj->upper - adj->page_size) val = adj->upper - adj->page_size; if (val < adj->lower) val = adj->lower; gtk_adjustment_set_value(adj, val); } view->currX = inX; view->currY = inY; } return FALSE; } gint startDragPic(GtkWidget *widget, GdkEventButton *event, gpointer data) { sgview *view; view = (sgview *) data; switch (event->button) { case 1: if (event->type == GDK_BUTTON_PRESS) { view->statCh = view->statCh | 0x04; view->currX = event->x_root; view->currY = event->y_root; } break; default: if (event->type == GDK_BUTTON_PRESS) popupPic(view, event); break; } return TRUE; } gint stopDragPic(GtkWidget *widget, GdkEventButton *event, gpointer data) { sgview *view; view = (sgview *) data; switch (event->button) { case 1: if (event->type == GDK_BUTTON_RELEASE) view->statCh = view->statCh & 0xfb; break; default: break; } return TRUE; }