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