Set.cpp 32 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287
  1. /** (c) Nullsoft, Inc. C O N F I D E N T I A L
  2. ** Filename:
  3. ** Project:
  4. ** Description:
  5. ** Author:
  6. ** Created:
  7. **/
  8. #include "Main.h"
  9. #include "WinampAttributes.h"
  10. #include "ExternalCOM.h"
  11. #include "../nu/AutoWide.h"
  12. static int dc_pos=0;
  13. extern int is_fullscreen_video;
  14. extern int g_fsapp;
  15. static BOOL HasParent(HWND hwnd)
  16. {
  17. return ((0 != (WS_CHILD & GetWindowLongPtrW(hwnd, GWL_STYLE))) && NULL != GetParent(hwnd));
  18. }
  19. void do_caption_autoscroll(void)
  20. {
  21. wchar_t buf[4096]=L"";
  22. if (dc_pos < (int)lstrlenW(caption))
  23. {
  24. StringCchCopyW(buf,4096, caption+dc_pos);
  25. StringCchCatW(buf,4096,L" *** ");
  26. StringCchCopyW(buf+lstrlenW(buf),4096-lstrlenW(buf),caption);
  27. dc_pos++;
  28. }
  29. else
  30. {
  31. StringCchCopyW(buf,4096,L" *** "+dc_pos-lstrlenW(caption));
  32. StringCchCatW(buf,4096, caption);
  33. StringCchCopyW(buf+lstrlenW(buf),4096-lstrlenW(buf), L" *** ");
  34. if (++dc_pos >= (int)lstrlenW(caption)+3) dc_pos=0;
  35. }
  36. SetWindowLong(hMainWindow,GWL_STYLE,GetWindowLongW(hMainWindow,GWL_STYLE)&~(WS_CAPTION));
  37. SetWindowTextW(hMainWindow,buf);
  38. SetWindowLong(hMainWindow,GWL_STYLE,GetWindowLongW(hMainWindow,GWL_STYLE)|(WS_CAPTION));
  39. }
  40. void set_caption(int alt_cb, wchar_t *format, ...)
  41. {
  42. va_list v;
  43. if (format)
  44. {
  45. va_start(v,format);
  46. StringCchVPrintfW(caption, CAPTION_SIZE, format, v);
  47. va_end(v);
  48. }
  49. SetWindowLong(hMainWindow,GWL_STYLE,GetWindowLongW(hMainWindow,GWL_STYLE)&~(WS_CAPTION));
  50. SetWindowTextW(hMainWindow,caption);
  51. SetWindowLong(hMainWindow,GWL_STYLE,GetWindowLongW(hMainWindow,GWL_STYLE)|(WS_CAPTION));
  52. dc_pos=0;
  53. if (systray_intray) systray_minimize(caption);
  54. // TODO in some cases this is crashing based on crash reports (issue with 'now playling' ??)
  55. JSAPI1_CurrentTitleChanged();
  56. PostMessageW(hMainWindow,WM_WA_IPC,(!alt_cb?IPC_CB_MISC_TITLE:IPC_CB_MISC_TITLE_RATING),IPC_CB_MISC);
  57. SendNotifyMessage(HWND_BROADCAST, songChangeBroadcastMessage, 0, 0);
  58. }
  59. void set_taskbar(void)
  60. {
  61. static int a;
  62. if (config_taskbar == 1 || config_taskbar == 2)
  63. {
  64. systray_minimize(caption);
  65. }
  66. else
  67. {
  68. if (systray_intray) systray_restore();
  69. }
  70. ShowWindow(hMainWindow,SW_HIDE);
  71. if (config_taskbar == 1 || config_taskbar == 3)
  72. SetWindowLong(hMainWindow,GWL_EXSTYLE,GetWindowLongW(hMainWindow,GWL_EXSTYLE)|WS_EX_TOOLWINDOW);
  73. else
  74. SetWindowLong(hMainWindow,GWL_EXSTYLE,GetWindowLongW(hMainWindow,GWL_EXSTYLE)&~WS_EX_TOOLWINDOW);
  75. if (a)
  76. {
  77. extern int deferring_show;
  78. if (!deferring_show) ShowWindow(hMainWindow,SW_SHOWNA);
  79. }
  80. a=1;
  81. }
  82. // better enter embedcs before calling this func
  83. static void doMyDirtyShitholeDockingShit(HWND myWnd, RECT newr, int sedge) // -1 to do all
  84. {
  85. RECT oldr = {0};
  86. GetWindowRect(myWnd, &oldr);
  87. if (myWnd == hMainWindow)
  88. FixMainWindowRect(&oldr);
  89. for (int whichedge = 0; whichedge < 2; whichedge++) // not always used
  90. {
  91. int diff;
  92. embedWindowState *p=embedwndlist;
  93. if (sedge >= 0)
  94. whichedge=sedge;
  95. if (whichedge == 0)
  96. diff=newr.bottom - oldr.bottom;
  97. else
  98. diff = newr.right - oldr.right;
  99. // move any windows docked to the bottom, bottom. recursively.
  100. if (diff) for (int x = 0; ; x ++)
  101. {
  102. HWND dockwnd=NULL;
  103. RECT oldrect;
  104. int vis=0;
  105. if ( x == 0 )
  106. {
  107. dockwnd = hMainWindow;
  108. vis = config_mw_open;
  109. }
  110. else if ( x == 1 )
  111. {
  112. dockwnd = hEQWindow;
  113. vis = config_eq_open;
  114. }
  115. else if ( x == 2 )
  116. {
  117. dockwnd = hPLWindow;
  118. vis = config_pe_open;
  119. }
  120. //else if (x == 3) { dockwnd=hMBWindow; vis=0; } //config_mb_open; }
  121. else if ( x == 4 )
  122. {
  123. dockwnd = hVideoWindow;
  124. vis = config_video_open;
  125. }
  126. else
  127. {
  128. if ( !p )
  129. break;
  130. dockwnd = p->me;
  131. vis = IsWindowVisible( p->me );
  132. }
  133. GetWindowRect(dockwnd,&oldrect);
  134. if (!x)
  135. FixMainWindowRect(&oldrect);
  136. if (dockwnd != myWnd)
  137. {
  138. int isdocked;
  139. if (!whichedge)
  140. isdocked=oldrect.top == oldr.bottom && (
  141. (oldrect.left >= oldr.left && oldrect.left < oldr.right) ||
  142. (oldrect.right > oldr.left && oldrect.right <= oldr.right) ||
  143. (oldr.left >= oldrect.left && oldr.left < oldrect.right) ||
  144. (oldr.right > oldrect.left && oldr.right <= oldrect.right)
  145. );
  146. else
  147. isdocked=oldrect.left == oldr.right && (
  148. (oldrect.top >= oldr.top && oldrect.top < oldr.bottom) ||
  149. (oldrect.bottom > oldr.top && oldrect.bottom <= oldr.bottom) ||
  150. (oldr.top >= oldrect.top && oldr.top < oldrect.bottom) ||
  151. (oldr.bottom > oldrect.top && oldr.bottom <= oldrect.bottom)
  152. );
  153. if (isdocked)
  154. {
  155. if ( x == 0 )
  156. {
  157. if ( !whichedge )
  158. config_wy = newr.bottom;
  159. else
  160. config_wx = newr.right;
  161. EstMainWindowRect( &oldrect );
  162. }
  163. else if ( x == 1 )
  164. {
  165. if ( !whichedge )
  166. config_eq_wy = newr.bottom;
  167. else
  168. config_eq_wx = newr.right;
  169. EstEQWindowRect( &oldrect );
  170. }
  171. else if ( x == 2 )
  172. {
  173. if ( !whichedge )
  174. config_pe_wy = newr.bottom;
  175. else
  176. config_pe_wx = newr.right;
  177. EstPLWindowRect( &oldrect );
  178. }
  179. else if ( x == 4 && !is_fullscreen_video )
  180. {
  181. if ( !whichedge )
  182. config_video_wy = newr.bottom;
  183. else
  184. config_video_wx = newr.right;
  185. EstVidWindowRect( &oldrect );
  186. }
  187. else
  188. {
  189. int w = p->r.right - p->r.left;
  190. int h = p->r.bottom - p->r.top;
  191. if ( !whichedge )
  192. p->r.top = newr.bottom;
  193. else
  194. p->r.left = newr.right;
  195. p->r.right = p->r.left + w;
  196. p->r.bottom = p->r.top + h;
  197. oldrect = p->r;
  198. }
  199. if ( vis )
  200. doMyDirtyShitholeDockingShit( dockwnd, oldrect, whichedge );
  201. }
  202. }
  203. if (x>4) p=p->link;
  204. }
  205. if (sedge >= 0) break;
  206. }
  207. }
  208. static void doScreenDockMoveSubWindows(HWND myWnd, RECT newr, int whichedge)
  209. {
  210. RECT oldr = {0};
  211. embedWindowState *p=embedwndlist;
  212. GetWindowRect(myWnd,&oldr);
  213. if (myWnd == hMainWindow)
  214. FixMainWindowRect(&oldr);
  215. // move any windows docked to the bottom, bottom. recursively.
  216. for (int x = 0; ; x ++)
  217. {
  218. HWND dockwnd=NULL;
  219. RECT oldrect;
  220. int vis=0;
  221. RECT newrect;
  222. if ( x == 0 )
  223. {
  224. dockwnd = hMainWindow;
  225. vis = config_mw_open;
  226. EstMainWindowRect( &newrect );
  227. }
  228. else if ( x == 1 )
  229. {
  230. dockwnd = hEQWindow;
  231. vis = config_eq_open;
  232. EstEQWindowRect( &newrect );
  233. }
  234. else if ( x == 2 )
  235. {
  236. dockwnd = hPLWindow;
  237. vis = config_pe_open;
  238. EstPLWindowRect( &newrect );
  239. }
  240. //else if (x == 3) { dockwnd=hMBWindow; vis=0;/*config_mb_open; */ EstMBWindowRect(&newrect); }
  241. else if ( x == 4 )
  242. {
  243. dockwnd = hVideoWindow;
  244. vis = config_video_open;
  245. EstVidWindowRect( &newrect );
  246. }
  247. else
  248. {
  249. if ( !p )
  250. break;
  251. newrect = p->r;
  252. dockwnd = p->me;
  253. vis = IsWindowVisible( p->me );
  254. }
  255. GetWindowRect(dockwnd,&oldrect);
  256. if (!x) FixMainWindowRect(&oldrect);
  257. if (dockwnd != myWnd)
  258. {
  259. int isdocked;
  260. if (!whichedge)
  261. isdocked=oldrect.bottom == oldr.top && (
  262. (oldrect.left >= oldr.left && oldrect.left <= oldr.right) ||
  263. (oldrect.right >= oldr.left && oldrect.right <= oldr.right) ||
  264. (oldr.left >= oldrect.left && oldr.left <= oldrect.right) ||
  265. (oldr.right >= oldrect.left && oldr.right <= oldrect.right)
  266. );
  267. else
  268. isdocked=oldrect.right == oldr.left && (
  269. (oldrect.top >= oldr.top && oldrect.top <= oldr.bottom) ||
  270. (oldrect.bottom >= oldr.top && oldrect.bottom <= oldr.bottom) ||
  271. (oldr.top >= oldrect.top && oldr.top <= oldrect.bottom) ||
  272. (oldr.bottom >= oldrect.top && oldr.bottom <= oldrect.bottom)
  273. );
  274. if (isdocked)
  275. {
  276. int h=newrect.bottom-newrect.top;
  277. int w=newrect.right-newrect.left;
  278. if ( x == 0 )
  279. {
  280. if ( !whichedge )
  281. config_wy = newr.top - h;
  282. else
  283. config_wx = newr.left - w;
  284. EstMainWindowRect( &oldrect );
  285. }
  286. else if ( x == 1 )
  287. {
  288. if ( !whichedge )
  289. config_eq_wy = newr.top - h;
  290. else
  291. config_eq_wx = newr.left - w;
  292. EstEQWindowRect( &oldrect );
  293. }
  294. else if ( x == 2 )
  295. {
  296. if ( !whichedge )
  297. config_pe_wy = newr.top - h;
  298. else
  299. config_pe_wx = newr.left - w;
  300. EstPLWindowRect( &oldrect );
  301. }
  302. else if ( x == 4 && !is_fullscreen_video )
  303. {
  304. if ( !whichedge )
  305. config_video_wy = newr.top - h;
  306. else
  307. config_video_wx = newr.left - w;
  308. EstVidWindowRect( &oldrect );
  309. }
  310. else
  311. {
  312. int w = p->r.right - p->r.left;
  313. int h = p->r.bottom - p->r.top;
  314. if ( !whichedge )
  315. p->r.top = newr.top - h;
  316. else
  317. p->r.left = newr.left - w;
  318. p->r.right = p->r.left + w;
  319. p->r.bottom = p->r.top + h;
  320. oldrect = p->r;
  321. }
  322. if (vis)
  323. doScreenDockMoveSubWindows(dockwnd,oldrect,whichedge);
  324. }
  325. }
  326. if (x>4) p=p->link;
  327. }
  328. }
  329. static void doScreenDock()
  330. {
  331. //RECT vp;
  332. //SystemParametersInfo(SPI_GETWORKAREA, 0, &vp, 0); //fixme: make sure we keep things in vp :)
  333. for (int whichedge = 0; whichedge < 2; whichedge++)
  334. {
  335. embedWindowState *p=embedwndlist;
  336. // move any windows docked to the bottom, bottom. recursively.
  337. for (int x = 0; ; x ++)
  338. {
  339. RECT vp;
  340. HWND dockwnd=NULL;
  341. RECT oldrect;
  342. RECT newrect;
  343. int at2side=0;
  344. int vis=0;
  345. if ( x == 0 )
  346. {
  347. dockwnd = hMainWindow;
  348. vis = config_mw_open;
  349. EstMainWindowRect( &newrect );
  350. }
  351. else if ( x == 1 )
  352. {
  353. dockwnd = hEQWindow;
  354. vis = config_eq_open;
  355. EstEQWindowRect( &newrect );
  356. }
  357. else if ( x == 2 )
  358. {
  359. dockwnd = hPLWindow;
  360. vis = config_pe_open;
  361. EstPLWindowRect( &newrect );
  362. }
  363. //else if (x == 3) { dockwnd=hMBWindow; vis=0; /*config_mb_open; */ EstMBWindowRect(&newrect); }
  364. else if ( x == 4 )
  365. {
  366. dockwnd = hVideoWindow;
  367. vis = config_video_open;
  368. EstVidWindowRect( &newrect );
  369. }
  370. else
  371. {
  372. if ( !p )
  373. break;
  374. newrect = p->r;
  375. dockwnd = p->me;
  376. vis = IsWindowVisible( p->me );
  377. }
  378. GetWindowRect(dockwnd,&oldrect);
  379. if (!x)
  380. FixMainWindowRect(&oldrect);
  381. getViewport(&vp,NULL,0,&oldrect);
  382. if (config_keeponscreen&1)
  383. {
  384. if (!whichedge)
  385. at2side=oldrect.bottom == vp.bottom;
  386. else
  387. at2side=oldrect.right == vp.right;
  388. }
  389. if (at2side)
  390. {
  391. if (!whichedge)
  392. {
  393. int diff=vp.bottom-newrect.bottom;
  394. newrect.bottom += diff;
  395. newrect.top += diff;
  396. }
  397. else
  398. {
  399. int diff=vp.right-newrect.right;
  400. newrect.right += diff;
  401. newrect.left += diff;
  402. }
  403. if ( x == 0 )
  404. {
  405. if ( !whichedge )
  406. config_wy = newrect.top;
  407. else
  408. config_wx = newrect.left;
  409. EstMainWindowRect( &oldrect );
  410. }
  411. else if ( x == 1 )
  412. {
  413. if ( !whichedge )
  414. config_eq_wy = newrect.top;
  415. else
  416. config_eq_wx = newrect.left;
  417. EstEQWindowRect( &oldrect );
  418. }
  419. else if ( x == 2 )
  420. {
  421. if ( !whichedge )
  422. config_pe_wy = newrect.top;
  423. else
  424. config_pe_wx = newrect.left;
  425. EstPLWindowRect( &oldrect );
  426. }
  427. // else if (x == 3) { if (!whichedge) config_mb_wy = newrect.top; else config_mb_wx = newrect.left; EstMBWindowRect(&oldrect); }
  428. else if ( x == 4 && !is_fullscreen_video )
  429. {
  430. if ( !whichedge )
  431. config_video_wy = newrect.top;
  432. else
  433. config_video_wx = newrect.left;
  434. EstVidWindowRect( &oldrect );
  435. }
  436. else
  437. {
  438. int w = p->r.right - p->r.left;
  439. int h = p->r.bottom - p->r.top;
  440. if ( !whichedge )
  441. p->r.top = newrect.top;
  442. else
  443. p->r.left = newrect.left;
  444. p->r.right = p->r.left + w;
  445. p->r.bottom = p->r.top + h;
  446. oldrect = p->r;
  447. }
  448. if (vis)
  449. {
  450. doScreenDockMoveSubWindows(dockwnd,oldrect,whichedge);
  451. }
  452. }
  453. if (x>4) p=p->link;
  454. }
  455. }
  456. }
  457. void set_eq_wnd_tooltip()
  458. {
  459. if (hEQTooltipWindow)
  460. {
  461. static int b=0;
  462. TOOLINFOW ti = {0};
  463. RECT r_main;
  464. EstEQWindowRect(&r_main);
  465. ti.cbSize = sizeof(ti);
  466. ti.uFlags = TTF_SUBCLASS;
  467. ti.hwnd = hEQWindow;
  468. ti.rect = r_main;
  469. ti.uId = (UINT_PTR)hEQTooltipWindow;
  470. ti.lpszText = (wchar_t*)LPSTR_TEXTCALLBACK;
  471. if (b) SendMessageW(hEQTooltipWindow,TTM_DELTOOLW,0,(LPARAM) &ti);
  472. if (config_ttips) SendMessageW(hEQTooltipWindow,TTM_ADDTOOLW,0,(LPARAM) &ti);
  473. {
  474. RECT rs[18]={{0},{0},{0},{0},{0},{0},{0},{0},{0},{0},{0},
  475. // toggle winshade / close button
  476. {254,3,262,12},{264,3,272,12},
  477. // toggle eq, toggle auto, presets
  478. {14,18,39,30},{39,18,72,30},{217,18,261,30},
  479. // windowshade volume and pan
  480. {61,3,162,11},{163,3,206,11}};
  481. wchar_t buf[2048] = {0};
  482. getStringW(IDS_TOOLTIPS,buf,2048);
  483. wchar_t *bands[11] =
  484. {
  485. L"",
  486. L"70",L"180",L"320",L"600", // Hz
  487. L"1",L"3",L"6",L"12",L"14",L"16" // KHz
  488. };
  489. wchar_t *bandsISO[11] =
  490. {
  491. L"",
  492. L"31.5",L"63",L"125",L"250", // Hz
  493. L"500",L"1",L"2",L"4",L"8",L"16" // KHz
  494. };
  495. for (int x=0; x < sizeof(rs)/sizeof(rs[0]); x++)
  496. {
  497. if(x < 11){
  498. int xoffs;
  499. if (!x) xoffs=21;
  500. else xoffs=78+(x-1)*(96-78);
  501. rs[x].left = xoffs;
  502. rs[x].top = 39;
  503. rs[x].right = xoffs+(33-21);
  504. rs[x].bottom = 98;
  505. }
  506. ti.uId = x;
  507. if(!x) ti.lpszText = getStringW(IDS_PREAMP,NULL,0);
  508. else if(x > 15){
  509. if(config_eq_ws)
  510. {
  511. // re-use the main tooltip text and handle the 'toggle windowshade' and 'close' buttons as applicable
  512. wchar_t buf[2048], *p=buf;
  513. getStringW(IDS_TOOLTIPS,buf,2048);
  514. ti.lpszText=(wchar_t*)SendMessageW(hMainWindow,WM_WA_IPC,(x - 4),IPC_CB_GETTOOLTIPW);
  515. if (!ti.lpszText) ti.lpszText=AutoWide((char*)SendMessageW(hMainWindow,WM_WA_IPC,(x - 4),IPC_CB_GETTOOLTIP));
  516. if (!ti.lpszText){
  517. for(int i = 0; i < (x - 4); i++){
  518. ti.lpszText=p;
  519. while (p && *p && *p != L'|') p++;
  520. if (p) *p++=0;
  521. }
  522. }
  523. }
  524. else
  525. ti.lpszText = 0;
  526. }
  527. else if(x > 12){
  528. wchar_t buf[2048], *p=buf;
  529. getStringW(IDS_EQ_TOOLTIPS,buf,2048);
  530. for(int i = 0; i < x - 12; i++){
  531. ti.lpszText=p;
  532. while (p && *p && *p != L'|') p++;
  533. if (p) *p++=0;
  534. }
  535. }
  536. else if(x > 10){
  537. // re-use the main tooltip text and handle the 'toggle windowshade' and 'close' buttons as applicable
  538. wchar_t buf[2048], *p=buf;
  539. getStringW(IDS_TOOLTIPS,buf,2048);
  540. ti.lpszText=(wchar_t*)SendMessageW(hMainWindow,WM_WA_IPC,x-11,IPC_CB_GETTOOLTIPW);
  541. if (!ti.lpszText) ti.lpszText=AutoWide((char*)SendMessageW(hMainWindow,WM_WA_IPC,x-11,IPC_CB_GETTOOLTIP));
  542. if (!ti.lpszText){
  543. for(int i = 0; i < (x == 11 ? 1 : 3); i++){
  544. ti.lpszText=p;
  545. while (p && *p && *p != L'|') p++;
  546. if (p) *p++=0;
  547. }
  548. }
  549. }
  550. else{
  551. wchar_t HZStr[16] = {0};
  552. getStringW((x<5+!(config_eq_frequencies==EQ_FREQUENCIES_WINAMP)?IDS_EQ_HZ:IDS_EQ_KHZ),HZStr,16);
  553. StringCchPrintfW(buf,80,L"%s%s",
  554. ((config_eq_frequencies==EQ_FREQUENCIES_WINAMP)?bands[x]:bandsISO[x]),
  555. (!x?L"":HZStr));
  556. ti.lpszText = buf;
  557. }
  558. ti.rect = rs[x];
  559. if (config_dsize)
  560. {
  561. ti.rect.left *= 2;
  562. ti.rect.right *= 2;
  563. ti.rect.top *= 2;
  564. ti.rect.bottom *= 2;
  565. }
  566. SendMessageW(hEQTooltipWindow,TTM_DELTOOLW,0,(LPARAM) &ti);
  567. if (config_ttips) SendMessageW(hEQTooltipWindow,TTM_ADDTOOLW,0,(LPARAM) &ti);
  568. }
  569. }
  570. b=config_ttips;
  571. }
  572. }
  573. void set_vid_wnd_tooltip()
  574. {
  575. if (hVideoTooltipWindow)
  576. {
  577. static int d=0;
  578. TOOLINFOW ti = {0};
  579. RECT r_main;
  580. EstVidWindowRect(&r_main);
  581. ti.cbSize = sizeof(ti);
  582. ti.uFlags = TTF_SUBCLASS;
  583. ti.hwnd = hVideoWindow;
  584. ti.rect = r_main;
  585. ti.uId = (UINT_PTR)hVideoTooltipWindow;
  586. ti.lpszText = (wchar_t*)LPSTR_TEXTCALLBACK;
  587. if (d) SendMessageW(hVideoTooltipWindow,TTM_DELTOOLW,0,(LPARAM) &ti);
  588. if (config_ttips) SendMessageW(hVideoTooltipWindow,TTM_ADDTOOLW,0,(LPARAM) &ti);
  589. {
  590. RECT rs[]={{0,3,0,12},{9,0,24,0},{25,0,40,0},{41,0,56,0},{57,0,72,0},{73,0,89,0}};
  591. rs[0].left = config_video_width-11;
  592. rs[0].right = config_video_width-2;
  593. rs[1].top = rs[2].top = rs[3].top = rs[4].top = rs[5].top = config_video_height-29;
  594. rs[1].bottom = rs[2].bottom = rs[3].bottom = rs[4].bottom = rs[5].bottom = config_video_height-11;
  595. wchar_t buf[2048], *p=buf;
  596. getStringW(IDS_VID_TOOLTIPS,buf,2048);
  597. for (int x=0; x < sizeof(rs)/sizeof(rs[0]); x++)
  598. {
  599. if(!x)
  600. {
  601. // re-use the main tooltip text and handle the 'toggle windowshade' and 'close' buttons as applicable
  602. wchar_t buf2[2048], *p2=buf2;
  603. getStringW(IDS_TOOLTIPS,buf2,2048);
  604. for(int i = 0; i < 3; i++){
  605. ti.lpszText=p2;
  606. while (p2 && *p2 && *p2 != L'|') p2++;
  607. if (p2) *p2++=0;
  608. }
  609. }
  610. else
  611. {
  612. ti.lpszText=p;
  613. while (p && *p && *p != L'|') p++;
  614. if (p) *p++=0;
  615. }
  616. ti.uId = x;
  617. ti.rect = rs[x];
  618. if (d) SendMessageW(hVideoTooltipWindow,TTM_DELTOOLW,0,(LPARAM) &ti);
  619. if (config_ttips) SendMessageW(hVideoTooltipWindow,TTM_ADDTOOLW,0,(LPARAM) &ti);
  620. }
  621. }
  622. d=config_ttips;
  623. }
  624. }
  625. void set_pl_wnd_tooltip()
  626. {
  627. if (hPLTooltipWindow)
  628. {
  629. static int c=0;
  630. TOOLINFOW ti = {0};
  631. RECT r_main;
  632. EstPLWindowRect(&r_main);
  633. ti.cbSize = sizeof(ti);
  634. ti.uFlags = TTF_SUBCLASS;
  635. ti.hwnd = hPLWindow;
  636. ti.rect = r_main;
  637. ti.uId = (UINT_PTR)hPLTooltipWindow;
  638. ti.lpszText = (wchar_t*)LPSTR_TEXTCALLBACK;
  639. if (c) SendMessageW(hPLWindow,TTM_DELTOOLW,0,(LPARAM) &ti);
  640. if (config_ttips) SendMessageW(hPLWindow,TTM_ADDTOOLW,0,(LPARAM) &ti);
  641. {
  642. // toggle winshade / close button
  643. RECT rs[]={{0,3,0,12},{0,3,0,12},
  644. // add, rem, sel, misc, list buttons
  645. {14,0,36,0},{43,0,65,0},{72,0,94,0},{101,0,123,0},{0},
  646. // windowshade mappings - order is out of kilt so it maps more easily to the string
  647. // (open, previuos, play, pause, stop, next, time)
  648. {0},{0},{0},{0},{0},{0},{0},
  649. // up/down scroll buttons
  650. {0},{0},
  651. // resize horizontally (winshade)
  652. /*{0},
  653. // playlist item truncated text*/
  654. {0}};
  655. rs[0].left = config_pe_width - 11;
  656. rs[0].right = config_pe_width - 2;
  657. rs[1].left = config_pe_width - 21;
  658. rs[1].right = config_pe_width - 12;
  659. rs[2].top = rs[3].top = rs[4].top = rs[5].top = rs[6].top = (config_pe_height - 30);
  660. rs[2].bottom = rs[3].bottom = rs[4].bottom = rs[5].bottom = rs[6].bottom = (config_pe_height - 12);
  661. rs[6].left = config_pe_width - 44;
  662. rs[6].right = config_pe_width - 22;
  663. rs[7].top = rs[8].top = rs[9].top = rs[10].top = rs[11].top = rs[12].top = rs[13].top = (config_pe_height - 16);
  664. rs[7].bottom = rs[8].bottom = rs[9].bottom = rs[10].bottom = rs[11].bottom = rs[12].bottom = rs[13].bottom = (config_pe_height - 8);
  665. rs[7].left = config_pe_width - 98;
  666. rs[7].right = config_pe_width - 90;
  667. rs[8].left = config_pe_width - 144;
  668. rs[8].right = config_pe_width - 137;
  669. rs[9].left = config_pe_width - 136;
  670. rs[9].right = config_pe_width - 127;
  671. rs[10].left = config_pe_width - 126;
  672. rs[10].right = config_pe_width - 117;
  673. rs[11].left = config_pe_width - 116;
  674. rs[11].right = config_pe_width - 109;
  675. rs[12].left = config_pe_width - 108;
  676. rs[12].right = config_pe_width - 100;
  677. rs[13].left = config_pe_width - 87;
  678. rs[13].right = config_pe_width - 54;
  679. wchar_t buf[2048], *p=buf;
  680. getStringW(IDS_PL_TOOLTIPS,buf,2048);
  681. for (int x=0; x < sizeof(rs)/sizeof(rs[0]); x++)
  682. {
  683. if(x < 2)
  684. {
  685. // re-use the main tooltip text and handle the 'toggle windowshade' and 'close' buttons as applicable
  686. wchar_t buf2[2048], *p2=buf2;
  687. getStringW(IDS_TOOLTIPS,buf2,2048);
  688. for(int i = 0; i < (x == 1 ? 1 : 3); i++){
  689. ti.lpszText=p2;
  690. while (p2 && *p2 && *p2 != L'|') p2++;
  691. if (p2) *p2++=0;
  692. }
  693. }
  694. else if(x == 16){
  695. if(config_pe_height == 14)
  696. {
  697. rs[x].left = config_pe_width - 29;
  698. rs[x].right = config_pe_width - 22;
  699. rs[x].top = 3;
  700. rs[x].bottom = 13;
  701. ti.lpszText=p;
  702. while (p && *p && *p != L'|') p++;
  703. if (p) *p++=0;
  704. }
  705. else
  706. ti.lpszText = 0;
  707. }
  708. else if(x >= 14)
  709. {
  710. rs[x].left = config_pe_width - 16;
  711. rs[x].right = config_pe_width - 6;
  712. rs[x].top = config_pe_height - (x == 14 ? 37 : 31);
  713. rs[x].bottom = config_pe_height - (x == 14 ? 32 : 25);
  714. ti.lpszText=p;
  715. while (p && *p && *p != L'|') p++;
  716. *p++=0;
  717. }
  718. else if(x > 6)
  719. {
  720. if (config_pe_height != 14)
  721. {
  722. wchar_t buf2[2048], *p2=buf2;
  723. getStringW(IDS_TOOLTIPS,buf2,2048);
  724. for(int i = 0; i < 17 + (x - 6); i++){
  725. ti.lpszText=p2;
  726. while (p2 && *p2 && *p2 != L'|') p2++;
  727. *p2++=0;
  728. }
  729. }
  730. else
  731. ti.lpszText = 0;
  732. }
  733. else
  734. {
  735. ti.lpszText=p;
  736. while (p && *p && *p != L'|') p++;
  737. if (p) *p++=0;
  738. if (config_pe_height == 14 && x > 1)
  739. ti.lpszText = 0;
  740. }
  741. ti.uId = x;
  742. ti.rect = rs[x];
  743. if (c) SendMessageW(hPLTooltipWindow,TTM_DELTOOLW,0,(LPARAM) &ti);
  744. if (config_ttips) SendMessageW(hPLTooltipWindow,TTM_ADDTOOLW,0,(LPARAM) &ti);
  745. }
  746. }
  747. c=config_ttips;
  748. }
  749. }
  750. void set_main_wnd_tooltip()
  751. {
  752. if (hTooltipWindow)
  753. {
  754. static int a=0;
  755. TOOLINFOW ti = {0};
  756. RECT r_main;
  757. EstMainWindowRect(&r_main);
  758. ti.cbSize = sizeof(ti);
  759. ti.uFlags = TTF_SUBCLASS;
  760. ti.hwnd = hMainWindow;
  761. ti.rect = r_main;
  762. ti.uId = (UINT_PTR)hTooltipWindow;
  763. ti.lpszText = (wchar_t*)LPSTR_TEXTCALLBACK;
  764. if (a) SendMessageW(hTooltipWindow,TTM_DELTOOLW,0,(LPARAM) &ti);
  765. if (config_ttips) SendMessageW(hTooltipWindow,TTM_ADDTOOLW,0,(LPARAM) &ti);
  766. {
  767. RECT rs[]={{254,3,262,12},{244,3,253,12},{264,3,272,12},{5,3,17,13},
  768. {219,58,219+23,58+12},{219+23,58,219+23+23,58+12},
  769. {11,24,19,31},{11,32,19,39},{11,40,19,47},{11,48,19,55},{11,56,19,62},
  770. {107,43+15,107+68,51+15},{177,43+15,177+38,51+15},{11+7,58+15,256+7,66+15},{133+7-4+29,75+15,181+7-4-4+29,87+15},{182+7-4-4+29,75+15,182+29+7-4-4+29,87+15},
  771. {246+7,76+15,258+7,90+15},{132+7-4+1,60+14+15,132+7-4+22+1,60+14+15+16},
  772. {7+8,15+72,7+31,15+91},{7+32,15+72,7+53,15+91},{7+54,15+72,7+77,15+91},{7+78,15+72,7+100,15+91},{7+101,15+72,7+123,15+91},
  773. {36,26,96,39},{105,24,266,35},
  774. // windowshade mappings - order is out of kilt so it maps more easily to the string
  775. // (seeker, open, previuos, play, pause, stop, next, time)
  776. {226,4,243,11},{216,2,224,11},{168,2,176,11},{177,2,186,11},{187,2,195,11},{196,2,204,11},{205,2,215,11},{125,4,157,10}};
  777. wchar_t buf[2048], *p=buf;
  778. getStringW(IDS_TOOLTIPS,buf,2048);
  779. for (int x=0; x < sizeof(rs)/sizeof(rs[0]); x++)
  780. {
  781. ti.uId = x;
  782. ti.lpszText=(wchar_t*)SendMessageW(hMainWindow,WM_WA_IPC,x,IPC_CB_GETTOOLTIPW);
  783. if (!ti.lpszText) ti.lpszText=AutoWide((char*)SendMessageW(hMainWindow,WM_WA_IPC,x,IPC_CB_GETTOOLTIP));
  784. if (!ti.lpszText) ti.lpszText=p;
  785. int ws_parts = sizeof(rs)/sizeof(rs[0]) - 8;
  786. if(x < ws_parts)
  787. {
  788. while (p && *p && *p != L'|') p++;
  789. if (p) *p++=0;
  790. }
  791. else
  792. {
  793. if(config_windowshade)
  794. {
  795. getStringW(IDS_TOOLTIPS,buf,2048);
  796. p=buf;
  797. for(int i = 0; i < (x - ws_parts == 0 ? 14 : x - 8); i++){
  798. ti.lpszText=p;
  799. while (p && *p && *p != L'|') p++;
  800. if (p) *p++=0;
  801. }
  802. }
  803. else
  804. ti.lpszText = 0;
  805. }
  806. ti.rect = rs[x];
  807. if (config_dsize)
  808. {
  809. ti.rect.left *= 2;
  810. ti.rect.right *= 2;
  811. ti.rect.top *= 2;
  812. ti.rect.bottom *= 2;
  813. }
  814. if (a) SendMessageW(hTooltipWindow,TTM_DELTOOLW,0,(LPARAM) &ti);
  815. if (config_ttips) SendMessageW(hTooltipWindow,TTM_ADDTOOLW,0,(LPARAM) &ti);
  816. }
  817. }
  818. a=config_ttips;
  819. }
  820. }
  821. void set_aot(int dodockingstuff)
  822. {
  823. // do size handling stuff here
  824. if (dodockingstuff>0)
  825. {
  826. //new mode is inspired by christophe's sexiness
  827. RECT newr;
  828. EnterCriticalSection(&embedcs);
  829. EstMainWindowRect(&newr);
  830. doMyDirtyShitholeDockingShit(hMainWindow,newr,-1);
  831. EstEQWindowRect(&newr);
  832. doMyDirtyShitholeDockingShit(hEQWindow,newr,-1);
  833. EstPLWindowRect(&newr);
  834. doMyDirtyShitholeDockingShit(hPLWindow,newr,-1);
  835. // check to see if any windows used to be docked to the right/bottom, and
  836. // if they did, move them to the bottom and any attached windows
  837. // this actually works OK!
  838. if ((config_keeponscreen&1) && !g_fsapp) doScreenDock();
  839. LeaveCriticalSection(&embedcs);
  840. }
  841. set_eq_wnd_tooltip();
  842. set_vid_wnd_tooltip();
  843. set_pl_wnd_tooltip();
  844. set_main_wnd_tooltip();
  845. CheckMenuItem(main_menu,WINAMP_OPTIONS_AOT,config_aot?MF_CHECKED:MF_UNCHECKED);
  846. CheckMenuItem(main_menu,WINAMP_OPTIONS_DSIZE,config_dsize?MF_CHECKED:MF_UNCHECKED);
  847. if ((config_keeponscreen&1) && !g_fsapp)
  848. {
  849. RECT r;
  850. if (config_mw_open)
  851. {
  852. RECT thisr;
  853. EstMainWindowRect( &thisr );
  854. getViewport( &r, NULL, 0, &thisr );
  855. if ( config_wx + ( thisr.right - thisr.left - 10 ) < r.left )
  856. config_wx = r.left - ( thisr.right - thisr.left - 10 );
  857. if ( config_wy + ( thisr.bottom - thisr.top - 10 ) < r.top )
  858. config_wy = r.top - ( thisr.bottom - thisr.top - 10 );
  859. if (config_wx > r.right - 10)
  860. config_wx = r.left + 10; //config_wx = r.right - 10;
  861. if (config_wy > r.bottom - 10)
  862. config_wy = r.top + 10; //config_wy = r.bottom - 10;
  863. }
  864. if (config_eq_open)
  865. {
  866. RECT thisr;
  867. EstEQWindowRect( &thisr );
  868. getViewport( &r, NULL, 0, &thisr );
  869. if ( config_eq_wx + ( thisr.right - thisr.left - 10 ) < r.left )
  870. config_eq_wx = r.left - ( thisr.right - thisr.left - 10 );
  871. if ( config_eq_wy + ( thisr.bottom - thisr.top - 10 ) < r.top )
  872. config_eq_wy = r.top - ( thisr.bottom - thisr.top - 10 );
  873. if (config_eq_wx > r.right - 10)
  874. config_eq_wx = r.left + 10; //r.right - 10;
  875. if (config_eq_wy > r.bottom - 10)
  876. config_eq_wy = r.top + 10; //r.bottom - 10;
  877. }
  878. if (config_pe_open)
  879. {
  880. RECT thisr;
  881. EstPLWindowRect( &thisr );
  882. getViewport( &r, NULL, 0, &thisr );
  883. if ( config_pe_wx + ( thisr.right - thisr.left - 10 ) < r.left )
  884. config_pe_wx = r.left - ( thisr.right - thisr.left - 10 );
  885. if ( config_pe_wy + ( thisr.bottom - thisr.top - 10 ) < r.top )
  886. config_pe_wy = r.top - ( thisr.bottom - thisr.top - 10 );
  887. if (config_pe_wx > r.right - 10)
  888. config_pe_wx = r.left + 10; //r.right - 10;
  889. if (config_pe_wy > r.bottom - 10)
  890. config_pe_wy = r.top + 10; //r.bottom - 10;
  891. }
  892. if (config_video_open && !is_fullscreen_video)
  893. {
  894. RECT thisr;
  895. EstVidWindowRect( &thisr );
  896. getViewport( &r, NULL, 0, &thisr );
  897. if ( config_video_wx + ( thisr.right - thisr.left - 10 ) < r.left )
  898. config_video_wx = r.left - ( thisr.right - thisr.left - 10 );
  899. if ( config_video_wy + ( thisr.bottom - thisr.top - 10 ) < r.top )
  900. config_video_wy = r.top - ( thisr.bottom - thisr.top - 10 );
  901. if (config_video_wx > r.right - 10)
  902. config_video_wx = r.left + 10; //r.right - 10;
  903. if (config_video_wy > r.bottom - 10)
  904. config_video_wy = r.top + 10; // r.bottom - 10;
  905. }
  906. EnterCriticalSection(&embedcs);
  907. {
  908. embedWindowState *p=embedwndlist;
  909. while (p)
  910. {
  911. if (IsWindowVisible(p->me))
  912. {
  913. RECT thisr = p->r;
  914. getViewport( &r, NULL, 0, &thisr );
  915. if ( thisr.right < r.left - 10 )
  916. p->r.left = r.left - ( thisr.right - thisr.left - 10 );
  917. if ( thisr.bottom < r.top - 10 )
  918. p->r.top = r.top - ( thisr.bottom - thisr.top - 10 );
  919. if (thisr.left > r.right - 10)
  920. p->r.left = r.left + 10; // r.right - 10;
  921. if (thisr.top > r.bottom - 10)
  922. p->r.top = r.top + 10; // r.bottom - 10;
  923. p->r.right = p->r.left + (thisr.right - thisr.left);
  924. p->r.bottom = p->r.top + (thisr.bottom - thisr.top);
  925. }
  926. p=p->link;
  927. }
  928. }
  929. LeaveCriticalSection(&embedcs);
  930. }
  931. {
  932. HDWP hwdp=BeginDeferWindowPos(10);
  933. RECT r;
  934. int do_pl_inv=0;
  935. extern int g_fsapp;
  936. EstMainWindowRect(&r);
  937. if (config_aot)
  938. {
  939. if (g_fsapp)
  940. {
  941. if (config_dropaotfs)
  942. {
  943. hwdp=DeferWindowPos(hwdp,hMainWindow, HWND_NOTOPMOST, r.left, r.top, r.right-r.left, r.bottom-r.top, SWP_NOACTIVATE|(config_mw_open?0:SWP_NOMOVE|SWP_NOSIZE));
  944. }
  945. else
  946. {
  947. hwdp=DeferWindowPos(hwdp,hMainWindow, HWND_TOPMOST, r.left, r.top, r.right-r.left, r.bottom-r.top, SWP_NOACTIVATE|(config_mw_open?0:SWP_NOMOVE|SWP_NOSIZE));
  948. }
  949. }
  950. else
  951. {
  952. hwdp=DeferWindowPos(hwdp,hMainWindow, HWND_TOPMOST, r.left, r.top, r.right-r.left, r.bottom-r.top, SWP_NOACTIVATE|(config_mw_open?0:SWP_NOMOVE|SWP_NOSIZE));
  953. }
  954. }
  955. else
  956. {
  957. hwdp=DeferWindowPos(hwdp,hMainWindow, HWND_NOTOPMOST, r.left, r.top, r.right-r.left, r.bottom-r.top, SWP_NOACTIVATE|(config_mw_open?0:SWP_NOMOVE|SWP_NOSIZE));
  958. }
  959. if (hEQWindow && !GetParent(hEQWindow)) // we check to see if the windows have no parent, for the gen_ff
  960. {
  961. EstEQWindowRect(&r);
  962. hwdp=DeferWindowPos(hwdp,hEQWindow, 0, r.left, r.top, r.right-r.left, r.bottom-r.top, SWP_NOACTIVATE|SWP_NOZORDER);
  963. }
  964. if (hPLWindow && !GetParent(hPLWindow))
  965. {
  966. EstPLWindowRect(&r);
  967. hwdp=DeferWindowPos(hwdp,hPLWindow, 0, r.left, r.top, r.right-r.left, r.bottom-r.top, SWP_NOACTIVATE|SWP_NOZORDER);
  968. do_pl_inv=1;
  969. }
  970. /* if (hMBWindow && !GetParent(hMBWindow))
  971. {
  972. EstMBWindowRect(&r);
  973. hwdp=DeferWindowPos(hwdp,hMBWindow, 0, r.left, r.top, r.right-r.left, r.bottom-r.top, SWP_DRAWFRAME|SWP_NOACTIVATE|SWP_NOZORDER);
  974. }*/
  975. if (hVideoWindow && !GetParent(hVideoWindow) && !is_fullscreen_video)
  976. {
  977. EstVidWindowRect(&r);
  978. hwdp=DeferWindowPos(hwdp,hVideoWindow, 0, r.left, r.top, r.right-r.left, r.bottom-r.top, SWP_NOCOPYBITS|SWP_NOACTIVATE|SWP_NOZORDER);
  979. }
  980. // traverse the embed windows
  981. EnterCriticalSection(&embedcs);
  982. {
  983. embedWindowState *p=embedwndlist;
  984. while (p)
  985. {
  986. if (!HasParent(p->me))
  987. hwdp=DeferWindowPos(hwdp,p->me, 0, p->r.left, p->r.top, p->r.right-p->r.left, p->r.bottom-p->r.top, SWP_DRAWFRAME|SWP_NOACTIVATE|SWP_NOZORDER);
  988. p=p->link;
  989. }
  990. }
  991. LeaveCriticalSection(&embedcs);
  992. EndDeferWindowPos(hwdp);
  993. if(do_pl_inv)
  994. InvalidateRect(hPLWindow,NULL,FALSE); // fix pl bug?
  995. }
  996. // region
  997. if (!config_minimized && config_mw_open)
  998. {
  999. HRGN lasthrgn=NULL;
  1000. int *plist=0, *nlist=0, len=0;
  1001. if (skin_directory[0])
  1002. len = Skin_GetRegionPointList(0,&plist,&nlist);
  1003. else
  1004. len=0;
  1005. if (len)
  1006. {
  1007. POINT *points;
  1008. int x;
  1009. int a=config_dsize?1:0;
  1010. int ma=0;
  1011. for (x=0; x < len; x ++)
  1012. ma+=nlist[x];
  1013. points= (POINT *) GlobalAlloc(GPTR,sizeof(POINT) * ma);
  1014. for (x = 0; x < ma; x ++)
  1015. {
  1016. points[x].x = *plist++<<a;
  1017. points[x].y = *plist++<<a;
  1018. }
  1019. lasthrgn = CreatePolyPolygonRgn(points,nlist,len,WINDING);
  1020. GlobalFree(points);
  1021. }
  1022. else
  1023. {
  1024. RECT r;
  1025. EstMainWindowRect(&r);
  1026. lasthrgn=CreateRectRgn(0,0,r.right-r.left,r.bottom-r.top);
  1027. }
  1028. if (lasthrgn) SetWindowRgn(hMainWindow,lasthrgn,TRUE);
  1029. else SetWindowRgn(hMainWindow,NULL,FALSE);
  1030. }
  1031. // region
  1032. if (!config_minimized && config_eq_open && hEQWindow)
  1033. {
  1034. int *plist, *nlist, len = Skin_GetRegionPointList(1,&plist,&nlist);
  1035. if (len)
  1036. {
  1037. POINT *points;
  1038. int x;
  1039. int a=config_dsize?1:0;
  1040. int ma=0;
  1041. for (x=0; x < len; x ++)
  1042. ma+=nlist[x];
  1043. points= (POINT *) GlobalAlloc(GPTR,sizeof(POINT) * ma);
  1044. for (x = 0; x < ma; x ++)
  1045. {
  1046. points[x].x = *plist++<<a;
  1047. points[x].y = *plist++<<a;
  1048. }
  1049. HRGN lasthrgn = CreatePolyPolygonRgn(points,nlist,len,WINDING);
  1050. GlobalFree(points);
  1051. SetWindowRgn(hEQWindow,lasthrgn,TRUE);
  1052. }
  1053. else SetWindowRgn(hEQWindow,NULL,FALSE);
  1054. }
  1055. // region
  1056. /*if (!config_minimized && config_pe_open && hPLWindow)
  1057. {
  1058. int *plist, *nlist, len = Skin_GetRegionPointList(2,&plist,&nlist);
  1059. if (len)
  1060. {
  1061. POINT *points;
  1062. int x;
  1063. int a=config_dsize?1:0;
  1064. int ma=0;
  1065. for (x=0; x < len; x ++)
  1066. ma+=nlist[x];
  1067. points= (POINT *) GlobalAlloc(GPTR,sizeof(POINT) * ma);
  1068. for (x = 0; x < ma; x ++)
  1069. {
  1070. points[x].x = *plist++<<a;
  1071. points[x].y = *plist++<<a;
  1072. }
  1073. HRGN lasthrgn = CreatePolyPolygonRgn(points,nlist,len,WINDING);
  1074. if (config_pe_height != 14)
  1075. {
  1076. HRGN allhrng = CreateRectRgn(0, 0, config_pe_width, config_pe_height);
  1077. CombineRgn(lasthrgn, lasthrgn, allhrng, RGN_XOR);
  1078. DeleteRgn(allhrng);
  1079. }
  1080. GlobalFree(points);
  1081. SetWindowRgn(hPLWindow,lasthrgn,TRUE);
  1082. }
  1083. else SetWindowRgn(hPLWindow,NULL,FALSE);
  1084. }*/
  1085. // refresh windows
  1086. if (config_mw_open) InvalidateRect(hMainWindow,NULL,FALSE);
  1087. if (hEQWindow) InvalidateRect(hEQWindow,NULL,FALSE);
  1088. if (hVisWindow)
  1089. {
  1090. int x,y,w,h;
  1091. if (config_windowshade)
  1092. {
  1093. x=79;
  1094. y=5;
  1095. w=38;
  1096. h=5;
  1097. }
  1098. else
  1099. {
  1100. x=24;
  1101. y=43;
  1102. w=76;
  1103. h=16;
  1104. }
  1105. if (config_dsize)
  1106. {
  1107. x*=2;
  1108. y*=2;
  1109. w*=2;
  1110. h*=2;
  1111. }
  1112. SetWindowPos(hVisWindow,0,x,y,w,h,SWP_NOZORDER|SWP_NOACTIVATE);
  1113. }
  1114. if (hPLVisWindow)
  1115. {
  1116. int x,y,w,h;
  1117. x=config_pe_width-150-75+2;
  1118. y=config_pe_height-26;
  1119. w=(config_pe_width >= 350 && config_pe_height != 14 ? 72 : 0);
  1120. h=16;
  1121. SetWindowPos(hPLVisWindow,0,x,y,w,h,SWP_NOZORDER|SWP_NOACTIVATE);
  1122. }
  1123. draw_clutterbar(0);
  1124. SendMessageW(hMainWindow, WM_WA_IPC, config_aot, IPC_CB_ONTOGGLEAOT);
  1125. }
  1126. void set_visopts(void)
  1127. {
  1128. if (prefs_last_page == 22 && IsWindow(prefs_hwnd))
  1129. {
  1130. prefs_last_page=0;
  1131. prefs_dialog(1);
  1132. prefs_last_page=22;
  1133. prefs_dialog(1);
  1134. }
  1135. }
  1136. void set_priority(void)
  1137. {
  1138. int tab[5]={IDLE_PRIORITY_CLASS,NORMAL_PRIORITY_CLASS,ABOVE_NORMAL_PRIORITY_CLASS,HIGH_PRIORITY_CLASS,REALTIME_PRIORITY_CLASS};
  1139. if (config_priority > 4) config_priority=1;
  1140. SetPriorityClass(GetCurrentProcess(),tab[config_priority]);
  1141. }