File: rotation.patch

package info (click to toggle)
wbar 1.3.3%2Bdfsg2-1
  • links: PTS
  • area: main
  • in suites: squeeze, wheezy
  • size: 224 kB
  • ctags: 201
  • sloc: cpp: 1,307; sh: 102; makefile: 70
file content (126 lines) | stat: -rw-r--r-- 3,220 bytes parent folder | download
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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
Index: Bar.cc
===================================================================
RCS file: /mnt/back/repository/c/wbar/Bar.cc,v
retrieving revision 1.3
diff -u -r1.3 Bar.cc
--- Bar.cc	14 Jan 2007 17:13:15 -0000	1.3
+++ Bar.cc	16 Jan 2007 23:15:57 -0000
@@ -1,5 +1,9 @@
 #include "Bar.h"
+#include "debug.h"
+#include <typeinfo>
 #include <math.h>
+#include <unistd.h>
+#include "SuperIcon.h"
 
 /* Posicionamiento de la ventana */
 #define MARGEN 8
@@ -490,6 +494,59 @@
 }
 /*}}}*/
 
+void Bar::animate(){
+    _image tmp_img;
+    Icon* cur_ic;
+    double ang = 0.0;
+    double r;
+
+    if(zoomed_icon == -1)
+	return;
+
+    cur_ic = icons[zoomed_icon];
+
+    if(typeid(*this) == typeid(Bar))
+	USE_IMAGE(cur_ic->icon);
+    else
+	USE_IMAGE(((SuperIcon*)cur_ic)->icon_color);
+
+    tmp_img = CLONE_IMAGE();
+    r = sqrt(cur_ic->osize * cur_ic->osize / 2);
+
+    float x01 = r * cos(135*M_PI/180);
+    float y01 = r * sin(135*M_PI/180);
+
+    for(ang=0 ; ang < 6.28; ang += 0.2){ 
+	if(typeid(*this) == typeid(Bar))
+	    USE_IMAGE(cur_ic->icon);
+	else
+	    USE_IMAGE(((SuperIcon*)cur_ic)->icon_color);
+
+	SET_BLEND(0);
+
+	imlib_blend_image_onto_image_at_angle(tmp_img, 1,
+	    0, 0, cur_ic->osize, cur_ic->osize, 
+	    cur_ic->osize/2 + (x01 * cos(ang) - y01 * sin(ang)), // 
+	    cur_ic->osize/2 - (x01 * sin(ang) + y01 * cos(ang)), // upper left corner
+	    cur_ic->osize * cos(ang), -cur_ic->osize * sin(ang)); // upper right corner (relative)
+
+	cur_ic->need_update = 1;
+	render();
+	usleep(800);
+    }
+
+    if(typeid(*this) == typeid(Bar)){
+	FREE_IMAGE(cur_ic->icon);
+	cur_ic->icon = tmp_img;
+    }else{
+	FREE_IMAGE(((SuperIcon*)cur_ic)->icon_color);
+	((SuperIcon*)cur_ic)->icon_color = tmp_img;
+    }
+
+    cur_ic->need_update = 1;
+    render();
+}
+
 #if 0
 /* Zoom beans *//*{{{*/
 void Bar::setZoom(float zoomf){
Index: Bar.h
===================================================================
RCS file: /mnt/back/repository/c/wbar/Bar.h,v
retrieving revision 1.2
diff -u -r1.2 Bar.h
--- Bar.h	13 Jan 2007 20:57:03 -0000	1.2
+++ Bar.h	16 Jan 2007 22:26:37 -0000
@@ -94,6 +94,7 @@
 	void iconUp(int i_num);
 	void setPosition(std::string p);
 
+	void animate();
 	//void setZoom(float zoomf);
 	//float getZoom();
 };
Index: Main.cc
===================================================================
RCS file: /mnt/back/repository/c/wbar/Main.cc,v
retrieving revision 1.3
diff -u -r1.3 Main.cc
--- Main.cc	14 Jan 2007 17:13:15 -0000	1.3
+++ Main.cc	16 Jan 2007 22:26:37 -0000
@@ -208,6 +208,11 @@
 		    case 3:/* Redraw Bar*/
 			execvp(argv[0], argv);
 			break;
+
+		    case 2:
+			barra->animate();
+			break;
+
 		    case 1:/* Execute Program */
 			if(!vertbar)
 			    inum = barra->iconIndex(ev.xbutton.x);
Index: SuperIcon.h
===================================================================
RCS file: /mnt/back/repository/c/wbar/SuperIcon.h,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 SuperIcon.h
--- SuperIcon.h	19 Oct 2006 23:25:01 -0000	1.1.1.1
+++ SuperIcon.h	16 Jan 2007 22:47:51 -0000
@@ -14,6 +14,7 @@
 	std::string text;
 	
 	friend class SuperBar;
+	friend class Bar;
 
     public:
 	SuperIcon(std::string iconImg, std::string cmd, std::string txt,