00001 // $Id: jogshuttle.h,v 1.12 2007/02/20 06:32:05 ddennedy Exp $ 00002 00003 /* 00004 * Copyright (C) 2001 Tomoaki Hayasaka <hayasakas@postman.riken.go.jp> 00005 * Copyright (C) 2001-2007 Dan Dennedy <dan@dennedy.org> 00006 * 00007 * This program is free software; you can redistribute it and/or modify 00008 * it under the terms of the GNU General Public License as published by 00009 * the Free Software Foundation; either version 2 of the License, or 00010 * (at your option) any later version. 00011 * 00012 * This program is distributed in the hope that it will be useful, 00013 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00015 * GNU General Public License for more details. 00016 * 00017 * You should have received a copy of the GNU General Public License 00018 * along with this program; if not, write to the Free Software Foundation, 00019 * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 00020 */ 00021 00022 #ifndef JOGSHUTTLE_H 00023 #define JOGSHUTTLE_H 00024 00025 #ifdef HAVE_CONFIG_H 00026 #include <config.h> 00027 #endif 00028 00029 #include <gtk/gtk.h> 00030 #include "mediactrl.h" 00031 00038 typedef void ( *JogShuttleCallback ) ( void *, unsigned short, unsigned short ); 00039 00049 class JogShuttle 00050 { 00051 private: 00053 static JogShuttle *_instance; 00055 JogShuttleCallback _callback; 00057 void * _callbackdata; 00058 00059 protected: 00060 friend void JogShuttle_inputCallback( gpointer data, gint source, 00061 GdkInputCondition condition ); 00062 void inputCallback( gint source, GdkInputCondition condition ); 00063 JogShuttle(); 00064 00065 public: 00066 ~JogShuttle(); 00067 bool start(); 00068 void stop(); 00069 static JogShuttle &getInstance(); 00070 void registerCallback( void * user, JogShuttleCallback callback ); 00071 void deregisterCallback(); 00072 struct media_ctrl_key *getKeyset(); 00073 00074 private: 00075 void jog( int dir ); 00076 void shuttle( int angle ); 00077 void button( struct media_ctrl_event * ); 00078 void button_old( int code ); 00079 00080 struct media_ctrl _ctrl; 00081 int input_; 00082 gint monitorTag_; 00083 00084 /* Used to keep track of "modifier" keys - only the buttons 00085 can be used, only the code is used */ 00086 unsigned short _modifier_code; 00087 media_ctrl_key *_modifier; 00088 }; 00089 00090 #endif
1.4.2