File: move.c

package info (click to toggle)
xslideshow 3.1-7
  • links: PTS
  • area: non-free
  • in suites: sarge
  • size: 792 kB
  • ctags: 1,375
  • sloc: ansic: 14,006; makefile: 897; sh: 1
file content (99 lines) | stat: -rw-r--r-- 1,747 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
/*
	move.c - animate move

	Author:	Susumu Shiohara (shiohara@tpp.epson.co.jp)

		Copyright 1993-1997 by Susumu Shiohara

			All Rights Reserved

*/

#include "xslideshow.h"
#include "animproto.h"

extern void myevent();

static Window imageWindow=(Window)0;

static void createImage()
{
int	x,y,w,h;

	x = (movep ? -gim.subImageList->width : windowWidth);
	y = (windowHeight - gim.subImageList->height) / 2;
	w = gim.subImageList->width;
	h = gim.subImageList->height;
	ShowImageWindow(&imageWindow, x, y, w, h);
}

static void moveImage()	/* Moving picture */
{
int	x,y,w,h;

	x = (movep ? -gim.subImageList->width : windowWidth);
	y = (windowHeight - gim.subImageList->height) / 2;
	w = gim.subImageList->width;
	h = gim.subImageList->height;

	if(movep){

		for(; x < windowWidth; x += app_data.moveSteps){
			XMoveWindow(theDisp,imageWindow,x,y);
			myusleep(app_data.moveTicks);
			if(gotSomeAction == True)
				break;
		}

	}
	else{

		for(; x > -gim.subImageList->width; x -= app_data.moveSteps){
			XMoveWindow(theDisp,imageWindow,x,y);
			myusleep(app_data.moveTicks);
			if(gotSomeAction == True)
				break;
		}

	}

	movep = !movep;
}

#if defined(__STDC__) || defined(__cplusplus)
ActionStatus xmoveshow(char *fname)
#else
ActionStatus xmoveshow(fname)
char *fname;
#endif
{
	PreDisplay();

	if(app_data.showFileName)
		createFileNameWindow(fname);

	createImage ();

	StoreColors(xcolors,gim.subImageList->mapsize);

	if(app_data.showFileName)
		raiseFileNameWindow();

	moveImage ();

	removeImageWindow(&imageWindow);

	return(mynowait());
}

#if defined(__STDC__) || defined(__cplusplus)
void postxmoveshow(char *fname)
#else
void postxmoveshow(fname)
char *fname;
#endif
{
	if(app_data.showFileName)
		removeFileNameWindow();
}