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