summaryrefslogtreecommitdiff
blob: 3faa33b8712857a144ef923a53cdcc1b255c44fc (plain)
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
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
diff -ru idesk-0.3.5/Desk.cc idesk-0.3.5-simeng/Desk.cc
--- idesk-0.3.5/Desk.cc	2002-11-09 19:06:16.000000000 +0100
+++ idesk-0.3.5-simeng/Desk.cc	2003-02-14 02:56:30.000000000 +0100
@@ -100,7 +100,12 @@
     
     if( HighContrast )
       Back.color.alpha = 21845;
-    
+
+    if ( !strcmp( (char*)Config->Query( "DoubleClick" ).c_str(), "true" ) )
+      DoubleClick = true;
+    else
+      DoubleClick = false;
+
     Transparency = atoi( (char*)Config->Query( "Transparency" ).c_str() );
     
     if( !strcmp( ( char * )Config->Query( "Locked" ).c_str(), "true" ) ) LockDesk();
@@ -123,13 +128,22 @@
       for(int i=0; i<FileCount; i++) {
         FileName = DirName + Files[i]->d_name;
         IconDb = new Database(FileName);
-        if(!(IconTb = IconDb->Query("Icon")))
+
+        if(IconDb->Tables.size() == 0)
 	{
 		free( Files[ i ] );
 		delete IconDb;
 		continue;
 	}
-        AddIcon( (char*)FileName.c_str(), (char*)IconTb->Query("Icon").c_str(), (char*)IconTb->Query("Caption").c_str(), (char*)IconTb->Query("Command").c_str(), atoi(IconTb->Query("X").c_str()), atoi(IconTb->Query("Y").c_str()) );
+        for (int y=0; y<IconDb->Tables.size(); y++) {
+          IconTb = IconDb->Tables[y];
+          AddIcon( (char*)FileName.c_str(), 
+            (char*)IconTb->Query("Icon").c_str(), 
+            (char*)IconTb->Query("Caption").c_str(), 
+            (char*)IconTb->Query("Command").c_str(), 
+            atoi(IconTb->Query("X").c_str()), 
+            atoi(IconTb->Query("Y").c_str()) );
+        }
 	free( Files[ i ] );
         delete IconDb;
 	delete IconTb;
@@ -151,12 +165,20 @@
     char     Num[10];
 
       IconDb = new Database(I->FileName);
-        if(!(IconTb = IconDb->Query("Icon"))) return;
-        sprintf(Num, "%d", I->X);
-        IconTb->Set("X", Num);
-        sprintf(Num, "%d", I->Y);
-        IconTb->Set("Y", Num);
+        if(IconDb->Tables.size() == 0) return;
+
+        for (int i=0; i<IconDb->Tables.size(); i++) {
+          IconTb = IconDb->Tables[i];
+          if (IconTb->Query("Caption") == I->Caption)
+          {
+            sprintf(Num, "%d", I->X);
+            IconTb->Set("X", Num);
+            sprintf(Num, "%d", I->Y);
+            IconTb->Set("Y", Num);
+          }
+        }
         IconDb->Write();
+        delete IconTb;
         delete IconDb;
   }
 
@@ -292,6 +314,10 @@
     return( Transparency );
   }
 
+  bool Desk::GetDoubleClick( ) {
+    return( DoubleClick );
+  }
+
   bool Desk::GetContrast( ) {
     return( HighContrast );
   }
diff -ru idesk-0.3.5/Desk.h idesk-0.3.5-simeng/Desk.h
--- idesk-0.3.5/Desk.h	2002-11-09 19:06:16.000000000 +0100
+++ idesk-0.3.5-simeng/Desk.h	2003-02-14 02:47:20.000000000 +0100
@@ -24,6 +24,7 @@
        bool Locked;
        bool HighContrast;
        bool ShadowFlag;
+       bool DoubleClick;
        int ShadowX;
        int ShadowY;
        int BoldVal;
@@ -44,6 +45,7 @@
        void SaveIcon( Icon *I );
        void Loop();
        int  GetTransparency( );
+       bool GetDoubleClick( );
        bool GetContrast( );
        bool GetShadow(int &x, int &y );
 
