| 1 |
|
| 2 |
#include "defextern.h" |
| 3 |
|
| 4 |
|
| 5 |
#ifndef STRICT |
| 6 |
#define STRICT |
| 7 |
#endif |
| 8 |
#include <windows.h> |
| 9 |
#include "main.h" |
| 10 |
#include "dir.h" |
| 11 |
#include "tabs.h" |
| 12 |
#include "initial.h" |
| 13 |
#include "status.h" |
| 14 |
#include "mousegesture.h" |
| 15 |
#include "paintflag.h" |
| 16 |
#include "listview.h" |
| 17 |
#include "myfilemv.h" |
| 18 |
#include "winpaint.h" |
| 19 |
#include "mainmsg.h" |
| 20 |
#include "resource.h" |
| 21 |
|
| 22 |
extern HBRUSH hbrush; |
| 23 |
int calckaiten(char *longv, char *recentv); |
| 24 |
BOOL calcIsCircle(POINTS a1, POINTS a2, POINTS a3, POINTS a4 ); |
| 25 |
|
| 26 |
|
| 27 |
POINTS stPoint,enPoint,sa,crPoint,lastPoint; |
| 28 |
POINTS logpoint[LogPosMax]; |
| 29 |
int mpos=0; |
| 30 |
int lmpos=0; // マルチラインのときは一本線ごとにリセット |
| 31 |
|
| 32 |
|
| 33 |
int mvSens =20; |
| 34 |
int saMin =1; |
| 35 |
int sensMin =1; |
| 36 |
int kaiten=0; |
| 37 |
|
| 38 |
|
| 39 |
POINTS Sa(POINTS a, POINTS b) |
| 40 |
{ |
| 41 |
static POINTS c; |
| 42 |
c.x =a.x -b.x; |
| 43 |
c.y =a.y -b.y; |
| 44 |
return c; |
| 45 |
} |
| 46 |
|
| 47 |
int Kyori2(POINTS a, POINTS b) |
| 48 |
{ |
| 49 |
return max(abs(Sa(a,b).x),abs(Sa(a,b).y)); |
| 50 |
} |
| 51 |
|
| 52 |
|
| 53 |
int mousecommand::calccloss() |
| 54 |
{ |
| 55 |
int findstart =2; |
| 56 |
int len=3; |
| 57 |
for (int i=0;i<mpos-len;i++) |
| 58 |
{ |
| 59 |
for (int j=i+len;j<mpos-len;j++) if(calcIsCircle(logpoint[i],logpoint[j],logpoint[i+len],logpoint[j+len])) |
| 60 |
{ |
| 61 |
clossnum++; |
| 62 |
j=mpos; |
| 63 |
i+=findstart; |
| 64 |
} |
| 65 |
} |
| 66 |
return clossnum; |
| 67 |
} |
| 68 |
|
| 69 |
|
| 70 |
void mousecommand::changeVector() |
| 71 |
{ |
| 72 |
last[0]=0; |
| 73 |
} |
| 74 |
|
| 75 |
|
| 76 |
BOOL mousecommand::add(char *str) |
| 77 |
{ |
| 78 |
BOOL ans=FALSE; |
| 79 |
if(strlen(mousecom)<mousecommax-4 && strcmp(str,last)!=0) |
| 80 |
{ |
| 81 |
ans=TRUE; |
| 82 |
if(len==0) strcpy(mousecom,""); |
| 83 |
strcat(mousecom,str); |
| 84 |
len =strlen(mousecom); |
| 85 |
} |
| 86 |
strcpy(last,str); |
| 87 |
return ans; |
| 88 |
}; |
| 89 |
|
| 90 |
BOOL mousecommand::addforce(char *str) |
| 91 |
{ |
| 92 |
BOOL ans=FALSE; |
| 93 |
if( strlen(mousecom)<mousecommax-4 ) |
| 94 |
{ |
| 95 |
ans=TRUE; |
| 96 |
strcat(mousecom,str); |
| 97 |
} |
| 98 |
strcpy(last,str); |
| 99 |
return ans; |
| 100 |
}; |
| 101 |
|
| 102 |
mousecommand mc; |
| 103 |
|
| 104 |
|
| 105 |
void DULR(char *mes, int x, int y, int saMin) |
| 106 |
{ |
| 107 |
int absx=abs(x); |
| 108 |
int absy=abs(y); |
| 109 |
if( absx >absy*3 ) |
| 110 |
{ |
| 111 |
if(x >saMin ) strcat(mes,"R"); //right |
| 112 |
if(x <-saMin) strcat(mes,"L"); //left |
| 113 |
return; |
| 114 |
} |
| 115 |
if( absy >absx*3 ) |
| 116 |
{ |
| 117 |
if(y >saMin) strcat(mes,"D"); //down |
| 118 |
if(y <-saMin) strcat(mes,"U"); //up |
| 119 |
} |
| 120 |
} |
| 121 |
|
| 122 |
void DULRmh(char *mes, int x, int y, int saMin) |
| 123 |
{ |
| 124 |
int absx=abs(x); |
| 125 |
int absy=abs(y); |
| 126 |
BOOL xbig =(absx>6 && absx>absy/2); |
| 127 |
BOOL ybig =(absy>6 && absy>absx/2); |
| 128 |
BOOL xsmall =(absx<3 || absx<absy/2); |
| 129 |
BOOL ysmall =(absy<3 || absy<absx/2); |
| 130 |
BOOL xybig =(xbig && ybig); |
| 131 |
BOOL xysame =(abs(absx-absy)<absx/2); |
| 132 |
if(x >saMin && xbig) |
| 133 |
{ |
| 134 |
if(y >saMin && xybig && xysame) strcat(mes,"m"); |
| 135 |
else if(y <-saMin && xybig && xysame) strcat(mes,"M"); |
| 136 |
else if(ysmall) strcat(mes,"R"); |
| 137 |
} |
| 138 |
else if(x <-saMin && xbig) |
| 139 |
{ |
| 140 |
if(y >saMin && ybig && xysame) strcat(mes,"h"); |
| 141 |
else if(y <-saMin && ybig && xysame) strcat(mes,"H"); |
| 142 |
else if(ysmall) strcat(mes,"L"); //left |
| 143 |
} |
| 144 |
else if( xsmall && ybig) |
| 145 |
{ |
| 146 |
if(y >saMin) strcat(mes,"D"); //down |
| 147 |
if(y <-saMin) strcat(mes,"U"); //up |
| 148 |
} |
| 149 |
} |
| 150 |
|
| 151 |
char * getMGchar(int x, int y, char *mes, char *mesmin) |
| 152 |
{ |
| 153 |
strcpy(mes,""); |
| 154 |
strcpy(mesmin,""); |
| 155 |
if(!nanameON) |
| 156 |
{ |
| 157 |
DULR(mes,x,y,saMin); |
| 158 |
DULR(mesmin,x,y,sensMin); |
| 159 |
} |
| 160 |
else |
| 161 |
{ |
| 162 |
DULRmh(mes,x,y,saMin); |
| 163 |
DULRmh(mesmin,x,y,sensMin); |
| 164 |
} |
| 165 |
return mes; |
| 166 |
} |
| 167 |
|
| 168 |
|
| 169 |
int calckaiten(char *longv, char *recentv) |
| 170 |
{ |
| 171 |
char tmp[3]; |
| 172 |
tmp[0]=longv[0]; |
| 173 |
tmp[1]=recentv[0]; |
| 174 |
tmp[2]=0; |
| 175 |
if(strstr("UHLhD",tmp)!=NULL) return 1; |
| 176 |
if(strstr("UMRmD",tmp)!=NULL) return -1; |
| 177 |
if(strstr("DmRMU",tmp)!=NULL) return 2; |
| 178 |
if(strstr("DhLHU",tmp)!=NULL) return -2; |
| 179 |
return 0; |
| 180 |
} |
| 181 |
|
| 182 |
BOOL circlecheck(char *str) |
| 183 |
{ |
| 184 |
char ci[]="UMRmDhLHUMRmDhLHU"; |
| 185 |
char *p=ci; |
| 186 |
char *now; |
| 187 |
BOOL ret=TRUE; |
| 188 |
now=strchr(ci,str[0]); |
| 189 |
if(now!=NULL) now[9]=0; |
| 190 |
for(int i=1;i<strlen(str);i++) |
| 191 |
{ |
| 192 |
if(now!=NULL) { |
| 193 |
now++; |
| 194 |
} |
| 195 |
else break; |
| 196 |
now=strchr(now,str[i]); |
| 197 |
if(now==NULL) |
| 198 |
{ |
| 199 |
ret=FALSE; |
| 200 |
break; |
| 201 |
} |
| 202 |
} |
| 203 |
if(ret) |
| 204 |
return ret; |
| 205 |
|
| 206 |
int len=strlen(str); |
| 207 |
now=strchr(ci,str[len-1]); |
| 208 |
if(now!=NULL) now[9]=0; |
| 209 |
for(i=len-2;i>=0;i--) |
| 210 |
{ |
| 211 |
if(now!=NULL) { |
| 212 |
now++; |
| 213 |
} |
| 214 |
else break; |
| 215 |
now=strchr(now,str[i]); |
| 216 |
if(now==NULL) |
| 217 |
{ |
| 218 |
ret=FALSE; |
| 219 |
break; |
| 220 |
} |
| 221 |
} |
| 222 |
return ret; |
| 223 |
} |
| 224 |
|
| 225 |
BOOL calcIsCircle(POINTS a1, POINTS a2, POINTS a3, POINTS a4 ) |
| 226 |
{ |
| 227 |
static char mes1[3]; |
| 228 |
static char mes2[3]; |
| 229 |
char ans[6]=""; |
| 230 |
POINTS sa[4]; |
| 231 |
sa[0]=Sa(a1,a2); |
| 232 |
sa[1]=Sa(a2,a3); |
| 233 |
sa[2]=Sa(a3,a4); |
| 234 |
sa[3]=Sa(a4,a1); |
| 235 |
strcat(ans , getMGchar(sa[0].x, sa[0].y, mes1, mes2 )); |
| 236 |
strcat(ans , getMGchar(sa[1].x, sa[1].y, mes1, mes2 )); |
| 237 |
strcat(ans , getMGchar(sa[2].x, sa[2].y, mes1, mes2 )); |
| 238 |
strcat(ans , getMGchar(sa[3].x, sa[3].y, mes1, mes2 )); |
| 239 |
BOOL ret= (strlen(ans)>3 && circlecheck(ans)); |
| 240 |
|
| 241 |
if(ret) |
| 242 |
{ |
| 243 |
//Mes(ans); |
| 244 |
} |
| 245 |
return ret; |
| 246 |
} |
| 247 |
|
| 248 |
|
| 249 |
char * mouseLog(POINTS cr, POINTS la) |
| 250 |
{ |
| 251 |
setstatusMousepos(mpos, cr.x-stPoint.x, cr.y-stPoint.y); |
| 252 |
static char mes[3]; |
| 253 |
wsprintf(mes,""); |
| 254 |
char mesmin[3]=""; |
| 255 |
char mesLong[3]=""; |
| 256 |
char mesminLong[3]=""; |
| 257 |
POINTS saLong,saRecent; |
| 258 |
if (mpos>LogPosMax-1) return mes; |
| 259 |
logpoint[mpos]=la; //元データ |
| 260 |
int now =mpos; |
| 261 |
int lago =mpos-10; |
| 262 |
int ago =mpos-4; |
| 263 |
mpos++; |
| 264 |
lmpos++; |
| 265 |
if(mpos<11) return mes; |
| 266 |
saLong = Sa(logpoint[now],logpoint[lago]); |
| 267 |
saRecent = Sa(logpoint[now],logpoint[ago]); |
| 268 |
if(abs(saLong.x)<5 && abs(saLong.y)<5 ) return mes; |
| 269 |
|
| 270 |
static char lastmes[3]=""; |
| 271 |
getMGchar(saLong.x, saLong.y, mesLong, mesminLong ); |
| 272 |
getMGchar(saRecent.x, saRecent.y, mes, mesmin ); |
| 273 |
if(strlen(mes)>0 && strlen(mesLong)>0 ) |
| 274 |
{ |
| 275 |
logwrite(mes,""); |
| 276 |
kaiten=calckaiten(mesLong,mes); |
| 277 |
if(strcmp(mes,lastmes)==0 && strcmp(mesLong,mes)==0 ) |
| 278 |
{ |
| 279 |
if(mc.add(mes)) setstatusonly(mc.getStatusStr()); |
| 280 |
} |
| 281 |
else |
| 282 |
{ |
| 283 |
//mc.changeVector(); |
| 284 |
} |
| 285 |
strcpy(lastmes,mes); |
| 286 |
} |
| 287 |
else if(strlen(mesmin)>0) |
| 288 |
{ |
| 289 |
//if(strcmp(mesmin,lastmes)!=0) mc.changeVector(); |
| 290 |
} |
| 291 |
return mes; |
| 292 |
} |
| 293 |
|
| 294 |
#define LINE(x0,y0,x1,y1) \ |
| 295 |
MoveToEx(hdc,x0,y0,NULL);\ |
| 296 |
LineTo(hdc,x1,y1); |
| 297 |
|
| 298 |
#define LINE(a,b) \ |
| 299 |
MoveToEx(hdc,a.x,a.y,NULL);\ |
| 300 |
LineTo(hdc,b.x,b.y); |
| 301 |
|
| 302 |
#define hosi 10 |
| 303 |
#define circle(a) \ |
| 304 |
{MoveToEx(hdc,a.x-hosi,a.y,NULL);\ |
| 305 |
LineTo(hdc,a.x,a.y-hosi);\ |
| 306 |
LineTo(hdc,a.x+hosi,a.y);\ |
| 307 |
LineTo(hdc,a.x,a.y+hosi);\ |
| 308 |
LineTo(hdc,a.x-hosi,a.y);} |
| 309 |
|
| 310 |
#define batu(a) \ |
| 311 |
{MoveToEx(hdc,a.x-hosi,a.y-hosi,NULL);\ |
| 312 |
LineTo(hdc,a.x+hosi,a.y+hosi);\ |
| 313 |
MoveToEx(hdc,a.x-hosi,a.y+hosi,NULL);\ |
| 314 |
LineTo(hdc,a.x+hosi,a.y-hosi);} |
| 315 |
|
| 316 |
#define hos(a,b) \ |
| 317 |
{MoveToEx(hdc,a.x,a.y-3*b,NULL);\ |
| 318 |
LineTo(hdc,a.x+2*b,a.y+3*b);\ |
| 319 |
LineTo(hdc,a.x-3*b,a.y-1*b);\ |
| 320 |
LineTo(hdc,a.x+3*b,a.y-1*b);\ |
| 321 |
LineTo(hdc,a.x-2*b,a.y+3*b);\ |
| 322 |
LineTo(hdc,a.x,a.y-3*b);} |
| 323 |
|
| 324 |
#define stMark(a,b) hos(a,b) |
| 325 |
|
| 326 |
#define seize IDC_IBEAM |
| 327 |
COLORREF mousepenC_P =RGB(0x10,0x10,0x10); |
| 328 |
COLORREF mousepenC_L =RGB(0x3f,0x71,0xa0);// |
| 329 |
COLORREF mousepenC_R =RGB(0x5f,0x71,0xd0);// |
| 330 |
COLORREF mousepenC_D =RGB(0x61,0xcc,0xab);// |
| 331 |
COLORREF mousepenC_U =RGB(0x91,0xcc,0xdb);// |
| 332 |
COLORREF mousepenC_H =RGB(0x92,0xff,0x22); |
| 333 |
COLORREF mousepenC_h =RGB(0x32,0xf9,0xa2); |
| 334 |
COLORREF mousepenC_m =RGB(0xb2,0xff,0x42); |
| 335 |
COLORREF mousepenC_M =RGB(0x52,0xfc,0x72); |
| 336 |
COLORREF mousepenC_kRU =RGB(0x92,0x69,0x92); |
| 337 |
COLORREF mousepenC_kRD =RGB(0xf2,0x69,0x62); |
| 338 |
COLORREF mousepenC_kLU =RGB(0x92,0xa9,0x32); |
| 339 |
COLORREF mousepenC_kLD =RGB(0xf2,0xa9,0x02); |
| 340 |
COLORREF mousepenC_RBUp =RGB(0x52,0xa9,0x72); |
| 341 |
COLORREF mousepenC =RGB(200,200,160); |
| 342 |
#define mousepenWn 1 |
| 343 |
#define mousepenWok 2 |
| 344 |
|
| 345 |
|
| 346 |
// タブ、リスト、選択されたほうを前に |
| 347 |
|
| 348 |
void selectSet( dirw &dir, HWND tab ) |
| 349 |
{ |
| 350 |
resettitle( dir.cd() ,dir.getLR() ); |
| 351 |
SetCurSel( tab, dir.getTabpos()); |
| 352 |
} |
| 353 |
|
| 354 |
// mousegesture, set color func |
| 355 |
// use first charactors of |
| 356 |
// Left,Right,Down,Up,kaiten,Hidariue,hidarishita,Migiue,migishita |
| 357 |
// kLU 回転、左上 |
| 358 |
// kLD 回転、左下 |
| 359 |
// kRU 回転、右上 |
| 360 |
// kRD 回転、右下 |
| 361 |
/* |
| 362 |
D 下 |
| 363 |
U 上 |
| 364 |
R |
| 365 |
L |
| 366 |
H |
| 367 |
M |
| 368 |
m |
| 369 |
h |
| 370 |
*/ |
| 371 |
|
| 372 |
|
| 373 |
void initmousecolor(char *file) |
| 374 |
{ |
| 375 |
char tmp[15],r[10],g[10],b[10]; |
| 376 |
COLORREF cl[15]; |
| 377 |
for(int i=0;i<15;i++){ |
| 378 |
wsprintf(tmp,"%d_R",i); |
| 379 |
GetPrivateProfileString("mousecolor", tmp, "", r, 10, file); |
| 380 |
wsprintf(tmp,"%d_G",i); |
| 381 |
GetPrivateProfileString("mousecolor", tmp, "", g, 10, file); |
| 382 |
wsprintf(tmp,"%d_B",i); |
| 383 |
GetPrivateProfileString("mousecolor", tmp, "", b, 10, file); |
| 384 |
cl[i]=RGB(atoi(r),atoi(g),atoi(b)); |
| 385 |
} |
| 386 |
mousepenC_P =cl[0]; |
| 387 |
mousepenC_L =cl[1]; |
| 388 |
mousepenC_R =cl[2]; |
| 389 |
mousepenC_D =cl[3]; |
| 390 |
mousepenC_U =cl[4]; |
| 391 |
mousepenC_H =cl[5]; |
| 392 |
mousepenC_h =cl[6]; |
| 393 |
mousepenC_m =cl[7]; |
| 394 |
mousepenC_M =cl[8]; |
| 395 |
mousepenC_kRU =cl[9]; |
| 396 |
mousepenC_kRD =cl[10]; |
| 397 |
mousepenC_kLU =cl[11]; |
| 398 |
mousepenC_kLD =cl[12]; |
| 399 |
mousepenC_RBUp =cl[13]; |
| 400 |
mousepenC =cl[14]; |
| 401 |
|
| 402 |
} |
| 403 |
|
| 404 |
LRESULT CALLBACK ListProc( dirw &dir, WNDPROC oldproc, HWND hWnd, UINT msg, WPARAM wp, LPARAM lp) |
| 405 |
{ |
| 406 |
RECT rect; |
| 407 |
PAINTSTRUCT ps; |
| 408 |
HDC hdc; |
| 409 |
static BOOL RBDown =FALSE; |
| 410 |
static BOOL mouseMalti =FALSE; |
| 411 |
//static HPEN hPen0 =CreatePen(PS_SOLID, mousepenWn, mousepenC); |
| 412 |
static HPEN hPen0 =CreatePen(PS_SOLID, mousepenWn, mousepenC); |
| 413 |
static HPEN hPenRBUp =CreatePen(PS_SOLID, mousepenWn, mousepenC_RBUp); |
| 414 |
static HPEN hPenL =CreatePen(PS_SOLID, mousepenWok, mousepenC_L); |
| 415 |
static HPEN hPenR =CreatePen(PS_SOLID, mousepenWok, mousepenC_R); |
| 416 |
static HPEN hPenU =CreatePen(PS_SOLID, mousepenWok, mousepenC_U); |
| 417 |
static HPEN hPenD =CreatePen(PS_SOLID, mousepenWok, mousepenC_D); |
| 418 |
static HPEN hPenH =CreatePen(PS_SOLID, mousepenWok, mousepenC_H); |
| 419 |
static HPEN hPenh =CreatePen(PS_SOLID, mousepenWok, mousepenC_h); |
| 420 |
static HPEN hPenm =CreatePen(PS_SOLID, mousepenWok, mousepenC_m); |
| 421 |
static HPEN hPenM =CreatePen(PS_SOLID, mousepenWok, mousepenC_M); |
| 422 |
static HPEN hPenkLU =CreatePen(PS_SOLID, mousepenWok, mousepenC_kLU); |
| 423 |
static HPEN hPenkRU =CreatePen(PS_SOLID, mousepenWok, mousepenC_kRU); |
| 424 |
static HPEN hPenkLD =CreatePen(PS_SOLID, mousepenWok, mousepenC_kLD); |
| 425 |
static HPEN hPenkRD =CreatePen(PS_SOLID, mousepenWok, mousepenC_kRD); |
| 426 |
static int r,g,b; |
| 427 |
static BOOL csr=FALSE; |
| 428 |
static BOOL mgRF=FALSE; |
| 429 |
static BOOL mgF=FALSE; |
| 430 |
static BOOL mgLF=FALSE; |
| 431 |
char *p; |
| 432 |
//if(csr) SetCursor(LoadCursor(NULL, seize)); |
| 433 |
|
| 434 |
switch(msg) |
| 435 |
{ |
| 436 |
case WM_KILLFOCUS : |
| 437 |
resettxt(); |
| 438 |
break; |
| 439 |
case WM_SETFOCUS : |
| 440 |
selectSet( dir, hTab ); |
| 441 |
break; |
| 442 |
case WM_LBUTTONUP : |
| 443 |
mgLF=FALSE; |
| 444 |
//SetCursor(LoadCursor(NULL, IDC_ARROW)); |
| 445 |
csr = FALSE; |
| 446 |
break; |
| 447 |
case WM_LBUTTONDOWN : |
| 448 |
mouseMalti = FALSE;// reset |
| 449 |
mgLF=TRUE; |
| 450 |
//SetCursor(LoadCursor(NULL, IDC_IBEAM)); |
| 451 |
csr = TRUE; |
| 452 |
break; |
| 453 |
case WM_RBUTTONDOWN : |
| 454 |
//mouseMalti =FALSE; |
| 455 |
RBDown =TRUE; |
| 456 |
mgRF =TRUE; |
| 457 |
mgF =TRUE; |
| 458 |
lmpos=0; |
| 459 |
if(!mouseMalti) |
| 460 |
{ |
| 461 |
mc.reset(); |
| 462 |
mpos=0; |
| 463 |
} |
| 464 |
logwrite("start","mg"); |
| 465 |
lastPoint =MAKEPOINTS(lp); |
| 466 |
stPoint =lastPoint; |
| 467 |
if( mousegON ==FALSE ) SendMessage(hWnd, WM_RBUTTONUP, wp, lp); |
| 468 |
else SetCapture(hWnd); |
| 469 |
return 0; |
| 470 |
case WM_RBUTTONUP : |
| 471 |
RBDown =FALSE; |
| 472 |
enPoint =MAKEPOINTS(lp); |
| 473 |
sa.x =enPoint.x-stPoint.x; |
| 474 |
sa.y =enPoint.y-stPoint.y; |
| 475 |
// 小さい丸でマルチラインモード開始終了 |
| 476 |
if(lmpos>1 && lmpos<30 && mgRF && abs(sa.x)+abs(sa.y)<20 ) |
| 477 |
{ |
| 478 |
if( mouseMalti ==FALSE ) |
| 479 |
{ |
| 480 |
mouseMalti=TRUE; |
| 481 |
lmpos=0; |
| 482 |
mpos=0; |
| 483 |
WinFlash(hmainwnd); |
| 484 |
return 0; |
| 485 |
} |
| 486 |
if( mouseMalti ) |
| 487 |
{ |
| 488 |
mouseMalti=FALSE; |
| 489 |
} |
| 490 |
} |
| 491 |
lmpos=0; |
| 492 |
if( mouseMalti ) |
| 493 |
{ |
| 494 |
mc.addforce("X"); |
| 495 |
return 0; |
| 496 |
} |
| 497 |
|
| 498 |
//mpos=0; |
| 499 |
if(mgRF) mgF=FALSE; |
| 500 |
if( mousegON) |
| 501 |
{ |
| 502 |
if( mgRF) |
| 503 |
{ |
| 504 |
ReleaseCapture(); |
| 505 |
logwrite("end","mg"); |
| 506 |
logwrite("mg",mc.getStr()); |
| 507 |
mgRF =FALSE; |
| 508 |
if(mc.getStrlen()==0) break; |
| 509 |
if(mouseGTransF && mc.getStrlen()>0) |
| 510 |
{ |
| 511 |
WORD msg=mgTrans(mc.getStr()); |
| 512 |
if(msg>40000 && msg<60000) |
| 513 |
{ |
| 514 |
setstatus(mc.getStatusStr()); |
| 515 |
mainMsg(msg); |
| 516 |
return 0; |
| 517 |
} |
| 518 |
} |
| 519 |
if(strcmp(mc.getStr(),"R")==0) |
| 520 |
{ |
| 521 |
mainMsg(IDM_HIS_FORWARD); |
| 522 |
return 0; |
| 523 |
} |
| 524 |
if(strcmp(mc.getStr(),"L")==0) |
| 525 |
{ |
| 526 |
mainMsg(IDM_HIS_BACKWARD); |
| 527 |
return 0; |
| 528 |
} |
| 529 |
if(strcmp(mc.getStr(),"U")==0) |
| 530 |
{ |
| 531 |
mainMsg(IDM_UPDIRLOCAL); |
| 532 |
return 0; |
| 533 |
} |
| 534 |
if(strcmp(mc.getStr(),"UD")==0) |
| 535 |
{ |
| 536 |
mainMsg(IDM_EDIT); |
| 537 |
return 0; |
| 538 |
} |
| 539 |
if(strcmp(mc.getStr(),"DL")==0) |
| 540 |
{ |
| 541 |
mainMsg(IDM_ENTER); |
| 542 |
return 0; |
| 543 |
} |
| 544 |
setstatusMousepos(mpos,mc.getStrlen(),mc.calccloss()); |
| 545 |
if(abs(sa.x)>0 && abs(sa.y)>0) return 0; |
| 546 |
} |
| 547 |
} |
| 548 |
mgRF =FALSE; |
| 549 |
break; |
| 550 |
case WM_MOUSEMOVE : |
| 551 |
crPoint =MAKEPOINTS(lp); |
| 552 |
if(mgRF) |
| 553 |
{ |
| 554 |
if(RBDown) p =mouseLog(crPoint, lastPoint); |
| 555 |
HDC hdc =GetDC( hWnd);//createpen |
| 556 |
if(!RBDown) |
| 557 |
{ |
| 558 |
SelectObject( hdc, hPenRBUp ) ; |
| 559 |
} |
| 560 |
else |
| 561 |
{ |
| 562 |
if(kaiten==2) SelectObject( hdc, hPenkLU ) ; |
| 563 |
else if(kaiten==1) SelectObject( hdc, hPenkLD ) ; |
| 564 |
else if(kaiten==-2) SelectObject( hdc, hPenkRU ) ; |
| 565 |
else if(kaiten==-1) SelectObject( hdc, hPenkRD ) ; |
| 566 |
else if(strlen(p)==0) SelectObject( hdc, hPen0 ) ; |
| 567 |
else if (strstr("D",p)!=NULL) SelectObject( hdc, hPenD ) ; |
| 568 |
else if (strstr("U",p)!=NULL) SelectObject( hdc, hPenU ) ; |
| 569 |
else if(strstr("R",p)!=NULL) SelectObject( hdc, hPenR ) ; |
| 570 |
else if(strstr("L",p)!=NULL) SelectObject( hdc, hPenL ) ; |
| 571 |
else if(strstr("H",p)!=NULL) SelectObject( hdc, hPenH ) ; |
| 572 |
else if(strstr("M",p)!=NULL) SelectObject( hdc, hPenM ) ; |
| 573 |
else if(strstr("m",p)!=NULL) SelectObject( hdc, hPenm ) ; |
| 574 |
else if(strstr("h",p)!=NULL) SelectObject( hdc, hPenh ) ; |
| 575 |
if(mpos<2 && mgRF) stMark(stPoint,2); |
| 576 |
LINE( lastPoint, crPoint) ; |
| 577 |
SetPixel(hdc, lastPoint.x, lastPoint.y, mousepenC_P); |
| 578 |
stMark(crPoint,1); |
| 579 |
} |
| 580 |
ReleaseDC( hWnd, hdc); |
| 581 |
} |
| 582 |
lastPoint =crPoint; |
| 583 |
if(mousemv) SetFocus(hWnd); |
| 584 |
return 0; |
| 585 |
case WM_ERASEBKGND : |
| 586 |
return 0; |
| 587 |
case WM_PAINT : |
| 588 |
GetClientRect (hWnd, &rect) ; |
| 589 |
hdc =BeginPaint(hWnd, &ps); |
| 590 |
SetBkMode(hdc, OPAQUE); |
| 591 |
SelectObject( hdc, hbrush ) ; |
| 592 |
if(paintf) Rectangle(hdc,rect.left,rect.top,rect.right,rect.bottom); |
| 593 |
EndPaint(hWnd,&ps); |
| 594 |
InvalidateRect(hWnd,&rect,FALSE); |
| 595 |
break; |
| 596 |
case WM_DESTROY : |
| 597 |
DeleteObject(hPen0); |
| 598 |
DeleteObject(hPenh); |
| 599 |
DeleteObject(hPenH); |
| 600 |
DeleteObject(hPenM); |
| 601 |
DeleteObject(hPenm); |
| 602 |
DeleteObject(hPenU); |
| 603 |
DeleteObject(hPenD); |
| 604 |
DeleteObject(hPenL); |
| 605 |
DeleteObject(hPenR); |
| 606 |
DeleteObject(hPenkLU); |
| 607 |
DeleteObject(hPenkRD); |
| 608 |
DeleteObject(hPenkLD); |
| 609 |
DeleteObject(hPenkRU); |
| 610 |
break; |
| 611 |
default: |
| 612 |
; |
| 613 |
} |
| 614 |
return CallWindowProc( oldproc, hWnd, msg, wp, lp); |
| 615 |
} |