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