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