[2] | 1 | /*
|
---|
| 2 | * This file is (C) Chris Wohlgemuth 2002-2004
|
---|
| 3 | * It is part of the MediaFolder package
|
---|
| 4 | */
|
---|
| 5 | /*
|
---|
| 6 | * This program is free software; you can redistribute it and/or modify
|
---|
| 7 | * it under the terms of the GNU General Public License as published by
|
---|
| 8 | * the Free Software Foundation; either version 2, or (at your option)
|
---|
| 9 | * any later version.
|
---|
| 10 | *
|
---|
| 11 | * This program is distributed in the hope that it will be useful,
|
---|
| 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
| 14 | * GNU General Public License for more details.
|
---|
| 15 | *
|
---|
| 16 | * You should have received a copy of the GNU General Public License
|
---|
| 17 | * along with this program; see the file COPYING. If not, write to
|
---|
| 18 | * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
|
---|
| 19 | */
|
---|
| 20 | #define INCL_GPI
|
---|
| 21 | #define INCL_GPILCIDS
|
---|
| 22 | #define INCL_GPIPRIMITIVES
|
---|
| 23 | #define INCL_GPIBITMAPS
|
---|
| 24 | #define INCL_SW
|
---|
| 25 | #define INCL_REXXSAA
|
---|
| 26 |
|
---|
| 27 | #include "mediafolder.hh"
|
---|
| 28 | #include "mediafolderres.h"
|
---|
| 29 |
|
---|
| 30 | #include "sys_funcs.h"
|
---|
| 31 | #include "menu_funcs.h"
|
---|
| 32 |
|
---|
| 33 | #include "launchpad.hh"
|
---|
| 34 |
|
---|
| 35 | //#pragma SOMAsDefault(pop)
|
---|
| 36 | #include <rexxsaa.h> /* needed for RexxStart() */
|
---|
| 37 |
|
---|
| 38 | #include <stdio.h>
|
---|
| 39 | #include <stdlib.h>
|
---|
| 40 | //#pragma SOMAsDefault(on)
|
---|
| 41 |
|
---|
| 42 | #include "menufolder.hh"
|
---|
| 43 |
|
---|
| 44 | typedef BOOL SOMLINK somTP_CWMenuFolder_mfCheckMenuItems(CWMenuFolder *somSelf,
|
---|
| 45 | WPObject* wpObject,
|
---|
| 46 | ULONG ulMenuId);
|
---|
| 47 | typedef somTP_CWMenuFolder_mfCheckMenuItems *somTD_CWMenuFolder_mfCheckMenuItems;
|
---|
| 48 |
|
---|
| 49 | typedef BOOL SOMLINK somTP_CWMenuFolder_mfCheckSkriptMenuItems(CWMenuFolder *somSelf,
|
---|
| 50 | WPObject* wpObject,
|
---|
| 51 | ULONG ulMenuId,
|
---|
| 52 | HWND hwndFrame);
|
---|
| 53 | typedef somTP_CWMenuFolder_mfCheckSkriptMenuItems *somTD_CWMenuFolder_mfCheckSkriptMenuItems;
|
---|
| 54 |
|
---|
| 55 |
|
---|
| 56 | PFNWP oldProc; //Old proc from subclassed shadow
|
---|
| 57 | HWND hwndShadow;// The handle of the help window
|
---|
| 58 | extern PFNWP oldButtonProc2; //place for original button-procedure
|
---|
| 59 | extern HWND hwndBubbleWindow;// The handle of the help window
|
---|
| 60 | #define WM_NEWBUBBLE WM_USER+100 //Use ATOM later
|
---|
| 61 | #define xVal 12 //x-distance of Bubble
|
---|
| 62 | #define yVal 8 //y-distance of Bubble
|
---|
| 63 | char chrTBFlyFontName[CCHMAXPATH]="9.WarpSans";/* Font for toolbar fly over help */
|
---|
| 64 | RGB rgbTBFlyForeground={0};
|
---|
| 65 | RGB rgbTBFlyBackground={180,255,255};
|
---|
| 66 | BOOL bTBFlyOverEnabled=TRUE;
|
---|
| 67 | int iTBFlyOverDelay=250;
|
---|
| 68 |
|
---|
| 69 | /* Pointer into window words */
|
---|
| 70 | extern ULONG ulQWP_CONTAINERPROC;
|
---|
| 71 | extern ULONG ulQWP_THISPTR;
|
---|
| 72 | extern ULONG ulQWL_TOPCTRLHWND;
|
---|
| 73 | extern ULONG ulQWL_BOTTOMCTRLHWND;
|
---|
| 74 | extern ULONG ulQWL_RIGHTCTRLHWND;
|
---|
| 75 | extern ULONG ulQWL_LEFTCTRLHWND;
|
---|
| 76 |
|
---|
| 77 | extern char chrInstallDir[CCHMAXPATH];
|
---|
| 78 | extern CONTROLINFO ciControls[];
|
---|
| 79 | extern LOADEDBITMAP allBMPs[];
|
---|
| 80 | extern PFNWP pfnwpGenericFrame;
|
---|
| 81 | extern PFNWP oldStaticTextProc;
|
---|
| 82 | extern LPList* lplAllLPads;
|
---|
| 83 |
|
---|
| 84 | /* Extern */
|
---|
| 85 | //extern ULONG cwQueryOSRelease();
|
---|
| 86 | extern BOOL cwMoveNotebookButtonsWarp4(HWND hwndDlg, USHORT usID, USHORT usDelta);
|
---|
| 87 | void sendConfig();
|
---|
| 88 | ULONG messageBox( char* text, ULONG ulTextID , LONG lSizeText,
|
---|
| 89 | char* title, ULONG ulTitleID, LONG lSizeTitle,
|
---|
| 90 | HMODULE hResource, HWND hwnd, ULONG ulFlags);
|
---|
| 91 | BOOL getMessage(char* text,ULONG ulID, LONG lSizeText, HMODULE hResource,HWND hwnd);
|
---|
| 92 |
|
---|
| 93 | void handleWindowPosChanged(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2);/* In dataCddialogProcs.cpp */
|
---|
| 94 | void writeLogPrintf(char* logFile, char* format, ...);
|
---|
| 95 | void HlpWriteToTrapLog(const char* chrFormat, ...);
|
---|
| 96 | HMODULE queryResModuleHandle(void);
|
---|
| 97 | void callMediaFolderMethod(CWMediaFolder *thisPtr, ULONG ulAction, ULONG ulData);
|
---|
| 98 |
|
---|
| 99 | MRESULT paintControls(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2);
|
---|
| 100 | BOOL paintHilitedControl(HWND hwnd, USHORT usControl, BOOL bHilite);
|
---|
| 101 | void adjustDialogControlPos(HWND hwnd);
|
---|
| 102 | MRESULT drawSlider(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2, USHORT id);
|
---|
| 103 | void setPlayTimeText(CWMediaFolder *thisPtr);
|
---|
| 104 | void togglePlayTimeDisplayVisibility(CWMediaFolder *thisPtr);
|
---|
| 105 | winSetVolumeSlider(CWMediaFolder *thisPtr);
|
---|
| 106 | winCheckRepeatButton(CWMediaFolder *thisPtr);
|
---|
| 107 | void contextMenu(HWND hwnd, USHORT usItem, BOOL fCheckItem);
|
---|
| 108 |
|
---|
| 109 | MRESULT EXPENTRY staticTextProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2);
|
---|
| 110 | extern void _Optlink openThreadFunc (void *arg);
|
---|
| 111 |
|
---|
| 112 | extern SOMClass* cwGetSomClass(char* chrClassName);
|
---|
| 113 |
|
---|
| 114 | /* Local */
|
---|
| 115 | MRESULT EXPENTRY topCtrlDialogProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2) ;
|
---|
| 116 |
|
---|
| 117 | /*****************************************************/
|
---|
| 118 | /* */
|
---|
| 119 | /* New container procedure so tabbing to the play */
|
---|
| 120 | /* control dialog works. */
|
---|
| 121 | /* */
|
---|
| 122 | /*****************************************************/
|
---|
| 123 | MRESULT EXPENTRY mediaFldrContainerProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
|
---|
| 124 | {
|
---|
| 125 | CWMediaFolder* thisPtr;
|
---|
| 126 | HWND hwndDialog;
|
---|
| 127 | PFNWP pfnwpContainer;
|
---|
| 128 |
|
---|
| 129 | switch(msg)
|
---|
| 130 | {
|
---|
| 131 | case WM_CHAR:
|
---|
| 132 | /* handle TAB keys so user may tab from the container to the frame controls */
|
---|
| 133 | if(SHORT1FROMMP(mp1) & KC_VIRTUALKEY)
|
---|
| 134 | {
|
---|
| 135 | if(SHORT2FROMMP(mp2)==VK_TAB && !(SHORT1FROMMP(mp1) & KC_KEYUP)) {
|
---|
| 136 | /* Always forward tab to the top middle framecontrol */
|
---|
| 137 | if((hwndDialog=WinQueryWindow(hwnd,QW_PARENT))!=NULLHANDLE)/* The frame */
|
---|
| 138 | {
|
---|
| 139 | /* Get HWND of top middle dialog */
|
---|
| 140 | if((hwndDialog=WinWindowFromID(WinWindowFromID(hwndDialog,IDDLG_TOPFRAME),IDDLG_TOPMIDDLE))!=NULLHANDLE)
|
---|
| 141 | {
|
---|
| 142 | if((hwndDialog=WinWindowFromID(hwndDialog,IDPB_SKIPBACK))!=NULLHANDLE)
|
---|
| 143 | if(WinSetFocus(HWND_DESKTOP,hwndDialog))
|
---|
| 144 | return (MRESULT)TRUE;
|
---|
| 145 | }
|
---|
| 146 | }
|
---|
| 147 | break;/* error: fall to the window proc */
|
---|
| 148 | }
|
---|
| 149 | else if(SHORT2FROMMP(mp2)==VK_BACKTAB && !(SHORT1FROMMP(mp1) & KC_KEYUP) )
|
---|
| 150 | {
|
---|
| 151 | /* Check for key down to make sure the focus doesn't switch immediately to the next
|
---|
| 152 | frame control when just coming from another control. Only if the user hits tab
|
---|
| 153 | again in the container the focus switches. */
|
---|
| 154 | if((hwndDialog=WinQueryWindow(hwnd,QW_PARENT))!=NULLHANDLE)
|
---|
| 155 | {
|
---|
| 156 | /* Get HWND of top middle dialog */
|
---|
| 157 | if((hwndDialog=WinWindowFromID(WinWindowFromID(hwndDialog,IDDLG_TOPFRAME),IDDLG_TOPMIDDLE))!=NULLHANDLE)
|
---|
| 158 | {
|
---|
| 159 | if((hwndDialog=WinWindowFromID(hwndDialog,IDSL_POSBAR))!=NULLHANDLE)
|
---|
| 160 | if(WinSetFocus(HWND_DESKTOP,hwndDialog))
|
---|
| 161 | return (MRESULT)TRUE;
|
---|
| 162 | }
|
---|
| 163 | }
|
---|
| 164 | }
|
---|
| 165 | break;/* error: fall to the window proc */
|
---|
| 166 | }
|
---|
| 167 | break;
|
---|
| 168 |
|
---|
| 169 | /*****************************************************/
|
---|
| 170 | /* Show a busy dialog if necessary. */
|
---|
| 171 | /*****************************************************/
|
---|
| 172 | case WM_MOUSEMOVE:
|
---|
| 173 | /* Get frame handle */
|
---|
| 174 | if((hwndDialog=WinQueryWindow(hwnd,QW_PARENT))!=NULLHANDLE)
|
---|
| 175 | {
|
---|
| 176 | thisPtr=(CWMediaFolder*) WinQueryWindowULong(hwndDialog,ulQWP_THISPTR);
|
---|
| 177 | if(somIsObj(thisPtr))
|
---|
| 178 | if(thisPtr->mfData)
|
---|
| 179 | /* A thread for calculating the size is running so show the wait ptr. */
|
---|
| 180 | if(thisPtr->mfData->bProcessing==TRUE) {
|
---|
| 181 | HPOINTER hptr=WinQuerySysPointer(HWND_DESKTOP, SPTR_WAIT, FALSE);
|
---|
| 182 | if(hptr) {
|
---|
| 183 | WinSetPointer(HWND_DESKTOP, hptr);
|
---|
| 184 | return MRTRUE;
|
---|
| 185 | }
|
---|
| 186 | }
|
---|
| 187 |
|
---|
| 188 | #if 0
|
---|
| 189 | if((hwndDialog=WinWindowFromID(hwndDialog,IDDLG_TOPFRAME))!=NULLHANDLE)
|
---|
| 190 | {
|
---|
| 191 | thisPtr=(CWMediaFolder*) WinQueryWindowULong(hwndDialog,QWL_USER);
|
---|
| 192 | if(somIsObj(thisPtr))
|
---|
| 193 | if(thisPtr->mfData)
|
---|
| 194 | /* A thread for calculating the size is running so show the wait ptr. */
|
---|
| 195 | if(thisPtr->mfData->bProcessing==TRUE) {
|
---|
| 196 | HPOINTER hptr=WinQuerySysPointer(HWND_DESKTOP, SPTR_WAIT, FALSE);
|
---|
| 197 | if(hptr) {
|
---|
| 198 | WinSetPointer(HWND_DESKTOP, hptr);
|
---|
| 199 | return MRTRUE;
|
---|
| 200 | }
|
---|
| 201 | }
|
---|
| 202 | }
|
---|
| 203 | #endif
|
---|
| 204 | }
|
---|
| 205 | break;
|
---|
| 206 | default:
|
---|
| 207 | break;
|
---|
| 208 | }
|
---|
| 209 | if((hwndDialog=WinQueryWindow(hwnd,QW_PARENT))!=NULLHANDLE) {
|
---|
| 210 | pfnwpContainer=(PFNWP)WinQueryWindowULong( hwndDialog, ulQWP_CONTAINERPROC);
|
---|
| 211 | if(pfnwpContainer)
|
---|
| 212 | return pfnwpContainer(hwnd, msg, mp1, mp2);
|
---|
| 213 | }
|
---|
| 214 |
|
---|
| 215 | #if 0
|
---|
| 216 | /* Any other message is handled by the folder container procedure */
|
---|
| 217 | if((hwndDialog=WinQueryWindow(hwnd,QW_PARENT))!=NULLHANDLE)
|
---|
| 218 | {
|
---|
| 219 | if((hwndDialog=WinWindowFromID(hwndDialog,IDDLG_TOPFRAME))!=NULLHANDLE)
|
---|
| 220 | {
|
---|
| 221 | thisPtr=(CWMediaFolder*) WinQueryWindowULong(hwndDialog,QWL_USER);
|
---|
| 222 | if(somIsObj(thisPtr))
|
---|
| 223 | if(thisPtr->pfnwpContainer)
|
---|
| 224 | return thisPtr->pfnwpContainer(hwnd, msg, mp1, mp2);
|
---|
| 225 | }
|
---|
| 226 | }
|
---|
| 227 | #endif
|
---|
| 228 | return WinDefWindowProc(hwnd, msg, mp1, mp2);
|
---|
| 229 | }
|
---|
| 230 |
|
---|
| 231 | /************************************************************
|
---|
| 232 | * *
|
---|
| 233 | * This frame proc handles the about menuitem of the *
|
---|
| 234 | * Warp 4 menu bar and removes the Tree view item. *
|
---|
| 235 | * *
|
---|
| 236 | ************************************************************/
|
---|
| 237 | MRESULT EXPENTRY mediaFrameProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
|
---|
| 238 | {
|
---|
| 239 | CWMediaFolder* thisPtr;
|
---|
| 240 | HWND hwndDialog;
|
---|
| 241 | MENUITEM mi;
|
---|
| 242 | char text[100];
|
---|
| 243 |
|
---|
| 244 | switch (msg)
|
---|
| 245 | {
|
---|
| 246 | case WM_INITMENU:
|
---|
| 247 | thisPtr=(CWMediaFolder*) WinQueryWindowULong(hwnd,ulQWP_THISPTR);
|
---|
| 248 | if(somIsObj(thisPtr)) {
|
---|
| 249 | HMODULE hResource=queryResModuleHandle();
|
---|
| 250 | switch(thisPtr->usLastSelMenuItem)
|
---|
| 251 | {
|
---|
| 252 | //#ifndef ECS
|
---|
| 253 | /* The eCS version doesn't have an 'About menu' */
|
---|
| 254 | case 0x2d3:/* Help menu */
|
---|
| 255 | {
|
---|
| 256 | if(hResource) {
|
---|
| 257 | /* insert separator */
|
---|
[178] | 258 | /* Insert 'About' item */
|
---|
[217] | 259 | //getMessage(text, IDSTR_MEDIAFLDHELP ,sizeof(text), hResource, hwnd);
|
---|
[201] | 260 | //menuInsertMenuItem(HWNDFROMMP(mp2), NULL, 0, ID_MEDIAFLDHELP, text);
|
---|
| 261 | //menuInsertMenuSeparator(HWNDFROMMP(mp2), NULL, 1);
|
---|
[217] | 262 | WinSendMsg(HWNDFROMMP(mp2),MM_REMOVEITEM,MPFROM2SHORT(603,TRUE),0);
|
---|
| 263 | getMessage(text, IDSTR_MEDIAFLDKEYSHELP ,sizeof(text), hResource, hwnd);
|
---|
| 264 | menuInsertMenuItem(HWNDFROMMP(mp2), NULL, MIT_END, ID_MEDIAFLDKEYSHELP, text);
|
---|
[2] | 265 | menuInsertMenuSeparator(HWNDFROMMP(mp2), NULL, MIT_END);
|
---|
| 266 | /* Insert 'About' item */
|
---|
| 267 | getMessage(text, IDSTR_MENUABOUT ,sizeof(text), hResource, hwnd);
|
---|
| 268 | menuInsertMenuItem(HWNDFROMMP(mp2), NULL, MIT_END, ID_ABOUTITEM, text);
|
---|
| 269 | break;
|
---|
| 270 | }
|
---|
| 271 | break;
|
---|
| 272 | }
|
---|
| 273 | //#endif
|
---|
| 274 |
|
---|
| 275 | case 0x68:
|
---|
| 276 | /* Remove change to Tree from menubar menu */
|
---|
| 277 | WinSendMsg(HWNDFROMMP(mp2),MM_REMOVEITEM,MPFROM2SHORT(717,TRUE),0);
|
---|
| 278 | /* V0.2.8 (07.09.2003):
|
---|
| 279 | Removed icon view item from menu. Icon view is no longer supported by
|
---|
| 280 | the media folder.*/
|
---|
| 281 |
|
---|
| 282 | /* Remove change to Icon view from menubar menu */
|
---|
| 283 | WinSendMsg(HWNDFROMMP(mp2),MM_REMOVEITEM,MPFROM2SHORT(0x2cc,TRUE),0);
|
---|
| 284 |
|
---|
| 285 | break;
|
---|
| 286 |
|
---|
| 287 | case 0x2d1:
|
---|
| 288 | /* Remove change to Tree from menubar menu */
|
---|
| 289 | WinSendMsg(HWNDFROMMP(mp2),MM_REMOVEITEM,MPFROM2SHORT(717,TRUE),0);
|
---|
| 290 | /* V0.2.8 (07.09.2003):
|
---|
| 291 | Removed icon view item from menu. Icon view is no longer supported by
|
---|
| 292 | the media folder.*/
|
---|
| 293 | /* Remove change to Icon view from menubar menu */
|
---|
| 294 | WinSendMsg(HWNDFROMMP(mp2),MM_REMOVEITEM,MPFROM2SHORT(0x2cc,TRUE),0);
|
---|
| 295 |
|
---|
| 296 | /* Insert the new 'compact' view item */
|
---|
| 297 | if(hResource) {
|
---|
| 298 | SHORT sItem;
|
---|
| 299 | /* Insert 'Compact' item */
|
---|
| 300 | getMessage(text, IDSTR_MENUCOMPACT ,sizeof(text), hResource, hwnd);
|
---|
| 301 | sItem=menuInsertMenuItem( HWNDFROMMP(mp2), NULL, 1, ID_MENUVIEWCOMPACT, text);
|
---|
| 302 | if(sItem!=MIT_MEMERROR && sItem!=MIT_ERROR)
|
---|
| 303 | {
|
---|
| 304 | /* Disable menu if already in compact view */
|
---|
| 305 | if(thisPtr->cwQueryMFldrFlags() & MFLDR_VIEW_COMPACT) {
|
---|
| 306 | WinEnableMenuItem(HWNDFROMMP(mp2), ID_MENUVIEWCOMPACT, FALSE);
|
---|
| 307 | /* Enable details view item */
|
---|
| 308 | WinEnableMenuItem(HWNDFROMMP(mp2), 0x2ce, TRUE);
|
---|
| 309 | }
|
---|
| 310 | }
|
---|
| 311 | }
|
---|
| 312 | break;
|
---|
| 313 | default:
|
---|
| 314 | break;
|
---|
| 315 | }
|
---|
| 316 |
|
---|
| 317 | }
|
---|
| 318 | #if 0
|
---|
| 319 | if((hwndDialog=WinWindowFromID(hwnd,IDDLG_TOPFRAME))!=NULLHANDLE)
|
---|
| 320 | {
|
---|
| 321 | thisPtr=(CWMediaFolder*) WinQueryWindowULong(hwndDialog,QWL_USER);
|
---|
| 322 | if(somIsObj(thisPtr)) {
|
---|
| 323 | HMODULE hResource=queryResModuleHandle();
|
---|
| 324 | switch(thisPtr->usLastSelMenuItem)
|
---|
| 325 | {
|
---|
| 326 | case 0x2d3:/* Help menu */
|
---|
| 327 | {
|
---|
| 328 | if(hResource) {
|
---|
| 329 | /* insert separator */
|
---|
| 330 | cwInsertMenuSeparator(MIT_END, HWNDFROMMP(mp2), NULL);
|
---|
| 331 | /* Insert 'About' item */
|
---|
| 332 | getMessage(text, IDSTR_MENUABOUT ,sizeof(text), hResource, hwnd);
|
---|
| 333 | cwInsertMenuItem(MIT_END, HWNDFROMMP(mp2), NULL, ID_ABOUTITEM, text);
|
---|
| 334 | break;
|
---|
| 335 | }
|
---|
| 336 | break;
|
---|
| 337 | }
|
---|
| 338 | case 0x2d1:
|
---|
| 339 | /* Remove change to Tree from menubar menu */
|
---|
| 340 | WinSendMsg(HWNDFROMMP(mp2),MM_REMOVEITEM,MPFROM2SHORT(717,TRUE),0);
|
---|
| 341 | /* Insert the new 'compact' view item */
|
---|
| 342 | if(hResource) {
|
---|
| 343 | /* Insert 'Compact' item */
|
---|
| 344 | getMessage(text, IDSTR_MENUCOMPACT ,sizeof(text), hResource, hwnd);
|
---|
| 345 | cwInsertMenuItem( 1, HWNDFROMMP(mp2), NULL, ID_MENUVIEWCOMPACT, text);
|
---|
| 346 | }
|
---|
| 347 | break;
|
---|
| 348 | default:
|
---|
| 349 | break;
|
---|
| 350 | }
|
---|
| 351 | }
|
---|
| 352 | }
|
---|
| 353 | #endif
|
---|
| 354 | break;
|
---|
| 355 | case WM_COMMAND:
|
---|
| 356 | if(SHORT1FROMMP(mp2)==CMDSRC_MENU) {
|
---|
| 357 | if(SHORT1FROMMP(mp1)>=FIRSTUSERITEM) {
|
---|
| 358 | BOOL bHandled=FALSE;
|
---|
| 359 |
|
---|
| 360 | TRY_LOUD(AF_MENU) {
|
---|
| 361 | thisPtr=(CWMediaFolder*) WinQueryWindowULong(hwnd,ulQWP_THISPTR);
|
---|
| 362 | if(somIsObj(thisPtr)) {
|
---|
| 363 | CWMenuFolder * wpFolder;
|
---|
| 364 | HOBJECT hObject;
|
---|
| 365 | somId id;
|
---|
| 366 |
|
---|
| 367 | somTD_CWMenuFolder_mfCheckSkriptMenuItems methodPtr;
|
---|
| 368 | M_WPObject *m_wpObject;
|
---|
| 369 |
|
---|
| 370 | // bHandled=thisPtr->cwCheckUserMenuItems(SKRIPTFOLDER_MEDIAFOLDER, SHORT1FROMMP(mp1));
|
---|
| 371 | if(!bHandled)
|
---|
| 372 | bHandled=thisPtr->cwCheckUserMenuItems(USERMENUFOLDER_MEDIAFOLDER , SHORT1FROMMP(mp1));
|
---|
| 373 | }/* if(somIsObj(thisPtr)) */
|
---|
| 374 | }
|
---|
| 375 | CATCH(AF_MENU)
|
---|
| 376 | {
|
---|
| 377 | } END_CATCH;
|
---|
| 378 |
|
---|
| 379 | #if 0
|
---|
| 380 | TRY_LOUD(AF_MENU) {
|
---|
| 381 | if((hwndDialog=WinWindowFromID(hwnd,IDDLG_TOPFRAME))!=NULLHANDLE)
|
---|
| 382 | {
|
---|
| 383 | thisPtr=(CWMediaFolder*) WinQueryWindowULong(hwndDialog,QWL_USER);
|
---|
| 384 | if(somIsObj(thisPtr)) {
|
---|
| 385 |
|
---|
| 386 | CWMenuFolder * wpFolder;
|
---|
| 387 | HOBJECT hObject;
|
---|
| 388 | somId id;
|
---|
| 389 | somTD_CWMenuFolder_mfCheckSkriptMenuItems methodPtr;
|
---|
| 390 | M_WPObject *m_wpObject;
|
---|
| 391 |
|
---|
| 392 | // bHandled=thisPtr->cwCheckUserMenuItems(SKRIPTFOLDER_MEDIAFOLDER, SHORT1FROMMP(mp1));
|
---|
| 393 | if(!bHandled)
|
---|
| 394 | bHandled=thisPtr->cwCheckUserMenuItems(USERMENUFOLDER_MEDIAFOLDER , SHORT1FROMMP(mp1));
|
---|
| 395 | }/* if(somIsObj(thisPtr)) */
|
---|
| 396 | }/* Dialog window */
|
---|
| 397 | }
|
---|
| 398 | CATCH(AF_MENU)
|
---|
| 399 | {
|
---|
| 400 | } END_CATCH;
|
---|
| 401 | #endif
|
---|
| 402 |
|
---|
| 403 | if(bHandled)
|
---|
| 404 | return (MRESULT) 0;
|
---|
| 405 | }
|
---|
| 406 | }
|
---|
| 407 | break;
|
---|
| 408 |
|
---|
| 409 | case WM_MENUSELECT:
|
---|
| 410 | thisPtr=(CWMediaFolder*) WinQueryWindowULong(hwnd,ulQWP_THISPTR);
|
---|
| 411 | if(somIsObj(thisPtr))
|
---|
| 412 | thisPtr->usLastSelMenuItem=SHORT1FROMMP(mp1);
|
---|
| 413 | break;
|
---|
[4] | 414 | case WM_TIMER:
|
---|
| 415 | /* The user didn't click any button on the message box asking for closing the
|
---|
| 416 | folder. Now the system forces the closing so automatic shutdown may finally
|
---|
| 417 | succeed. */
|
---|
| 418 | if(SHORT1FROMMP(mp1)==MFLDR_MBOX_TIMER_ID) {
|
---|
| 419 | WinStopTimer(WinQueryAnchorBlock(HWND_DESKTOP), hwnd, MFLDR_MBOX_TIMER_ID);
|
---|
| 420 | WinPostMsg(hwnd, WM_CLOSE, 0, 0);
|
---|
| 421 | }
|
---|
| 422 | return MRFALSE;
|
---|
[2] | 423 | default:
|
---|
| 424 | break;
|
---|
| 425 | }
|
---|
| 426 | /* Any other message is handled by the folder frame procedure */
|
---|
| 427 | thisPtr=(CWMediaFolder*) WinQueryWindowULong(hwnd,ulQWP_THISPTR);
|
---|
| 428 | if(somIsObj(thisPtr))
|
---|
| 429 | if(thisPtr->pfnwpFrame)
|
---|
| 430 | return thisPtr->pfnwpFrame(hwnd, msg, mp1, mp2);
|
---|
| 431 |
|
---|
| 432 | return pfnwpGenericFrame(hwnd, msg, mp1, mp2);
|
---|
| 433 | }
|
---|
| 434 |
|
---|
| 435 | /************************************************************
|
---|
| 436 | * *
|
---|
| 437 | * This dialog proc handles the playcontrol area at the *
|
---|
| 438 | * top. *
|
---|
| 439 | * *
|
---|
| 440 | ************************************************************/
|
---|
| 441 | MRESULT EXPENTRY playControlDialogProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
|
---|
| 442 | {
|
---|
| 443 | CWMediaFolder *thisPtr;
|
---|
| 444 | static BOOL bPosDragging=FALSE;
|
---|
| 445 |
|
---|
| 446 | switch(msg)
|
---|
| 447 | {
|
---|
| 448 | /*****************************************************/
|
---|
| 449 | /* Init the dialog */
|
---|
| 450 | /*****************************************************/
|
---|
| 451 | case WM_INITDLG :
|
---|
| 452 |
|
---|
| 453 | WinDefDlgProc(hwnd, msg, mp1, mp2);
|
---|
| 454 |
|
---|
| 455 | WinSetWindowULong(hwnd,QWL_USER,(ULONG)PVOIDFROMMP(mp2));//Save object ptr.
|
---|
| 456 | thisPtr=(CWMediaFolder*) PVOIDFROMMP(mp2);
|
---|
| 457 | adjustDialogControlPos(hwnd);
|
---|
| 458 |
|
---|
| 459 | if(SysQueryOSRelease()>=40) {
|
---|
| 460 | WinSetPresParam(hwnd,
|
---|
| 461 | PP_FONTNAMESIZE,(ULONG)sizeof(DEFAULT_DIALOG_FONT),
|
---|
| 462 | DEFAULT_DIALOG_FONT );
|
---|
| 463 | }
|
---|
| 464 |
|
---|
| 465 | if(somIsObj(thisPtr)) {
|
---|
| 466 | WinSendMsg( WinWindowFromID(hwnd, IDSL_VOLUME),
|
---|
| 467 | SLM_SETSLIDERINFO,
|
---|
| 468 | MPFROM2SHORT(SMA_SLIDERARMPOSITION,SMA_INCREMENTVALUE),
|
---|
| 469 | MPFROMLONG( thisPtr->ulVolume));
|
---|
| 470 | /* Set position slider */
|
---|
| 471 | WinSendMsg( WinWindowFromID(hwnd, IDPB_POSBAR),
|
---|
| 472 | SLM_SETSLIDERINFO,
|
---|
| 473 | MPFROM2SHORT(SMA_SLIDERARMPOSITION,SMA_INCREMENTVALUE),
|
---|
| 474 | MPFROMLONG(0));
|
---|
| 475 |
|
---|
| 476 | /* Set repeat check button if necessary */
|
---|
| 477 | #if 0
|
---|
| 478 | /* This Does not work... Probably because hwndTopMiddle isn't set in the
|
---|
| 479 | instance data yet. Left in here so it isn't forgotten... */
|
---|
| 480 | winCheckRepeatButton(thisPtr);
|
---|
| 481 | winSetVolumeSlider(thisPtr);
|
---|
| 482 | #endif
|
---|
| 483 |
|
---|
| 484 | if(thisPtr->ulFlags&FLAG_REPEAT)
|
---|
| 485 | WinCheckButton(hwnd, IDCB_REPEAT,1);
|
---|
| 486 | if(thisPtr->ulFlags&FLAG_RANDOM)
|
---|
| 487 | WinCheckButton(hwnd, IDCB_RANDOM,1);
|
---|
| 488 |
|
---|
| 489 |
|
---|
| 490 | if(thisPtr->mfData)
|
---|
| 491 | WinSetPresParam(WinWindowFromID(hwnd, IDST_PLAYTIME),
|
---|
| 492 | PP_FONTNAMESIZE,(ULONG)sizeof(thisPtr->mfData->chrPlayTimeFont),
|
---|
| 493 | thisPtr->mfData->chrPlayTimeFont);
|
---|
| 494 | }
|
---|
| 495 | return (MRESULT)FALSE;
|
---|
| 496 | /*****************************************************/
|
---|
| 497 | /* The dialog is about to be destroyed */
|
---|
| 498 | /*****************************************************/
|
---|
| 499 | case WM_DESTROY:
|
---|
| 500 | {
|
---|
| 501 | ULONG attrFound;
|
---|
| 502 |
|
---|
| 503 | thisPtr=(CWMediaFolder*) WinQueryWindowULong(hwnd,QWL_USER);
|
---|
| 504 | if(somIsObj(thisPtr)) {
|
---|
| 505 | if(thisPtr->mfData)
|
---|
| 506 | // Query the playtime font
|
---|
| 507 | WinQueryPresParam(WinWindowFromID(hwnd, IDST_PLAYTIME),
|
---|
| 508 | PP_FONTNAMESIZE,0, &attrFound,sizeof(thisPtr->mfData->chrPlayTimeFont),
|
---|
| 509 | thisPtr->mfData->chrPlayTimeFont, QPF_NOINHERIT);
|
---|
| 510 | }
|
---|
| 511 | break;
|
---|
| 512 | }
|
---|
| 513 | /*****************************************************/
|
---|
| 514 | /* Paint the background */
|
---|
| 515 | /*****************************************************/
|
---|
| 516 | case WM_PAINT:
|
---|
| 517 | {
|
---|
| 518 | SWP swp;
|
---|
| 519 | RECTL rcl;
|
---|
| 520 | HPS hps;
|
---|
| 521 |
|
---|
| 522 | WinQueryWindowPos(hwnd,&swp);
|
---|
| 523 | if(swp.fl & SWP_MINIMIZE)
|
---|
| 524 | break;
|
---|
| 525 | hps = WinBeginPaint( hwnd, NULLHANDLE, &rcl );
|
---|
| 526 | WinDrawBitmap(hps, allBMPs[MAIN_BMP_IDX].hbm,
|
---|
| 527 | &rcl,
|
---|
| 528 | (PPOINTL)&rcl,
|
---|
| 529 | 0, 0,
|
---|
| 530 | DBM_IMAGEATTRS);
|
---|
| 531 | WinQueryWindowRect(hwnd, &rcl);
|
---|
| 532 | WinEndPaint( hps );
|
---|
| 533 | return FALSE;
|
---|
| 534 | }
|
---|
| 535 | /*****************************************************/
|
---|
| 536 | /* The following two messages are for device sharing */
|
---|
| 537 | /*****************************************************/
|
---|
| 538 | case WM_ACTIVATE:
|
---|
| 539 | if(SHORT1FROMMP(mp1)){
|
---|
| 540 | thisPtr=(CWMediaFolder*) WinQueryWindowULong(hwnd,QWL_USER);
|
---|
| 541 | if(somIsObj(thisPtr)){
|
---|
| 542 | char chrCommand[100];
|
---|
| 543 |
|
---|
| 544 | if(thisPtr->mrcPlaying) {
|
---|
| 545 | sprintf(chrCommand,"ACQUIRE wave%d QUEUE wait", thisPtr->iWave);
|
---|
| 546 | mciSendString(chrCommand, NULL, 0, 0, 0);
|
---|
| 547 | }
|
---|
| 548 | }
|
---|
| 549 | }
|
---|
| 550 | break;
|
---|
| 551 | case MM_MCIPASSDEVICE:
|
---|
| 552 | thisPtr=(CWMediaFolder*) WinQueryWindowULong(hwnd,QWL_USER);
|
---|
| 553 | if(somIsObj(thisPtr)){
|
---|
| 554 | HWND hwndFrame=WinQueryWindow(WinQueryWindow(hwnd,QW_PARENT),QW_PARENT);
|
---|
| 555 | switch(SHORT1FROMMP(mp2))
|
---|
| 556 | {
|
---|
| 557 | case MCI_GAINING_USE:
|
---|
| 558 | thisPtr->bPaused=FALSE;/* The time display will not be increased */
|
---|
| 559 | paintHilitedControl(WinWindowFromID(hwnd, IDPB_PAUSE), IDPB_PAUSE, FALSE);
|
---|
| 560 | return (MRESULT)0;
|
---|
| 561 | case MCI_LOSING_USE:
|
---|
| 562 | thisPtr->bPaused=TRUE;
|
---|
| 563 | paintHilitedControl(WinWindowFromID(hwnd, IDPB_PLAY), IDPB_PLAY, FALSE);
|
---|
| 564 | return (MRESULT)0;
|
---|
| 565 | default:
|
---|
| 566 | break;
|
---|
| 567 | }
|
---|
| 568 | }
|
---|
| 569 | break;
|
---|
| 570 | /*****************************************************/
|
---|
| 571 | /* Set the time in the palytime display. */
|
---|
| 572 | /* SETPOSITIONADVICE does not work for some reason, */
|
---|
| 573 | /* so a timer is used. Yes, it's quit cumbersome... */
|
---|
| 574 | /*****************************************************/
|
---|
| 575 | case WM_TIMER:
|
---|
| 576 | if(SHORT1FROMMP(mp1)==IDTIMER_PLAY) {
|
---|
| 577 | thisPtr=(CWMediaFolder*) WinQueryWindowULong(hwnd,QWL_USER);
|
---|
| 578 | if(somIsObj(thisPtr)){
|
---|
| 579 | char chrCommand[50];
|
---|
| 580 | char retMsg[20];
|
---|
| 581 | ULONG rc;
|
---|
| 582 |
|
---|
| 583 | if(!thisPtr->bPaused) {
|
---|
| 584 | /* Adjust position info if not paused. */
|
---|
| 585 | thisPtr->ulPos++;
|
---|
| 586 | if(thisPtr->ulPos*1000>thisPtr->ulTotalLength)
|
---|
| 587 | thisPtr->ulPos=thisPtr->ulTotalLength/1000;/* Prevent wrong time if timer info isn't accurate.
|
---|
| 588 | I know all this timing stuff is an ugly thing. */
|
---|
| 589 |
|
---|
| 590 | if(!bPosDragging) {
|
---|
| 591 | ULONG ulInc=thisPtr->ulTotalLength/1000;
|
---|
| 592 | setPlayTimeText(thisPtr); /* Set time display */
|
---|
| 593 | /* Catch potential division by zero trap */
|
---|
| 594 | if(ulInc)
|
---|
| 595 | ulInc=thisPtr->ulPos*100/ulInc;
|
---|
| 596 | else
|
---|
| 597 | ulInc=100;
|
---|
| 598 | /* Set slider position */
|
---|
| 599 | WinPostMsg( WinWindowFromID(hwnd, IDSL_POSBAR),
|
---|
| 600 | SLM_SETSLIDERINFO,
|
---|
| 601 | MPFROM2SHORT(SMA_SLIDERARMPOSITION,SMA_INCREMENTVALUE),
|
---|
| 602 | MPFROMLONG(ulInc));
|
---|
| 603 | }
|
---|
| 604 | thisPtr->cwPlayTimeCallback(WinQueryWindow(WinQueryWindow(hwnd,QW_PARENT),QW_PARENT), thisPtr->ulPos);
|
---|
| 605 | /* Blink play control */
|
---|
| 606 | paintHilitedControl(WinWindowFromID(hwnd, IDPB_PLAY), IDPB_PLAY, thisPtr->ulPos%2);
|
---|
| 607 | }
|
---|
| 608 | else {
|
---|
| 609 | /* Currently pausing */
|
---|
| 610 | togglePlayTimeDisplayVisibility(thisPtr);
|
---|
| 611 | paintHilitedControl( WinWindowFromID(hwnd, IDPB_PAUSE), IDPB_PAUSE,
|
---|
| 612 | WinIsWindowVisible(WinWindowFromID(thisPtr->hwndTopMiddle, IDST_PLAYTIME)));
|
---|
| 613 | }
|
---|
| 614 | }
|
---|
| 615 | return (MRESULT)0;
|
---|
| 616 | }
|
---|
| 617 | break;
|
---|
| 618 | /*****************************************************/
|
---|
| 619 | /* Draw the sliders. */
|
---|
| 620 | /*****************************************************/
|
---|
| 621 | case WM_DRAWITEM:
|
---|
| 622 | switch(SHORT1FROMMP(mp1))
|
---|
| 623 | {
|
---|
| 624 | case IDSL_POSBAR:
|
---|
| 625 | case IDSL_VOLUME:
|
---|
| 626 | return drawSlider(hwnd, msg, mp1, mp2, SHORT1FROMMP(mp1));
|
---|
| 627 | default:
|
---|
| 628 | break;
|
---|
| 629 | }
|
---|
| 630 | break;
|
---|
| 631 | /*****************************************************/
|
---|
| 632 | /* Control messages */
|
---|
| 633 | /*****************************************************/
|
---|
| 634 | case WM_CONTROL:
|
---|
| 635 | {
|
---|
| 636 | SWP swp;
|
---|
| 637 | char chrCommand[50];
|
---|
| 638 | char retMsg[20];
|
---|
| 639 |
|
---|
| 640 | thisPtr=(CWMediaFolder*) WinQueryWindowULong(hwnd,QWL_USER);
|
---|
| 641 | if(somIsObj(thisPtr)){
|
---|
| 642 | switch(SHORT1FROMMP(mp1))
|
---|
| 643 | {
|
---|
| 644 | case IDCB_REPEAT:
|
---|
| 645 | if(SHORT2FROMMP(mp1)== BN_CLICKED) {
|
---|
| 646 | if(WinQueryButtonCheckstate(hwnd,IDCB_REPEAT) & 1) {
|
---|
| 647 | thisPtr->ulFlags|=FLAG_REPEAT;
|
---|
| 648 | }
|
---|
| 649 | else {
|
---|
| 650 | thisPtr->ulFlags&=~FLAG_REPEAT;
|
---|
| 651 | }
|
---|
| 652 | }
|
---|
| 653 | return (MRESULT) FALSE;
|
---|
| 654 | break;
|
---|
| 655 | case IDCB_RANDOM:
|
---|
| 656 | if(SHORT2FROMMP(mp1)== BN_CLICKED) {
|
---|
| 657 | if(WinQueryButtonCheckstate(hwnd,IDCB_RANDOM) & 1) {
|
---|
| 658 | thisPtr->ulFlags|=FLAG_RANDOM;
|
---|
| 659 | }
|
---|
| 660 | else {
|
---|
| 661 | thisPtr->ulFlags&=~FLAG_RANDOM;
|
---|
| 662 | }
|
---|
| 663 | }
|
---|
| 664 | return (MRESULT) FALSE;
|
---|
| 665 | break;
|
---|
| 666 | default:
|
---|
| 667 | break;
|
---|
| 668 | }
|
---|
| 669 | switch(SHORT2FROMMP(mp1))
|
---|
| 670 | {
|
---|
| 671 | case BN_PAINT:
|
---|
| 672 | /* Paint the custom controls (buttons, sliders ) */
|
---|
| 673 | WinQueryWindowPos(hwnd,&swp);
|
---|
| 674 | if(swp.fl & SWP_MINIMIZE)
|
---|
| 675 | break;
|
---|
| 676 | return paintControls(hwnd, msg, mp1, mp2);
|
---|
| 677 | /*****************************************************/
|
---|
| 678 | /* Handle position and volume changes. */
|
---|
| 679 | /*****************************************************/
|
---|
| 680 | case SLN_SLIDERTRACK:
|
---|
| 681 | {
|
---|
| 682 | switch(SHORT1FROMMP(mp1))
|
---|
| 683 | {
|
---|
| 684 | case IDSL_VOLUME:
|
---|
| 685 | {
|
---|
| 686 | ULONG ulValue;
|
---|
| 687 |
|
---|
| 688 | ulValue=LONGFROMMP(mp2);
|
---|
| 689 | thisPtr->ulVolume=ulValue;
|
---|
| 690 | sprintf(chrCommand,"SET wave%d AUDIO VOLUME %d WAIT", thisPtr->iWave, thisPtr->ulVolume);
|
---|
| 691 | mciSendString(chrCommand, retMsg, sizeof(retMsg), 0, 0);
|
---|
| 692 | break;
|
---|
| 693 | }
|
---|
| 694 | case IDSL_POSBAR:
|
---|
| 695 | {
|
---|
| 696 | static lLastPos=0;
|
---|
| 697 | long lPos=LONGFROMMP(mp2);
|
---|
| 698 |
|
---|
| 699 | bPosDragging=TRUE;
|
---|
| 700 | lPos*=thisPtr->ulTotalLength/100;
|
---|
| 701 | if(lPos/1000!=lLastPos) {
|
---|
| 702 | /* Prevent flickering */
|
---|
[108] | 703 | sprintf(chrCommand, "%ld:%02ld", lPos/1000/60, (lPos/1000)%60);
|
---|
[2] | 704 | WinSetWindowText(WinWindowFromID(hwnd, IDST_PLAYTIME), chrCommand);
|
---|
| 705 | lLastPos=lPos/1000;
|
---|
| 706 | }
|
---|
| 707 | break;
|
---|
| 708 | }
|
---|
| 709 | default:
|
---|
| 710 | break;
|
---|
| 711 | }/* switch */
|
---|
| 712 | return (MRESULT) 0;
|
---|
| 713 | break;
|
---|
| 714 | }
|
---|
| 715 | case SLN_CHANGE:
|
---|
| 716 | {
|
---|
| 717 | switch(SHORT1FROMMP(mp1))
|
---|
| 718 | {
|
---|
| 719 | case IDSL_VOLUME:
|
---|
| 720 | ULONG ulValue;
|
---|
| 721 |
|
---|
| 722 | ulValue=LONGFROMMP(mp2);
|
---|
| 723 | thisPtr->ulVolume=ulValue;
|
---|
| 724 | sprintf(chrCommand,"SET wave%d AUDIO VOLUME %d WAIT", thisPtr->iWave, thisPtr->ulVolume);
|
---|
| 725 | mciSendString(chrCommand, retMsg, sizeof(retMsg), 0, 0);
|
---|
| 726 | thisPtr->wpSaveDeferred();
|
---|
| 727 | break;
|
---|
| 728 | case IDSL_POSBAR:
|
---|
| 729 | {
|
---|
| 730 | ULONG rc;
|
---|
| 731 | long lPos=LONGFROMMP(mp2);
|
---|
| 732 |
|
---|
| 733 | bPosDragging=FALSE;
|
---|
| 734 | lPos*=1000;
|
---|
| 735 | lPos*=thisPtr->ulTotalLength/100;
|
---|
| 736 | lPos/=1000;// Use only full seconds
|
---|
| 737 |
|
---|
| 738 | /* Set time display first */
|
---|
| 739 |
|
---|
| 740 | thisPtr->cwSeekAudioFile(lPos);
|
---|
| 741 | /* restart timer */
|
---|
| 742 | WinStartTimer(WinQueryAnchorBlock(hwnd), hwnd, IDTIMER_PLAY, PLAYTIMER_DELAY);
|
---|
| 743 | thisPtr->ulPos=lPos/1000;
|
---|
| 744 | break;
|
---|
| 745 | }
|
---|
| 746 | default:
|
---|
| 747 | break;
|
---|
| 748 | }/* switch */
|
---|
| 749 | return (MRESULT)TRUE;
|
---|
| 750 | }
|
---|
| 751 | default:
|
---|
| 752 | break;
|
---|
| 753 | }/* switch */
|
---|
| 754 | break;
|
---|
| 755 | }
|
---|
| 756 | }/* WM_CONTROL */
|
---|
| 757 |
|
---|
| 758 | /*****************************************************/
|
---|
| 759 | /* Handle push button messages. */
|
---|
| 760 | /*****************************************************/
|
---|
| 761 | case WM_COMMAND:
|
---|
| 762 | /* The play control handling for starting, stopping etc. */
|
---|
| 763 | thisPtr=(CWMediaFolder*) WinQueryWindowULong(hwnd,QWL_USER);
|
---|
| 764 | if(somIsObj(thisPtr)){
|
---|
| 765 | HWND hwndFrame=WinQueryWindow(WinQueryWindow(hwnd,QW_PARENT),QW_PARENT);
|
---|
| 766 | switch(SHORT1FROMMP(mp1))
|
---|
| 767 | {
|
---|
| 768 | case IDPB_PLAY:
|
---|
| 769 | paintHilitedControl(WinWindowFromID(hwnd, IDPB_PAUSE), IDPB_PAUSE, FALSE);
|
---|
| 770 | callMediaFolderMethod(thisPtr, PLAY_FIRST, 0);
|
---|
| 771 | break;
|
---|
| 772 | case IDPB_STOP:
|
---|
| 773 | paintHilitedControl(WinWindowFromID(hwnd, IDPB_PLAY), IDPB_PLAY, FALSE);
|
---|
| 774 | paintHilitedControl(WinWindowFromID(hwnd, IDPB_PAUSE), IDPB_PAUSE, FALSE);
|
---|
| 775 | callMediaFolderMethod(thisPtr, STOP_TRACK, 0);
|
---|
| 776 | break;
|
---|
| 777 | case IDPB_SKIPFORWARD:
|
---|
| 778 | paintHilitedControl(WinWindowFromID(hwnd, IDPB_PLAY), IDPB_PLAY, FALSE);
|
---|
| 779 | paintHilitedControl(WinWindowFromID(hwnd, IDPB_PAUSE), IDPB_PAUSE, FALSE);
|
---|
| 780 | callMediaFolderMethod(thisPtr, PLAY_NEXT, 0);
|
---|
| 781 | break;
|
---|
| 782 | case IDPB_SKIPBACK:
|
---|
| 783 | paintHilitedControl(WinWindowFromID(hwnd, IDPB_PLAY), IDPB_PLAY, FALSE);
|
---|
| 784 | paintHilitedControl(WinWindowFromID(hwnd, IDPB_PAUSE), IDPB_PAUSE, FALSE);
|
---|
| 785 | callMediaFolderMethod(thisPtr, PLAY_PREV, 0);
|
---|
| 786 | break;
|
---|
| 787 | case IDPB_PAUSE:
|
---|
| 788 | paintHilitedControl(WinWindowFromID(hwnd, IDPB_PLAY), IDPB_PLAY, FALSE);
|
---|
| 789 | callMediaFolderMethod(thisPtr, PAUSE_TRACK, 0);
|
---|
| 790 | break;
|
---|
| 791 | /* Popup menu over time control */
|
---|
| 792 | case ID_MENUITEMELAPSED:
|
---|
| 793 | thisPtr->usWhichDisplay=DISPLAY_TIMEELAPSED;
|
---|
| 794 | setPlayTimeText(thisPtr);
|
---|
| 795 | break;
|
---|
| 796 | case ID_MENUITEMREMAINING:
|
---|
| 797 | thisPtr->usWhichDisplay=DISPLAY_TIMEREMAINING;
|
---|
| 798 | setPlayTimeText(thisPtr);
|
---|
| 799 | break;
|
---|
| 800 | case ID_MENUITEMID3:
|
---|
| 801 | thisPtr->usWhichDisplay=DISPLAY_TIMEID3;
|
---|
| 802 | WinSetWindowULong(WinWindowFromID(thisPtr->hwndTopMiddle, IDST_PLAYTIME), QWL_USER, 0);
|
---|
| 803 | setPlayTimeText(thisPtr);
|
---|
| 804 | break;
|
---|
| 805 | default:
|
---|
| 806 | break;
|
---|
| 807 | }/* switch() */
|
---|
| 808 | }/* somIsObj()*/
|
---|
| 809 | return (MRESULT)FALSE;
|
---|
| 810 |
|
---|
| 811 | /*****************************************************/
|
---|
| 812 | /* Make sure tabbing works. */
|
---|
| 813 | /*****************************************************/
|
---|
| 814 | case WM_CHAR:
|
---|
| 815 | if(SHORT1FROMMP(mp1) & KC_ALT) { // Send keys with ALT modifier to the folder
|
---|
| 816 | HWND hwndTemp;
|
---|
| 817 | // Save control with focus
|
---|
| 818 | hwndTemp=WinQueryFocus(HWND_DESKTOP);
|
---|
| 819 | // Set focus to container so the key will be processed as usual
|
---|
| 820 | WinSetFocus(HWND_DESKTOP, WinWindowFromID(WinQueryWindow(WinQueryWindow(hwnd,QW_PARENT),QW_PARENT),FID_CLIENT));
|
---|
| 821 | // Set saved control as old focus owner so it will get the focus back when necessary, not the container
|
---|
| 822 | WinSetWindowULong(WinQueryWindow(WinQueryWindow(hwnd,QW_PARENT),QW_PARENT),QWL_HWNDFOCUSSAVE,hwndTemp);
|
---|
| 823 | return WinSendMsg(WinWindowFromID(WinQueryWindow(WinQueryWindow(hwnd,QW_PARENT),QW_PARENT),FID_CLIENT),msg,mp1,mp2);
|
---|
| 824 | }
|
---|
| 825 | else if((SHORT1FROMMP(mp1) & KC_VIRTUALKEY)== KC_VIRTUALKEY)
|
---|
| 826 | {
|
---|
| 827 | if(SHORT2FROMMP(mp2)==VK_TAB ) {
|
---|
| 828 | if(WinQueryFocus(HWND_DESKTOP)==WinWindowFromID(hwnd,IDSL_POSBAR)) {
|
---|
| 829 | // Set focus to container
|
---|
| 830 | WinSetFocus(HWND_DESKTOP, WinWindowFromID(WinQueryWindow(WinQueryWindow(hwnd,QW_PARENT),QW_PARENT),
|
---|
| 831 | FID_CLIENT));
|
---|
| 832 | return (MRESULT)TRUE;
|
---|
| 833 | }
|
---|
| 834 | }/* if(SHORT2FROMMP(mp2)==VK_TAB ) */
|
---|
| 835 | else if(SHORT2FROMMP(mp2)==VK_BACKTAB )
|
---|
| 836 | {
|
---|
| 837 | if(WinQueryFocus(HWND_DESKTOP)==WinWindowFromID(hwnd,IDPB_SKIPBACK)) {
|
---|
| 838 | // Set focus to container
|
---|
| 839 | WinSetFocus(HWND_DESKTOP, WinWindowFromID(WinQueryWindow(WinQueryWindow(hwnd,QW_PARENT),QW_PARENT),
|
---|
| 840 | FID_CLIENT));
|
---|
| 841 | return (MRESULT)TRUE;
|
---|
| 842 | }
|
---|
| 843 | }
|
---|
| 844 | }/* else if(SHORT1FROMMP(mp1) & KC_VIRTUALKEY) */
|
---|
| 845 | break;
|
---|
| 846 | #if 0
|
---|
| 847 | case WM_CONTEXTMENU:
|
---|
| 848 | thisPtr=(CWMediaFolder*) WinQueryWindowULong(hwnd,QWL_USER);
|
---|
| 849 | if(somIsObj(thisPtr)){
|
---|
| 850 | POINTL ptl;
|
---|
| 851 | HWND hwndClient=WinWindowFromID(WinQueryWindow(WinQueryWindow(hwnd,QW_PARENT),QW_PARENT),FID_CLIENT);
|
---|
| 852 | WinQueryPointerPos(HWND_DESKTOP, &ptl) ;
|
---|
| 853 | WinMapWindowPoints(HWND_DESKTOP, hwndClient, &ptl, 1);
|
---|
| 854 |
|
---|
| 855 | thisPtr->wpDisplayMenu(hwndClient, NULLHANDLE, &ptl,MENU_OBJECTPOPUP,NULL);
|
---|
| 856 | }
|
---|
| 857 | return MRFALSE;
|
---|
| 858 | #endif
|
---|
| 859 | /*****************************************************/
|
---|
| 860 | /* Handle playtime display switching. */
|
---|
| 861 | /* The messages are coming from the static text. */
|
---|
| 862 | /*****************************************************/
|
---|
| 863 | case WM_APPTERMINATENOTIFY:
|
---|
| 864 | thisPtr=(CWMediaFolder*) WinQueryWindowULong(hwnd,QWL_USER);
|
---|
| 865 | if(somIsObj(thisPtr)){
|
---|
| 866 | switch(SHORT1FROMMP(mp1))
|
---|
| 867 | {
|
---|
| 868 | case NOTIFY_CLICK:
|
---|
| 869 | /* Clicked on the playtime display */
|
---|
| 870 | thisPtr->usWhichDisplay++;
|
---|
| 871 | if(thisPtr->usWhichDisplay>2)
|
---|
| 872 | thisPtr->usWhichDisplay=0;
|
---|
| 873 | if(thisPtr->usWhichDisplay==2)
|
---|
| 874 | WinSetWindowULong(WinWindowFromID(thisPtr->hwndTopMiddle, IDST_PLAYTIME), QWL_USER, 0);
|
---|
| 875 | setPlayTimeText(thisPtr);
|
---|
| 876 | return MRFALSE;
|
---|
| 877 | case NOTIFY_CONTEXT:
|
---|
| 878 | /* Show context menu. */
|
---|
| 879 | contextMenu(hwnd, thisPtr->usWhichDisplay+ID_MENUITEMELAPSED, TRUE);
|
---|
| 880 | return MRFALSE;
|
---|
| 881 | default:
|
---|
| 882 | break;
|
---|
| 883 | }
|
---|
| 884 | }
|
---|
| 885 | return MRFALSE;
|
---|
| 886 |
|
---|
| 887 | #if 0
|
---|
| 888 | case MM_MCIPOSITIONCHANGE:
|
---|
| 889 | thisPtr=(CWMediaFolder*) WinQueryWindowULong(hwnd,QWL_USER);
|
---|
| 890 | if(somIsObj(thisPtr)){
|
---|
| 891 | char chrCommand[50];
|
---|
| 892 | char retMsg[20];
|
---|
| 893 | char retMsg2[20];
|
---|
| 894 | int iTime;
|
---|
| 895 | ULONG rc;
|
---|
| 896 | /* Restart check timer */
|
---|
| 897 | WinStartTimer(WinQueryAnchorBlock(hwnd), hwnd, IDTIMER_PLAY, PLAYTIMER_DELAY);
|
---|
| 898 | sprintf(chrCommand,"STATUS wave%d POSITION WAIT", thisPtr->iWave);
|
---|
| 899 | rc = mciSendString(chrCommand, retMsg, sizeof(retMsg), 0, 0);
|
---|
| 900 | if((rc & 0x0000ffff)==MCIERR_SUCCESS) {
|
---|
| 901 | iTime=atoi(retMsg);
|
---|
| 902 | /* Set time display */
|
---|
| 903 | sprintf(chrCommand,"%d:%02d %d:%02d -%d:%02d",thisPtr->ulTotalLength/1000/60,(thisPtr->ulTotalLength/1000)%60,
|
---|
| 904 | (iTime+thisPtr->ulStartPosition)/1000/60,((iTime+thisPtr->ulStartPosition)/1000)%60,
|
---|
| 905 | (thisPtr->ulTotalLength-(iTime+thisPtr->ulStartPosition))/1000/60,
|
---|
| 906 | ((thisPtr->ulTotalLength-(iTime+thisPtr->ulStartPosition))/1000)%60);
|
---|
| 907 | WinSetWindowText(WinWindowFromID(hwnd, IDST_PLAYTIME), chrCommand);
|
---|
| 908 | WinPostMsg( WinWindowFromID(hwnd, IDPB_POSBAR),
|
---|
| 909 | SLM_SETSLIDERINFO,
|
---|
| 910 | MPFROM2SHORT(SMA_SLIDERARMPOSITION,SMA_INCREMENTVALUE),
|
---|
| 911 | MPFROMLONG( (LONG)((iTime/10)/(thisPtr->ulTotalLength/1000))));
|
---|
| 912 | }
|
---|
| 913 | else {
|
---|
| 914 | char retError[1024];
|
---|
| 915 | mciGetErrorString(rc, retError, 1024);
|
---|
| 916 | sprintf(chrCommand,"%s", retMsg);
|
---|
| 917 | WinSetWindowText(WinWindowFromID(hwnd, IDST_PLAYTIME), chrCommand);
|
---|
| 918 | }
|
---|
| 919 | }
|
---|
| 920 | break;
|
---|
| 921 | #endif
|
---|
| 922 | default:
|
---|
| 923 | break;
|
---|
| 924 | }
|
---|
| 925 | return WinDefDlgProc(hwnd, msg, mp1, mp2);
|
---|
| 926 | }
|
---|
| 927 |
|
---|
| 928 | /************************************************************
|
---|
| 929 | * *
|
---|
| 930 | * This procedure calculates the positions for the custom *
|
---|
| 931 | * frame controls. *
|
---|
| 932 | * PM uses the pos to calculate the area which needs *
|
---|
| 933 | * repainting and the pos of each control. Using this code *
|
---|
| 934 | * prevents flickering. *
|
---|
| 935 | * *
|
---|
| 936 | ************************************************************/
|
---|
| 937 | MRESULT handleCalcValidRects(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
|
---|
| 938 | {
|
---|
| 939 | PRECTL pRectl, pRectlNew;
|
---|
| 940 | PSWP pswp;
|
---|
| 941 | POINTL ptl;
|
---|
| 942 |
|
---|
| 943 | pswp=(PSWP)mp2;
|
---|
| 944 | if(pswp->fl&SWP_SIZE) {
|
---|
| 945 | pRectl=(PRECTL)mp1;
|
---|
| 946 | pRectlNew=pRectl;
|
---|
| 947 | pRectlNew++;
|
---|
| 948 |
|
---|
| 949 | if(pRectlNew->xRight!=pRectl->xRight) {
|
---|
| 950 | if(WinSendMsg(hwnd,WM_QUERYBORDERSIZE,(MPARAM)&ptl,0)) {
|
---|
| 951 | pRectl->xRight-=ptl.x;
|
---|
| 952 | }else {
|
---|
| 953 | /* Ok, then use some defaults. Better than nothing... */
|
---|
| 954 | pRectl->xRight-=4;
|
---|
| 955 | }
|
---|
| 956 | pRectlNew->xRight=pRectl->xRight;
|
---|
| 957 | return (MRESULT)0;
|
---|
| 958 | }
|
---|
| 959 | else if(pRectlNew->xLeft<pRectl->xLeft) {
|
---|
| 960 | if(WinSendMsg(hwnd,WM_QUERYBORDERSIZE,(MPARAM)&ptl,0)) {
|
---|
| 961 | pRectl->xLeft+=ptl.x;
|
---|
| 962 | }else {
|
---|
| 963 | /* Ok, then use some defaults. Better than nothing... */
|
---|
| 964 | pRectl->xLeft+=4;
|
---|
| 965 | }
|
---|
| 966 | pRectlNew->xLeft=pRectl->xLeft;
|
---|
| 967 | return (MRESULT)0;
|
---|
| 968 | }
|
---|
| 969 | else if(pRectlNew->xLeft<pRectl->xLeft) {
|
---|
| 970 | pRectlNew->xLeft=pRectl->xLeft;
|
---|
| 971 |
|
---|
| 972 | return (MRESULT)0;
|
---|
| 973 | } else if(pRectlNew->yBottom!=pRectl->yBottom || pRectlNew->yTop!=pRectl->yTop) {
|
---|
| 974 | pRectlNew->yTop=pRectl->yTop;
|
---|
| 975 | pRectlNew->yBottom=pRectl->yBottom;
|
---|
| 976 | return (MRESULT)0;
|
---|
| 977 | }
|
---|
| 978 | }
|
---|
| 979 | return (MRESULT)0;
|
---|
| 980 | }
|
---|
| 981 |
|
---|
| 982 |
|
---|
| 983 | /************************************************************
|
---|
| 984 | * *
|
---|
| 985 | * When sizing and moving the folder the custom frame *
|
---|
| 986 | * controls must be moved too so they keep their visual *
|
---|
| 987 | * position with respect to the left border of the folder. *
|
---|
| 988 | * *
|
---|
| 989 | ************************************************************/
|
---|
| 990 | void handleWindowPosChanged(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
|
---|
| 991 | {
|
---|
| 992 | PSWP pswp=(PSWP)mp1;
|
---|
| 993 |
|
---|
| 994 | if((pswp->fl & SWP_SIZE)&&!(pswp->fl & SWP_SHOW)) {
|
---|
| 995 | SWP swp;
|
---|
| 996 | HENUM hEnum;
|
---|
| 997 | HWND hwndClient;
|
---|
| 998 | PSWP pswpOld;
|
---|
| 999 | int xPos, yPos;
|
---|
| 1000 | ULONG ulStyle;
|
---|
| 1001 |
|
---|
| 1002 | pswpOld=pswp;
|
---|
| 1003 | pswpOld++;
|
---|
| 1004 |
|
---|
| 1005 | ulStyle=WinQueryWindowULong(WinQueryWindow(hwnd,QW_PARENT),QWL_STYLE);
|
---|
| 1006 | if(!(ulStyle & WS_MINIMIZED) && !(ulStyle & WS_MAXIMIZED) ) {
|
---|
| 1007 |
|
---|
| 1008 | if(pswpOld->x != pswp->x || 1) {
|
---|
| 1009 | if((pswpOld->cx!=0)) {
|
---|
| 1010 | xPos=(pswpOld->x > pswp->x ? pswpOld->x-pswp->x : 0);
|
---|
| 1011 | // yPos=(pswpOld->y > pswp->y ? pswpOld->y-pswp->y : 0);
|
---|
| 1012 | }
|
---|
| 1013 | else {
|
---|
| 1014 | xPos=0;
|
---|
| 1015 | }
|
---|
| 1016 | if(pswp->cx<=allBMPs[MAIN_BMP_IDX].bmpInfoHdr.cx)
|
---|
| 1017 | WinSetWindowPos(WinWindowFromID(hwnd, IDDLG_TOPMIDDLE), NULLHANDLE, 0, 0, 0, 0, SWP_MOVE);
|
---|
| 1018 | else
|
---|
| 1019 | WinSetWindowPos(WinWindowFromID(hwnd, IDDLG_TOPMIDDLE), NULLHANDLE, (pswp->cx-allBMPs[MAIN_BMP_IDX].bmpInfoHdr.cx)/2,
|
---|
| 1020 | 0, 0, 0, SWP_MOVE);
|
---|
| 1021 | #if 0
|
---|
| 1022 | /* Move all client windows so they keep their distance to the left border */
|
---|
| 1023 | hEnum=WinBeginEnumWindows(hwnd);
|
---|
| 1024 | while((hwndClient=WinGetNextWindow(hEnum))!=NULLHANDLE) {
|
---|
| 1025 | if(WinQueryWindowULong())
|
---|
| 1026 | WinQueryWindowPos(hwndClient,&swp);
|
---|
| 1027 | WinSetWindowPos(hwndClient, NULLHANDLE, swp.x-xPos, (pswp->cy-swp.cy)/2/*swp.y-yPos*/, 0, 0, SWP_MOVE);
|
---|
| 1028 | }/* while */
|
---|
| 1029 | WinEndEnumWindows(hEnum);
|
---|
| 1030 | #endif
|
---|
| 1031 | }
|
---|
| 1032 | }
|
---|
| 1033 | }
|
---|
| 1034 | }
|
---|
| 1035 |
|
---|
| 1036 |
|
---|
| 1037 | /****************************************************************************/
|
---|
| 1038 | /* */
|
---|
| 1039 | /* This procedure handles the frame extension of the folder at the top */
|
---|
| 1040 | /* */
|
---|
| 1041 | /* The playcontrol dialog is a child of this 'background' dialog. */
|
---|
| 1042 | /* */
|
---|
| 1043 | /****************************************************************************/
|
---|
| 1044 | MRESULT EXPENTRY topCtrlDialogProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
|
---|
| 1045 | {
|
---|
| 1046 | CWMediaFolder *thisPtr;
|
---|
| 1047 | char name[CCHMAXPATH];
|
---|
| 1048 | ULONG ulNameSize;
|
---|
| 1049 | SIZEL sizel;
|
---|
| 1050 | ULONG ulFlags;
|
---|
| 1051 | HWND hwndTemp;
|
---|
| 1052 | POINTL ptl;
|
---|
| 1053 | SHORT a,b;
|
---|
| 1054 | HOBJECT hObject;
|
---|
| 1055 |
|
---|
| 1056 | switch(msg)
|
---|
| 1057 | {
|
---|
| 1058 | /*****************************************************/
|
---|
| 1059 | /* Init the dialog */
|
---|
| 1060 | /*****************************************************/
|
---|
| 1061 | case WM_INITDLG :
|
---|
| 1062 | {
|
---|
| 1063 | ULONG ulStyle;
|
---|
| 1064 | SWP swp;
|
---|
| 1065 |
|
---|
| 1066 | WinSetWindowULong(hwnd,QWL_USER,(ULONG)PVOIDFROMMP(mp2));//Save object ptr.
|
---|
| 1067 | thisPtr=(CWMediaFolder*) PVOIDFROMMP(mp2);
|
---|
| 1068 |
|
---|
| 1069 | hwndTemp=WinLoadDlg(hwnd, hwnd, playControlDialogProc, queryResModuleHandle(),
|
---|
| 1070 | IDDLG_TOPMIDDLE ,thisPtr);
|
---|
| 1071 | WinQueryWindowPos(WinQueryWindow(hwnd,QW_PARENT),&swp);
|
---|
| 1072 | /**!!!!!!!!!! BORDERSIZE !!!!!!!!!! **/
|
---|
| 1073 | WinSetWindowPos(hwndTemp, NULL, (swp.cx-allBMPs[MAIN_BMP_IDX].bmpInfoHdr.cx)/2, 0,
|
---|
| 1074 | allBMPs[MAIN_BMP_IDX].bmpInfoHdr.cx, allBMPs[MAIN_BMP_IDX].bmpInfoHdr.cy, SWP_SIZE|SWP_MOVE|SWP_SHOW);
|
---|
| 1075 | thisPtr->hwndTopMiddle=hwndTemp;
|
---|
| 1076 | /* Set dialog font to WarpSans for Warp 4 and above */
|
---|
| 1077 | if(SysQueryOSRelease()>=40) {
|
---|
| 1078 | WinSetPresParam(hwnd,
|
---|
| 1079 | PP_FONTNAMESIZE,(ULONG)sizeof(DEFAULT_DIALOG_FONT),
|
---|
| 1080 | DEFAULT_DIALOG_FONT );
|
---|
| 1081 | }
|
---|
| 1082 | return (MRESULT)FALSE;
|
---|
| 1083 | }
|
---|
| 1084 | case WM_CALCVALIDRECTS:
|
---|
| 1085 | {
|
---|
| 1086 | if(WinIsWindowVisible(hwnd))
|
---|
| 1087 | return handleCalcValidRects(hwnd, msg, mp1, mp2);
|
---|
| 1088 | break;
|
---|
| 1089 | }
|
---|
| 1090 | case WM_WINDOWPOSCHANGED:
|
---|
| 1091 | {
|
---|
| 1092 | /* Move the clients of the framecontrol so they keep their distance to the left */
|
---|
| 1093 | handleWindowPosChanged(hwnd, msg, mp1, mp2);
|
---|
| 1094 | break;
|
---|
| 1095 | }
|
---|
| 1096 | case WM_CHAR:
|
---|
| 1097 | // Set focus to container so the key will be processed as usual
|
---|
| 1098 | WinSetFocus(HWND_DESKTOP, WinWindowFromID(WinQueryWindow(hwnd,QW_PARENT),FID_CLIENT));
|
---|
| 1099 | return WinSendMsg(WinWindowFromID(WinQueryWindow(hwnd,QW_PARENT),FID_CLIENT),msg,mp1,mp2);
|
---|
| 1100 |
|
---|
| 1101 | /*****************************************************/
|
---|
| 1102 | /* Paint the background. */
|
---|
| 1103 | /*****************************************************/
|
---|
| 1104 | case WM_PAINT:
|
---|
| 1105 | HPS hps;
|
---|
| 1106 | RECTL rcl, rclSave, rclSource;
|
---|
| 1107 | SWP swp;
|
---|
| 1108 |
|
---|
| 1109 | hps=WinBeginPaint(hwnd, NULLHANDLE,NULL);
|
---|
| 1110 | /* Get Window size */
|
---|
| 1111 | WinQueryWindowRect(hwnd, &rcl);
|
---|
| 1112 | rclSave=rcl;
|
---|
| 1113 | /* Get size and pos of control area */
|
---|
| 1114 | WinQueryWindowPos(WinWindowFromID(hwnd, IDDLG_TOPMIDDLE),&swp);
|
---|
| 1115 | /* Left area */
|
---|
| 1116 | rcl.xRight=swp.x;
|
---|
| 1117 | rclSource.xLeft=0;
|
---|
| 1118 | rclSource.yBottom=0;
|
---|
| 1119 | rclSource.yTop=allBMPs[CTRLIDX_TOPLEFT].bmpInfoHdr.cy;
|
---|
| 1120 | rclSource.xRight=allBMPs[CTRLIDX_TOPLEFT].bmpInfoHdr.cx;
|
---|
| 1121 | WinDrawBitmap(hps, allBMPs[CTRLIDX_TOPLEFT].hbm,
|
---|
| 1122 | &rclSource,
|
---|
| 1123 | (PPOINTL)&rclSave,
|
---|
| 1124 | 0, 0,
|
---|
| 1125 | DBM_IMAGEATTRS | DBM_STRETCH);
|
---|
| 1126 |
|
---|
| 1127 | /* Right area */
|
---|
| 1128 | rclSave.xLeft=swp.x+swp.cx;
|
---|
| 1129 | rclSource.xLeft=0;
|
---|
| 1130 | rclSource.yBottom=0;
|
---|
| 1131 | rclSource.yTop=allBMPs[CTRLIDX_TOPRIGHT].bmpInfoHdr.cy;
|
---|
| 1132 | rclSource.xRight=allBMPs[CTRLIDX_TOPRIGHT].bmpInfoHdr.cx;
|
---|
| 1133 | WinDrawBitmap(hps, allBMPs[CTRLIDX_TOPRIGHT].hbm,
|
---|
| 1134 | &rclSource,
|
---|
| 1135 | (PPOINTL)&rclSave,
|
---|
| 1136 | 0, 0,
|
---|
| 1137 | DBM_IMAGEATTRS | DBM_STRETCH);
|
---|
| 1138 |
|
---|
| 1139 | WinEndPaint(hps);
|
---|
| 1140 | return (MRESULT) 0;
|
---|
| 1141 | case WM_COMMAND:
|
---|
| 1142 | thisPtr=(CWMediaFolder*) WinQueryWindowULong(hwnd,QWL_USER);
|
---|
| 1143 | if(somIsObj(thisPtr)){
|
---|
| 1144 | switch(SHORT1FROMMP(mp1))
|
---|
| 1145 | {
|
---|
| 1146 | case IDPB_PAUSE:
|
---|
| 1147 | {
|
---|
| 1148 | #if 0
|
---|
| 1149 | CNRINFO cnrInfo;
|
---|
| 1150 | HWND hwndContainer;
|
---|
| 1151 | FIELDINFO fi;
|
---|
| 1152 | PFIELDINFO pfi, pfiFirst;
|
---|
| 1153 | char text[200];
|
---|
| 1154 | int numLeft=0;
|
---|
| 1155 | int numRight=0;
|
---|
| 1156 | int numVisLeft=0;
|
---|
| 1157 | int numVisRight=0;
|
---|
| 1158 | int a=0;
|
---|
| 1159 | LONG lWidth[100];
|
---|
| 1160 | HPS hps;
|
---|
| 1161 | FONTMETRICS fm={0};
|
---|
| 1162 | RECTL rcl2;
|
---|
| 1163 | ULONG attrFound;
|
---|
| 1164 | char chrFontName[50];
|
---|
| 1165 | char *chrPtr;
|
---|
| 1166 |
|
---|
| 1167 | THREADPARAMS* pTp;
|
---|
| 1168 | ULONG ulErr;
|
---|
| 1169 |
|
---|
| 1170 | return (MRESULT)0;
|
---|
| 1171 |
|
---|
| 1172 | pTp=(THREADPARAMS*)thisPtr->wpAllocMem(sizeof(THREADPARAMS), &ulErr);
|
---|
| 1173 | pTp->thisPtr=thisPtr;
|
---|
| 1174 | pTp->hwndFrame=WinQueryWindow(hwnd, QW_PARENT);
|
---|
| 1175 |
|
---|
| 1176 | // _beginthread(rexxThreadFunc,NULL,8192*16,(void*)pTp); //Fehlerbehandlung fehlt
|
---|
| 1177 | hwndContainer=WinWindowFromID(WinQueryWindow(hwnd,QW_PARENT), FID_CLIENT);
|
---|
| 1178 | return (MRESULT)0;
|
---|
| 1179 | WinSendMsg(hwndContainer,CM_QUERYCNRINFO, MPFROMP(&cnrInfo),
|
---|
| 1180 | MPFROMLONG(sizeof(cnrInfo)));
|
---|
| 1181 |
|
---|
| 1182 | pfi=(PFIELDINFO)WinSendMsg(hwndContainer,CM_QUERYDETAILFIELDINFO, NULLHANDLE,
|
---|
| 1183 | MPFROMSHORT(CMA_FIRST));
|
---|
| 1184 | if(!pfi)
|
---|
| 1185 | return (MRESULT)0;
|
---|
| 1186 | lWidth[a]=(LONG)WinSendMsg(hwndContainer,CM_QUERYDETAILFIELDINFO, MPFROMP(pfi),
|
---|
| 1187 | MPFROMLONG(0x200));
|
---|
| 1188 | pfiFirst=pfi;
|
---|
| 1189 | numRight++;
|
---|
| 1190 | a++;
|
---|
| 1191 | if(!(pfi->flData & CFA_INVISIBLE))
|
---|
| 1192 | numVisRight++;
|
---|
| 1193 | while(pfi){
|
---|
| 1194 | if(pfi==cnrInfo.pFieldInfoLast) {
|
---|
| 1195 | numLeft=numRight;
|
---|
| 1196 | numRight=0;
|
---|
| 1197 | numVisLeft=numVisRight;
|
---|
| 1198 | numVisRight=0;
|
---|
| 1199 | }
|
---|
| 1200 | pfi=(PFIELDINFO)WinSendMsg(hwndContainer,CM_QUERYDETAILFIELDINFO, MPFROMP(pfi),
|
---|
| 1201 | MPFROMSHORT(CMA_NEXT));
|
---|
| 1202 | if(pfi) {
|
---|
| 1203 | lWidth[a]=(LONG)WinSendMsg(hwndContainer,CM_QUERYDETAILFIELDINFO, MPFROMP(pfi),
|
---|
| 1204 | MPFROMLONG(0x200));
|
---|
| 1205 | a++;
|
---|
| 1206 | numRight++;
|
---|
| 1207 | if(!(pfi->flData & CFA_INVISIBLE))
|
---|
| 1208 | numVisRight++;
|
---|
| 1209 | }
|
---|
| 1210 | }
|
---|
| 1211 |
|
---|
| 1212 | pfi=pfiFirst;
|
---|
| 1213 | // Query the current font
|
---|
| 1214 | WinQueryPresParam(hwndContainer,
|
---|
| 1215 | PP_FONTNAMESIZE,0,&attrFound,sizeof(chrFontName),
|
---|
| 1216 | chrFontName,QPF_NOINHERIT);
|
---|
| 1217 | /* 0 means error */
|
---|
| 1218 | fm.lEmHeight=atol(chrFontName);
|
---|
| 1219 | if((chrPtr=strchr(chrFontName, '.'))!=NULLHANDLE)
|
---|
| 1220 | chrPtr++;
|
---|
| 1221 |
|
---|
| 1222 | hps=WinGetPS(hwndContainer);
|
---|
| 1223 | strcpy(fm.szFacename, chrPtr);
|
---|
| 1224 |
|
---|
| 1225 | GpiQueryFontMetrics(hps,sizeof(fm),&fm);
|
---|
| 1226 |
|
---|
| 1227 | WinReleasePS(hps);
|
---|
| 1228 | sprintf(text,"%s num: %d CFA_OWNER: %s numLeft: %d numRight: %d numVisLeft: %d numVisRight: %d",
|
---|
| 1229 | pfi->pTitleData,
|
---|
| 1230 | cnrInfo.cFields,
|
---|
| 1231 | (pfi->flData & CFA_OWNER ? "Yes": "No"),
|
---|
| 1232 | numLeft, numRight,numVisLeft, numVisRight);
|
---|
| 1233 | WinMessageBox(HWND_DESKTOP, HWND_DESKTOP, text, "", 1234, MB_OK|MB_MOVEABLE);
|
---|
| 1234 |
|
---|
| 1235 | WinSendMsg(hwndContainer, CM_QUERYVIEWPORTRECT, MPFROMP(&rcl) , MPFROM2SHORT(CMA_WORKSPACE, FALSE));
|
---|
| 1236 | WinSendMsg(hwndContainer, CM_QUERYVIEWPORTRECT, MPFROMP(&rcl2) , MPFROM2SHORT(CMA_WINDOW, FALSE));
|
---|
| 1237 |
|
---|
| 1238 | sprintf(text,"%d %d %d %d %d %d %d average: %d average*3 %d rcl.xLeft: %d rcl.xRight %d %d rcl2.xLeft: %d rcl2.xRight %d %d",
|
---|
| 1239 | lWidth[0], lWidth[1], lWidth[2], lWidth[3], lWidth[4],
|
---|
| 1240 | lWidth[5], lWidth[6],
|
---|
| 1241 | fm.lAveCharWidth, fm.lAveCharWidth*3 , rcl.xLeft,rcl.xRight, rcl.xRight-rcl.xLeft
|
---|
| 1242 | , rcl2.xLeft,rcl2.xRight, rcl2.xRight-rcl2.xLeft);
|
---|
| 1243 |
|
---|
| 1244 | WinMessageBox(HWND_DESKTOP, HWND_DESKTOP, text, "", 1234, MB_OK|MB_MOVEABLE);
|
---|
| 1245 | // DosBeep(5000,300);
|
---|
| 1246 | return (MRESULT)0;
|
---|
| 1247 |
|
---|
| 1248 | // WinMessageBox(HWND_DESKTOP, HWND_DESKTOP, "Noch nicht implementiert..", "", 1234, MB_OK|MB_MOVEABLE);
|
---|
| 1249 | char chrCommand[200];
|
---|
| 1250 | PUSEITEM pUseItem;
|
---|
| 1251 | PVIEWITEM pViewItem;
|
---|
| 1252 | PVIEWITEM pView;
|
---|
| 1253 | WPObject *wpObj;
|
---|
| 1254 | WPObject *wpObject;
|
---|
| 1255 |
|
---|
| 1256 | PMINIRECORDCORE mrc;
|
---|
| 1257 | M_WPObject *mWPObject;
|
---|
| 1258 |
|
---|
| 1259 | hwndContainer=WinWindowFromID(WinQueryWindow(hwnd,QW_PARENT), FID_CLIENT);
|
---|
| 1260 | mWPObject=thisPtr->wpQueryFldrDetailsClass();
|
---|
| 1261 |
|
---|
| 1262 | /* Selected object */
|
---|
| 1263 | /* Get first selected container item of our folder */
|
---|
| 1264 | mrc=(PMINIRECORDCORE)WinSendMsg(hwndContainer,CM_QUERYRECORDEMPHASIS, MPFROMSHORT(CMA_FIRST),
|
---|
| 1265 | MPFROMSHORT(CRA_SELECTED));
|
---|
| 1266 |
|
---|
| 1267 | while(mrc) {
|
---|
| 1268 | wpObj=(WPObject*)OBJECT_FROM_PREC(mrc);//Get object
|
---|
| 1269 | wpObject=thisPtr->cwGetFileSystemObject(wpObj);
|
---|
| 1270 | if(wpObject!=wpObj && wpObject) {
|
---|
| 1271 | if(somIsObj(wpObject)) {
|
---|
| 1272 | if(wpObject->somIsA(mWPObject)) {
|
---|
| 1273 | ULONG ulFieldSize=0;
|
---|
| 1274 | /* Fieldinfosize */
|
---|
| 1275 | ULONG ulCols=mWPObject->wpclsQueryDetailsInfo(NULL, &ulFieldSize);
|
---|
| 1276 | ULONG ulDataSize=0;
|
---|
| 1277 | PBYTE memFieldPtr, memFieldPtrSave;
|
---|
| 1278 | static PBYTE memPtr, memPtrSave;
|
---|
| 1279 | ULONG ulRC;
|
---|
| 1280 | PCLASSFIELDINFO pcfi;
|
---|
| 1281 | PFIELDINFO pfi;
|
---|
| 1282 | int a;
|
---|
| 1283 | PSZ *theStrings;
|
---|
| 1284 | PBYTE bPtr;
|
---|
| 1285 |
|
---|
| 1286 | /* Detailsdata size */
|
---|
| 1287 | wpObject->wpQueryDetailsData(NULL, &ulDataSize);
|
---|
| 1288 |
|
---|
| 1289 | /* For now some safety */
|
---|
| 1290 | ulDataSize*=4;
|
---|
| 1291 |
|
---|
| 1292 | if((memFieldPtr=thisPtr->wpAllocMem(ulFieldSize, &ulRC))!=NULLHANDLE) {
|
---|
| 1293 | memFieldPtrSave=memFieldPtr;
|
---|
| 1294 | mWPObject->wpclsQueryDetailsInfo( (PCLASSFIELDINFO*)&memFieldPtr, &ulFieldSize);
|
---|
| 1295 | if((memPtr=thisPtr->wpAllocMem(ulDataSize, &ulRC))!=NULLHANDLE) {
|
---|
| 1296 | memPtrSave=memPtr;
|
---|
| 1297 | memset(memPtr, 0, ulDataSize);
|
---|
| 1298 |
|
---|
| 1299 | /* Query details data */
|
---|
| 1300 | wpObject->wpQueryDetailsData( (PPVOID)&memPtr, &ulDataSize);
|
---|
| 1301 | pcfi=(PCLASSFIELDINFO)memFieldPtr;
|
---|
| 1302 | pcfi=pcfi->pNextFieldInfo;
|
---|
| 1303 |
|
---|
| 1304 | /* Get first fieldinfo */
|
---|
| 1305 | pfi=(PFIELDINFO)WinSendMsg(hwndContainer,CM_QUERYDETAILFIELDINFO, MPFROMLONG(0L),
|
---|
| 1306 | MPFROMSHORT(CMA_FIRST));
|
---|
| 1307 | memPtr=memPtrSave;
|
---|
| 1308 | PSZ* ptr;
|
---|
| 1309 | PSZ* mrcPtr;
|
---|
| 1310 | for(a=1, pcfi=(PCLASSFIELDINFO)memFieldPtr,ptr=(PSZ*)memPtr;
|
---|
| 1311 | a<=ulCols && pcfi && pfi;
|
---|
| 1312 | pfi=pfi->pNextFieldInfo, pcfi=pcfi->pNextFieldInfo,a++)
|
---|
| 1313 | {
|
---|
| 1314 | PFIELDINFO pfi2=NULL;
|
---|
| 1315 | PBYTE temp;
|
---|
| 1316 | PBYTE temp2;
|
---|
| 1317 | temp=(PBYTE)mrc;
|
---|
| 1318 | temp2=temp;
|
---|
| 1319 | temp+=pfi->offStruct;
|
---|
| 1320 | mrcPtr=(PSZ*)temp;
|
---|
| 1321 |
|
---|
| 1322 | if(pfi->offStruct >= mrc->cb) {
|
---|
| 1323 | /* do something here */
|
---|
| 1324 | if(a==7) {
|
---|
| 1325 | *mrcPtr=*ptr;
|
---|
| 1326 | // pfi->flData&=~(CFA_OWNER|CFA_IGNORE);
|
---|
| 1327 | // pfi->flData&=~(CFA_OWNER);
|
---|
| 1328 | }
|
---|
| 1329 | mrcPtr++;
|
---|
| 1330 | ptr++;
|
---|
| 1331 | }/* offStruct*/
|
---|
| 1332 | }/* for pcfi */
|
---|
| 1333 | DosBeep(5000, 50);
|
---|
| 1334 | thisPtr->wpFreeMem(memPtrSave);
|
---|
| 1335 | }
|
---|
| 1336 | thisPtr->wpFreeMem(memFieldPtrSave);
|
---|
| 1337 | }
|
---|
| 1338 | }/* somIsA */
|
---|
| 1339 | }/* somIsObj */
|
---|
| 1340 | }
|
---|
| 1341 | /* Get next container item of our folder */
|
---|
| 1342 | mrc=(PMINIRECORDCORE)WinSendMsg(hwndContainer,CM_QUERYRECORD,mrc,
|
---|
| 1343 | MPFROM2SHORT(CMA_NEXT,CMA_ITEMORDER));
|
---|
| 1344 | };/* mrc */
|
---|
| 1345 |
|
---|
| 1346 |
|
---|
| 1347 | WinSendMsg(hwndContainer,CM_INVALIDATERECORD, NULL,
|
---|
| 1348 | MPFROM2SHORT(0, CMA_TEXTCHANGED));
|
---|
| 1349 | DosBeep(500,300);
|
---|
| 1350 |
|
---|
| 1351 | #if 0
|
---|
| 1352 | sprintf(chrCommand, "a: %d: Title: %s ptr: %lx *ptr: %lx ,*bPtr: %lx, offset: %x cb: %x",
|
---|
| 1353 | a, pcfi->pTitleData, ptr, *ptr, *ptrMrc , pfi->offStruct, mrc->cb
|
---|
| 1354 | );
|
---|
| 1355 | WinMessageBox(HWND_DESKTOP, HWND_DESKTOP, chrCommand, "", 1234, MB_OK|MB_MOVEABLE);
|
---|
| 1356 |
|
---|
| 1357 | if(a==6) {
|
---|
| 1358 | sprintf(chrCommand,
|
---|
| 1359 | "a: %d: Title: %s ptr: %lx *ptr: %lx ,*bPtr: %lx, %s offset: %x flData: %x %x",
|
---|
| 1360 | a, pcfi->pTitleData, ptr, *ptr, *ptrMrc , *ptr, pfi->offStruct
|
---|
| 1361 | ,pfi->flData ,mrc->cb);
|
---|
| 1362 | //WinMessageBox(HWND_DESKTOP, HWND_DESKTOP, chrCommand, "6", 1234, MB_OK|MB_MOVEABLE);
|
---|
| 1363 | // *ptrMrc="00:00";
|
---|
| 1364 | /* Make column visible */
|
---|
| 1365 | // pfi->flData |=(CFA_STRING | CFA_FIREADONLY);
|
---|
| 1366 | }/* a */
|
---|
| 1367 | if(a==26) {
|
---|
| 1368 | PSZ* ptr;
|
---|
| 1369 | PSZ* ptrMrc;
|
---|
| 1370 |
|
---|
| 1371 | DosBeep(500, 20);
|
---|
| 1372 | bPtr=(BYTE*) mrc;
|
---|
| 1373 | bPtr+=pfi->offStruct;
|
---|
| 1374 | ptr=(PSZ*)memPtr;
|
---|
| 1375 | ptrMrc=(PSZ*)bPtr;
|
---|
| 1376 | *ptrMrc=*ptr;
|
---|
| 1377 | *ptrMrc="00:00";
|
---|
| 1378 | }/* a */
|
---|
| 1379 | #endif
|
---|
| 1380 | #if 0
|
---|
| 1381 | /* Get first selected container item of our folder */
|
---|
| 1382 | mrc=(PMINIRECORDCORE)WinSendMsg(hwndContainer,CM_QUERYRECORDEMPHASIS, MPFROMSHORT(CMA_FIRST),
|
---|
| 1383 | MPFROMSHORT(CRA_SELECTED));
|
---|
| 1384 | if(mrc) {
|
---|
| 1385 | wpObject=(WPObject*)OBJECT_FROM_PREC(mrc);//Get object
|
---|
| 1386 | if(somIsObj(wpObject)) {
|
---|
| 1387 | DosBeep(5000,300);
|
---|
| 1388 | for(pView=wpObject->wpFindViewItem( 0xFFFFFFFF, NULL );pView;
|
---|
| 1389 | pView=NULLHANDLE/*wpObject->wpFindViewItem( 0xFFFFFFFF, pView )*/)
|
---|
| 1390 | {
|
---|
| 1391 |
|
---|
| 1392 | }
|
---|
| 1393 | DosBeep(500,300);
|
---|
| 1394 | }
|
---|
| 1395 | }
|
---|
| 1396 | #endif
|
---|
| 1397 | break;
|
---|
| 1398 | #endif
|
---|
| 1399 | }
|
---|
| 1400 | default:
|
---|
| 1401 | break;
|
---|
| 1402 | }
|
---|
| 1403 | }
|
---|
| 1404 | return (MRESULT) TRUE;
|
---|
| 1405 | default:
|
---|
| 1406 | break;
|
---|
| 1407 | }
|
---|
| 1408 | return WinDefDlgProc(hwnd, msg, mp1, mp2);
|
---|
| 1409 | }
|
---|
| 1410 |
|
---|
| 1411 |
|
---|
| 1412 | MRESULT EXPENTRY leftCtrlDialogProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
|
---|
| 1413 | {
|
---|
| 1414 | CWMediaFolder *thisPtr;
|
---|
| 1415 |
|
---|
| 1416 | char name[CCHMAXPATH];
|
---|
| 1417 | ULONG ulNameSize;
|
---|
| 1418 | SIZEL sizel;
|
---|
| 1419 | ULONG ulFlags;
|
---|
| 1420 | HWND hwndTemp;
|
---|
| 1421 | POINTL ptl;
|
---|
| 1422 | SHORT a,b;
|
---|
| 1423 | HOBJECT hObject;
|
---|
| 1424 | static PMINIRECORDCORE pmrcInserted=NULL;
|
---|
| 1425 |
|
---|
| 1426 | switch(msg)
|
---|
| 1427 | {
|
---|
| 1428 | case WM_INITDLG :
|
---|
| 1429 | WinSetWindowULong(hwnd,QWL_USER,(ULONG)PVOIDFROMMP(mp2));//Save object ptr.
|
---|
| 1430 | thisPtr=(CWMediaFolder*) PVOIDFROMMP(mp2);
|
---|
| 1431 | if(somIsObj(thisPtr)) {
|
---|
| 1432 | WinSendMsg( WinWindowFromID(hwnd, IDSL_VOLUME),
|
---|
| 1433 | SLM_SETSLIDERINFO,
|
---|
| 1434 | MPFROM2SHORT(SMA_SLIDERARMPOSITION,SMA_INCREMENTVALUE),
|
---|
| 1435 | MPFROMLONG( thisPtr->ulVolume));
|
---|
| 1436 | }
|
---|
| 1437 | /* Set dialog font to WarpSans for Warp 4 and above */
|
---|
| 1438 | if(SysQueryOSRelease()>=40) {
|
---|
| 1439 | WinSetPresParam(hwnd,
|
---|
| 1440 | PP_FONTNAMESIZE,(ULONG)sizeof(DEFAULT_DIALOG_FONT),
|
---|
| 1441 | DEFAULT_DIALOG_FONT );
|
---|
| 1442 | }
|
---|
| 1443 | return (MRESULT)FALSE;
|
---|
| 1444 | case WM_CHAR:
|
---|
| 1445 | // Set focus to container so the key will be processed as usual
|
---|
| 1446 | WinSetFocus(HWND_DESKTOP, WinWindowFromID(WinQueryWindow(hwnd,QW_PARENT),FID_CLIENT));
|
---|
| 1447 | return WinSendMsg(WinWindowFromID(WinQueryWindow(hwnd,QW_PARENT),FID_CLIENT),msg,mp1,mp2);
|
---|
| 1448 |
|
---|
| 1449 | case WM_PAINT:
|
---|
| 1450 | {
|
---|
| 1451 | HPS hps;
|
---|
| 1452 | RECTL rcl, rclSource;
|
---|
| 1453 | POINTL ptl;
|
---|
| 1454 | LONG lTemp;
|
---|
| 1455 |
|
---|
| 1456 | if(allBMPs[CTRLIDX_TOPLEFT].hbm) {
|
---|
| 1457 | hps=WinBeginPaint(hwnd, NULL, &rcl);
|
---|
| 1458 | rclSource.xLeft=0;
|
---|
| 1459 | rclSource.yBottom=0;
|
---|
| 1460 | rclSource.yTop=allBMPs[CTRLIDX_TOPLEFT].bmpInfoHdr.cy;
|
---|
| 1461 | rclSource.xRight=allBMPs[CTRLIDX_TOPLEFT].bmpInfoHdr.cx;
|
---|
| 1462 | lTemp=rcl.xLeft/rclSource.xRight;
|
---|
| 1463 | ptl.x=lTemp*rclSource.xRight;
|
---|
| 1464 | lTemp=rcl.yBottom/rclSource.yTop;
|
---|
| 1465 | lTemp*=rclSource.yTop;
|
---|
| 1466 | //WinFillRect(hps, &rcl, CLR_RED);
|
---|
| 1467 | while(ptl.x<rcl.xRight) {
|
---|
| 1468 | ptl.y=lTemp;
|
---|
| 1469 | while(ptl.y<rcl.yTop) {/* y direction */
|
---|
| 1470 | //DosBeep(5000,100);
|
---|
| 1471 | WinDrawBitmap(hps, allBMPs[CTRLIDX_TOPLEFT].hbm,
|
---|
| 1472 | &rclSource,
|
---|
| 1473 | (PPOINTL)&ptl,
|
---|
| 1474 | 0, 0,
|
---|
| 1475 | DBM_IMAGEATTRS);
|
---|
| 1476 | ptl.y+=allBMPs[CTRLIDX_TOPLEFT].bmpInfoHdr.cy;
|
---|
| 1477 | //DosSleep(200);
|
---|
| 1478 | };
|
---|
| 1479 | ptl.x+=allBMPs[CTRLIDX_TOPLEFT].bmpInfoHdr.cx;
|
---|
| 1480 | };
|
---|
| 1481 | WinEndPaint(hps);
|
---|
| 1482 | return (MRESULT)0;
|
---|
| 1483 | }
|
---|
| 1484 | break;
|
---|
| 1485 | }
|
---|
| 1486 | case WM_CONTROL:
|
---|
| 1487 | switch(SHORT1FROMMP(mp1))
|
---|
| 1488 | {
|
---|
| 1489 | return (MRESULT)0;
|
---|
| 1490 | default:
|
---|
| 1491 | break;
|
---|
| 1492 | }
|
---|
| 1493 | break;
|
---|
| 1494 | case WM_COMMAND:
|
---|
| 1495 | thisPtr=(CWMediaFolder*) WinQueryWindowULong(hwnd,QWL_USER);
|
---|
| 1496 | if(somIsObj(thisPtr)){
|
---|
| 1497 | switch(SHORT1FROMMP(mp1))
|
---|
| 1498 | {
|
---|
| 1499 | case IDPB_ADD:
|
---|
| 1500 | {
|
---|
| 1501 | HWND hwndContainer;
|
---|
| 1502 | HWND hwndInsert;
|
---|
| 1503 | PMINIRECORDCORE mrc;
|
---|
| 1504 |
|
---|
| 1505 | WPObject *wpObject;
|
---|
| 1506 |
|
---|
| 1507 | hwndContainer=WinWindowFromID(WinQueryWindow(hwnd,QW_PARENT), FID_CLIENT);
|
---|
| 1508 | /* Get first selected container item of our folder */
|
---|
| 1509 | mrc=(PMINIRECORDCORE)WinSendMsg(hwndContainer,CM_QUERYRECORDEMPHASIS, MPFROMSHORT(CMA_FIRST),
|
---|
| 1510 | MPFROMSHORT(CRA_SELECTED));
|
---|
| 1511 | if(mrc)
|
---|
| 1512 | {
|
---|
| 1513 | DosBeep(5000, 500);
|
---|
| 1514 | wpObject=(WPObject*)OBJECT_FROM_PREC(mrc);//Get object
|
---|
| 1515 | if(somIsObj(wpObject)) {
|
---|
| 1516 | POINTL ptl= {40,40};
|
---|
| 1517 |
|
---|
| 1518 | DosBeep(500, 500);
|
---|
| 1519 | hwndInsert=WinWindowFromID(hwnd, IDCNR_PLAYLIST);
|
---|
| 1520 | if(!pmrcInserted)
|
---|
| 1521 | DosBeep(5000, 500);
|
---|
| 1522 | pmrcInserted=wpObject->wpCnrInsertObject(hwndInsert, &ptl,NULL, NULL );
|
---|
| 1523 | }
|
---|
| 1524 | }
|
---|
| 1525 | break;
|
---|
| 1526 | }
|
---|
| 1527 | case IDPB_REMOVE:
|
---|
| 1528 | {
|
---|
| 1529 | HWND hwndInserted;
|
---|
| 1530 | WPObject *wpObject;
|
---|
| 1531 |
|
---|
| 1532 | hwndInserted=WinWindowFromID(hwnd, IDCNR_PLAYLIST);
|
---|
| 1533 | if(pmrcInserted) {
|
---|
| 1534 | DosBeep(5000, 500);
|
---|
| 1535 | wpObject=(WPObject*)OBJECT_FROM_PREC(pmrcInserted);//Get object
|
---|
| 1536 | if(wpObject->wpCnrRemoveObject(hwndInserted))
|
---|
| 1537 | pmrcInserted=NULL;
|
---|
| 1538 | }
|
---|
| 1539 | break;
|
---|
| 1540 | }
|
---|
| 1541 | default:
|
---|
| 1542 | break;
|
---|
| 1543 | }
|
---|
| 1544 | }
|
---|
| 1545 | return (MRESULT) TRUE;
|
---|
| 1546 | default:
|
---|
| 1547 | break;
|
---|
| 1548 | }
|
---|
| 1549 | return WinDefDlgProc(hwnd, msg, mp1, mp2);
|
---|
| 1550 | }
|
---|
| 1551 |
|
---|
| 1552 | ULONG modulo(ULONG start,ULONG* delta, ULONG max)
|
---|
| 1553 | {
|
---|
| 1554 | while(start>max) {/* Probably slow for small bitmaps and wide screens. Anyone volunteering to write better code? */
|
---|
| 1555 | start-=max;
|
---|
| 1556 | };
|
---|
| 1557 | *delta=max-start;
|
---|
| 1558 | return start;
|
---|
| 1559 | }
|
---|
| 1560 |
|
---|
| 1561 | /****************************************************************************/
|
---|
| 1562 | /* */
|
---|
| 1563 | /* This procedure handles the frame extension of the folder on the right */
|
---|
| 1564 | /* */
|
---|
| 1565 | /****************************************************************************/
|
---|
| 1566 | MRESULT EXPENTRY rightCtrlDialogProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
|
---|
| 1567 | {
|
---|
| 1568 | CWMediaFolder *thisPtr;
|
---|
| 1569 |
|
---|
| 1570 | switch(msg)
|
---|
| 1571 | {
|
---|
| 1572 | case WM_INITDLG :
|
---|
| 1573 | WinSetWindowULong(hwnd,QWL_USER,(ULONG)PVOIDFROMMP(mp2));//Save object ptr.
|
---|
| 1574 | thisPtr=(CWMediaFolder*) PVOIDFROMMP(mp2);
|
---|
| 1575 | if(somIsObj(thisPtr)) {
|
---|
| 1576 | WinSendMsg( WinWindowFromID(hwnd, IDSL_VOLUME),
|
---|
| 1577 | SLM_SETSLIDERINFO,
|
---|
| 1578 | MPFROM2SHORT(SMA_SLIDERARMPOSITION,SMA_INCREMENTVALUE),
|
---|
| 1579 | MPFROMLONG( thisPtr->ulVolume));
|
---|
| 1580 | }
|
---|
| 1581 | /* Set dialog font to WarpSans for Warp 4 and above */
|
---|
| 1582 | if(SysQueryOSRelease()>=40) {
|
---|
| 1583 | WinSetPresParam(hwnd,
|
---|
| 1584 | PP_FONTNAMESIZE,(ULONG)sizeof(DEFAULT_DIALOG_FONT),
|
---|
| 1585 | DEFAULT_DIALOG_FONT );
|
---|
| 1586 | }
|
---|
| 1587 |
|
---|
| 1588 | return (MRESULT)FALSE;
|
---|
| 1589 | case WM_CHAR:
|
---|
| 1590 | // Set focus to container so the key will be processed as usual
|
---|
| 1591 | WinSetFocus(HWND_DESKTOP, WinWindowFromID(WinQueryWindow(hwnd,QW_PARENT),FID_CLIENT));
|
---|
| 1592 | return WinSendMsg(WinWindowFromID(WinQueryWindow(hwnd,QW_PARENT),FID_CLIENT),msg,mp1,mp2);
|
---|
| 1593 | case WM_PAINT:
|
---|
| 1594 | {
|
---|
| 1595 | HPS hps;
|
---|
| 1596 | RECTL rcl, rclSource;
|
---|
| 1597 | POINTL ptl;
|
---|
| 1598 | LONG lTemp;
|
---|
| 1599 |
|
---|
| 1600 | if(allBMPs[CTRLIDX_TOPRIGHT].hbm) {
|
---|
| 1601 | hps=WinBeginPaint(hwnd, NULL, &rcl);
|
---|
| 1602 | rclSource.xLeft=0;
|
---|
| 1603 | rclSource.yBottom=0;
|
---|
| 1604 | rclSource.yTop=allBMPs[CTRLIDX_TOPRIGHT].bmpInfoHdr.cy;
|
---|
| 1605 | rclSource.xRight=allBMPs[CTRLIDX_TOPRIGHT].bmpInfoHdr.cx;
|
---|
| 1606 | lTemp=rcl.xLeft/rclSource.xRight;
|
---|
| 1607 | ptl.x=lTemp*rclSource.xRight;
|
---|
| 1608 | lTemp=rcl.yBottom/rclSource.yTop;
|
---|
| 1609 | lTemp*=rclSource.yTop;
|
---|
| 1610 | //WinFillRect(hps, &rcl, CLR_RED);
|
---|
| 1611 | while(ptl.x<rcl.xRight) {
|
---|
| 1612 | ptl.y=lTemp;
|
---|
| 1613 | while(ptl.y<rcl.yTop) {/* y direction */
|
---|
| 1614 | //DosBeep(5000,100);
|
---|
| 1615 | WinDrawBitmap(hps, allBMPs[CTRLIDX_TOPRIGHT].hbm,
|
---|
| 1616 | &rclSource,
|
---|
| 1617 | (PPOINTL)&ptl,
|
---|
| 1618 | 0, 0,
|
---|
| 1619 | DBM_IMAGEATTRS);
|
---|
| 1620 | ptl.y+=allBMPs[CTRLIDX_TOPRIGHT].bmpInfoHdr.cy;
|
---|
| 1621 | //DosSleep(200);
|
---|
| 1622 | };
|
---|
| 1623 | ptl.x+=allBMPs[CTRLIDX_TOPRIGHT].bmpInfoHdr.cx;
|
---|
| 1624 | };
|
---|
| 1625 | WinEndPaint(hps);
|
---|
| 1626 | return (MRESULT)0;
|
---|
| 1627 | }
|
---|
| 1628 | break;
|
---|
| 1629 | }
|
---|
| 1630 | case WM_CONTROL:
|
---|
| 1631 | switch(SHORT1FROMMP(mp1))
|
---|
| 1632 | {
|
---|
| 1633 |
|
---|
| 1634 | return (MRESULT)0;
|
---|
| 1635 | default:
|
---|
| 1636 | break;
|
---|
| 1637 | }
|
---|
| 1638 | break;
|
---|
| 1639 | case WM_COMMAND:
|
---|
| 1640 | thisPtr=(CWMediaFolder*) WinQueryWindowULong(hwnd,QWL_USER);
|
---|
| 1641 | if(somIsObj(thisPtr)){
|
---|
| 1642 | switch(SHORT1FROMMP(mp1))
|
---|
| 1643 | {
|
---|
| 1644 | default:
|
---|
| 1645 | break;
|
---|
| 1646 | }
|
---|
| 1647 | }
|
---|
| 1648 | return (MRESULT) TRUE;
|
---|
| 1649 | default:
|
---|
| 1650 | break;
|
---|
| 1651 | }
|
---|
| 1652 | return WinDefDlgProc(hwnd, msg, mp1, mp2);
|
---|
| 1653 | }
|
---|
| 1654 |
|
---|
| 1655 | /****************************************************************************/
|
---|
| 1656 | /* */
|
---|
| 1657 | /* This procedure is used to position the controls on the bottom frame ctrl */
|
---|
| 1658 | /* when the folder is sized or a new item is added to the launchpad. */
|
---|
| 1659 | /* */
|
---|
| 1660 | /****************************************************************************/
|
---|
| 1661 | static void _setBottomCtrlClientsPos(HWND hwnd)
|
---|
| 1662 | {
|
---|
| 1663 | HWND hwndClient;
|
---|
| 1664 | SWP swp, swp2;
|
---|
| 1665 |
|
---|
| 1666 | WinQueryWindowPos(hwnd, &swp2);
|
---|
| 1667 | hwndClient=WinWindowFromID(hwnd, 1234);
|
---|
| 1668 | WinQueryWindowPos(hwndClient,&swp);
|
---|
| 1669 | WinSetWindowPos(hwndClient,NULLHANDLE, 20, 0,0,0,SWP_MOVE);
|
---|
| 1670 |
|
---|
| 1671 | hwndClient=WinWindowFromID(hwnd, IDST_STATUSTEXT);
|
---|
| 1672 | WinSetWindowPos(hwndClient,NULLHANDLE, swp.cx+20+20, 0, swp2.cx-4,
|
---|
| 1673 | swp2.cy-2, SWP_MOVE|SWP_SIZE|SWP_SHOW);
|
---|
| 1674 | }
|
---|
| 1675 |
|
---|
| 1676 | /****************************************************************************/
|
---|
| 1677 | /* */
|
---|
| 1678 | /* This procedure handles the frame extension of the folder at the bottom */
|
---|
| 1679 | /* */
|
---|
| 1680 | /****************************************************************************/
|
---|
| 1681 | MRESULT EXPENTRY bottomCtrlDialogProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
|
---|
| 1682 | {
|
---|
| 1683 | CWMediaFolder *thisPtr;
|
---|
| 1684 |
|
---|
| 1685 | switch(msg)
|
---|
| 1686 | {
|
---|
| 1687 | case WM_INITDLG :
|
---|
| 1688 | {
|
---|
| 1689 | WinSetWindowULong(hwnd,QWL_USER,(ULONG)PVOIDFROMMP(mp2));//Save object ptr.
|
---|
| 1690 | thisPtr=(CWMediaFolder*) PVOIDFROMMP(mp2);
|
---|
| 1691 | /* Set dialog font to WarpSans for Warp 4 and above */
|
---|
| 1692 | if(SysQueryOSRelease()>=40) {
|
---|
| 1693 | WinSetPresParam(hwnd,
|
---|
| 1694 | PP_FONTNAMESIZE,(ULONG)sizeof(DEFAULT_DIALOG_FONT),
|
---|
| 1695 | DEFAULT_DIALOG_FONT );
|
---|
| 1696 | }
|
---|
| 1697 | oldStaticTextProc=WinSubclassWindow(WinWindowFromID(hwnd, IDST_STATUSTEXT), staticTextProc);
|
---|
| 1698 |
|
---|
| 1699 | /* Build launchpad control */
|
---|
| 1700 | if(somIsObj(thisPtr)) {
|
---|
| 1701 | SWP swp, swp2;
|
---|
| 1702 | char text[200];
|
---|
| 1703 | thisPtr->lPad=new launchPad(hwnd, hwnd, TRUE, (WPFolder*) PVOIDFROMMP(mp2), &lplAllLPads, NULLHANDLE, 0);
|
---|
| 1704 | WinQueryWindowPos(hwnd,&swp);
|
---|
| 1705 | if(thisPtr->lPad) {
|
---|
| 1706 | thisPtr->lPad->lpSetConfiguration(chrInstallDir, MEDIAFLDR_TBID);
|
---|
| 1707 | thisPtr->lPad->lpSetLaunchPadPos(NULLHANDLE, 20, 0,
|
---|
| 1708 | 30 , swp.cy-2, SWP_SIZE | SWP_MOVE);
|
---|
| 1709 | thisPtr->lPad->lpFillPad();
|
---|
| 1710 | if(!getMessage(text, IDSTR_LAUNCHPADFLYOVER, sizeof(text), queryResModuleHandle(), hwnd))
|
---|
| 1711 | strncpy(text, "Launchpad: Drop objects here", sizeof(text));
|
---|
| 1712 | text[sizeof(text)-1]=0;
|
---|
| 1713 | thisPtr->lPad->lpSetFlyOverText(text);
|
---|
| 1714 | }
|
---|
| 1715 | }
|
---|
[3] | 1716 | /*
|
---|
| 1717 | FIXME:
|
---|
| 1718 | Start timer which triggers time calculation. The timer is rather long so the objects may
|
---|
| 1719 | awake first. This is not yet bullet proof, because if there're a lot of objects in the folder
|
---|
| 1720 | the time will be too short. */
|
---|
| 1721 | WinStartTimer(WinQueryAnchorBlock(hwnd),hwnd, IDTIMER_STATUS, 5000);
|
---|
[2] | 1722 | return (MRESULT)FALSE;
|
---|
| 1723 | }
|
---|
| 1724 | case WM_TIMER:
|
---|
| 1725 | if(SHORT1FROMMP(mp1)==IDTIMER_STATUS) {
|
---|
| 1726 | thisPtr=(CWMediaFolder*) WinQueryWindowULong(hwnd,QWL_USER);
|
---|
| 1727 | if(somIsObj(thisPtr)){
|
---|
| 1728 | THREADPARAMS* pTp;
|
---|
| 1729 | ULONG ulErr;
|
---|
| 1730 | SWP swp;
|
---|
| 1731 | char text[100];
|
---|
| 1732 |
|
---|
| 1733 | _setBottomCtrlClientsPos(hwnd);
|
---|
| 1734 | getMessage(text, IDSTR_STATUSCOLLECTING, sizeof(text), queryResModuleHandle(),hwnd);
|
---|
| 1735 | WinSetWindowText(WinWindowFromID(hwnd, IDST_STATUSTEXT), text);
|
---|
| 1736 | if(!(thisPtr->wpQueryFldrFlags() & FOI_POPULATEDWITHALL)) {
|
---|
| 1737 | WinStartTimer(WinQueryAnchorBlock(hwnd),hwnd, IDTIMER_STATUS, 300);
|
---|
| 1738 | return MRFALSE;
|
---|
| 1739 | }
|
---|
| 1740 | pTp=(THREADPARAMS*)thisPtr->wpAllocMem(sizeof(THREADPARAMS), &ulErr);
|
---|
| 1741 | pTp->thisPtr=thisPtr;
|
---|
| 1742 | pTp->hwndFrame=WinQueryWindow(hwnd, QW_PARENT);
|
---|
| 1743 | _beginthread(openThreadFunc,NULL,8192*16,(void*)pTp); //Fehlerbehandlung fehlt
|
---|
| 1744 | };
|
---|
| 1745 | WinStopTimer(WinQueryAnchorBlock(hwnd), hwnd, IDTIMER_STATUS);
|
---|
| 1746 | return MRFALSE;
|
---|
| 1747 | }
|
---|
| 1748 | break;
|
---|
| 1749 | case WM_CHAR:
|
---|
| 1750 | // Set focus to container so the key will be processed as usual
|
---|
| 1751 | WinSetFocus(HWND_DESKTOP, WinWindowFromID(WinQueryWindow(hwnd,QW_PARENT),FID_CLIENT));
|
---|
| 1752 | return WinSendMsg(WinWindowFromID(WinQueryWindow(hwnd,QW_PARENT),FID_CLIENT),msg,mp1,mp2);
|
---|
| 1753 | case WM_CALCVALIDRECTS:
|
---|
| 1754 | {
|
---|
| 1755 | if(WinIsWindowVisible(hwnd))
|
---|
| 1756 | return handleCalcValidRects(hwnd, msg, mp1, mp2);
|
---|
| 1757 | break;
|
---|
| 1758 | }
|
---|
| 1759 | case WM_WINDOWPOSCHANGED:
|
---|
| 1760 | {
|
---|
| 1761 | /* Move the clients of the framecontrol so they keep their distance to the left */
|
---|
| 1762 | PSWP pswp=(PSWP)mp1;
|
---|
| 1763 | if((pswp->fl & SWP_SIZE)&&!(pswp->fl & SWP_SHOW)) {
|
---|
| 1764 | PSWP pswpOld;
|
---|
| 1765 | ULONG ulStyle;
|
---|
| 1766 |
|
---|
| 1767 | pswpOld=pswp;
|
---|
| 1768 | pswpOld++;
|
---|
| 1769 |
|
---|
| 1770 | if(!(ulStyle & WS_MINIMIZED) && !(ulStyle & WS_MAXIMIZED) ) {
|
---|
| 1771 | HWND hwndClient;
|
---|
| 1772 | SWP swp, swp2;
|
---|
| 1773 |
|
---|
| 1774 | hwndClient=WinWindowFromID(hwnd, 1234);
|
---|
| 1775 | WinQueryWindowPos(hwndClient,&swp);
|
---|
| 1776 | WinSetWindowPos(hwndClient,NULLHANDLE, 20, 0,0,0,SWP_MOVE);
|
---|
| 1777 |
|
---|
| 1778 | hwndClient=WinWindowFromID(hwnd, IDST_STATUSTEXT);
|
---|
| 1779 | WinSetWindowPos(hwndClient,NULLHANDLE, swp.cx+20+20, 0, pswp->cx-4-20-swp.cx,
|
---|
| 1780 | pswp->cy-2, SWP_MOVE|SWP_SIZE);
|
---|
| 1781 | }
|
---|
| 1782 | }
|
---|
| 1783 | break;
|
---|
| 1784 | }
|
---|
| 1785 | case WM_APPTERMINATENOTIFY:
|
---|
| 1786 | if(SHORT1FROMMP(mp1)==NOTIFY_STARTSTATUSTIMER)
|
---|
| 1787 | {
|
---|
| 1788 | WinStartTimer(WinQueryAnchorBlock(hwnd),hwnd, IDTIMER_STATUS, 300);
|
---|
| 1789 | return MRFALSE;
|
---|
| 1790 | }
|
---|
| 1791 | break;
|
---|
| 1792 | case WM_PAINT:
|
---|
| 1793 | {
|
---|
| 1794 | HPS hps;
|
---|
| 1795 | RECTL rcl, rclSource;
|
---|
| 1796 | POINTL ptl;
|
---|
| 1797 | LONG lTemp;
|
---|
| 1798 |
|
---|
| 1799 | if(allBMPs[CTRLIDX_BOTTOM].hbm) {
|
---|
| 1800 | hps=WinBeginPaint(hwnd, NULL, &rcl);
|
---|
| 1801 | rclSource.xLeft=0;
|
---|
| 1802 | rclSource.yBottom=0;
|
---|
| 1803 | rclSource.yTop=allBMPs[CTRLIDX_BOTTOM].bmpInfoHdr.cy;
|
---|
| 1804 | rclSource.xRight=allBMPs[CTRLIDX_BOTTOM].bmpInfoHdr.cx;
|
---|
| 1805 | lTemp=rcl.xLeft/rclSource.xRight;
|
---|
| 1806 | ptl.x=lTemp*rclSource.xRight;
|
---|
| 1807 | lTemp=rcl.yBottom/rclSource.yTop;
|
---|
| 1808 | lTemp*=rclSource.yTop;
|
---|
| 1809 | while(ptl.x<rcl.xRight) {
|
---|
| 1810 | ptl.y=lTemp;
|
---|
| 1811 | while(ptl.y<rcl.yTop) {/* y direction */
|
---|
| 1812 | WinDrawBitmap(hps, allBMPs[CTRLIDX_BOTTOM].hbm,
|
---|
| 1813 | &rclSource,
|
---|
| 1814 | (PPOINTL)&ptl,
|
---|
| 1815 | 0, 0,
|
---|
| 1816 | DBM_IMAGEATTRS);
|
---|
| 1817 | ptl.y+=allBMPs[CTRLIDX_BOTTOM].bmpInfoHdr.cy;
|
---|
| 1818 | };
|
---|
| 1819 | ptl.x+=allBMPs[CTRLIDX_BOTTOM].bmpInfoHdr.cx;
|
---|
| 1820 | };
|
---|
| 1821 | WinEndPaint(hps);
|
---|
| 1822 | return (MRESULT)0;
|
---|
| 1823 | }
|
---|
| 1824 | break;
|
---|
| 1825 | }
|
---|
| 1826 | default:
|
---|
| 1827 | break;
|
---|
| 1828 | }
|
---|
| 1829 | return WinDefDlgProc(hwnd, msg, mp1, mp2);
|
---|
| 1830 | }
|
---|
| 1831 |
|
---|
| 1832 | /*************************************************************/
|
---|
| 1833 | /* This dialog procedure handles the toolbar page */
|
---|
| 1834 | /*************************************************************/
|
---|
| 1835 | MRESULT EXPENTRY settingsToolbarOptionDlgProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2) {
|
---|
| 1836 | HINI hini;
|
---|
| 1837 | HOBJECT hObject;
|
---|
| 1838 | ULONG attrFound;
|
---|
| 1839 | ULONG len;
|
---|
| 1840 | char text[250];
|
---|
| 1841 | char title[250];
|
---|
| 1842 | CWMediaFolder* thisPtr;
|
---|
| 1843 |
|
---|
| 1844 | switch(msg) {
|
---|
| 1845 | #if 0
|
---|
| 1846 | case WM_INITDLG :
|
---|
| 1847 | WinSetWindowULong(hwnd,QWL_USER,LONGFROMMP(mp2));
|
---|
| 1848 | thisPtr=(CWMediaFolder*)LONGFROMMP(mp2);
|
---|
| 1849 | /* We have to initialize the dialog controls with the approbiate values */
|
---|
| 1850 |
|
---|
| 1851 | if(somIsObj(thisPtr)) {
|
---|
| 1852 | // Set the focus on the demo area
|
---|
| 1853 | WinSetFocus(HWND_DESKTOP, WinWindowFromID(hwnd, IDST_TEXTDEMOFIELD));
|
---|
| 1854 |
|
---|
| 1855 | // Set the background colour of the demo area
|
---|
| 1856 | WinSetPresParam(WinWindowFromID(hwnd, IDST_TEXTDEMOFIELD),
|
---|
| 1857 | PP_BACKGROUNDCOLOR,(ULONG)sizeof(RGB), &(thisPtr->rgbTBFlyBackground) );
|
---|
| 1858 | // Set the foreground colour of the demo area
|
---|
| 1859 | WinSetPresParam(WinWindowFromID(hwnd, IDST_TEXTDEMOFIELD),
|
---|
| 1860 | PP_FOREGROUNDCOLOR,(ULONG)sizeof(RGB), &(thisPtr->rgbTBFlyForeground) );
|
---|
| 1861 |
|
---|
| 1862 | // Set the font of the demo area
|
---|
| 1863 | WinSetPresParam(WinWindowFromID(hwnd, IDST_TEXTDEMOFIELD),
|
---|
| 1864 | PP_FONTNAMESIZE,(ULONG)sizeof(thisPtr->chrTBFlyFontName),
|
---|
| 1865 | thisPtr->chrTBFlyFontName );
|
---|
| 1866 |
|
---|
| 1867 | if(thisPtr->bTBFlyOverEnabled) {
|
---|
| 1868 | WinCheckButton(hwnd, IDCB_ENABLETBFLYOVER, 1);
|
---|
| 1869 | WinEnableWindow(WinWindowFromID(hwnd, IDSB_TBFLYOVERDELAY),TRUE);
|
---|
| 1870 | }
|
---|
| 1871 | else {
|
---|
| 1872 | WinCheckButton(hwnd, IDCB_ENABLETBFLYOVER, 0);
|
---|
| 1873 | WinEnableWindow(WinWindowFromID(hwnd, IDSB_TBFLYOVERDELAY),FALSE);
|
---|
| 1874 | }
|
---|
| 1875 |
|
---|
| 1876 | // Set the linits for the delay spin button
|
---|
| 1877 | WinSendMsg(WinWindowFromID(hwnd, IDSB_TBFLYOVERDELAY),
|
---|
| 1878 | SPBM_SETLIMITS,(MPARAM)MAXDELAY,(MPARAM)0);
|
---|
| 1879 | // Set the current value for delay
|
---|
| 1880 | WinSendMsg(WinWindowFromID(hwnd, IDSB_TBFLYOVERDELAY),
|
---|
| 1881 | SPBM_SETCURRENTVALUE,
|
---|
| 1882 | (MPARAM)thisPtr->iTBFlyOverDelay,
|
---|
| 1883 | (MPARAM)NULL);
|
---|
| 1884 | }
|
---|
| 1885 | /* Move default buttons on Warp 4 */
|
---|
| 1886 | cwMoveNotebookButtonsWarp4(hwnd, IDPB_COLORHELP, 20);
|
---|
| 1887 | WinSetWindowULong(WinQueryWindow(hwnd, QW_PARENT), QWL_HWNDFOCUSSAVE, hwnd);
|
---|
| 1888 | return (MRESULT) TRUE;
|
---|
| 1889 | case WM_DESTROY:
|
---|
| 1890 | WinSetFocus(WinQueryWindow(hwnd, QW_PARENT), TRUE);
|
---|
| 1891 | thisPtr=(CWMediaFolder*) WinQueryWindowULong(hwnd , QWL_USER);
|
---|
| 1892 | if(somIsObj(thisPtr)){
|
---|
| 1893 |
|
---|
| 1894 | /* The notebook closes and gets destroyed */
|
---|
| 1895 | // Query the current background colour
|
---|
| 1896 | len=WinQueryPresParam(WinWindowFromID(hwnd, IDST_TEXTDEMOFIELD),
|
---|
| 1897 | PP_BACKGROUNDCOLOR,0,&attrFound,sizeof(thisPtr->rgbTBFlyBackground),
|
---|
| 1898 | &(thisPtr->rgbTBFlyBackground),QPF_NOINHERIT);
|
---|
| 1899 | // Query the current font
|
---|
| 1900 | len=WinQueryPresParam(WinWindowFromID(hwnd, IDST_TEXTDEMOFIELD),
|
---|
| 1901 | PP_FONTNAMESIZE,0,&attrFound,sizeof(thisPtr->chrTBFlyFontName),
|
---|
| 1902 | thisPtr->chrTBFlyFontName,QPF_NOINHERIT);
|
---|
| 1903 | // Query the current foreground colour
|
---|
| 1904 | len=WinQueryPresParam(WinWindowFromID(hwnd, IDST_TEXTDEMOFIELD),
|
---|
| 1905 | PP_FOREGROUNDCOLOR,0,&attrFound,sizeof(thisPtr->rgbTBFlyForeground),
|
---|
| 1906 | &(thisPtr->rgbTBFlyForeground),QPF_NOINHERIT);
|
---|
| 1907 | // Query the enable state
|
---|
| 1908 | if(WinQueryButtonCheckstate(hwnd,IDCB_ENABLETBFLYOVER) & 1)
|
---|
| 1909 | thisPtr->bTBFlyOverEnabled=1;
|
---|
| 1910 | else
|
---|
| 1911 | thisPtr->bTBFlyOverEnabled=0;
|
---|
| 1912 |
|
---|
| 1913 | // Query delay value
|
---|
| 1914 | WinSendMsg(WinWindowFromID(hwnd, IDSB_TBFLYOVERDELAY),
|
---|
| 1915 | SPBM_QUERYVALUE,(MPARAM)&(thisPtr->iTBFlyOverDelay),
|
---|
| 1916 | MPFROM2SHORT(0,SPBQ_ALWAYSUPDATE));
|
---|
| 1917 |
|
---|
| 1918 | // Save data
|
---|
| 1919 | thisPtr->wpSaveImmediate();
|
---|
| 1920 | }
|
---|
| 1921 | break;
|
---|
| 1922 | #if 0
|
---|
| 1923 | case WM_CONTROL:
|
---|
| 1924 | /* The window controls send WM_CONTROL messages */
|
---|
| 1925 | switch(SHORT1FROMMP(mp1))
|
---|
| 1926 | {
|
---|
| 1927 | case IDCB_ENABLETBFLYOVER:
|
---|
| 1928 | if(WinQueryButtonCheckstate(hwnd,IDCB_ENABLETBFLYOVER) & 1)
|
---|
| 1929 | WinEnableWindow(WinWindowFromID(hwnd, IDSB_TBFLYOVERDELAY),1);
|
---|
| 1930 | else
|
---|
| 1931 | WinEnableWindow(WinWindowFromID(hwnd, IDSB_TBFLYOVERDELAY),0);
|
---|
| 1932 | break;
|
---|
| 1933 | default:
|
---|
| 1934 | break;
|
---|
| 1935 | } // end switch(SHORT1FROMMP(mp1))
|
---|
| 1936 | return (MRESULT)0;
|
---|
| 1937 | break;
|
---|
| 1938 | #endif
|
---|
| 1939 | case WM_COMMAND :
|
---|
| 1940 | switch (SHORT1FROMMP(mp1)) {
|
---|
| 1941 | // Process commands here //
|
---|
| 1942 | case IDPB_COLORUNDO:
|
---|
| 1943 | thisPtr=(CWMediaFolder*) WinQueryWindowULong(hwnd , QWL_USER);
|
---|
| 1944 | if(somIsObj(thisPtr)){
|
---|
| 1945 | /* The undo button was clicked */
|
---|
| 1946 | // Set the background colour of the demo area
|
---|
| 1947 | WinSetPresParam(WinWindowFromID(hwnd, IDST_TEXTDEMOFIELD),
|
---|
| 1948 | PP_BACKGROUNDCOLOR,(ULONG)sizeof(thisPtr->rgbTBFlyBackground), &(thisPtr->rgbTBFlyBackground) );
|
---|
| 1949 | // Set the foreground colour of the demo area
|
---|
| 1950 | WinSetPresParam(WinWindowFromID(hwnd, IDST_TEXTDEMOFIELD),
|
---|
| 1951 | PP_FOREGROUNDCOLOR,(ULONG)sizeof(thisPtr->rgbTBFlyForeground), &(thisPtr->rgbTBFlyForeground) );
|
---|
| 1952 |
|
---|
| 1953 | // Set the font of the demo area
|
---|
| 1954 | WinSetPresParam(WinWindowFromID(hwnd, IDST_TEXTDEMOFIELD),
|
---|
| 1955 | PP_FONTNAMESIZE,(ULONG)sizeof(thisPtr->chrTBFlyFontName),
|
---|
| 1956 | thisPtr->chrTBFlyFontName );
|
---|
| 1957 |
|
---|
| 1958 | if(thisPtr->bTBFlyOverEnabled) {
|
---|
| 1959 | WinCheckButton(hwnd, IDCB_ENABLETBFLYOVER, 1);
|
---|
| 1960 | WinEnableWindow(WinWindowFromID(hwnd, IDSB_TBFLYOVERDELAY),TRUE);
|
---|
| 1961 | }
|
---|
| 1962 | else {
|
---|
| 1963 | WinCheckButton(hwnd, IDCB_ENABLETBFLYOVER, 0);
|
---|
| 1964 | WinEnableWindow(WinWindowFromID(hwnd, IDSB_TBFLYOVERDELAY),FALSE);
|
---|
| 1965 | }
|
---|
| 1966 |
|
---|
| 1967 | // Set the current value for delay
|
---|
| 1968 | WinSendMsg(WinWindowFromID(hwnd, IDSB_TBFLYOVERDELAY),
|
---|
| 1969 | SPBM_SETCURRENTVALUE,
|
---|
| 1970 | (MPARAM)thisPtr->iTBFlyOverDelay,
|
---|
| 1971 | (MPARAM)NULL);
|
---|
| 1972 | }
|
---|
| 1973 | break;
|
---|
| 1974 | case IDPB_COLORSTANDARD:
|
---|
| 1975 | thisPtr=(CWMediaFolder*) WinQueryWindowULong(hwnd , QWL_USER);
|
---|
| 1976 | if(somIsObj(thisPtr)){
|
---|
| 1977 | /* The default button was clicked */
|
---|
| 1978 | thisPtr->rgbTBFlyBackground.bBlue=180; // Set the default colours
|
---|
| 1979 | thisPtr->rgbTBFlyBackground.bGreen=255;
|
---|
| 1980 | thisPtr->rgbTBFlyBackground.bRed=255;
|
---|
| 1981 | thisPtr->rgbTBFlyForeground.bBlue=0;
|
---|
| 1982 | thisPtr->rgbTBFlyForeground.bGreen=0;
|
---|
| 1983 | thisPtr->rgbTBFlyForeground.bRed=0;
|
---|
| 1984 | // Set the default font
|
---|
| 1985 | if(cwQueryOSRelease()>=40)
|
---|
| 1986 | strcpy((thisPtr->chrTBFlyFontName), DEFAULT_DIALOG_FONT);
|
---|
| 1987 | else
|
---|
| 1988 | strcpy((thisPtr->chrTBFlyFontName), DEFAULT_DIALOG_FONT_WARP3);
|
---|
| 1989 |
|
---|
| 1990 | // Set the background colour of the demo area
|
---|
| 1991 | WinSetPresParam(WinWindowFromID(hwnd, IDST_TEXTDEMOFIELD),
|
---|
| 1992 | PP_BACKGROUNDCOLOR,(ULONG)sizeof(RGB), &thisPtr->rgbTBFlyBackground );
|
---|
| 1993 | // Set the foreground colour of the demo area
|
---|
| 1994 | WinSetPresParam(WinWindowFromID(hwnd, IDST_TEXTDEMOFIELD),
|
---|
| 1995 | PP_FOREGROUNDCOLOR,(ULONG)sizeof(RGB), &thisPtr->rgbTBFlyForeground );
|
---|
| 1996 | // Set the font of the demo area
|
---|
| 1997 | WinSetPresParam(WinWindowFromID(hwnd, IDST_TEXTDEMOFIELD),
|
---|
| 1998 | PP_FONTNAMESIZE,(ULONG)sizeof(thisPtr->chrTBFlyFontName),
|
---|
| 1999 | thisPtr->chrTBFlyFontName );
|
---|
| 2000 |
|
---|
| 2001 | WinCheckButton(hwnd, IDCB_ENABLETBFLYOVER, 1);
|
---|
| 2002 | WinEnableWindow(WinWindowFromID(hwnd, IDSB_TBFLYOVERDELAY),TRUE);
|
---|
| 2003 |
|
---|
| 2004 | // Set the value for delay
|
---|
| 2005 | WinSendMsg(WinWindowFromID(hwnd, IDSB_TBFLYOVERDELAY),
|
---|
| 2006 | SPBM_SETCURRENTVALUE,
|
---|
| 2007 | (MPARAM)DEFAULTDELAY,
|
---|
| 2008 | (MPARAM)NULL);
|
---|
| 2009 | }
|
---|
| 2010 | break;
|
---|
| 2011 | case IDPB_COLORPALETTE:
|
---|
| 2012 | /* Colour... button was clicked */
|
---|
| 2013 | // Open the colorpalette
|
---|
| 2014 | if((hObject=WinQueryObject("<WP_HIRESCLRPAL>"))!=NULL) {
|
---|
| 2015 | WinOpenObject(hObject,OPEN_DEFAULT,TRUE);
|
---|
| 2016 | }
|
---|
| 2017 | else {//Error, can't open the palette
|
---|
| 2018 | /* Show an error msg. */
|
---|
| 2019 | /*
|
---|
| 2020 | Text: "Can't open the color palette. It may have lost it's ID. Check your INI files."
|
---|
| 2021 | Title: "CD-Creator settings"
|
---|
| 2022 | */
|
---|
| 2023 | messageBox( text, IDSTRS_NOCOLORPALETTE , sizeof(text),
|
---|
| 2024 | title, IDSTRS_MEDIAFLDRSETTINGS , sizeof(title),
|
---|
| 2025 | queryResModuleHandle(), hwnd, MB_OK | MB_ICONEXCLAMATION | MB_MOVEABLE);
|
---|
| 2026 |
|
---|
| 2027 | }
|
---|
| 2028 | break;
|
---|
| 2029 | case IDPB_FONTPALETTE:
|
---|
| 2030 | /* Font... button was clicked */
|
---|
| 2031 | // Open the fontpalette
|
---|
| 2032 | if((hObject=WinQueryObject("<WP_FNTPAL>"))!=NULL) {
|
---|
| 2033 | WinOpenObject(hObject,OPEN_DEFAULT,TRUE);
|
---|
| 2034 | }
|
---|
| 2035 | else {//Error, can't open the palette
|
---|
| 2036 | /* Show an error msg. */
|
---|
| 2037 | /*
|
---|
| 2038 | Text: "Can't open the font palette. It may have lost it's ID. Check your INI files."
|
---|
| 2039 | Title: "CD-Creator settings"
|
---|
| 2040 | */
|
---|
| 2041 | messageBox( text, IDSTRS_NOFONTPALETTE , sizeof(text),
|
---|
| 2042 | title, IDSTRS_MEDIAFLDRSETTINGS , sizeof(title),
|
---|
| 2043 | queryResModuleHandle(), hwnd, MB_OK | MB_ICONEXCLAMATION | MB_MOVEABLE);
|
---|
| 2044 | }
|
---|
| 2045 | break;
|
---|
| 2046 | default:
|
---|
| 2047 | break;
|
---|
| 2048 | }
|
---|
| 2049 | /* Don't call WinDefDlgProc here, or the dialog gets closed */
|
---|
| 2050 | return (MRESULT) TRUE;
|
---|
| 2051 | #endif
|
---|
| 2052 | default:
|
---|
| 2053 | break;
|
---|
| 2054 | }
|
---|
| 2055 | // The WinDefDlgProc() handles the rest of the messages
|
---|
| 2056 | return WinDefDlgProc(hwnd, msg, mp1, mp2);
|
---|
| 2057 | }
|
---|
| 2058 |
|
---|
| 2059 |
|
---|
| 2060 | MRESULT EXPENTRY shadowProc(HWND hwnd, ULONG msg,MPARAM mp1,MPARAM mp2 )
|
---|
| 2061 | {
|
---|
| 2062 | switch (msg)
|
---|
| 2063 | {
|
---|
| 2064 | case WM_PAINT:
|
---|
| 2065 | {
|
---|
| 2066 | HPS hps;
|
---|
| 2067 | HPS hpsMem;
|
---|
| 2068 | BITMAPINFOHEADER2 bmpIH2;
|
---|
| 2069 | PBITMAPINFO2 pbmp2;
|
---|
| 2070 | char * chrBuff;
|
---|
| 2071 | PBYTE ptr;
|
---|
| 2072 | HDC hdcMem;
|
---|
| 2073 | HBITMAP hbm;
|
---|
| 2074 | ULONG ulCx, ulCy;
|
---|
| 2075 | SWP swp;
|
---|
| 2076 |
|
---|
| 2077 | hps=WinBeginPaint(hwnd, NULLHANDLE, NULLHANDLE/*&rectl*/);
|
---|
| 2078 |
|
---|
| 2079 | GpiCreateLogColorTable(hps, 0, LCOLF_RGB, 0, 0, NULL);
|
---|
| 2080 | WinQueryWindowPos(hwnd, &swp);
|
---|
| 2081 |
|
---|
| 2082 | ulCx=swp.cx;
|
---|
| 2083 | ulCy=swp.cy;
|
---|
| 2084 |
|
---|
| 2085 | bmpIH2.cbFix=sizeof(BITMAPINFOHEADER2);
|
---|
| 2086 | bmpIH2.cx=ulCx;
|
---|
| 2087 | bmpIH2.cy=ulCy;
|
---|
| 2088 | bmpIH2.cPlanes=1;
|
---|
| 2089 | bmpIH2.cBitCount=8;
|
---|
| 2090 | bmpIH2.cbImage=(((ulCx*(1<<bmpIH2.cPlanes)*(1<<bmpIH2.cBitCount))+31)/32)*bmpIH2.cy;
|
---|
| 2091 |
|
---|
| 2092 | chrBuff=(char*)malloc(bmpIH2.cbImage+sizeof(BITMAPINFO2)+256*sizeof(RGB2));
|
---|
| 2093 | pbmp2=(PBITMAPINFO2)chrBuff;
|
---|
| 2094 | memset(pbmp2, 0, sizeof(BITMAPINFO2)+256*sizeof(RGB2));
|
---|
| 2095 | ptr=chrBuff+sizeof(BITMAPINFO2)+256*sizeof(RGB2);
|
---|
| 2096 |
|
---|
| 2097 | pbmp2->cbFix=sizeof(BITMAPINFO2);
|
---|
| 2098 | pbmp2->cx=ulCx;
|
---|
| 2099 | pbmp2->cy=ulCy;
|
---|
| 2100 | pbmp2->cPlanes=1;
|
---|
| 2101 | pbmp2->cBitCount=8;
|
---|
| 2102 | pbmp2->cbImage=((pbmp2->cx+31)/32)*pbmp2->cy;
|
---|
| 2103 | pbmp2->ulCompression=BCA_UNCOMP;
|
---|
| 2104 | pbmp2->ulColorEncoding=BCE_RGB;
|
---|
| 2105 |
|
---|
| 2106 | hdcMem=DevOpenDC(WinQueryAnchorBlock(hwnd),OD_MEMORY,"*", 0L/*4L*/, (PDEVOPENDATA)NULLHANDLE/*pszData*/, NULLHANDLE);
|
---|
| 2107 | if(hdcMem) {
|
---|
| 2108 | SIZEL sizel= {0,0};
|
---|
| 2109 |
|
---|
| 2110 | hpsMem=GpiCreatePS(WinQueryAnchorBlock(hwnd), hdcMem, &sizel, PU_PELS|GPIT_MICRO|GPIA_ASSOC);
|
---|
| 2111 | if(hpsMem)
|
---|
| 2112 | {
|
---|
| 2113 | hbm=GpiCreateBitmap(hpsMem, &bmpIH2, FALSE, NULL, pbmp2);
|
---|
| 2114 | if(hbm) {
|
---|
| 2115 | HPS hpsDesktop;
|
---|
| 2116 | POINTL ptl[3]={0};
|
---|
| 2117 | RGB2 *prgb2;
|
---|
| 2118 | int a, r,g,b;
|
---|
| 2119 |
|
---|
| 2120 | hpsDesktop=WinGetScreenPS(HWND_DESKTOP);
|
---|
| 2121 | GpiSetBitmap(hpsMem, hbm);
|
---|
| 2122 |
|
---|
| 2123 | ptl[0].x=0;
|
---|
| 2124 | ptl[0].y=0;
|
---|
| 2125 | ptl[1].x=0+ulCx;
|
---|
| 2126 | ptl[1].y=0+ulCy;
|
---|
| 2127 |
|
---|
| 2128 | ptl[2].x=swp.x;
|
---|
| 2129 | ptl[2].y=swp.y;
|
---|
| 2130 |
|
---|
| 2131 | if(GpiBitBlt(hpsMem, hpsDesktop, 3, ptl , ROP_SRCCOPY, BBO_IGNORE)==GPI_ERROR)
|
---|
| 2132 | {
|
---|
| 2133 | }
|
---|
| 2134 |
|
---|
| 2135 | WinReleasePS(hpsDesktop);
|
---|
| 2136 |
|
---|
| 2137 | if(GpiQueryBitmapBits(hpsMem, 0, ulCy, ptr, pbmp2)==GPI_ALTERROR)
|
---|
| 2138 | {
|
---|
| 2139 | // DosBeep(500,300);
|
---|
| 2140 | }
|
---|
| 2141 |
|
---|
| 2142 | prgb2=(RGB2*)(++pbmp2);
|
---|
| 2143 | for(a=0;a<256; a++, prgb2++) {
|
---|
| 2144 | r=-50;
|
---|
| 2145 | g=-50;
|
---|
| 2146 | b=-50;
|
---|
| 2147 |
|
---|
| 2148 | b+=prgb2->bBlue;
|
---|
| 2149 | g+=prgb2->bGreen;
|
---|
| 2150 | r+=prgb2->bRed;
|
---|
| 2151 | if(r>255)
|
---|
| 2152 | r=255;
|
---|
| 2153 | if(r<0)
|
---|
| 2154 | r=0;
|
---|
| 2155 | prgb2->bRed=r;
|
---|
| 2156 |
|
---|
| 2157 | if(g>255)
|
---|
| 2158 | g=255;
|
---|
| 2159 | if(g<0)
|
---|
| 2160 | g=0;
|
---|
| 2161 | prgb2->bGreen=g;
|
---|
| 2162 |
|
---|
| 2163 | if(b>255)
|
---|
| 2164 | b=255;
|
---|
| 2165 | if(b<0)
|
---|
| 2166 | b=0;
|
---|
| 2167 | prgb2->bBlue=b;
|
---|
| 2168 | }
|
---|
| 2169 |
|
---|
| 2170 | if(GpiSetBitmapBits(hpsMem, 0, ulCy, ptr, --pbmp2)!=GPI_ALTERROR)
|
---|
| 2171 | {
|
---|
| 2172 | ptl[0].x=0;
|
---|
| 2173 | ptl[0].y=0;
|
---|
| 2174 | ptl[1].x=ulCx;
|
---|
| 2175 | ptl[1].y=ulCy;
|
---|
| 2176 | ptl[2].x=0;
|
---|
| 2177 | ptl[2].y=0;
|
---|
| 2178 |
|
---|
| 2179 | GpiBitBlt(hps, hpsMem, 3, ptl , ROP_SRCCOPY, BBO_IGNORE);
|
---|
| 2180 | }
|
---|
| 2181 | GpiSetBitmap(hpsMem, NULLHANDLE);
|
---|
| 2182 | GpiDeleteBitmap(hbm);
|
---|
| 2183 | }/* hbm */
|
---|
| 2184 | GpiDestroyPS(hpsMem);
|
---|
| 2185 | }/* hpsMem */
|
---|
| 2186 | DevCloseDC(hdcMem);
|
---|
| 2187 | }/* if(hdcMem) */
|
---|
| 2188 | WinEndPaint(hps);
|
---|
| 2189 | free(chrBuff);
|
---|
| 2190 | return MRFALSE;
|
---|
| 2191 | }
|
---|
| 2192 | default:
|
---|
| 2193 | break;
|
---|
| 2194 | }
|
---|
| 2195 | return (*oldProc)(hwnd,msg,mp1,mp2);
|
---|
| 2196 | }
|
---|
| 2197 |
|
---|
| 2198 |
|
---|
| 2199 | /*****************************************************************************/
|
---|
| 2200 | /* New button procedure with fly over help */
|
---|
| 2201 | /*****************************************************************************/
|
---|
| 2202 | MRESULT EXPENTRY newButtonProc(HWND hwnd, ULONG msg,MPARAM mp1,MPARAM mp2 )
|
---|
| 2203 | {
|
---|
| 2204 | static BOOL bBubbleOn=TRUE;
|
---|
| 2205 | POINTL ptl;
|
---|
| 2206 | HPS hps;
|
---|
| 2207 | FONTMETRICS fm;
|
---|
| 2208 | LONG ulWinTextLen;
|
---|
| 2209 | POINTL aptlPoints[TXTBOX_COUNT];
|
---|
| 2210 | RECTL rcl;
|
---|
| 2211 | LONG deltaX,deltaY;
|
---|
| 2212 | RGB rgb= {200,200,0};
|
---|
| 2213 | static USHORT id=0;//Initialisation new in V1.00a
|
---|
| 2214 | RECTL rclWork;
|
---|
| 2215 | HWND hwndStore;
|
---|
| 2216 | WPObject * wpObject;
|
---|
| 2217 |
|
---|
| 2218 | switch (msg)
|
---|
| 2219 | {
|
---|
| 2220 | case WM_DESTROY:
|
---|
| 2221 | WinStopTimer(WinQueryAnchorBlock(hwnd),hwnd,1);//Stop timer if running
|
---|
| 2222 | if(hwndBubbleWindow) WinDestroyWindow(hwndBubbleWindow);/* close the bubblewindow */
|
---|
| 2223 | hwndBubbleWindow=0;
|
---|
| 2224 | /* Stop delay timer if running */
|
---|
| 2225 | WinStopTimer(WinQueryAnchorBlock(hwnd),hwnd,WinQueryWindowUShort(hwnd,QWS_ID));
|
---|
| 2226 | break;
|
---|
| 2227 | case WM_NEWBUBBLE:
|
---|
| 2228 | ULONG bubbleEnabled;
|
---|
| 2229 | HWND hwndStore;
|
---|
| 2230 | /* we have to build a new information window */
|
---|
| 2231 | if(hwndBubbleWindow){// if(){...} new in V1.00a
|
---|
| 2232 | WinDestroyWindow(hwndBubbleWindow);/* close the bubblewindow */
|
---|
| 2233 | hwndBubbleWindow=NULL;
|
---|
| 2234 | }
|
---|
| 2235 | // Query the pointer position
|
---|
| 2236 | WinQueryPointerPos(HWND_DESKTOP,&ptl);
|
---|
| 2237 | WinMapWindowPoints(HWND_DESKTOP,hwnd,&ptl,1);
|
---|
| 2238 | WinQueryWindowRect(hwnd,&rclWork);
|
---|
| 2239 | if(!hwndBubbleWindow
|
---|
| 2240 | && WinPtInRect(WinQueryAnchorBlock(hwnd),&rclWork,&ptl)
|
---|
| 2241 | && bTBFlyOverEnabled) {
|
---|
| 2242 |
|
---|
| 2243 | static HWND hwndBubbleClient;
|
---|
| 2244 | ULONG style=FCF_BORDER|FCF_NOBYTEALIGN;
|
---|
| 2245 | char winText[255];
|
---|
| 2246 |
|
---|
| 2247 | /* Get window text (It's the object title) for size calculating */
|
---|
| 2248 | WinQueryWindowText(hwnd,sizeof(winText),winText);
|
---|
| 2249 | ulWinTextLen=(LONG)strlen(winText); // Query text length
|
---|
| 2250 |
|
---|
| 2251 | /* Delete 'Returns' in object title */
|
---|
| 2252 | char *pBuchst;
|
---|
| 2253 | char *pRest;
|
---|
| 2254 | pRest=winText;
|
---|
| 2255 | while((pBuchst=strchr(pRest,13))!=NULL) {
|
---|
| 2256 | *pBuchst=' ';
|
---|
| 2257 | pBuchst++;
|
---|
| 2258 | if(*pBuchst==10)
|
---|
| 2259 | *pBuchst=' ';
|
---|
| 2260 | pRest=pBuchst;
|
---|
| 2261 | }
|
---|
| 2262 |
|
---|
| 2263 | /* Create help window */
|
---|
| 2264 | hwndBubbleWindow=WinCreateStdWindow(HWND_DESKTOP,
|
---|
| 2265 | 0,
|
---|
| 2266 | &style,
|
---|
| 2267 | WC_STATIC,
|
---|
| 2268 | "",
|
---|
| 2269 | SS_TEXT|DT_CENTER|DT_VCENTER,
|
---|
| 2270 | NULLHANDLE,
|
---|
| 2271 | 400,
|
---|
| 2272 | &hwndBubbleClient);
|
---|
| 2273 | hwndShadow=WinCreateWindow(HWND_DESKTOP,
|
---|
| 2274 | WC_STATIC,
|
---|
| 2275 | "",
|
---|
| 2276 | SS_TEXT|DT_CENTER|DT_VCENTER,
|
---|
| 2277 | 0, 0,
|
---|
| 2278 | 0, 0,
|
---|
| 2279 | hwndBubbleWindow,
|
---|
| 2280 | hwndBubbleWindow,
|
---|
| 2281 | 401,
|
---|
| 2282 | NULLHANDLE,
|
---|
| 2283 | NULLHANDLE);
|
---|
| 2284 | oldProc=WinSubclassWindow(hwndShadow, shadowProc);
|
---|
| 2285 |
|
---|
| 2286 | // Set the font for the help
|
---|
| 2287 | WinSetPresParam(hwndBubbleClient,PP_FONTNAMESIZE,
|
---|
| 2288 | sizeof(chrTBFlyFontName),
|
---|
| 2289 | chrTBFlyFontName);
|
---|
| 2290 | /* Calculate text size in pixel */
|
---|
| 2291 | hps=WinBeginPaint(hwndBubbleClient,(HPS)NULL,(PRECTL)NULL);
|
---|
| 2292 | GpiQueryTextBox(hps,ulWinTextLen,winText,TXTBOX_COUNT,aptlPoints);
|
---|
| 2293 | WinEndPaint(hps);
|
---|
| 2294 |
|
---|
| 2295 | /* Set colors */
|
---|
| 2296 | WinSetPresParam(hwndBubbleClient,
|
---|
| 2297 | PP_BACKGROUNDCOLOR,sizeof(rgbTBFlyBackground) ,
|
---|
| 2298 | &rgbTBFlyBackground );
|
---|
| 2299 | WinSetPresParam(hwndBubbleClient,
|
---|
| 2300 | PP_FOREGROUNDCOLOR,sizeof(rgbTBFlyForeground) ,
|
---|
| 2301 | &rgbTBFlyForeground );
|
---|
| 2302 |
|
---|
| 2303 | /* Calculate bubble positon and show bubble */
|
---|
| 2304 | WinQueryPointerPos(HWND_DESKTOP,&ptl);//Query pointer position in the desktop window
|
---|
| 2305 | WinQueryWindowRect(HWND_DESKTOP,&rcl);//Query desktop size
|
---|
| 2306 | aptlPoints[TXTBOX_BOTTOMRIGHT].x-aptlPoints[TXTBOX_BOTTOMLEFT].x+7+xVal+ptl.x
|
---|
| 2307 | > rcl.xRight
|
---|
| 2308 | ? deltaX=-aptlPoints[TXTBOX_BOTTOMRIGHT].x-aptlPoints[TXTBOX_BOTTOMLEFT].x-xVal-xVal-7
|
---|
| 2309 | : deltaX=0 ;
|
---|
| 2310 |
|
---|
| 2311 | aptlPoints[TXTBOX_TOPLEFT].y-aptlPoints[TXTBOX_BOTTOMLEFT].y+2+yVal+ptl.y
|
---|
| 2312 | > rcl.yTop
|
---|
| 2313 | ? deltaY=-aptlPoints[TXTBOX_TOPLEFT].y-aptlPoints[TXTBOX_BOTTOMLEFT].y-2*yVal-7
|
---|
| 2314 | : deltaY=0 ;
|
---|
| 2315 | WinSetWindowPos(hwndBubbleWindow,
|
---|
| 2316 | HWND_TOP,
|
---|
| 2317 | ptl.x+xVal+deltaX,ptl.y+yVal+deltaY,
|
---|
| 2318 | aptlPoints[TXTBOX_BOTTOMRIGHT].x-aptlPoints[TXTBOX_BOTTOMLEFT].x+8,
|
---|
| 2319 | aptlPoints[TXTBOX_TOPLEFT].y-aptlPoints[TXTBOX_BOTTOMLEFT].y+2,
|
---|
| 2320 | SWP_ZORDER|SWP_SIZE|SWP_MOVE|SWP_SHOW);
|
---|
| 2321 |
|
---|
| 2322 | WinSetWindowPos(hwndShadow,
|
---|
| 2323 | hwndBubbleWindow,
|
---|
| 2324 | ptl.x+xVal+deltaX+5
|
---|
| 2325 | ,ptl.y+yVal+deltaY-5,
|
---|
| 2326 | aptlPoints[TXTBOX_BOTTOMRIGHT].x-aptlPoints[TXTBOX_BOTTOMLEFT].x+8,
|
---|
| 2327 | aptlPoints[TXTBOX_TOPLEFT].y-aptlPoints[TXTBOX_BOTTOMLEFT].y+2,
|
---|
| 2328 | SWP_ZORDER|SWP_SIZE|SWP_MOVE|SWP_SHOW);
|
---|
| 2329 |
|
---|
| 2330 | /* Set bubble text */
|
---|
| 2331 | WinSetWindowText(hwndBubbleClient,winText);
|
---|
| 2332 | WinStartTimer(WinQueryAnchorBlock(hwnd),hwnd,1,35);
|
---|
| 2333 | } // end if(!hwndBubbleWindow)
|
---|
| 2334 | break;
|
---|
| 2335 | case WM_MOUSEMOVE:
|
---|
| 2336 | USHORT tempID;
|
---|
| 2337 | ULONG delayValue;
|
---|
| 2338 | delayValue=250;
|
---|
| 2339 |
|
---|
| 2340 | tempID=WinQueryWindowUShort(hwnd,QWS_ID);/* get the id of the window under the pointer */
|
---|
| 2341 | if(id!=tempID) { // New Button?
|
---|
| 2342 | WinStartTimer(WinQueryAnchorBlock(hwnd),hwnd,tempID,(ULONG)iTBFlyOverDelay); // New timer for delay
|
---|
| 2343 | id=tempID; // Save ID
|
---|
| 2344 | }
|
---|
| 2345 | else {
|
---|
| 2346 | if(!hwndBubbleWindow)WinStartTimer(WinQueryAnchorBlock(hwnd),hwnd,tempID,(ULONG)iTBFlyOverDelay); // New timer for delay
|
---|
| 2347 | }
|
---|
| 2348 | break;
|
---|
| 2349 | case WM_TIMER:
|
---|
| 2350 | switch (SHORT1FROMMP(mp1))
|
---|
| 2351 | {
|
---|
| 2352 | case 1: //Intervall timer
|
---|
| 2353 | /* Test pointer position */
|
---|
| 2354 | WinQueryPointerPos(HWND_DESKTOP,&ptl);
|
---|
| 2355 | WinMapWindowPoints(HWND_DESKTOP,hwnd,&ptl,1);
|
---|
| 2356 | WinQueryWindowRect(hwnd,&rclWork);
|
---|
| 2357 | if(!WinPtInRect(WinQueryAnchorBlock(hwnd),&rclWork,&ptl))
|
---|
| 2358 | { // Button has changed
|
---|
| 2359 | WinStopTimer(WinQueryAnchorBlock(hwnd),hwnd,1); // stop the running timer
|
---|
| 2360 | if(hwndBubbleWindow) WinDestroyWindow(hwndBubbleWindow);/* close the bubblewindow */
|
---|
| 2361 | hwndBubbleWindow=0;
|
---|
| 2362 | id=0;
|
---|
| 2363 | }
|
---|
| 2364 | break;
|
---|
| 2365 | default:// delay over
|
---|
| 2366 | if (SHORT1FROMMP(mp1)==WinQueryWindowUShort(hwnd,QWS_ID)) {//our own timer. It has got the window id
|
---|
| 2367 | WinStopTimer(WinQueryAnchorBlock(hwnd),hwnd,SHORT1FROMMP(mp1));//Stop the delay timer
|
---|
| 2368 | /* Check the pointer position */
|
---|
| 2369 | WinQueryPointerPos(HWND_DESKTOP,&ptl);
|
---|
| 2370 | WinMapWindowPoints(HWND_DESKTOP,hwnd,&ptl,1);
|
---|
| 2371 | WinQueryWindowRect(hwnd,&rclWork);
|
---|
| 2372 | if(WinPtInRect(WinQueryAnchorBlock(hwnd),&rclWork,&ptl))
|
---|
| 2373 | WinPostMsg(hwnd,WM_NEWBUBBLE,NULL,NULL);//Request a help window
|
---|
| 2374 | return (MRESULT)FALSE;
|
---|
| 2375 | }
|
---|
| 2376 | break;
|
---|
| 2377 | }
|
---|
| 2378 | break;
|
---|
| 2379 |
|
---|
| 2380 | }
|
---|
| 2381 | // call the original button procedure to handle the rest of the messages
|
---|
| 2382 | return (*oldButtonProc2)(hwnd,msg,mp1,mp2);
|
---|
| 2383 | };
|
---|
| 2384 |
|
---|