diff -ru idesk-0.3.5/Icon.cc idesk-0.3.5-simeng/Icon.cc
--- idesk-0.3.5/Icon.cc	2002-11-09 19:06:16.000000000 +0100
+++ idesk-0.3.5-simeng/Icon.cc	2003-02-14 02:57:27.000000000 +0100
@@ -73,14 +73,11 @@
       
       for( int i=0, a=0; i<(3*Width*Height); i+=3, a++) {
          int alevel = ( (alpha_levels != 0) ? alpha_levels[a] : 255 );
-         if( alevel == 0 ) { bgrgb[i] = bgrgb[i+2] = 255; bgrgb[i+1] = 0; continue; }
          bgrgb[i+0] = (bgrgb[i+0] * (255-alevel))/255 + (rgb[i+0] * alevel)/255;
          bgrgb[i+1] = (bgrgb[i+1] * (255-alevel))/255 + (rgb[i+1] * alevel)/255;
          bgrgb[i+2] = (bgrgb[i+2] * (255-alevel))/255 + (rgb[i+2] * alevel)/255;
       }
       
-      ImlibColor IClr={255,0,255,0};
-      Imlib_set_image_shape(D->Data, Bg, &IClr);
       Imlib_apply_image( D->Data, Bg, Win );
 
       Imlib_kill_image( D->Data, Bg );
@@ -146,17 +143,33 @@
     
     bool locked = D->IsLocked();
 
-    if( Ev->type == ButtonRelease )
+    if( D->GetDoubleClick() )
     {
-      // Something of a special case.
-      if( Ev->xbutton.time - Time <= 200 )
+      if( Ev->type == ButtonRelease )
       {
-	D->Execute( Command );
-	Time = 0;
+        // Something of a special case.  Doubleclick
+        if( Ev->xbutton.time - Time <= 200 )
+        {
+         D->Execute( Command );
+         Time = 0;
+        }
+        else Time = Ev->xbutton.time;
       }
-      else Time = Ev->xbutton.time;
     }
-     
+    else 
+    { 
+      // If buttontime is less than 200ms we click, else we drag.  Singleclick
+      if( Ev->type == ButtonPress )
+        Time = Ev->xbutton.time;
+  
+      if( Ev->type == ButtonRelease && 
+        Ev->xbutton.time - Time <= 200 )
+      {
+        D->Execute( Command );
+        Time = 0;
+      }
+    }
+
     if( locked ) return;
 
     switch( Ev->type )
diff -ru idesk-0.3.5/Icon.h idesk-0.3.5-simeng/Icon.h
--- idesk-0.3.5/Icon.h	2002-10-28 22:30:03.000000000 +0100
+++ idesk-0.3.5-simeng/Icon.h	2003-02-13 21:46:42.000000000 +0100
@@ -7,7 +7,7 @@
   class Icon {
     private:
        Desk *D;
-       char *Command, *Caption;
+       char *Command;
        XGlyphInfo FontInfo;
        bool FreeAlpha;
        bool Glowing;
@@ -18,6 +18,7 @@
 
        Window Win, Text;
        XftDraw *Draw;
+       char *Caption;
        char FileName[128];
        unsigned char *rgb, *alpha, *alpha2;
        int LoadPng( char *filename );
diff -ru idesk-0.3.5/README idesk-0.3.5-simeng/README
--- idesk-0.3.5/README	2002-11-09 19:06:16.000000000 +0100
+++ idesk-0.3.5-simeng/README	2003-02-14 03:05:08.000000000 +0100
@@ -26,6 +26,7 @@
   PaddingY: 25
   Locked: false
   HighContrast: false
+  DoubleClick: true
   Transparency: 150
   Shadow: true
   ShadowColor: #000000
@@ -41,6 +42,9 @@
 it is true.  It will draw it in an arbitary colour if it "#aa00aa", for
 example.  And it will not draw anything at all if it is set to "false".
 
+"DoubleClick" when set true it requires you to doubleclick on an icon to 
+execute programs while only a single click is required when set to false.
+
 "Shadow" is boolean (true/false). Turning this on will draw a drop shadow 
 of color ShadowColor behind the text. The shadow will be ShadowX pixels right
 and ShadowY pixels down (negative values will work). Both ShadowX and ShadowY
@@ -62,7 +66,7 @@
 executes the command you assigned it.
 
 You can double-middle click on any icon to reload the icon files in the
-.idestop directory and the .ideskrc settings.
+.idesktop directory and the .ideskrc settings.
 
 After you move your icons around to get them where you want them, you can
 change "Locked" from false to true in the config file.