Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRob Haarsma <phaseIV@zonnet.nl>2003-01-28 02:57:43 +0300
committerRob Haarsma <phaseIV@zonnet.nl>2003-01-28 02:57:43 +0300
commit0a37ede0e789966ce4bee11e58bb3f7ecadd6141 (patch)
tree9f7eb730fac7a3af9f0096fd0399fa4be819b964
parent0df2cdbc2dfe2b257ba8e0322e71d49be71ee11a (diff)
added mousewheel support
-rw-r--r--source/blender/include/mydevice.h2
-rw-r--r--source/blender/src/filesel.c34
-rw-r--r--source/blender/src/ghostwinlay.c14
3 files changed, 50 insertions, 0 deletions
diff --git a/source/blender/include/mydevice.h b/source/blender/include/mydevice.h
index 43e42c8a49a..3bbaafd0c1a 100644
--- a/source/blender/include/mydevice.h
+++ b/source/blender/include/mydevice.h
@@ -45,6 +45,8 @@
#define RIGHTMOUSE 0x003
#define MOUSEX 0x004
#define MOUSEY 0x005
+#define WHEELUPMOUSE 0x00a
+#define WHEELDOWNMOUSE 0x00b
/* timers */
diff --git a/source/blender/src/filesel.c b/source/blender/src/filesel.c
index 60948b8291e..d3bc996c7db 100644
--- a/source/blender/src/filesel.c
+++ b/source/blender/src/filesel.c
@@ -1153,6 +1153,27 @@ static void do_filescroll(SpaceFile *sfile)
}
+static void do_filescrollwheel(SpaceFile *sfile, int move)
+{
+ // by phase
+ int lines, rt;
+
+ calc_file_rcts(sfile);
+
+ lines = (int)(textrct.ymax-textrct.ymin)/FILESEL_DY;
+ rt = lines * sfile->collums;
+
+ if(sfile->totfile > rt) {
+ sfile->ofs+= move;
+ if( sfile->ofs + rt > sfile->totfile + 1)
+ sfile->ofs = sfile->totfile - rt + 1;
+ }
+
+ if(sfile->ofs<0) {
+ sfile->ofs= 0;
+ }
+}
+
void activate_fileselect(int type, char *title, char *file, void (*func)(char *))
{
SpaceFile *sfile;
@@ -1715,6 +1736,19 @@ void winqreadfilespace(unsigned short event, short val, char ascii)
do_filesel_buttons(val, sfile);
break;
+ case WHEELDOWNMOUSE:
+ do_filescrollwheel(sfile, 3); //U.wheellinescroll);
+ act= find_active_file(sfile, mval[0], mval[1]);
+ set_active_file(sfile, act);
+ do_draw= 1;
+ break;
+ case WHEELUPMOUSE:
+ do_filescrollwheel(sfile, -3); //U.wheellinescroll);
+ act= find_active_file(sfile, mval[0], mval[1]);
+ set_active_file(sfile, act);
+ do_draw= 1;
+ break;
+
case LEFTMOUSE:
case MIDDLEMOUSE:
if(mval[0]>scrollrct.xmin && mval[0]<scrollrct.xmax && mval[1]>scrollrct.ymin && mval[1]<scrollrct.ymax) {
diff --git a/source/blender/src/ghostwinlay.c b/source/blender/src/ghostwinlay.c
index a8863816a01..2d46de95538 100644
--- a/source/blender/src/ghostwinlay.c
+++ b/source/blender/src/ghostwinlay.c
@@ -435,6 +435,20 @@ static int event_proc(GHOST_EventHandle evt, GHOST_TUserDataPtr private) {
break;
}
+ case GHOST_kEventWheel:
+ {
+ GHOST_TEventWheelData* wheelData = (GHOST_TEventWheelData*) data;
+ if (wheelData->z > 0)
+ {
+ window_handle(win, WHEELUPMOUSE, 1);
+ }
+ else
+ {
+ window_handle(win, WHEELDOWNMOUSE, 1);
+ }
+ }
+ break;
+
case GHOST_kEventWindowDeactivate:
case GHOST_kEventWindowActivate: {
win->active= (type==GHOST_kEventWindowActivate);