static void internal_SetPageFont(HWND hwnd) { char *pchTemp; // Set new window fonts! if (DosRequestMutexSem(hmtxUseNLSTextArray, SEM_INDEFINITE_WAIT)==NO_ERROR) { pchTemp = apchNLSText[SSMODULE_NLSTEXT_FONTTOUSE]; if (pchTemp) { HWND hwndChild; HENUM henum; // Oookay, we have the font, set the page and all controls inside it! WinSetPresParam(hwnd, PP_FONTNAMESIZE, strlen(pchTemp)+1, pchTemp); // Now go through all of its children, and set it there, too! henum = WinBeginEnumWindows(hwnd); while ((hwndChild = WinGetNextWindow(henum))!=NULLHANDLE) { WinSetPresParam(hwndChild, PP_FONTNAMESIZE, strlen(pchTemp)+1, pchTemp); } WinEndEnumWindows(henum); } DosReleaseMutexSem(hmtxUseNLSTextArray); } }
OWindow& OWindow::setPresentation(pPresParms presentation) { pparms.Fore = presentation->Fore; pparms.Back = presentation->Back; WinSetPresParam(hwnd, PP_FOREGROUNDCOLOR, sizeof(COLOR), &pparms.Fore); WinSetPresParam(hwnd, PP_BACKGROUNDCOLOR, sizeof(COLOR), &pparms.Back); setFont(presentation->Font); return(*this); }
void main (void) { QMSG qmsg; HMQ hmq; HWND hwndClient; ULONG flFrameFlags; WinInitialize(0); hmq = WinCreateMsgQueue(hab, 0); /* get access to shared memory */ DosGetNamedSharedMem((PVOID*)&memptr, MEM_NAME, PAG_READ); if (!memptr) WinMessageBox(HWND_DESKTOP, HWND_DESKTOP, " FreeType/2 is not running!", "Error", 0, MB_OK | MB_ERROR); else { meminfo = memptr->address; if (meminfo->signature != 0x46524545) WinMessageBox(HWND_DESKTOP, HWND_DESKTOP, " FreeType/2 is not running!", "Error", 0, MB_OK | MB_ERROR); else { flFrameFlags = FCF_TITLEBAR | FCF_SYSMENU | FCF_TASKLIST ; WinRegisterClass(hab, "MyClass", (PFNWP) ClientWndProc, CS_SIZEREDRAW, 0); hwndFrame = WinCreateStdWindow(HWND_DESKTOP, WS_VISIBLE, &flFrameFlags, "MyClass", "FreeType/2 Heap Usage", 0, (HMODULE) NULL, 0, &hwndClient); WinSetVisibleRegionNotify(hwndClient, TRUE); /* make titlebar text look better */ WinSetPresParam(WinWindowFromID(hwndFrame, FID_TITLEBAR), PP_FONTNAMESIZE, 9, (PVOID)"8.Helv"); WinSetWindowPos(hwndFrame, NULLHANDLE, 0, 0, 350, 42, SWP_MOVE | SWP_SIZE | SWP_SHOW); while (WinGetMsg(hab, &qmsg, (HWND) NULL, 0, 0)) WinDispatchMsg(hab, &qmsg); WinSetVisibleRegionNotify(hwndClient, FALSE); } } /* free shared memory block */ DosFreeMem(memptr); WinDestroyWindow(hwndFrame); WinDestroyMsgQueue(hmq); WinTerminate(hab); }
OWindow& OWindow::setBackColor(COLOR color) { pparms.Back = color; WinSetPresParam(hwnd, PP_BACKGROUNDCOLOR, sizeof(COLOR), &pparms.Back); WinUpdateWindow(hwnd); return(*this); }
OWindow& OWindow::setFont(PSZ fontnamesize) { strcpy(pparms.Font, fontnamesize); WinSetPresParam(hwnd, PP_FONTNAMESIZE, strlen(pparms.Font)+1, pparms.Font); WinUpdateWindow(hwnd); return(*this); }
/*-------------------------------------------------- * Sets a new font to be used by the window *--------------------------------------------------*/ PMWindow& PMWindow::set_font( const char* font ) { static int have_warpsans = -1; const char* used_font = font; if( strcmp( font, "9.WarpSans" ) == 0 ) { if( have_warpsans == -1 ) { LONG rc; LONG fonts = 0; HPS hps; hps = WinGetPS( HWND_DESKTOP ); rc = GpiQueryFonts( hps, QF_PUBLIC, "WarpSans", &fonts, 0, NULL ); WinReleasePS( hps ); have_warpsans = ( rc > 0 && rc != GPI_ALTERROR ); } if( !have_warpsans ) { used_font = "8.Helv"; } } if( !WinSetPresParam( win_handle, PP_FONTNAMESIZE, strlen(used_font)+1, (PVOID)used_font )) PM_THROW_GUIERROR(); return *this; }
void FontSelectDialog( HWND hwndWnd ) { /* * Bring up the font selection dialog; display only FIXED-pitch fonts! * Save the client window handle in the ulUser field. */ fdFontDlg.hpsScreen = WinGetPS( hwndWnd ); fdFontDlg.cbSize = sizeof( FONTDLG ); fdFontDlg.pszFamilyname = achFamily; fdFontDlg.usFamilyBufLen = sizeof( achFamily ); fdFontDlg.clrFore = CLR_BLACK; fdFontDlg.pszPreview = "AaBb"; fdFontDlg.fl = FNTS_CENTER | FNTS_FIXEDWIDTHONLY | FNTS_INITFROMFATTRS | FNTS_HELPBUTTON | FNTS_RESETBUTTON | FNTS_APPLYBUTTON; fdFontDlg.pfnDlgProc = FontDlgProc; fdFontDlg.ulUser = (ULONG)hwndWnd; WinFontDlg( HWND_DESKTOP, hwndWnd, (PFONTDLG)&fdFontDlg ); WinReleasePS( fdFontDlg.hpsScreen ); /* * If a font was successfully selected, copy its attributes into achFont and * use that to set the default PM font parameter for the client window. */ if ( fdFontDlg.lReturn == DID_OK ) { sprintf( achFont, "%d.%s", FIXEDINT( fdFontDlg.fxPointSize ), fdFontDlg.fAttrs.szFacename ); WinSetPresParam( hwndWnd, PP_FONTNAMESIZE, strlen( achFont ) + 1, achFont ); GetFontMetrics( hwndWnd, FALSE ); UpdateScreenLimits( hwndWnd, TRUE ); } }
MRESULT EXPENTRY FontDlgProc( HWND hwndDlg, ULONG ulMsg, MPARAM mpParm1, MPARAM mpParm2 ) { HWND hwndWnd; switch ( ulMsg ) { case WM_HELP: DisplayHelpPanel( hwndDlg, IDP_OPTIONS_FONT_DLG ); return (MRESULT)FALSE; case WM_COMMAND: switch ( SHORT1FROMMP( mpParm1 ) ) { case DID_APPLY_BUTTON: hwndWnd = (HWND)fdFontDlg.ulUser; sprintf( achFont, "%d.%s", FIXEDINT( fdFontDlg.fxPointSize ), fdFontDlg.fAttrs.szFacename ); WinSetPresParam( hwndWnd, PP_FONTNAMESIZE, strlen( achFont ) + 1, achFont ); GetFontMetrics( hwndWnd, FALSE ); UpdateScreenLimits( hwndWnd, TRUE ); return (MRESULT)FALSE; default: return WinDefFontDlgProc( hwndDlg, ulMsg, mpParm1, mpParm2 ); } default: return WinDefFontDlgProc( hwndDlg, ulMsg, mpParm1, mpParm2 ); } }
OWindow& OWindow::setForeColor(COLOR color) { pparms.Fore = color; WinSetPresParam(hwnd, PP_FOREGROUNDCOLOR, sizeof(COLOR), &pparms.Fore); WinUpdateWindow(hwnd); return(*this); }
/* WinSetWindowFontMy */ VOID WinSetWindowFontMy(HWND hwnd, PSZ pszFontName) { BOOL brc = FALSE; /* pszFontName format - "10.Helv" "12.Tms Rmn" "14.Tms Rmn" */ brc = WinSetPresParam (hwnd, PP_FONTNAMESIZE, (ULONG)((ULONG)strlen(pszFontName)+(ULONG)1), (PSZ)pszFontName); return; }
MRESULT EXPENTRY ClientWndProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2) { HPS hps; RECTL rcl; static ULONG i = 1; ULONG ulMem; char szBuf[200]; switch (msg) { case WM_CREATE: /* use smaller text */ WinSetPresParam(hwnd, PP_FONTNAMESIZE, 7, (PVOID)"8.Helv"); /* start the timer (ticks each 0.5 sec.) */ AddFloat(WinQueryWindow(hwnd, QW_PARENT)); WinStartTimer(hab, hwnd, ID_TIMER, 500); break; /* make window always stay on top (if desired) */ case WM_VRNENABLED: if (bFloat) WinSetWindowPos(hwndFrame, HWND_TOP, 0, 0, 0, 0, SWP_ZORDER); break; case WM_COMMAND: /* why doesn't WM_SYSCOMMAND work? */ if (LOUSHORT(mp1) == IDM_FLOAT) { bFloat = !bFloat; WinCheckMenuItem(hwndSysSubmenu, IDM_FLOAT, bFloat); } break; case WM_TIMER: if (++i > 13) i = 1; WinInvalidateRect(hwnd, NULL, FALSE); return FALSE; case WM_PAINT: hps = WinBeginPaint(hwnd, NULLHANDLE, &rcl); /* necessary to avoid incorrectly repainting window */ WinQueryWindowRect(hwnd, &rcl); /* sprintf(szBuf, " Current use %dK Maximum ever used %dK Errors %d", meminfo->used / 1024, meminfo->maxused / 1024, meminfo->num_err);*/ sprintf(szBuf, " Current use %dB Maximum ever used %dK Errors %d", meminfo->used, meminfo->maxused / 1024, meminfo->num_err); WinDrawText(hps, -1, szBuf, &rcl, CLR_BLACK, CLR_WHITE, DT_CENTER | DT_VCENTER | DT_ERASERECT); WinEndPaint(hps); break; } return WinDefWindowProc(hwnd, msg, mp1, mp2); }
static void createchild(HWND hwnd, const MSGCHILD *def, USHORT qtd) { int f; HWND h; ICQFRAME *cfg = WinQueryWindowPtr(hwnd,0); ULONG bg = 0x00D1D1D1; DBGMessage("Creating child windows"); cfg->childCount = qtd; cfg->childList = def; for(f=0;f < qtd;f++) { h = WinCreateWindow( hwnd, /* Parent window */ (PSZ) def->wClass, /* Class name */ (PSZ) def->wText, /* Window text */ def->wStyle|WS_VISIBLE, /* Window style */ 0, 0, /* Position (x,y) */ 10,10, /* Size (width,height) */ hwnd, /* Owner window */ HWND_BOTTOM, /* Sibling window */ DLG_ELEMENT_ID+def->id, /* Window id */ NULL, /* Control data */ NULL); /* Pres parameters */ icqskin_setICQHandle(h,cfg->icq); icqskin_setFont(h,def->font); icqskin_setButtonName(h,def->name); #ifdef STANDARD_GUI WinSetPresParam(h,PP_BACKGROUNDCOLOR,sizeof(bg),&bg); WinSetPresParam(h,PP_DISABLEDBACKGROUNDCOLOR,sizeof(bg),&bg); #endif def++; } }
/* Sets the enable state of the entryfield in the dialog template to the enable flag. */ void en_enable( HWND hwnd, SHORT id, BOOL enable ) { ULONG bg_color = enable ? SYSCLR_ENTRYFIELD : SYSCLR_DIALOGBACKGROUND; HWND hcontrol = WinWindowFromID( hwnd, id ); if( hcontrol ) { WinSendMsg( hcontrol, EM_SETREADONLY, MPFROMSHORT( !enable ), 0 ); WinSetPresParam( hcontrol, PP_BACKGROUNDCOLORINDEX, sizeof( bg_color ), &bg_color ); } }
/** * When the page is inserted we'll set the background of the * notebook page. */ VOID kAboutPage::ntfyInserted() { #if 0 /* Arg! This didn't work - still have with space around the page dialog! */ LONG lClr; HWND hwndParent; /* Set page background color */ lClr = SYSCLR_DIALOGBACKGROUND; hwndParent = WinQueryWindow(hwnd, QW_PARENT); WinSetPresParam(hwndParent, PP_BACKGROUNDCOLORINDEX, sizeof(lClr), &lClr); WinSetPresParam(hwndParent, PP_HILITEBACKGROUNDCOLORINDEX, sizeof(lClr), &lClr); #endif }
// Window proc for dialog MRESULT APIENTRY ProgressDlgProc(HWND hWndDlg, ULONG msg, MPARAM mp1, MPARAM mp2) { switch (msg) { case WM_INITDLG: AdjustDialogSize(hWndDlg); WinSetPresParam(hWndDlg, PP_FONTNAMESIZE, strlen(sgInstallGui.szDefinedFont)+1, sgInstallGui.szDefinedFont); WinSendMsg(WinWindowFromID(hWndDlg, IDC_GAUGE_ARCHIVE), SLM_SETSLIDERINFO, MPFROM2SHORT(SMA_SHAFTDIMENSIONS, 0), (MPARAM)20); // DisableSystemMenuItems(hWndDlg, TRUE); CenterWindow(hWndDlg); break; case WM_CLOSE: case WM_COMMAND: return (MRESULT)TRUE; } return WinDefDlgProc(hWndDlg, msg, mp1, mp2); }
VOID PDSGetTemplate(HWND hWnd, ULONG idDlg) { PDLGTEMPLATE pdlgt; /* Dialog Template Pointer */ POINTL aptl[2]; /* Dialog Points Array */ PVOID pvClassName; /* Control Data Pointer */ PVOID pvCtlData; /* Control Data Pointer */ PVOID pvPresParams; /* Presentation Parameters Pointer */ PVOID pvStart; /* Dialog Template Item Pointer */ PVOID pvText; /* Control Data Pointer */ INT cbparam; /* Presentation Parameter Size */ PPARAM pparam; /* Presentation Parameters Pointer */ PPRESPARAMS ppres; /* Presentation Parameters Pointer */ register INT cItems; /* Dialog Items Counter */ register INT i; /* Loop Counter */ /* Try reading in the dialog template for the */ /* dialog ID given */ if ( DosGetResource((HMODULE)NULL, RT_DIALOG, idDlg, (PPVOID)(PVOID)&pdlgt) ) /* Dialog template not found, exit without */ /* creating any controls */ return; /* Convert the memory selector returned into an */ /* addressable pointer to allow the controls to */ /* be decoded */ pvStart = (PVOID)pdlgt; /* Check to see if any presentation parameters */ /* associated with the control. A -1 indicates */ /* that no presentation parameters are */ /* associated. */ if ( pdlgt->adlgti[0].offPresParams != 0xffff ) { ppres = (PPRESPARAMS)((PBYTE)pvStart + pdlgt->adlgti[0].offPresParams); cbparam = (INT)ppres->cb; i = 0; pparam = ppres->aparam; while ( cbparam ) { pparam = (PPARAM)((BYTE *)pparam + i); WinSetPresParam(hWnd, pparam->id, pparam->cb, pparam->ab); cbparam -= (i = (INT)pparam->cb + (INT)sizeof(ULONG) * 2); } } /* Save the number of controls found within the */ /* dialog template */ cItems = pdlgt->adlgti[0].cChildren + 1; /* Read in and translate each of the controls */ for ( i = 1; i < cItems; i++ ) { /* Get the position and size of the control and */ /* convert from dialog units to actual window */ /* co-ordinates */ aptl[0].x = (LONG)pdlgt->adlgti[i].x; aptl[0].y = (LONG)pdlgt->adlgti[i].y; aptl[1].x = (LONG)pdlgt->adlgti[i].cx; aptl[1].y = (LONG)pdlgt->adlgti[i].cy; WinMapDlgPoints(hWnd, aptl, 2UL, TRUE); /* Check to see if a custom class is specified */ /* or if a standard PM control class is being */ /* used */ if ( pdlgt->adlgti[i].cchClassName ) /* Since a length for the class name present, */ /* a custom class name is being used for the */ /* control. Point to the memory location where */ /* the class name is found within the dialog */ /* template information. */ pvClassName = (PVOID)((PBYTE)pvStart + pdlgt->adlgti[i].offClassName); else /* No class name length given indicating that a */ /* standard PM class is being used. The class */ /* name is stored as an index value. For */ /* example, the class for static's is defined as */ /* */ /* #define WC_STATIC ((PSZ)0xffff0005L) */ /* */ /* The values within the dialog template for */ /* the static class would be */ /* */ /* adlgti[i].cchClassName = 0 */ /* adlgti[i].offClassName = 5 */ /* */ /* Therefore, the value of offClassName field */ /* must be used as an index that is used to */ /* actually select the class name. */ switch ( pdlgt->adlgti[i].offClassName ) { /* Control Type: Button */ case WINCLASS_BUTTON : pvClassName = WC_BUTTON; break; /* Control Type: Frame */ case WINCLASS_FRAME : pvClassName = WC_FRAME; break; /* Control Type: Scroll Bar */ case WINCLASS_SCROLLBAR : pvClassName = WC_SCROLLBAR; break; /* Control Type: List Box */ case WINCLASS_LISTBOX : pvClassName = WC_LISTBOX; break; /* Control Type: Edit */ case WINCLASS_ENTRYFIELD : pvClassName = WC_ENTRYFIELD; break; /* Control Type: Static */ case WINCLASS_STATIC : pvClassName = WC_STATIC; break; /* Control Type: Combo Box */ case WINCLASS_COMBOBOX : pvClassName = WC_COMBOBOX; break; /* Control Type: Multi-Line Edit */ case WINCLASS_MLE : pvClassName = WC_MLE; break; /* Control Type: Spin Button [1.3] */ case WINCLASS_SPINBUTTON : pvClassName = WC_SPINBUTTON; break; /* Control Type: Container [2.0] */ case WINCLASS_CONTAINER : pvClassName = WC_CONTAINER; break; /* Control Type: Slider [2.0] */ case WINCLASS_SLIDER : pvClassName = WC_SLIDER; break; /* Control Type: Value Set [2.0] */ case WINCLASS_VALUESET : pvClassName = WC_VALUESET; break; /* Control Type: Notebook [2.0] */ case WINCLASS_NOTEBOOK : pvClassName = WC_NOTEBOOK; break; /* Control Type: Handwriting [Pen for OS/2] */ case WINCLASS_HWXENTRY : pvClassName = WC_HWXENTRY; break; /* Control Type: Sketch [Pen for OS/2] */ case WINCLASS_SKETCH : pvClassName = WC_SKETCH; break; /* Control Type: Graphic Button [MMPM/2] */ case WINCLASS_GRAPHICBUTTON : pvClassName = WC_GRAPHICBUTTON; break; /* Control Type: Circular Slider [MMPM/2] */ case WINCLASS_CIRCULARSLIDER : pvClassName = WC_CIRCULARSLIDER; break; } /* Check to see if any control data associated */ /* with the control. A -1 indicates that no */ /* control data is associated. */ if ( pdlgt->adlgti[i].offCtlData != 0xffff ) pvCtlData = (PVOID)((PBYTE)pvStart + pdlgt->adlgti[i].offCtlData); else pvCtlData = NULL; /* Check to see if any presentation parameters */ /* associated with the control. A -1 indicates */ /* that no presentation parameters are */ /* associated. */ if ( pdlgt->adlgti[i].offPresParams != 0xffff ) pvPresParams = (PVOID)((PBYTE)pvStart + pdlgt->adlgti[i].offPresParams); else pvPresParams = NULL; /* Check to see if any text specified for the */ /* control */ if ( pdlgt->adlgti[i].cchText ) pvText = (PVOID)((PBYTE)pvStart + pdlgt->adlgti[i].offText); else pvText = NULL; /* Create the control */ WinCreateWindow(hWnd, pvClassName, pvText, pdlgt->adlgti[i].flStyle, aptl[0].x, aptl[0].y, aptl[1].x, aptl[1].y, hWnd, HWND_BOTTOM, (ULONG)(pdlgt->adlgti[i].id & 0xffff), pvCtlData, pvPresParams); } /* Release the memory allocated for the dialog */ /* template before returning */ DosFreeResource(pvStart); }
void CreateButtons(HWND hwndClient) { LONG lRGB; hwnd0 = WinCreateWindow(hwndClient, WC_BUTTON, "0", WS_VISIBLE | BS_PUSHBUTTON | BS_NOPOINTERFOCUS, NUMCOL1, ROW1, NUMWIDTH, KEYHEIGHT, hwndClient, HWND_TOP, K_0, NULL, NULL); hwnd1 = WinCreateWindow(hwndClient, WC_BUTTON, "1", WS_VISIBLE | BS_PUSHBUTTON | BS_NOPOINTERFOCUS, NUMCOL1, ROW2, NUMWIDTH, KEYHEIGHT, hwndClient, HWND_TOP, K_1, NULL, NULL); hwnd4 = WinCreateWindow(hwndClient, WC_BUTTON, "4", WS_VISIBLE | BS_PUSHBUTTON | BS_NOPOINTERFOCUS, NUMCOL1, ROW3, NUMWIDTH, KEYHEIGHT, hwndClient, HWND_TOP, K_4, NULL, NULL); hwnd7 = WinCreateWindow(hwndClient, WC_BUTTON, "7", WS_VISIBLE | BS_PUSHBUTTON | BS_NOPOINTERFOCUS, NUMCOL1, ROW4, NUMWIDTH, KEYHEIGHT, hwndClient, HWND_TOP, K_7, NULL, NULL); hwnddot = WinCreateWindow(hwndClient, WC_BUTTON, "\371", WS_VISIBLE | BS_PUSHBUTTON | BS_NOPOINTERFOCUS, NUMCOL2, ROW1, NUMWIDTH, KEYHEIGHT, hwndClient, HWND_TOP, K_DOT, NULL, NULL); hwnd2 = WinCreateWindow(hwndClient, WC_BUTTON, "2", WS_VISIBLE | BS_PUSHBUTTON | BS_NOPOINTERFOCUS, NUMCOL2, ROW2, NUMWIDTH, KEYHEIGHT, hwndClient, HWND_TOP, K_2, NULL, NULL); hwnd5 = WinCreateWindow(hwndClient, WC_BUTTON, "5", WS_VISIBLE | BS_PUSHBUTTON | BS_NOPOINTERFOCUS, NUMCOL2, ROW3, NUMWIDTH, KEYHEIGHT, hwndClient, HWND_TOP, K_5, NULL, NULL); hwnd8 = WinCreateWindow(hwndClient, WC_BUTTON, "8", WS_VISIBLE | BS_PUSHBUTTON | BS_NOPOINTERFOCUS, NUMCOL2, ROW4, NUMWIDTH, KEYHEIGHT, hwndClient, HWND_TOP, K_8, NULL, NULL); hwnd3 = WinCreateWindow(hwndClient, WC_BUTTON, "3", WS_VISIBLE | BS_PUSHBUTTON | BS_NOPOINTERFOCUS, NUMCOL3, ROW2, NUMWIDTH, KEYHEIGHT, hwndClient, HWND_TOP, K_3, NULL, NULL); hwnd6 = WinCreateWindow(hwndClient, WC_BUTTON, "6", WS_VISIBLE | BS_PUSHBUTTON | BS_NOPOINTERFOCUS, NUMCOL3, ROW3, NUMWIDTH, KEYHEIGHT, hwndClient, HWND_TOP, K_6, NULL, NULL); hwnd9 = WinCreateWindow(hwndClient, WC_BUTTON, "9", WS_VISIBLE | BS_PUSHBUTTON | BS_NOPOINTERFOCUS, NUMCOL3, ROW4, NUMWIDTH, KEYHEIGHT, hwndClient, HWND_TOP, K_9, NULL, NULL); hwndmin = WinCreateWindow(hwndClient, WC_BUTTON, "-", WS_VISIBLE | BS_PUSHBUTTON | BS_NOPOINTERFOCUS, COL1, ROW4, FUNCWIDTH, KEYHEIGHT, hwndClient, HWND_TOP, K_MIN, NULL, NULL); hwndplu = WinCreateWindow(hwndClient, WC_BUTTON, "+", WS_VISIBLE | BS_PUSHBUTTON | BS_NOPOINTERFOCUS, COL1, ROW3, FUNCWIDTH, KEYHEIGHT, hwndClient, HWND_TOP, K_PLU, NULL, NULL); hwndmul = WinCreateWindow(hwndClient, WC_BUTTON, "X", WS_VISIBLE | BS_PUSHBUTTON | BS_NOPOINTERFOCUS, COL1, ROW2, FUNCWIDTH, KEYHEIGHT, hwndClient, HWND_TOP, K_MUL, NULL, NULL); hwnddiv = WinCreateWindow(hwndClient, WC_BUTTON, "\366", WS_VISIBLE | BS_PUSHBUTTON | BS_NOPOINTERFOCUS, COL1, ROW1, FUNCWIDTH, KEYHEIGHT, hwndClient, HWND_TOP, K_DIV, NULL, NULL); hwndent = WinCreateWindow(hwndClient, WC_BUTTON, "Enter \030", WS_VISIBLE | BS_PUSHBUTTON | BS_NOPOINTERFOCUS, COL1, ROW5, ENTWIDTH, KEYHEIGHT, hwndClient, HWND_TOP, K_ENT, NULL, NULL); hwndgol = WinCreateWindow(hwndClient, WC_BUTTON, "", WS_VISIBLE | BS_PUSHBUTTON | BS_NOPOINTERFOCUS, COL1, ROW6, FUNCWIDTH, KEYHEIGHT, hwndClient, HWND_TOP, K_GOL, NULL, NULL); hwndxy = WinCreateWindow(hwndClient, WC_BUTTON, "~x\035y", WS_VISIBLE | BS_PUSHBUTTON | BS_NOPOINTERFOCUS, COL1, ROW7, FUNCWIDTH, KEYHEIGHT, hwndClient, HWND_TOP, K_XY, NULL, NULL); hwndsig = WinCreateWindow(hwndClient, WC_BUTTON, "\344+", WS_VISIBLE | BS_PUSHBUTTON | BS_NOPOINTERFOCUS, COL1, ROW8, FUNCWIDTH, KEYHEIGHT, hwndClient, HWND_TOP, K_SIG, NULL, NULL); hwndxeq = WinCreateWindow(hwndClient, WC_BUTTON, "<", BS_PUSHBUTTON | BS_NOPOINTERFOCUS, COL2, ROW6, FUNCWIDTH, KEYHEIGHT, hwndClient, HWND_TOP, K_XEQ, NULL, NULL); hwndrd = WinCreateWindow(hwndClient, WC_BUTTON, "R\31", WS_VISIBLE | BS_PUSHBUTTON | BS_NOPOINTERFOCUS, COL2, ROW7, FUNCWIDTH, KEYHEIGHT, hwndClient, HWND_TOP, K_RD, NULL, NULL); hwnd1x = WinCreateWindow(hwndClient, WC_BUTTON, "1/x", WS_VISIBLE | BS_PUSHBUTTON | BS_NOPOINTERFOCUS, COL2, ROW8, FUNCWIDTH, KEYHEIGHT, hwndClient, HWND_TOP, K_1X, NULL, NULL); hwndchs = WinCreateWindow(hwndClient, WC_BUTTON, "C~hs", WS_VISIBLE | BS_PUSHBUTTON | BS_NOPOINTERFOCUS, COL3, ROW5, FUNCWIDTH, KEYHEIGHT, hwndClient, HWND_TOP, K_CHS, NULL, NULL); hwndsto = WinCreateWindow(hwndClient, WC_BUTTON, "St~o", WS_VISIBLE | BS_PUSHBUTTON | BS_NOPOINTERFOCUS, COL3, ROW6, FUNCWIDTH, KEYHEIGHT, hwndClient, HWND_TOP, K_STO, NULL, NULL); hwndsin = WinCreateWindow(hwndClient, WC_BUTTON, "~Sin", WS_VISIBLE | BS_PUSHBUTTON | BS_NOPOINTERFOCUS, COL3, ROW7, FUNCWIDTH, KEYHEIGHT, hwndClient, HWND_TOP, K_SIN, NULL, NULL); hwndroo = WinCreateWindow(hwndClient, WC_BUTTON, "\373x", WS_VISIBLE | BS_PUSHBUTTON | BS_NOPOINTERFOCUS, COL3, ROW8, FUNCWIDTH, KEYHEIGHT, hwndClient, HWND_TOP, K_ROO, NULL, NULL); hwndeex = WinCreateWindow(hwndClient, WC_BUTTON, "~EEx", WS_VISIBLE | BS_PUSHBUTTON | BS_NOPOINTERFOCUS, COL4, ROW5, FUNCWIDTH, KEYHEIGHT, hwndClient, HWND_TOP, K_EEX, NULL, NULL); hwndrcl = WinCreateWindow(hwndClient, WC_BUTTON, "~Rcl", WS_VISIBLE | BS_PUSHBUTTON | BS_NOPOINTERFOCUS, COL4, ROW6, FUNCWIDTH, KEYHEIGHT, hwndClient, HWND_TOP, K_RCL, NULL, NULL); hwndcos = WinCreateWindow(hwndClient, WC_BUTTON, "~Cos", WS_VISIBLE | BS_PUSHBUTTON | BS_NOPOINTERFOCUS, COL4, ROW7, FUNCWIDTH, KEYHEIGHT, hwndClient, HWND_TOP, K_COS, NULL, NULL); hwndlog = WinCreateWindow(hwndClient, WC_BUTTON, "Lo~g", WS_VISIBLE | BS_PUSHBUTTON | BS_NOPOINTERFOCUS, COL4, ROW8, FUNCWIDTH, KEYHEIGHT, hwndClient, HWND_TOP, K_LOG, NULL, NULL); hwndbs = WinCreateWindow(hwndClient, WC_BUTTON, "\33", WS_VISIBLE | BS_PUSHBUTTON | BS_NOPOINTERFOCUS, COL5, ROW5, FUNCWIDTH, KEYHEIGHT, hwndClient, HWND_TOP, K_BS, NULL, NULL); hwndsst = WinCreateWindow(hwndClient, WC_BUTTON, "Cls", WS_VISIBLE | BS_PUSHBUTTON | BS_NOPOINTERFOCUS, COL5, ROW6, FUNCWIDTH, KEYHEIGHT, hwndClient, HWND_TOP, K_SST, NULL, NULL); hwndtan = WinCreateWindow(hwndClient, WC_BUTTON, "~Tan", WS_VISIBLE | BS_PUSHBUTTON | BS_NOPOINTERFOCUS, COL5, ROW7, FUNCWIDTH, KEYHEIGHT, hwndClient, HWND_TOP, K_TAN, NULL, NULL); hwndln = WinCreateWindow(hwndClient, WC_BUTTON, "L~N", WS_VISIBLE | BS_PUSHBUTTON | BS_NOPOINTERFOCUS, COL5, ROW8, FUNCWIDTH, KEYHEIGHT, hwndClient, HWND_TOP, K_LN, NULL, NULL); hwndDisplay = WinCreateWindow(hwndClient, WC_ENTRYFIELD, " 0.0000 00", WS_VISIBLE | ES_MARGIN | ES_READONLY | ES_LEFT, COL1, ROWDISPLAY, DISPLAYWIDTH, KEYHEIGHT, hwndClient, HWND_TOP, K_DISPLAY, NULL, NULL); hwndDispY = WinCreateWindow(hwndClient, WC_ENTRYFIELD, " 0.0000 00", ES_MARGIN | ES_READONLY | ES_LEFT, COL1, ROWDISPLAY+KEYHEIGHT*4/3, DISPLAYWIDTH, KEYHEIGHT, hwndClient, HWND_TOP, K_DISPY, NULL, NULL); hwndDispZ = WinCreateWindow(hwndClient, WC_ENTRYFIELD, " 0.0000 00", ES_MARGIN | ES_READONLY | ES_LEFT, COL1, ROWDISPLAY+KEYHEIGHT*8/3, DISPLAYWIDTH, KEYHEIGHT, hwndClient, HWND_TOP, K_DISPZ, NULL, NULL); hwndDispT = WinCreateWindow(hwndClient, WC_ENTRYFIELD, " 0.0000 00", ES_MARGIN | ES_READONLY | ES_LEFT, COL1, ROWDISPLAY+KEYHEIGHT*12/3, DISPLAYWIDTH, KEYHEIGHT, hwndClient, HWND_TOP, K_DISPT, NULL, NULL); hwndAmode = WinCreateWindow(hwndClient, WC_BUTTON, "RAD", WS_VISIBLE | BS_PUSHBUTTON | BS_NOPOINTERFOCUS, COL2, ROW9+ROWSEP/2, FUNCWIDTH+FUNCSEP, KEYHEIGHT-2, hwndClient, HWND_TOP, K_AMODE, NULL, NULL); hwndSmode = WinCreateWindow(hwndClient, WC_STATIC, "", WS_VISIBLE | SS_TEXT | DT_VCENTER | DT_CENTER, NUMCOL2, ROW9+ROWSEP/2, FUNCWIDTH+FUNCSEP, KEYHEIGHT-2, hwndClient, HWND_BOTTOM, K_SMODE, NULL, NULL); /* hwndtest = WinCreateWindow(hwndClient, WC_BUTTON, "#1", WS_VISIBLE | BS_ICON | BS_PUSHBUTTON | BS_AUTOSIZE, COL1, ROW8, 0, 0, hwndClient, HWND_BOTTOM, K_XEQ, NULL, NULL); */ lRGB=CLR_YELLOW; WinSetPresParam(hwndgol, PP_BACKGROUNDCOLORINDEX, (ULONG)sizeof(LONG), (PVOID)&lRGB); lRGB=CLR_WHITE; WinSetPresParam(hwndAmode, PP_BACKGROUNDCOLORINDEX, (ULONG)sizeof(LONG), (PVOID)&lRGB); /* lRGB=CLR_PALEGRAY; WinSetPresParam(hwndClient, PP_BACKGROUNDCOLORINDEX, (ULONG)sizeof(LONG), (PVOID)&lRGB); */ SwitchFonts(SIZE_NORM); }
static MRESULT EXPENTRY launchPadWindowProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2) { WPFolder* thisPtr; launchPad * lp; LPObject *lpo; static USHORT id=0;//Initialisation new in V1.00a switch(msg) { #if 0 case DM_ENDCONVERSATION: case DM_DRAGFILECOMPLETE: case DM_DROPNOTIFY: case DM_FILERENDERED: case DM_RENDERCOMPLETE: break; return (MRESULT)FALSE; case WM_ENDDRAG: break; return (MRESULT)TRUE; #endif case WM_PAINT: { RECTL rcl; launchPad * lp; HPS hps=WinBeginPaint(hwnd,NULLHANDLE, &rcl); WinFillRect(hps, &rcl, SYSCLR_DIALOGBACKGROUND); lp=(launchPad*)WinQueryWindowULong(hwnd,QWL_USER); if(lp) { if(lp->lpQueryNumObjects()==0) { WinQueryWindowRect(hwnd,&rcl); WinDrawBorder(hps,&rcl,1,1,SYSCLR_WINDOWFRAME,SYSCLR_DIALOGBACKGROUND, DB_STANDARD); } } WinEndPaint(hps); return (MRESULT) 0; } case DM_DRAGOVER: return handleDragOver(hwnd, mp1, mp2); case DM_DROP: { ULONG ulCount; ULONG ulNumberOfObjects; PDRAGITEM pDragItem; SOMClass *folderClass; WPObject * wpObject; PDRAGINFO pDragInfo; TRY_LOUD(LP_FRAMEDROP) { /* A new object dropped on the launchpad */ pDragInfo=(PDRAGINFO)mp1; if(DrgAccessDraginfo(pDragInfo)) { /* Get number of items */ ulNumberOfObjects = DrgQueryDragitemCount( pDragInfo); if(ulNumberOfObjects>1){ /* Free the draginfo */ DrgDeleteDraginfoStrHandles(pDragInfo); DrgFreeDraginfo(pDragInfo); } else { ulCount=0; pDragItem=DrgQueryDragitemPtr( pDragInfo, ulCount); wpObject=(WPObject*)OBJECT_FROM_PREC(DrgQueryDragitemPtr( pDragInfo, ulCount)->ulItemID); lp=(launchPad*)WinQueryWindowULong(hwnd,QWL_USER); if(lp) { if(somIsObj(wpObject)) { POINTL ptl; int numB; SWP swp; WinQueryWindowPos(hwnd,&swp); ptl.x=pDragInfo->xDrop; ptl.y=pDragInfo->yDrop; /* Pos in window coords */ WinMapWindowPoints(HWND_DESKTOP, hwnd, &ptl, 1); numB=(ptl.x-xButtonOffset)/(swp.cy+xButtonDelta); numB=((ptl.x-numB*swp.cy) > swp.cy/2 ? numB+1: numB); /* Do a link */ lp->lpAddButton(wpObject, numB); handleDragLeave(hwnd, mp1, mp2); } } DrgDeleteDraginfoStrHandles(pDragInfo); DrgFreeDraginfo(pDragInfo); } } handleDragLeave(hwnd, mp1, mp2); } CATCH(LP_FRAMEDROP) { } END_CATCH; break; } case DM_DRAGLEAVE: return handleDragLeave(hwnd, mp1, mp2); break; case WM_COMMAND: if(SHORT1FROMMP(mp2)==CMDSRC_PUSHBUTTON) { /* It's a push button */ lpo=(LPObject*)WinQueryWindowULong(WinWindowFromID(hwnd,SHORT1FROMMP(mp1)),QWL_USER); if(lpo) { if(somIsObj(lpo->wpObject)) lpo->wpObject->wpViewObject(NULLHANDLE, OPEN_DEFAULT,0); } } return (MRESULT)FALSE; /***********************************************/ /* Stuff for fly over help */ case WM_MOUSEMOVE: launchPad * lp; lp=(launchPad*)WinQueryWindowULong(hwnd,QWL_USER); if(lp) { if(lp->lpQueryNumObjects()!=0) { break; } } #if 0 tempID=WinQueryWindowUShort(hwnd,QWS_ID);/* get the id of the window under the pointer */ if(id!=tempID) { // New Button? WinStartTimer(WinQueryAnchorBlock(hwnd),hwnd,tempID,(ULONG)iTBFlyOverDelay); // New timer for delay id=tempID; // Save ID } else { if(!hwndBubbleWindow) WinStartTimer(WinQueryAnchorBlock(hwnd),hwnd,tempID,(ULONG)iTBFlyOverDelay); // New timer for delay } #endif if(!hwndBubbleWindow) WinStartTimer(WinQueryAnchorBlock(hwnd), hwnd, 2,(ULONG)iTBFlyOverDelay); // New timer for delay break; case WM_DESTROY: WinStopTimer(WinQueryAnchorBlock(hwnd),hwnd,1);//Stop timer if running if(hwndBubbleWindow) WinDestroyWindow(hwndBubbleWindow);/* close the bubblewindow */ hwndBubbleWindow=0; /* Stop delay timer if running */ WinStopTimer(WinQueryAnchorBlock(hwnd),hwnd, 2); break; case WM_NEWBUBBLE: ULONG bubbleEnabled; HWND hwndStore; POINTL ptl; RECTL rclWork; LONG ulWinTextLen; POINTL aptlPoints[TXTBOX_COUNT]; LONG deltaX,deltaY; HPS hps; RECTL rcl; /* we have to build a new information window */ if(hwndBubbleWindow){// if(){...} new in V1.00a WinDestroyWindow(hwndBubbleWindow);/* close the bubblewindow */ hwndBubbleWindow=NULL; } // Query the pointer position WinQueryPointerPos(HWND_DESKTOP,&ptl); WinMapWindowPoints(HWND_DESKTOP,hwnd,&ptl,1); WinQueryWindowRect(hwnd,&rclWork); if(!hwndBubbleWindow && WinPtInRect(WinQueryAnchorBlock(hwnd),&rclWork,&ptl) && bTBFlyOverEnabled) { static HWND hwndBubbleClient; ULONG style=FCF_BORDER|FCF_NOBYTEALIGN; char winText[255]; /* Get window text for size calculating */ lp=(launchPad*)WinQueryWindowULong(hwnd,QWL_USER); if(lp) { strncpy(winText, lp->lpQueryFlyOverText(), sizeof(winText)); winText[sizeof(winText)-1]=0; } ulWinTextLen=(LONG)strlen(winText); // Query text length /* Delete 'Returns' in object title */ char *pBuchst; char *pRest; pRest=winText; while((pBuchst=strchr(pRest,13))!=NULL) { *pBuchst=' '; pBuchst++; if(*pBuchst==10) *pBuchst=' '; pRest=pBuchst; } /* Create help window */ hwndBubbleWindow=WinCreateStdWindow(HWND_DESKTOP, 0, &style, WC_STATIC, "", SS_TEXT|DT_CENTER|DT_VCENTER, NULLHANDLE, 400, &hwndBubbleClient); hwndShadow=WinCreateWindow(HWND_DESKTOP, WC_STATIC, "", SS_TEXT|DT_CENTER|DT_VCENTER, 0, 0, 0, 0, hwndBubbleWindow, hwndBubbleWindow, 401, NULLHANDLE, NULLHANDLE); oldProc=WinSubclassWindow(hwndShadow, shadowProc); // Set the font for the help WinSetPresParam(hwndBubbleClient,PP_FONTNAMESIZE, sizeof(chrTBFlyFontName), chrTBFlyFontName); /* Calculate text size in pixel */ hps=WinBeginPaint(hwndBubbleClient,(HPS)NULL,(PRECTL)NULL); GpiQueryTextBox(hps,ulWinTextLen,winText,TXTBOX_COUNT,aptlPoints); WinEndPaint(hps); /* Set colors */ WinSetPresParam(hwndBubbleClient, PP_BACKGROUNDCOLOR,sizeof(rgbTBFlyBackground) , &rgbTBFlyBackground ); WinSetPresParam(hwndBubbleClient, PP_FOREGROUNDCOLOR,sizeof(rgbTBFlyForeground) , &rgbTBFlyForeground ); /* Calculate bubble positon and show bubble */ WinQueryPointerPos(HWND_DESKTOP,&ptl);//Query pointer position in the desktop window WinQueryWindowRect(HWND_DESKTOP,&rcl);//Query desktop size aptlPoints[TXTBOX_BOTTOMRIGHT].x-aptlPoints[TXTBOX_BOTTOMLEFT].x+7+xVal+ptl.x > rcl.xRight ? deltaX=-aptlPoints[TXTBOX_BOTTOMRIGHT].x-aptlPoints[TXTBOX_BOTTOMLEFT].x-xVal-xVal-7 : deltaX=0 ; aptlPoints[TXTBOX_TOPLEFT].y-aptlPoints[TXTBOX_BOTTOMLEFT].y+2+yVal+ptl.y > rcl.yTop ? deltaY=-aptlPoints[TXTBOX_TOPLEFT].y-aptlPoints[TXTBOX_BOTTOMLEFT].y-2*yVal-7 : deltaY=0 ; WinSetWindowPos(hwndBubbleWindow, HWND_TOP, ptl.x+xVal+deltaX,ptl.y+yVal+deltaY, aptlPoints[TXTBOX_BOTTOMRIGHT].x-aptlPoints[TXTBOX_BOTTOMLEFT].x+8, aptlPoints[TXTBOX_TOPLEFT].y-aptlPoints[TXTBOX_BOTTOMLEFT].y+2, SWP_ZORDER|SWP_SIZE|SWP_MOVE|SWP_SHOW); WinSetWindowPos(hwndShadow, hwndBubbleWindow, ptl.x+xVal+deltaX+5 ,ptl.y+yVal+deltaY-5, aptlPoints[TXTBOX_BOTTOMRIGHT].x-aptlPoints[TXTBOX_BOTTOMLEFT].x+8, aptlPoints[TXTBOX_TOPLEFT].y-aptlPoints[TXTBOX_BOTTOMLEFT].y+2, SWP_ZORDER|SWP_SIZE|SWP_MOVE|SWP_SHOW); /* Set bubble text */ WinSetWindowText(hwndBubbleClient,winText); WinStartTimer(WinQueryAnchorBlock(hwnd),hwnd,1,35); } // end if(!hwndBubbleWindow) break; case WM_TIMER: switch (SHORT1FROMMP(mp1)) { case 1: //Intervall timer { POINTL ptl; RECTL rclWork; /* Test pointer position */ WinQueryPointerPos(HWND_DESKTOP, &ptl); WinMapWindowPoints(HWND_DESKTOP, hwnd,&ptl, 1); WinQueryWindowRect(hwnd, &rclWork); if(!WinPtInRect(WinQueryAnchorBlock(hwnd),&rclWork,&ptl)) { // Window has changed WinStopTimer(WinQueryAnchorBlock(hwnd), hwnd, 1); // stop the running timer if(hwndBubbleWindow) WinDestroyWindow(hwndBubbleWindow);/* close the bubblewindow */ hwndBubbleWindow=0; id=0; } break; } case 2:// delay over {//our own timer. POINTL ptl; RECTL rclWork; WinStopTimer(WinQueryAnchorBlock(hwnd), hwnd, 2);//Stop the delay timer /* Check the pointer position */ WinQueryPointerPos(HWND_DESKTOP,&ptl); WinMapWindowPoints(HWND_DESKTOP,hwnd,&ptl,1); WinQueryWindowRect(hwnd,&rclWork); if(WinPtInRect(WinQueryAnchorBlock(hwnd),&rclWork,&ptl)) WinPostMsg(hwnd,WM_NEWBUBBLE,NULL,NULL);//Request a help window return (MRESULT)FALSE; } default: break; } break; default: break; } return pfnwpOldLPProc(hwnd, msg, mp1, mp2); }
void h2font_restore( HWND hwndWnd, HINI hiniPrf, PSZ pszApp ) { PrfQueryProfileString( hiniPrf, pszApp, szPrfKeyFont, szDefaultFont, achFont, sizeof( achFont ) ); WinSetPresParam( hwndWnd, PP_FONTNAMESIZE, strlen( achFont ) + 1, achFont ); GetFontMetrics( hwndWnd, TRUE ); }
void SetPositions(USHORT pos) { switch (pos) { case SIZE_NORM: KEYHEIGHT =25; ROWSEP =18; ROW1 =10; FUNCWIDTH =35; FUNCSEP =15; COL1 =10; NUMWIDTH =40; NUMSEP =24; break; case SIZE_SMALL: KEYHEIGHT =20; ROWSEP =14; ROW1 =7; FUNCWIDTH =28; FUNCSEP =12; COL1 =7; NUMWIDTH =34; NUMSEP =18; break; default: } /* endswitch */ ROWSTEP =(KEYHEIGHT + ROWSEP); ROW2 =(ROW1 + ROWSTEP); ROW3 =(ROW2 + ROWSTEP); ROW4 =(ROW3 + ROWSTEP); ROW5 =(ROW4 + ROWSTEP); ROW6 =(ROW5 + ROWSTEP); ROW7 =(ROW6 + ROWSTEP); ROW8 =(ROW7 + ROWSTEP); ROW9 =(ROW8 + ROWSTEP); FUNCSTEP =(FUNCWIDTH + FUNCSEP); COL2 =(COL1 + FUNCSTEP); COL3 =(COL2 + FUNCSTEP); COL4 =(COL3 + FUNCSTEP); COL5 =(COL4 + FUNCSTEP); COL6 =(COL5 + FUNCSTEP); ENTWIDTH =(FUNCWIDTH + FUNCSEP + FUNCWIDTH); DISPLAYWIDTH =(FUNCWIDTH * 5 + FUNCSEP * 4); NUMSTEP =(NUMWIDTH + NUMSEP); NUMCOL1 =(COL1 + (DISPLAYWIDTH - 3 * NUMWIDTH - 2 * NUMSEP)); NUMCOL2 =(NUMCOL1 + NUMSTEP); NUMCOL3 =(NUMCOL2 + NUMSTEP); ROWDISPLAY =(ROW9 + 2 * ROWSEP); } void SwitchFonts(USHORT usType) { PSZ szDisp, szBS, szFunc, szDigit, szMenu; HWND hwndMenu; switch (usType) { case SIZE_NORM: szDisp = szLargeDispFont; szBS = szLargeBSFont; szFunc = szLargeFuncFont; szDigit = szLargeDigitFont; szMenu = szLargeMenuFont; break; case SIZE_SMALL: szDisp = szSmallDispFont; szBS = szSmallBSFont; szFunc = szSmallFuncFont; szDigit = szSmallDigitFont; szMenu = szSmallMenuFont; break; default: szDisp = szLargeDispFont; szBS = szLargeBSFont; szFunc = szLargeFuncFont; szDigit = szLargeDigitFont; szMenu = szLargeMenuFont; break; } /* endswitch */ hwndMenu = WinWindowFromID(hwndFrame, FID_MENU); WinSetPresParam(hwndMenu, PP_FONTNAMESIZE, (ULONG)strlen(szMenu)+1, (PVOID)szMenu); WinSetPresParam(hwndClient, PP_FONTNAMESIZE, (ULONG)strlen(szFunc)+1, (PVOID)szFunc); WinSetPresParam(hwndDisplay, PP_FONTNAMESIZE, (ULONG)strlen(szDisp)+1, (PVOID)szDisp); WinSetPresParam(hwndDispY, PP_FONTNAMESIZE, (ULONG)strlen(szDisp)+1, (PVOID)szDisp); WinSetPresParam(hwndDispZ, PP_FONTNAMESIZE, (ULONG)strlen(szDisp)+1, (PVOID)szDisp); WinSetPresParam(hwndDispT, PP_FONTNAMESIZE, (ULONG)strlen(szDisp)+1, (PVOID)szDisp); WinSetPresParam(hwndbs, PP_FONTNAMESIZE, (ULONG)strlen(szBS)+1, (PVOID)szBS); WinSetPresParam(hwndmin, PP_FONTNAMESIZE, (ULONG)strlen(szBS)+1, (PVOID)szBS); WinSetPresParam(hwndplu, PP_FONTNAMESIZE, (ULONG)strlen(szBS)+1, (PVOID)szBS); WinSetPresParam(hwndmul, PP_FONTNAMESIZE, (ULONG)strlen(szBS)+1, (PVOID)szBS); WinSetPresParam(hwnddiv, PP_FONTNAMESIZE, (ULONG)strlen(szBS)+1, (PVOID)szBS); WinSetPresParam(hwnd0, PP_FONTNAMESIZE, (ULONG)strlen(szDigit)+1, (PVOID)szDigit); WinSetPresParam(hwnd1, PP_FONTNAMESIZE, (ULONG)strlen(szDigit)+1, (PVOID)szDigit); WinSetPresParam(hwnd2, PP_FONTNAMESIZE, (ULONG)strlen(szDigit)+1, (PVOID)szDigit); WinSetPresParam(hwnd3, PP_FONTNAMESIZE, (ULONG)strlen(szDigit)+1, (PVOID)szDigit); WinSetPresParam(hwnd4, PP_FONTNAMESIZE, (ULONG)strlen(szDigit)+1, (PVOID)szDigit); WinSetPresParam(hwnd5, PP_FONTNAMESIZE, (ULONG)strlen(szDigit)+1, (PVOID)szDigit); WinSetPresParam(hwnd6, PP_FONTNAMESIZE, (ULONG)strlen(szDigit)+1, (PVOID)szDigit); WinSetPresParam(hwnd7, PP_FONTNAMESIZE, (ULONG)strlen(szDigit)+1, (PVOID)szDigit); WinSetPresParam(hwnd8, PP_FONTNAMESIZE, (ULONG)strlen(szDigit)+1, (PVOID)szDigit); WinSetPresParam(hwnd9, PP_FONTNAMESIZE, (ULONG)strlen(szDigit)+1, (PVOID)szDigit); WinSetPresParam(hwnddot, PP_FONTNAMESIZE, (ULONG)strlen(szDigit)+1, (PVOID)szDigit); /* if (fDispBG) idAttrType=PP_BACKGROUNDCOLORINDEX; else idAttrType=PP_BACKGROUNDCOLOR; WinSetPresParam(hwndDisplay, idAttrType, sizeof(int), &lDispBG); WinSetPresParam(hwndDispY, idAttrType, sizeof(int), &lDispBG); WinSetPresParam(hwndDispZ, idAttrType, sizeof(int), &lDispBG); WinSetPresParam(hwndDispT, idAttrType, sizeof(int), &lDispBG); */ }
VOID main() { if ( (hab = WinInitialize( 0L )) == (HAB) NULL ){ printf( "ToolBar Error: WinInitialize failed \n" ); return; } else { if ( (hmq = WinCreateMsgQueue( hab, 0 )) == (HMQ) NULL ){ printf( "ToolBar Error: WinCreateMsgQueue failed \n" ); return; } else { ULONG fulCreate= FCF_TITLEBAR | FCF_SYSMENU | FCF_SIZEBORDER | FCF_MINMAX | FCF_SHELLPOSITION | FCF_ICON ; /* * Note: no menu was specificed in create flags */ WinSetPointer( HWND_DESKTOP, WinQuerySysPointer(HWND_DESKTOP,SPTR_WAIT,TRUE)); WinRegisterClass(hab, szClassName, (PFNWP)MainWindowProc, CS_SIZEREDRAW, 0); hwndFrame = WinCreateStdWindow(HWND_DESKTOP, 0L, (PULONG)&fulCreate, szClassName , szMainTitle, 0L, (HMODULE)NULL, ID_MAIN_WIN, &hwndClient); if ( hwndFrame == NULLHANDLE ) { ShowErrorWindow( "Error creating Main window !", TRUE ); } else { PFNWP pfnwpOldFrameProc ; /* --------- subclass frame proc ------------------ */ pfnwpOldFrameProc = WinSubclassWindow( hwndFrame, (PFNWP) NewFrameProc ); if ( pfnwpOldFrameProc == (PFNWP)0L ){ ShowErrorWindow( "Error subclassing frame window !", TRUE ); } else { PID pid ; SWCNTRL swCntrl; HSWITCH hSwitch ; LONG lRGB; /* ------- store old frame proc with handle ------- */ WinSetWindowULong( hwndFrame, QWL_USER, (ULONG) pfnwpOldFrameProc ); /* ------------------ load menus ------------------- */ hwndMenuBar = WinLoadMenu( hwndFrame, (HMODULE)NULL, MID_MENUBAR ); hwndToolBar = WinLoadMenu( hwndFrame, (HMODULE)NULL, MID_TOOLBAR ); /* * Note that the last menu loaded, the toolbar, is the * one that is associated with the frame as "the" menu. * this means that hwndMenuBar is the only link to the * regular action bar, so hang onto it tightly */ /* ---------- set toolbar background color ---------- */ lRGB = WinQuerySysColor( HWND_DESKTOP, SYSCLR_BUTTONDARK, 0L ); WinSetPresParam( hwndToolBar, PP_BACKGROUNDCOLOR, 4L, (PVOID)lRGB ); /* --------- set window size and pos -------------- */ WinSetWindowPos( hwndFrame, HWND_TOP, 0, 0, 370, 300, SWP_SIZE | SWP_SHOW | SWP_ACTIVATE ); /* ----------- add program to tasklist --------------- */ WinQueryWindowProcess( hwndFrame, &pid, NULL ); swCntrl.hwnd = hwndFrame ; swCntrl.hwndIcon = (HWND) NULL ; swCntrl.hprog = (HPROGRAM) NULL ; swCntrl.idProcess = pid ; swCntrl.idSession = (LONG) NULL ; swCntrl.uchVisibility = SWL_VISIBLE ; swCntrl.fbJump = SWL_JUMPABLE ; sprintf( swCntrl.szSwtitle, szMainTitle ); hSwitch = WinAddSwitchEntry((PSWCNTRL)&swCntrl); WinSetPointer(HWND_DESKTOP, WinQuerySysPointer(HWND_DESKTOP,SPTR_ARROW,TRUE)); /* ---------- start the main processing loop ----------- */ while (WinGetMsg(hab, &qmsg,NULLHANDLE,0,0)){ WinDispatchMsg(hab, &qmsg); } WinRemoveSwitchEntry( hSwitch ); } /* end of else ( pfnwpOldFrameProc ) */ WinSetPointer(HWND_DESKTOP, WinQuerySysPointer(HWND_DESKTOP,SPTR_ARROW,TRUE)); WinDestroyWindow(hwndFrame); } /* end of else (hwndFrame == NULLHANDLE) */ WinSetPointer(HWND_DESKTOP, WinQuerySysPointer(HWND_DESKTOP,SPTR_ARROW,TRUE)); WinDestroyMsgQueue(hmq); } /* end of else ( ...WinCreateMsgQueue() */ WinTerminate(hab); } /* end of else (...WinInitialize(NULL) */ } /* end of main() */
VOID InitSlider (HWND hwnd, ULONG idSlider, USHORT usMaximumTicks, USHORT usMinorTickSpacing, USHORT usMinorTickSize, USHORT usMajorTickSpacing, USHORT usMajorTickSize, USHORT usDetentSpacing, USHORT usTextSpacing, PSZ pszFont) { USHORT i; CHAR buffer[20]; USHORT usIncrements; USHORT usSpacing; WNDPARAMS wprm; SLDCDATA sldcd; HWND hwndSlider = WinWindowFromID (hwnd, idSlider); wprm.fsStatus = WPM_CTLDATA; wprm.cbCtlData = sizeof (SLDCDATA); wprm.pCtlData = &sldcd; WinSendMsg (hwndSlider, WM_QUERYWINDOWPARAMS, MPFROMP(&wprm), 0); //********************************************************************* // Set the total-max num of increments for slider sldcd.usScale1Increments = usMaximumTicks +1; sldcd.usScale1Spacing = 0; //let slider do spacing wprm.fsStatus = WPM_CTLDATA; wprm.cbCtlData = sizeof (SLDCDATA); wprm.pCtlData = &sldcd; //set these paramaters WinSendMsg (hwndSlider, WM_SETWINDOWPARAMS, MPFROMP(&wprm), 0); //********************************************************************* //Read these parameters back so we can use them wprm.fsStatus = WPM_CTLDATA; wprm.cbCtlData = sizeof (SLDCDATA); wprm.pCtlData = &sldcd; WinSendMsg (hwndSlider, WM_QUERYWINDOWPARAMS, MPFROMP(&wprm), 0); usIncrements = sldcd.usScale1Increments; usSpacing = sldcd.usScale1Spacing; //********************************************************************* if (usMinorTickSpacing != 0) { for (i = 0; i <= usIncrements; i += usMinorTickSpacing) { WinSendMsg (hwndSlider, // Set minor tick SLM_SETTICKSIZE, MPFROM2SHORT(i, usMinorTickSize), NULL); } } //********************************************************************* if (usMajorTickSpacing != 0) { for (i = 0; i <= usIncrements; i += usMajorTickSpacing) { WinSendMsg (hwndSlider, // Set major tick SLM_SETTICKSIZE, MPFROM2SHORT(i, usMajorTickSize), NULL); } } //********************************************************************* if (usDetentSpacing != 0) { for (i = 0; i <= usIncrements; i += usDetentSpacing) { WinSendMsg (hwndSlider, // Set the detent SLM_ADDDETENT, MPFROM2SHORT((i*usSpacing), usDetentSpacing), NULL); } } //********************************************************************* if (usTextSpacing != 0) { if (pszFont != NULL) { WinSetPresParam (hwndSlider, PP_FONTNAMESIZE, (strlen(pszFont)+1), pszFont); } for (i = 0; i <= usIncrements; i += usTextSpacing) { _itoa (i, buffer, 10); WinSendMsg (hwndSlider,SLM_SETSCALETEXT, MPFROMSHORT(i), MPFROMP(buffer)); } } }
MRESULT EXPENTRY ProgressDlgProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2) { switch (msg) { // init ----------------------------------------------------------------- case WM_INITDLG: { PPRGSAPPDATA pad = (PPRGSAPPDATA)mp2; ULONG ul; POINTL aptl[] = {{1, 36}, {220, 24}}; WinSetWindowPtr(hwnd, 0L, (PVOID)mp2); WinSetWindowText(hwnd, pad->ppd->pszTitle); // dimensioni-coordinate varie pad->cyTitle = uGetSval(SV_CYTITLEBAR); pad->hButton = WinWindowFromID(hwnd, BTN_STOP); WinQueryWindowPos(pad->hButton, &pad->swp); WinQueryWindowRect(hwnd, &pad->rcl); WinMapDlgPoints(hwnd, aptl, 2, TRUE); pad->sldd.cbSize = sizeof(SLDCDATA); pad->sldd.usScale1Increments = 11; pad->sldd.usScale1Spacing = (pad->rcl.xRight - 2 * pad->cyTitle) / 10 - 1; pad->hProgress = WinCreateWindow(hwnd, WC_SLIDER, (PSZ)NULL, SLS_BOTTOM | SLS_OWNERDRAW | SLS_READONLY | SLS_RIBBONSTRIP | WS_VISIBLE, 3, aptl[0].y, pad->rcl.xRight - 6, aptl[1].y, hwnd, HWND_TOP, SLDR_PROGRESS, (PVOID)&pad->sldd, NULL); // controlla versione S.O. e setta font slider e bottone DosQuerySysInfo(QSV_VERSION_MINOR, QSV_VERSION_MINOR, &ul, sizeof(ULONG)); if (ul < 40) { WinSetPresParam(pad->hProgress, PP_FONTNAMESIZE, 7, "8.Helv"); WinSetPresParam(pad->hButton, PP_FONTNAMESIZE, 7, "8.Helv"); } else { WinSetPresParam(pad->hProgress, PP_FONTNAMESIZE, 11, "9.WarpSans"); } /* endif */ // rileva larghezza progress bar pad->cxPrgs = LOUSHORT((ULONG)WinSendMsg(pad->hProgress, SLM_QUERYSLIDERINFO, MPFROM2SHORT(SMA_SHAFTDIMENSIONS, 0), MPVOID)) - 6; // setta altezza barra pari a altezza barra titolo WinSendMsg(pad->hProgress, SLM_SETSLIDERINFO, MPFROM2SHORT(SMA_SHAFTDIMENSIONS, 0), (MPARAM)pad->cyTitle); // setta testo e altezza barra graduata WinSendMsg(pad->hProgress, SLM_SETTICKSIZE, MPFROM2SHORT(SMA_SETALLTICKS, pad->cyTitle / 3), MPVOID); WinSendMsg(pad->hProgress, SLM_SETSCALETEXT, (MPARAM)0, (MPARAM)"0%"); WinSendMsg(pad->hProgress, SLM_SETSCALETEXT, (MPARAM)5, (MPARAM)"50%"); WinSendMsg(pad->hProgress, SLM_SETSCALETEXT, (MPARAM)10, (MPARAM)"100%"); // testo iniziale progesso e elapsed time: sprintf(pad->achElapsed, "%s: 00:00:00", pad->ppd->pszTime); WinSetDlgItemText(hwnd, TXT_TIME, pad->achElapsed); sprintf(pad->achCurPrg, "%s: 0%%", pad->ppd->pszPrgrss); WinSetDlgItemText(hwnd, TXT_PERCENT, pad->achCurPrg); // se specificato setta nuovo font dialogo if (pad->ppd->fl & PRGSS_FONT) WsetDlgFonts(hwnd, NULLHANDLE, pad->ppd->FontNameSize); // posiziona finestra al centro Parent window if (pad->ppd->fl & PRGSS_CENTER) { WcenterInWindow(hwnd, pad->ppd->hPos); } else { SWP swp; swp.hwnd = pad->ppd->hPos; swp.x = pad->ppd->ptl.x; swp.y = pad->ppd->ptl.y; swp.cx = swp.cy = 0; swp.fl = SWP_MOVE | SWP_SHOW | SWP_ACTIVATE | SWP_ZORDER; swp.hwndInsertBehind = HWND_TOP; WsetRelativePos(hwnd, &swp); } // end if // notifica creazione dialogo WinPostMsg(pad->ppd->hNotify, WM_PRGRSREADY, (MPARAM)hwnd, (MPARAM)0); break; } // end case WM_INITDLG case WM_DRAWITEM: if (((POWNERITEM)mp2)->idItem == SDA_RIBBONSTRIP) { PPRGSAPPDATA pad = GetData(hwnd); if (pad->ppd->fl & PRGSS_BITMAP) { // se deve disegnare la bitmap RECTL rcl = {0, 0, ((POWNERITEM)mp2)->rclItem.xRight - ((POWNERITEM)mp2)->rclItem.xLeft, pad->cyTitle}; POINTL ptl = {((POWNERITEM)mp2)->rclItem.xLeft, ((POWNERITEM)mp2)->rclItem.yBottom}; while (ptl.x < ((POWNERITEM)mp2)->rclItem.xRight) { WinDrawBitmap(((POWNERITEM)mp2)->hps, pad->ppd->hbmp, &rcl, &ptl, 0L, 0L, DBM_NORMAL); ptl.x += pad->cxbmp; rcl.xRight = ((POWNERITEM)mp2)->rclItem.xRight - ptl.x; } /* endwhile */ } else { // colore GpiCreateLogColorTable(((POWNERITEM)mp2)->hps, 0, LCOLF_RGB, 0, 0, NULL); WinFillRect(((POWNERITEM)mp2)->hps, &((POWNERITEM)mp2)->rclItem, pad->ppd->color); } /* endif */ return (MRESULT)TRUE; } // end if break; case PRGSM_INCREMENT: { // notifica incremento PPRGSAPPDATA pad = GetData(hwnd); ULONG ul; pad->incr = (ULONG)mp1; WinSendMsg(pad->hProgress, SLM_SETSLIDERINFO, MPFROM2SHORT(SMA_SLIDERARMPOSITION, SMA_RANGEVALUE), (MPARAM)((pad->incr * pad->cxPrgs) / 1000)); ul = WinGetCurrentTime(pad->hab) / 1000; if (pad->current != ul) { pad->current = ul; pad->elapsed = pad->current - pad->start; sprintf(pad->achElapsed, "%s: %02d:%02d:%02d", pad->ppd->pszTime, pad->elapsed / 3600, (pad->elapsed % 3600) / 60, pad->elapsed % 60); WinSetDlgItemText(hwnd, TXT_TIME, pad->achElapsed); } // end if if (pad->ulCurPrg != (ul = (ULONG)mp1 / 10)) { pad->ulCurPrg = ul; sprintf(pad->achCurPrg, "%s: %3d %%", pad->ppd->pszPrgrss, pad->ulCurPrg); WinSetDlgItemText(hwnd, TXT_PERCENT, pad->achCurPrg); } // end if return (MRESULT)pad->flStop; } // end case PRGSM_INCREMENT case PRGSM_MSG: return (MRESULT)Wprint(hwnd, (PSZ)mp1, (ULONG)mp2); case WM_COMMAND: if ((ULONG)mp1 == BTN_STOP) { PPRGSAPPDATA pad = GetData(hwnd); pad->flStop = TRUE; WinEnableWindow(pad->hButton, FALSE); } /* endif */ break; case WM_CLOSE: { PPRGSAPPDATA pad = GetData(hwnd); // se elaborazione ancora in corso mostra messaggio if (pad->incr > 0 && pad->incr < 1000) { PSZ psz; if (!(psz = (PSZ)malloc(1024)) || // se la notify window restituisce NULL (BOOL)WinSendMsg(pad->ppd->hNotify, WM_PRGRSQUIT, (MPARAM)psz, MPVOID) || // o se la chiusura Š confermata Wprint(hwnd, psz, PMPRNT_QUERY)) { WinPostMsg(hwnd, PRGSM_END, MPVOID, MPVOID); WinPostMsg(pad->hOwner, WM_CLOSE, MPVOID, MPVOID); // se nel frattempo Š terminato } else { pad->qQuit.msg = 0; if (!pad->incr || pad->incr >= 1000) { WinPostMsg(hwnd, PRGSM_END, MPVOID, MPVOID); } else if ((BOOL)mp1) { WinCancelShutdown((HMQ)WinQueryWindowULong(hwnd, QWL_HMQ), FALSE); } // end if } // end if free (psz); } /* endif */ } break; default: return WinDefDlgProc(hwnd, msg, mp1, mp2); } /* endswitch */ return (MRESULT)FALSE; }
/* This Proc handles the on-the-fly data CD writing */ MRESULT EXPENTRY waveinfoStatusDialogProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2) { char text[CCHMAXPATH*2 +10]; char title[CCHMAXPATH]; SWCNTRL swctl; PID pid; int a; int rate; int iBitRate; SHORT stereo; LONG lSec; switch (msg) { case WM_INITDLG: /* Add switch entry */ memset(&swctl,0,sizeof(swctl)); WinQueryWindowProcess(hwnd,&pid,NULL); swctl.hwnd=hwnd; swctl.uchVisibility=SWL_VISIBLE; swctl.idProcess=pid; swctl.bProgType=PROG_DEFAULT; swctl.fbJump=SWL_JUMPABLE; WinAddSwitchEntry(&swctl); /* sprintf(text,"1: %s, 2: %s, 3: %s",params[1],params[2],params[3]); WinMessageBox( HWND_DESKTOP, HWND_DESKTOP, text, params[3], 0UL, MB_OK | MB_ICONEXCLAMATION|MB_MOVEABLE ); */ WinSendMsg(WinWindowFromID(hwnd,IDST_WAVENAME),EM_SETTEXTLIMIT,MPFROMSHORT((SHORT)CCHMAXPATH),0); if(!iMp3 || (iMp3 && iMp3Decoder==IDKEY_USEMMIOMP3)) { /* Query a wave */ switch (mmAudioHeader.mmXWAVHeader.WAVEHeader.usFormatTag) { case DATATYPE_WAVEFORM: getMessage(text, IDSTR_PMWAVEINFOPCM, sizeof(text), RESSOURCEHANDLE, hwnd); break; case DATATYPE_ALAW: getMessage(text, IDSTR_PMWAVEINFOALAW, sizeof(text), RESSOURCEHANDLE, hwnd); break; case DATATYPE_MULAW: getMessage(text, IDSTR_PMWAVEINFOMULAW, sizeof(text), RESSOURCEHANDLE, hwnd); break; case DATATYPE_ADPCM_AVC: getMessage(text, IDSTR_PMWAVEINFOADPCM, sizeof(text), RESSOURCEHANDLE, hwnd); break; default: getMessage(text, IDSTR_PMWAVEINFOUNKNOWN, sizeof(text), RESSOURCEHANDLE, hwnd); break; } /* Channels */ getMessage(title, IDSTR_PMWAVEINFOCHANNELS, sizeof(title), RESSOURCEHANDLE, hwnd); sprintf(text, title, mmAudioHeader.mmXWAVHeader.WAVEHeader.usChannels); WinSetWindowText(WinWindowFromID(hwnd,IDST_CHANNELS),text); /* Bit per sample */ getMessage(title, IDSTR_PMWAVEINFOBITPERSAMPLE, sizeof(title), RESSOURCEHANDLE, hwnd); sprintf(text, title,mmAudioHeader.mmXWAVHeader.WAVEHeader.usBitsPerSample); WinSetWindowText(WinWindowFromID(hwnd,IDST_BITPERSAMPLE),text); /* Samplerate */ getMessage(title, IDSTR_PMWAVEINFOSAMPLERATE, sizeof(title), RESSOURCEHANDLE, hwnd); sprintf(text, title, mmAudioHeader.mmXWAVHeader.WAVEHeader.ulSamplesPerSec); WinSetWindowText(WinWindowFromID(hwnd,IDST_SAMPLERATE),text); /* Filename */ WinSetWindowText(WinWindowFromID(hwnd,IDST_WAVENAME),params[3]); /* Playtime */ getMessage(title, IDSTR_PMWAVEINFOPLAYTIME, sizeof(title), RESSOURCEHANDLE, hwnd); sprintf(text, title, mmAudioHeader.mmXWAVHeader.XWAVHeaderInfo.ulAudioLengthInBytes/ mmAudioHeader.mmXWAVHeader.WAVEHeader.ulAvgBytesPerSec/60, mmAudioHeader.mmXWAVHeader.XWAVHeaderInfo.ulAudioLengthInBytes/ mmAudioHeader.mmXWAVHeader.WAVEHeader.ulAvgBytesPerSec%60); WinSetWindowText(WinWindowFromID(hwnd,IDST_PLAYTIME),text); } else { /* Query info for MP3 */ getMessage(title, IDSTR_PMMP3INFODLGTITLE, sizeof(title), RESSOURCEHANDLE, hwnd); WinSetWindowText(hwnd,title); WinSetWindowText(WinWindowFromID(hwnd,IDST_CDBITS), ""); /* Filename */ WinSetWindowText(WinWindowFromID(hwnd,IDST_WAVENAME),params[3]); audioHlpStartMp3Query(params[3], hwnd); } /* Set dialog font to WarpSans for Warp 4 and above */ if(cwQueryOSRelease()>=40) { WinSetPresParam(hwnd, PP_FONTNAMESIZE,(ULONG)sizeof(DEFAULT_DIALOG_FONT), DEFAULT_DIALOG_FONT ); } if(!bHaveWindowPos) WinSetWindowPos(hwnd,HWND_TOP,0,0,0,0,SWP_ZORDER|SWP_ACTIVATE|SWP_SHOW); else WinSetWindowPos(hwnd,HWND_TOP,swpWindow.x, swpWindow.y, 0, 0, SWP_MOVE|SWP_ZORDER|SWP_ACTIVATE|SWP_SHOW); return (MRESULT) TRUE; /* WM_APPTERMINATENOTIFY messages are sent from the helper programs e.g. format checker. */ case WM_APPTERMINATENOTIFY: switch(LONGFROMMP(mp1)) { case ACKEY_MP3INFO: rate=SHORT2FROMMP(mp2); iBitRate=SHORT1FROMMP(mp2); iBitRate>>=2; stereo=SHORT1FROMMP(mp2) & 0x3; /* Channels */ getMessage(title, IDSTR_PMWAVEINFOCHANNELS, sizeof(title), RESSOURCEHANDLE, hwnd); if(stereo) sprintf(text, title, 2); else sprintf(text, title, 1); WinSetWindowText(WinWindowFromID(hwnd,IDST_CHANNELS),text); /* Bitrate */ getMessage(title, IDSTR_PMMP3INFOBITRATE, sizeof(title), RESSOURCEHANDLE, hwnd); sprintf(text, title, iBitRate); WinSetWindowText(WinWindowFromID(hwnd,IDST_BITPERSAMPLE),text); /* Samplerate */ getMessage(title, IDSTR_PMWAVEINFOSAMPLERATE, sizeof(title), RESSOURCEHANDLE, hwnd); sprintf(text, title, rate); WinSetWindowText(WinWindowFromID(hwnd,IDST_SAMPLERATE),text); break; case ACKEY_PLAYTIME: lSec=LONGFROMMP(mp2); lSec/=(44100*4); /* Playtime */ getMessage(title, IDSTR_PMWAVEINFOPLAYTIME, sizeof(title), RESSOURCEHANDLE, hwnd); sprintf(text, title, lSec/60, lSec%60); WinSetWindowText(WinWindowFromID(hwnd,IDST_PLAYTIME),text); break; default: break; } return FALSE; case WM_CLOSE: WinQueryWindowPos(hwnd,&swpWindow); WinDismissDlg(hwnd,0); return FALSE; case WM_COMMAND: switch(SHORT1FROMMP(mp1)) { case IDPB_OK: /* User pressed the OK button */ WinPostMsg(hwnd,WM_CLOSE,0,0); break; default: break; } return (MRESULT) FALSE; default: break; }/* switch */ return WinDefDlgProc( hwnd, msg, mp1, mp2); }
/* This Proc handles the on-the-fly data CD writing */ MRESULT EXPENTRY onTheFlyStatusDialogProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2) { char text[CCHMAXPATH*2+10]; char title[CCHMAXPATH]; char *textPtr; char *textPtr2; static LONG lCDSize; static LONG lImageSize; SWCNTRL swctl; PID pid; switch (msg) { case WM_PAINT: { if(HlpPaintFrame(hwnd, TRUE)) return (MRESULT)0; break; } case WM_INITDLG: WinShowWindow(WinWindowFromID(hwnd,IDPB_STATUSOK),FALSE); WinShowWindow(WinWindowFromID(hwnd,IDPB_SHOWLOG),FALSE); WinShowWindow(WinWindowFromID(hwnd,IDPB_ABORTWRITE), TRUE); /* Hide percent bar which shows the write progress */ WinShowWindow(WinWindowFromID(hwnd,IDSR_PERCENT), FALSE); /* Add switch entry */ memset(&swctl,0,sizeof(swctl)); WinQueryWindowProcess(hwnd,&pid,NULL); swctl.hwnd=hwnd; swctl.uchVisibility=SWL_VISIBLE; swctl.idProcess=pid; swctl.bProgType=PROG_DEFAULT; swctl.fbJump=SWL_JUMPABLE; WinAddSwitchEntry(&swctl); /* Set percent bar to 0. */ WinSetWindowText(WinWindowFromID(hwnd,IDSR_PERCENT),"0#0%"); /* Set dialog font to WarpSans for Warp 4 and above */ if(cwQueryOSRelease()>=40) { WinSetPresParam(hwnd, PP_FONTNAMESIZE,(ULONG)sizeof(DEFAULT_DIALOG_FONT), DEFAULT_DIALOG_FONT ); } /* Custom painting */ setupGroupBoxControl(hwnd, IDGB_CHECKSTATUS); setupStaticTextControl(hwnd, IDST_ACTIONTEXT); /* Show dialog */ if(!bHaveWindowPos) WinSetWindowPos(hwnd,HWND_TOP,0,0,0,0,SWP_ZORDER|SWP_ACTIVATE); else WinSetWindowPos(hwnd,HWND_TOP,swpWindow.x, swpWindow.y, 0, 0, SWP_MOVE|SWP_ZORDER|SWP_ACTIVATE|SWP_SHOW); /* Get writer device from parameter memory */ if((textPtr=strstr(ptrLocalMem, "--device"))!=NULL) if((textPtr2=strchr(textPtr, ' '))!=NULL) if((textPtr2=strchr(++textPtr2, ' '))!=NULL) *textPtr2=0; sprintf(text, "\"%s\"", textPtr); /* First query free CD space */ if(queryFreeDVDSpace(hwnd, text)) { WinPostMsg(hwnd,WM_CLOSE,0,0); return (MRESULT) TRUE; }; if(textPtr2) *textPtr2=' '; return (MRESULT) TRUE; case WM_CLOSE: WinShowWindow(WinWindowFromID(hwnd,IDPB_ABORTWRITE),FALSE); WinShowWindow(WinWindowFromID(hwnd,IDPB_STATUSOK),TRUE); WinShowWindow(WinWindowFromID(hwnd,IDPB_SHOWLOG),TRUE); return FALSE; case WM_COMMAND: switch(SHORT1FROMMP(mp1)) { case IDPB_ABORTWRITE: /* User pressed the ABORT button */ DosBeep(1000,200); bAbort=TRUE; writeLog("User pressed ABORT.\n"); WinPostMsg(hwnd,WM_CLOSE,0,0); break; case IDPB_STATUSOK: WinQueryWindowPos(hwnd,&swpWindow); WinDismissDlg(hwnd,0); break; case IDPB_SHOWLOG: showLogFile(); break; default: break; } case WM_APPTERMINATENOTIFY: if(1) { switch(LONGFROMMP(mp1)) { case ACKEY_ONTHEFLY: /* Writing done. */ WinSendMsg(WinWindowFromID(hwnd,IDLB_CHECKSTATUS),LM_DELETEITEM,MPFROMSHORT(2),0); if(!(LONGFROMMP(mp2))) { /* Tell the folder that we successfully wrote the CD */ /* This message will cause the folder to reset the archive bit if selected */ sendCommand("ONTHEFLYDONE=1"); /* Text: "CD-ROM successfully created." */ getMessage(text, IDSTRLB_CDROMCREATIONSUCCESS, sizeof(text), RESSOURCEHANDLE, hwnd); DosBeep(1000,100); DosBeep(2000,100); DosBeep(3000,100); } else { /* There was an error while writing */ sendCommand("ONTHEFLYDONE=0"); DosBeep(100,200); /* Text: "Error while writing on the fly!" */ getMessage(text, IDSTRLB_ONTHEFLYDVDERROR, sizeof(text), RESSOURCEHANDLE, hwnd); } writeLog(text); writeLog("\n"); WinSendMsg(WinWindowFromID(hwnd,IDLB_CHECKSTATUS),LM_INSERTITEM,MPFROMSHORT(2),text); WinShowWindow(WinWindowFromID(hwnd,IDSR_PERCENT),FALSE); WinPostMsg(hwnd,WM_CLOSE,0,0); WinSetWindowPos(hwnd,HWND_TOP,0,0,0,0,SWP_ZORDER|SWP_ACTIVATE); break; case ACKEY_FIXATING: /* This msg. is sent by the helper process when cdrecord begins with fixating the disk */ WinSendMsg(WinWindowFromID(hwnd,IDLB_CHECKSTATUS),LM_DELETEITEM,MPFROMSHORT(2),0); if(LONGFROMMP(mp2)==0) { /* Text: "Fixating... (may need some minutes)" */ getMessage(text, IDSTRLB_FIXATING, sizeof(text), RESSOURCEHANDLE, hwnd); } else { /* Text: "Writing buffers to CD..." */ getMessage(text, IDSTRLB_WRITINGBUFFERS, sizeof(text), RESSOURCEHANDLE, hwnd); } WinSendMsg(WinWindowFromID(hwnd,IDLB_CHECKSTATUS),LM_INSERTITEM,MPFROMSHORT(2),text); break; case ACKEY_MBWRITTEN: { int iPercent; iPercent=LONGFROMMP(mp2); if(lImageSize<100)/* Catch division by zero trap */ iPercent=0; else iPercent/=(lImageSize/100); if(iPercent>100) iPercent=100; if(iPercent<0) iPercent=0; /* Update percent bar value. The helper prog sends us the actual written Mbytes. */ sprintf(text,"%d#%d%%", iPercent, iPercent); WinSetWindowText(WinWindowFromID(hwnd,IDSR_PERCENT), text); break; } case ACKEY_PRINTSIZE: { FILE * file; /* The PM wrapper requested the imagesize by invoking mkisofs with the -print-size option. The helper prog sends us the # of extents (each 2048bytes) with this msg */ /* Delete previous message in listbox */ WinSendMsg(WinWindowFromID(hwnd,IDLB_CHECKSTATUS),LM_DELETEITEM,MPFROMSHORT(1),0); if(LONGFROMMP(mp2)<=2097152) { /* Put new msg with imagesize into listbox */ /* title: "Imagesize is %d.%0.3d.%0.3d bytes" */ getMessage(title, IDSTRD_IMAGESIZE, sizeof(title), RESSOURCEHANDLE, hwnd); sprintf(text,title, LONGFROMMP(mp2)*2048/1000000,(LONGFROMMP(mp2)*2048%1000000)/1000,LONGFROMMP(mp2)*2048%1000); } else { /* title: "Estimated imagesize is %d Mb" */ getMessage( title, IDSTRD_IMAGESIZESTATUSLINETEXT2, sizeof(title), RESSOURCEHANDLE, hwnd); sprintf(text, title, LONGFROMMP(mp2)*2/1024); } writeLog(text); writeLog("\n"); WinSendMsg(WinWindowFromID(hwnd,IDLB_CHECKSTATUS),LM_INSERTITEM,MPFROMSHORT(1),text); /* Save imagesize. We need it for the percent bar */ lImageSize=LONGFROMMP(mp2); /* mkisofs can't create the image for some reason... */ if(lImageSize==0) { messageBox( text, IDSTRD_CHECKSIZEERRORMULTI, sizeof(text), title, IDSTRD_ONTHEFLYTITLE, sizeof(title), RESSOURCEHANDLE, hwnd, MB_OK | MB_ERROR | MB_MOVEABLE); WinPostMsg(hwnd,WM_CLOSE,0,0); break; } if(LONGFROMMP(mp2) >lCDSize && lCDSize!=0) { /* Text: "Image is bigger than free CD space! [...]. Do you want to proceed?" Title: "On the fly writing" */ if(MBID_NO==messageBox( text, IDSTRPM_IMAGETOBIG , sizeof(text), title, IDSTRD_ONTHEFLYTITLE, sizeof(title), RESSOURCEHANDLE, hwnd, MB_YESNO | MB_WARNING|MB_MOVEABLE)) { WinPostMsg(hwnd,WM_CLOSE,0,0); break; } } /**************************************************************************************************************************************************************/ /* Check if user pressed Abort in the meantime */ if(bAbort) return FALSE; /* Now starting the write process */ if(pipePtr) { *pipePtr='|'; pipePtr++; *pipePtr=' '; } /* Copy updated command line to parameter file */ if((file=fopen(params[4],"wb"))!=NULL) { fwrite(ptrLocalMem, sizeof(char), SHAREDMEM_SIZE, file); fclose(file); } /* Put a message in the listbox */ /* Text: "Writing on the fly..." */ getMessage(text, IDSTR_ONTHEFLYWRITING, sizeof(text), RESSOURCEHANDLE, hwnd); WinSendMsg(WinWindowFromID(hwnd,IDLB_CHECKSTATUS),LM_INSERTITEM,MPFROMSHORT(2),text); /* Hide ABORT Button in the status dialog. We do not let the user interrupt a write because this will damage the CD. */ WinShowWindow(WinWindowFromID(hwnd,IDPB_ABORTWRITE),FALSE); /* Set percent bar value */ WinPostMsg(WinWindowFromID(hwnd,IDSR_PERCENT),WM_UPDATEPROGRESSBAR,MPFROMLONG(0),MPFROMLONG(lImageSize)); /* Show percent bar which shows the write progress */ WinShowWindow(WinWindowFromID(hwnd,IDSR_PERCENT),TRUE); /* logfilename as a parameter */ buildLogName(title, logName, sizeof(title)); // snprintf(text, sizeof(text), "\"%s\"" ,title); snprintf(text, sizeof(text), "\"%s\" \"%s\"" ,params[4], title); /* Launch the helper program */ /* Title: "On the fly VIO helper" */ getMessage(title, IDSTRVIO_ONTHEFLY, sizeof(title), RESSOURCEHANDLE, hwnd); launchWrapper( text, chrInstallDir, hwnd, "dvdthefly.exe", title); break; } case ACKEY_CDSIZE: { FILE * file; /* This msg is sent by the helper prog after getting the actual free space of the inserted CD */ /* Save CD-Size */ lCDSize=LONGFROMMP(mp2); /* Delete previous Message in the listbox */ WinSendMsg(WinWindowFromID(hwnd,IDLB_CHECKSTATUS),LM_DELETEITEM,MPFROMSHORT(0),0); if(lCDSize==0) { /* There was an error. */ /* Title: "Writing CD" Text: "Can't query free CD space! On some systems detection of free CD space fails so you may override this message if you know what you're doing! Do you want to proceed with writing? " */ writeLog("Can't query CD-size. Returned value is 0.\n"); writeLog("\n"); if(MBID_NO==queryFreeCDSpaceError(hwnd)) { WinPostMsg(hwnd, WM_CLOSE,0,0); return FALSE; } } /* Delete check size error message in listbox */ WinSendMsg(WinWindowFromID(hwnd,IDLB_CHECKSTATUS),LM_DELETEITEM,MPFROMSHORT(0),0); if(LONGFROMMP(mp2)<=2097152) { /* Insert the CD size into the listbox to inform the user */ /* title: "Free CD space is %d.%0.3d.%0.3d bytes" */ getMessage(title, IDSTRLB_FREECDSPACE, sizeof(title), RESSOURCEHANDLE, hwnd); sprintf(text,title, LONGFROMMP(mp2)*2048/1000000,(LONGFROMMP(mp2)*2048%1000000)/1000,LONGFROMMP(mp2)*2048%1000); } else { getMessage( title, IDSTR_CDSIZESTATUSLINETEXT2, sizeof(title), RESSOURCEHANDLE, hwnd); sprintf(text, title, LONGFROMMP(mp2)*2/1024); } WinSendMsg(WinWindowFromID(hwnd,IDLB_CHECKSTATUS),LM_INSERTITEM,MPFROMSHORT(0),text); /* User pressed 'Abort' */ if(bAbort) return FALSE; /* Query image size. This is the second check prior to writing */ /* Put a message into the listbox */ /* Text: "Calculating image size. Please wait..." */ getMessage(text, IDSTRD_CALCULATINGIMAGESIZE, sizeof(text), RESSOURCEHANDLE, hwnd); writeLog(text); writeLog("\n"); WinSendMsg(WinWindowFromID(hwnd,IDLB_CHECKSTATUS),LM_INSERTITEM,MPFROMSHORT(1),text); pipePtr=strchr(ptrLocalMem,'|'); if(pipePtr) { *pipePtr=0; pipePtr++; *pipePtr=0; pipePtr--; } textPtr=strstr(ptrLocalMem,"-o-print-size"); if(textPtr) { *textPtr=' '; textPtr++; *textPtr=' '; } /* Copy updated command line to parameter file */ if((file=fopen(params[4],"wb"))!=NULL) { fwrite(ptrLocalMem, sizeof(char), SHAREDMEM_SIZE, file); fclose(file); } /* logfilename as a parameter */ buildLogName(title, logName, sizeof(title)); snprintf(text, sizeof(text), "\"%s\" \"%s\"" ,params[4], title); /* Launch the helper program */ launchWrapper( text, chrInstallDir, hwnd,"prntsize.exe", "Query image size"); break; } default: break; }/* switch */ }/* if(thisPtr) */ return WinDefWindowProc( hwnd, msg, mp1, mp2); default: break; } return WinDefDlgProc(hwnd, msg, mp1, mp2); }
/* Assigns the 9.WarpSans as default font for a specified window if it is supported by operating system. Otherwise assigns the 8.Helv as default font. */ void do_warpsans( HWND hwnd ) { char *font = check_warpsans() ? "9.WarpSans" : "8.Helv"; WinSetPresParam( hwnd, PP_FONTNAMESIZE, strlen( font ) + 1, font ); }
//A Dlg procedure if the plugin has selectable settings. MRESULT EXPENTRY CBZPluginSetupDlgProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2) { short sControlId; PLUGINSHARE *pPluginData; HOBJECT hObject; switch (msg) { case WM_INITDLG: { short sInsertItem;/*to insert in ListBox*/ CHAR *szLineStyles [] = {"dotted","short-dashed","dash-dot", "double-dotted","long-dashed","dash-double-dot", "solid","invisible","alternate pels" }; if ((pPluginData = (PLUGINSHARE *) mp2) == NULL) { //Error message.. WinDismissDlg(hwnd, DID_ERROR); return (MRFROMLONG(FALSE)); } WinSetWindowPtr(hwnd, QWL_USER, pPluginData); // store window words WinSetPresParam(WinWindowFromID(hwnd, PBID_ACTIVELINECOLOR), PP_BACKGROUNDCOLOR, (ULONG) sizeof(pPluginData->lActiveLineColor), (PVOID) & (pPluginData->lActiveLineColor)); WinSetPresParam(WinWindowFromID(hwnd, PBID_ACTIVESHADOWCOLOR), PP_BACKGROUNDCOLOR, (ULONG) sizeof(pPluginData->lActiveShadowColor), (PVOID) & (pPluginData->lActiveShadowColor)); WinSetPresParam(WinWindowFromID(hwnd, PBID_INACTIVELINECOLOR), PP_BACKGROUNDCOLOR, (ULONG) sizeof(pPluginData->lInactiveLineColor), (PVOID) & (pPluginData->lInactiveLineColor)); WinSetPresParam(WinWindowFromID(hwnd, PBID_INACTIVESHADOWCOLOR), PP_BACKGROUNDCOLOR, (ULONG) sizeof(pPluginData->lInactiveShadowColor), (PVOID) & (pPluginData->lInactiveShadowColor)); if (pPluginData->bActiveEnabled) { WinCheckButton(hwnd, CBID_ACTIVEENABLED, TRUE); WinEnableWindow(WinWindowFromID(hwnd, PBID_ACTIVELINECOLOR), TRUE); WinEnableWindow(WinWindowFromID(hwnd, PBID_ACTIVESHADOWCOLOR), TRUE); } else { WinCheckButton(hwnd, CBID_ACTIVEENABLED, FALSE); WinEnableWindow(WinWindowFromID(hwnd, PBID_ACTIVELINECOLOR), FALSE); WinEnableWindow(WinWindowFromID(hwnd, PBID_ACTIVESHADOWCOLOR), FALSE); } if (pPluginData->bInactiveEnabled) { WinCheckButton(hwnd, CBID_INACTIVEENABLED, TRUE); WinEnableWindow(WinWindowFromID(hwnd, PBID_INACTIVELINECOLOR), TRUE); WinEnableWindow(WinWindowFromID(hwnd, PBID_INACTIVESHADOWCOLOR), TRUE); } else { WinCheckButton(hwnd, CBID_INACTIVEENABLED, FALSE); WinEnableWindow(WinWindowFromID(hwnd, PBID_INACTIVELINECOLOR), FALSE); WinEnableWindow(WinWindowFromID(hwnd, PBID_INACTIVESHADOWCOLOR), FALSE); } /*there are 9 line styles*/ for (sInsertItem=0; sInsertItem < 9; sInsertItem++) { WinSendDlgItemMsg (hwnd, LBID_LINESTYLE, LM_INSERTITEM, MPFROMSHORT (LIT_END), szLineStyles [sInsertItem]); } WinSendDlgItemMsg (hwnd, LBID_LINESTYLE, LM_SELECTITEM, MPFROMSHORT(pPluginData->lLineStyle-1), MPFROMSHORT(TRUE)); } break; case WM_COMMAND: { sControlId = COMMANDMSG(&msg)->cmd; switch (sControlId) { case PBID_ACTIVELINECOLOR: case PBID_ACTIVESHADOWCOLOR: case PBID_INACTIVELINECOLOR: case PBID_INACTIVESHADOWCOLOR: { // Open the colorpalette hObject=WinQueryObject("<WP_HIRESCLRPAL>"); if((hObject=WinQueryObject("<WP_HIRESCLRPAL>"))!=NULLHANDLE) { WinOpenObject(hObject, OPEN_DEFAULT ,TRUE); } else {//Error, can't open the palette /* Show an error msg. */ WinMessageBox(HWND_DESKTOP, hwnd, "Can't open color palette", "Gradient plugin", 12345, /* Window ID */ MB_OK | MB_MOVEABLE | MB_ICONEXCLAMATION | MB_DEFBUTTON1); /* Style */ } /* long lColor; if (sControlId == PBID_ACTIVELINECOLOR) { if (CBZGetColor(hwnd, &lColor)) { WinSetPresParam(WinWindowFromID(hwnd, PBID_ACTIVELINECOLOR), PP_BACKGROUNDCOLOR, (ULONG) sizeof(lColor), (PVOID) &lColor ); } } else if (sControlId == PBID_ACTIVESHADOWCOLOR) { if (CBZGetColor(hwnd, &lColor)) { WinSetPresParam(WinWindowFromID(hwnd, PBID_ACTIVESHADOWCOLOR), PP_BACKGROUNDCOLOR, (ULONG) sizeof(lColor), (PVOID) &lColor ); } } else if (sControlId == PBID_INACTIVELINECOLOR) { if (CBZGetColor(hwnd, &lColor)) { WinSetPresParam(WinWindowFromID(hwnd, PBID_INACTIVELINECOLOR), PP_BACKGROUNDCOLOR, (ULONG) sizeof(lColor), (PVOID) &lColor ); } } else if (sControlId == PBID_INACTIVESHADOWCOLOR) { if (CBZGetColor(hwnd, &lColor)) { WinSetPresParam(WinWindowFromID(hwnd, PBID_INACTIVESHADOWCOLOR), PP_BACKGROUNDCOLOR, (ULONG) sizeof(lColor), (PVOID) &lColor ); } }*/ } break; case PBID_OK: { ULONG attrFound; if ((pPluginData = (PLUGINSHARE *) WinQueryWindowPtr(hwnd, QWL_USER)) == NULL) { //error message here. break; } WinQueryPresParam(WinWindowFromID(hwnd, PBID_ACTIVELINECOLOR), PP_BACKGROUNDCOLOR, 0, &attrFound, sizeof(attrFound), &(pPluginData->lActiveLineColor), QPF_PURERGBCOLOR); WinQueryPresParam(WinWindowFromID(hwnd, PBID_ACTIVESHADOWCOLOR), PP_BACKGROUNDCOLOR, 0, &attrFound, sizeof(attrFound), &(pPluginData->lActiveShadowColor), QPF_PURERGBCOLOR); WinQueryPresParam(WinWindowFromID(hwnd, PBID_INACTIVELINECOLOR), PP_BACKGROUNDCOLOR, 0, &attrFound, sizeof(attrFound), &(pPluginData->lInactiveLineColor), QPF_PURERGBCOLOR); WinQueryPresParam(WinWindowFromID(hwnd, PBID_INACTIVESHADOWCOLOR), PP_BACKGROUNDCOLOR, 0, &attrFound, sizeof(attrFound), &(pPluginData->lInactiveShadowColor), QPF_PURERGBCOLOR); if ( WinQueryButtonCheckstate(hwnd, CBID_ACTIVEENABLED) ) pPluginData->bActiveEnabled = TRUE; else pPluginData->bActiveEnabled = FALSE; if ( WinQueryButtonCheckstate(hwnd, CBID_INACTIVEENABLED) ) pPluginData->bInactiveEnabled = TRUE; else pPluginData->bInactiveEnabled = FALSE; pPluginData->lLineStyle = 1 + (LONG) WinSendDlgItemMsg (hwnd, LBID_LINESTYLE, LM_QUERYSELECTION, (MPARAM) 0, NULL); //update! WinDismissDlg(hwnd, PBID_OK); } break; case PBID_CANCEL: { //don't update shared Memory! WinDismissDlg(hwnd, PBID_CANCEL); } break; } return ((MPARAM) 0); } break; case WM_CONTROL: { switch (SHORT1FROMMP(mp1)) { case CBID_ACTIVEENABLED: { // if Enabled if (!WinQueryButtonCheckstate(hwnd, CBID_ACTIVEENABLED)) { // check button WinCheckButton(hwnd, CBID_ACTIVEENABLED, TRUE); WinEnableWindow(WinWindowFromID(hwnd, PBID_ACTIVELINECOLOR), TRUE); WinEnableWindow(WinWindowFromID(hwnd, PBID_ACTIVESHADOWCOLOR), TRUE); } else { // uncheck button WinCheckButton(hwnd, CBID_ACTIVEENABLED, FALSE); WinEnableWindow(WinWindowFromID(hwnd, PBID_ACTIVELINECOLOR), FALSE); WinEnableWindow(WinWindowFromID(hwnd, PBID_ACTIVESHADOWCOLOR), FALSE); } } break; case CBID_INACTIVEENABLED: { // if Enabled if (!WinQueryButtonCheckstate(hwnd, CBID_INACTIVEENABLED)) { // check button WinCheckButton(hwnd, CBID_INACTIVEENABLED, TRUE); WinEnableWindow(WinWindowFromID(hwnd, PBID_INACTIVELINECOLOR), TRUE); WinEnableWindow(WinWindowFromID(hwnd, PBID_INACTIVESHADOWCOLOR), TRUE); } else { // uncheck button WinCheckButton(hwnd, CBID_INACTIVEENABLED, FALSE); WinEnableWindow(WinWindowFromID(hwnd, PBID_INACTIVELINECOLOR), FALSE); WinEnableWindow(WinWindowFromID(hwnd, PBID_INACTIVESHADOWCOLOR), FALSE); } } break; } return ((MRESULT) 0); } break; } return (WinDefDlgProc(hwnd, msg, mp1, mp2)); }
static void skinChild(HWND h, ICQFRAME *cfg, const char *name, const char *defName, const char *defFont, SKINFILESECTION *fl) { ULONG bg = 0x00D1D1D1; ULONG fg = 0x00000040; ULONG wrk; char buffer[0x0100]; const char *ptr; if(cfg) { bg = cfg->pal[ICQCLR_BACKGROUND]; fg = cfg->pal[ICQCLR_FOREGROUND]; } // Element font sprintf(buffer,"%s.Font",defName); DBGMessage(buffer); ptr = getSkinInfo(cfg, buffer, name, fl); if(ptr) { DBGMessage(ptr); icqskin_setButtonFont(h,ptr); } else { icqskin_setButtonFont(h,defFont); } // Foreground color sprintf(buffer,"%s.Foreground",defName); ptr = getSkinInfo(cfg, buffer, name, fl); if(!ptr) ptr = getSkinInfo(cfg, "Foreground", name, fl); if(ptr) { wrk = icqskin_loadPalleteFromString(ptr); WinSetPresParam(h,PP_FOREGROUNDCOLOR,sizeof(ULONG),&wrk); } else { WinSetPresParam(h,PP_FOREGROUNDCOLOR,sizeof(ULONG),&bg); } // Background color sprintf(buffer,"%s.Background",defName); ptr = getSkinInfo(cfg, buffer, name, fl); if(!ptr) ptr = getSkinInfo(cfg, "Background", name, fl); if(ptr) { wrk = icqskin_loadPalleteFromString(ptr); WinSetPresParam(h,PP_BACKGROUNDCOLOR,sizeof(ULONG),&wrk); } else { WinSetPresParam(h,PP_BACKGROUNDCOLOR,sizeof(ULONG),&bg); } }
MRESULT EXPENTRY tButProc( HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2 ) { HWND hwndFly = WinQueryWindowULong( hwnd, QWL_USER ); switch( msg ) { case WM_MOUSEMOVE: { if( !hwndFly && useBubbles ) WinStartTimer( 0, hwnd, 1 /* unused id */, 500 ); return ( *oldButProc )( hwnd, msg, mp1, mp2 ); } break; case WM_TIMER: { RGB rgb; HPS hps; HAB hab; RECTL rectl; ULONG breite, hoehe; POINTL p; char str[200]; if( hwndFly ) break; hab = WinQueryAnchorBlock( hwnd ); WinLoadString( hab, NULLHANDLE, WinQueryWindowUShort( hwnd, QWS_ID ), sizeof( str ), str ); hwndFly = WinCreateWindow( HWND_DESKTOP, WC_STATIC, str, SS_TEXT | DT_VCENTER | DT_CENTER, 0, 0, 0, 0, hwnd, HWND_TOP, 0, 0, NULL ); rgb.bBlue = 0; rgb.bGreen = 254; rgb.bRed = 254; WinSetPresParam( hwndFly, PP_BACKGROUNDCOLOR, sizeof( RGB ), &rgb ); rgb.bBlue = 0; rgb.bGreen = 0; rgb.bRed = 0; WinSetPresParam( hwndFly, PP_FOREGROUNDCOLOR, sizeof( RGB ), &rgb ); WinSetPresParam( hwndFly, PP_FONTNAMESIZE, sizeof( DefCntrFont ), DefCntrFont ); queryDimensions( hwndFly, str, &breite, &hoehe ); WinQueryPointerPos( HWND_DESKTOP, &p ); p.y -= WinQuerySysValue( HWND_DESKTOP, SV_CYTITLEBAR ); p.y -= hoehe/2; p.x += 5; WinSetWindowPos( hwndFly, HWND_TOP, p.x, p.y, breite+4, hoehe+2, SWP_SHOW | SWP_MOVE | SWP_SIZE ); WinSetWindowULong( hwnd, QWL_USER, (ULONG) hwndFly ); } break; case UM_FLYOVER_BEGIN: useBubbles = 1; break; case UM_FLYOVER_END: WinStopTimer( 0, hwnd, 1 /* unused id */ ); if( hwndFly ) WinDestroyWindow( hwndFly ); WinSetWindowULong( hwnd, QWL_USER, 0 ); break; default: return ( *oldButProc )( hwnd, msg, mp1, mp2 ); } return FALSE; }
/* This Proc handles the ISO image mounting */ MRESULT EXPENTRY unmountIsoDialogProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2) { char text[CCHMAXPATH]; char title[CCHMAXPATH]; ULONG rc; SWCNTRL swctl; PID pid; switch (msg) { case WM_INITDLG: { BOOL bDone=FALSE; int i; writeLog("Initializing dialog...\n"); /* Add switch entry */ memset(&swctl,0,sizeof(swctl)); WinQueryWindowProcess(hwnd,&pid,NULL); swctl.hwnd=hwnd; swctl.uchVisibility=SWL_VISIBLE; swctl.idProcess=pid; swctl.bProgType=PROG_DEFAULT; swctl.fbJump=SWL_JUMPABLE; WinAddSwitchEntry(&swctl); /*sprintf(text,"%d",params[4]);*/ // sprintf(text,"params[1]: %s ",params[1]); /* WinMessageBox( HWND_DESKTOP, HWND_DESKTOP, pvSharedMem, params[4], 0UL, MB_OK | MB_ICONEXCLAMATION|MB_MOVEABLE ); WinPostMsg(hwnd,WM_CLOSE,0,0); return (MRESULT) TRUE; */ /* Get free drive letters */ if((rc=DosQueryCurrentDisk(&ulDriveNum, &ulDriveMap))!=NO_ERROR) WinPostMsg(hwnd,WM_CLOSE,0,0); DosError(FERR_DISABLEHARDERR); for(i=2;i<26;i++) { if(( (ulDriveMap << (31-i)) >>31)) { char chrDrive[3]="A:"; BYTE fsqBuf2[sizeof(FSQBUFFER2)+3*CCHMAXPATH]={0}; PFSQBUFFER2 pfsqBuf2=(PFSQBUFFER2) &fsqBuf2; ULONG ulLength; /* Get FS */ chrDrive[0]='A'+i; ulLength=sizeof(fsqBuf2); if(DosQueryFSAttach(chrDrive,0L,FSAIL_QUERYNAME, (PFSQBUFFER2)&fsqBuf2, &ulLength)==NO_ERROR) { if(!strcmp(pfsqBuf2->szName+pfsqBuf2->cbName+1,"ISOFS")) { FSINFO fsInfo; if(DosQueryFSInfo(i+1, FSIL_VOLSER, &fsInfo,sizeof(fsInfo))==NO_ERROR) sprintf(text, "%s (%s)",chrDrive, fsInfo.vol.szVolLabel); else sprintf(text, "%s (unknown)",chrDrive); WinSendMsg(WinWindowFromID(hwnd, IDLB_UNMOUNTLETTER),LM_INSERTITEM,MPFROMSHORT(LIT_END),MPFROMP(text)); } } else printf("%s %s\n",chrDrive, "---"); } } DosError(FERR_ENABLEHARDERR); /* Set dialog font to WarpSans for Warp 4 and above */ if(cwQueryOSRelease()>=40) { WinSetPresParam(hwnd, PP_FONTNAMESIZE,(ULONG)sizeof(DEFAULT_DIALOG_FONT), DEFAULT_DIALOG_FONT ); } if(!bHaveWindowPos) WinSetWindowPos(hwnd,HWND_TOP,0,0,0,0,SWP_ZORDER|SWP_ACTIVATE); else WinSetWindowPos(hwnd,HWND_TOP,swpWindow.x, swpWindow.y, 0, 0, SWP_MOVE|SWP_ZORDER|SWP_ACTIVATE|SWP_SHOW); return (MRESULT) TRUE; } case WM_CLOSE: WinQueryWindowPos(hwnd,&swpWindow); WinDismissDlg(hwnd,0); return FALSE; case WM_HELP: sendCommand("DISPLAYHELPPANEL=5100"); break; case WM_COMMAND: switch(SHORT1FROMMP(mp1)) { case IDPB_UNMOUNT: { /* User pressed the Unount button */ AEFS_DETACH detachparms={0}; char pszDrive[3]={0}; HOBJECT hObject; SHORT sSelected; memset(&detachparms, 0, sizeof(detachparms)); /* Get the drive letter */ sSelected=SHORT1FROMMR(WinSendMsg(WinWindowFromID(hwnd, IDLB_UNMOUNTLETTER),LM_QUERYSELECTION, MPFROMSHORT(LIT_FIRST),MPFROMLONG(0L))); if(sSelected==LIT_NONE) break; WinSendMsg(WinWindowFromID(hwnd, IDLB_UNMOUNTLETTER),LM_QUERYITEMTEXT, MPFROM2SHORT(sSelected,2),MPFROMP(pszDrive)); /* Send the attachment request to the FSD. */ rc = DosFSAttach( // (PSZ) "", (PSZ) pszDrive, (PSZ) AEFS_IFS_NAME, &detachparms, sizeof(detachparms), FS_DETACH); if (rc) { DosBeep(100,400); sprintf(text, "Error while unmounting rc=%d. Make sure there're no open files on the drive.\n", rc); WinMessageBox( HWND_DESKTOP, HWND_DESKTOP, text, "ISO image unmount error", 0UL, MB_OK | MB_ICONEXCLAMATION|MB_MOVEABLE ); }else { WinSendMsg(WinWindowFromID(hwnd, IDLB_UNMOUNTLETTER),LM_DELETEITEM, MPFROMSHORT(sSelected),MPFROMLONG(0L)); sSelected=SHORT1FROMMR(WinSendMsg(WinWindowFromID(hwnd, IDLB_UNMOUNTLETTER),LM_QUERYITEMCOUNT, MPFROMLONG(0L),MPFROMLONG(0L))); if(sSelected==0) WinEnableWindow(WinWindowFromID(hwnd,IDPB_UNMOUNT), FALSE); } break; } case IDPB_UNMOUNTCLOSE: WinPostMsg(hwnd,WM_CLOSE,0,0); break; default: break; } return (MRESULT) FALSE; default: break; } return WinDefDlgProc(hwnd, msg, mp1, mp2); }