/* Global Download Editor - DMS - February 2003 - by Bob Le Gob */ /******************************************************************************* Variables *******************************************************************************/ typeof winEditor = ObjWin;; /* Editor window */ typeof winCZB_Col = ObjWin;; /* Client Zone Background : Color window */ typeof winDPB_Col = ObjWin;; /* Download Progress Bar : Color window */ typeof winDAC_Col = ObjWin;; /* Download Activity Cursor : Color window */ typeof tabWin = tab ObjWin;; /* Windows table: 0-Background, 1-Progress, 2-Activity */ typeof txtCZB_Title = ObjText;; /* Client Zone Background : Title */ typeof txtCZB_File = ObjText;; /* Client Zone Background : File */ typeof txtDPB_Title = ObjText;; /* Download Progress Bar : Title */ typeof txtDAC_Title = ObjText;; /* Download Activity Cursor : Title */ typeof butCZB_Bmp = ObjButton;; /* Client Zone Background : Change bitmap button */ typeof butCZB_Col = ObjButton;; /* Client Zone Background : Change color button */ typeof butDPB_Col = ObjButton;; /* Download Progress Bar : Change color button */ typeof butDAC_Col = ObjButton;; /* Download Activity Cursor : Change color button */ typeof chkCZB_Bmp = ObjCheck;; /* Client Zone Background : Bmp checkbox */ typeof chkCZB_Col = ObjCheck;; /* Client Zone Background : Color checkbox */ typeof tabChk = tab ObjCheck;; /* Checkboxes table used for Radio Buttons */ var iBgCol = 0x000000;; /* Default background color */ var iPgCol = 0xFFFFFF;; /* Default progress bar color */ var iCrCol = 0x7F7F7F;; /* Default activity cursor color */ typeof tabCol = tab I;; /* Colors table : 0-background, 1-progress, 2-activity */ /******************************************************************************* Functions *******************************************************************************/ /******************************************************************************* Functions: Secondary Functions *******************************************************************************/ /******************************************************************************* cbBmpFileChosen() - box -> OpenBox : File selection box p -> u0 : Not used <- I : Not used *******************************************************************************/ fun cbBmpFileChosen(box, p, path) = if (path == nil) then 0 else ( _SETtext txtCZB_File _PtoScol path; _SETcheck tabChk.0 1; _SETcheck tabChk.1 0; 0; );; /******************************************************************************* cbColorChosen() - Color chosen callback col -> I : New color p -> I : 0-Background color, 1-progress bar color <- I : Not used *******************************************************************************/ fun cbColorChosen(col, p) = if (col == nil) then 0 else ( set tabCol.p = col; if (p == 0) then ( _SETcheck tabChk.0 0; _SETcheck tabChk.1 1; 0; ) else 0; _PAINTwindow tabWin.p; 0; );; /******************************************************************************* SaveSupplementalData() - Saving supplemental DMI data <- [[S r1] r1] : Supplemental data *******************************************************************************/ fun SaveSupplementalData() = if ((_GETcheck chkCZB_Bmp) == 1) then ("bgBmp"::(_GETtext txtCZB_File)::nil):: ("registerF"::(_GETtext txtCZB_File)::nil):: ("clientNeeded"::(_GETtext txtCZB_File)::nil):: ("pgCol"::(itoa tabCol.1)::nil):: ("crCol"::(itoa tabCol.2)::nil):: nil else ("bgCol"::(itoa tabCol.0)::nil):: ("pgCol"::(itoa tabCol.1)::nil):: ("crCol"::(itoa tabCol.2)::nil):: nil;; /******************************************************************************* Functions: Editor's main callbacks *******************************************************************************/ /******************************************************************************* cbCheck() - Checkboxes click callback chk -> ObjCheck : Clicked checkbox p -> I : 0-bitmap, 1-color checkbox status -> I : Not used <- I : Not used *******************************************************************************/ fun cbCheck(chk, p, status) = _SETcheck tabChk.p 1; _SETcheck tabChk.(1-p)0; 0;; /******************************************************************************* cbPaint() - Color windows paint callback win -> ObjWin : Painted window p -> I : 0-background window, 1-progress bar window <- I : Not used *******************************************************************************/ fun cbPaint(win, p) = _PAINTrectangle win 0 0 200 20 DRAW_INVISIBLE nil nil DRAW_SOLID tabCol.p; 0;; /******************************************************************************* cbClick_CZB_Bmp() - Change bitmap button click callback but -> ObjButton : Clicked button p -> I : Not used <- I : Not used *******************************************************************************/ fun cbClick_CZB_Bmp(but, p) = _DLGrflopen (_DLGOpenFile _channel nil nil nil "bitmap (*.bmp,*.jpg)\0*.BMP;*.JPG;*.JPEG\0\0") @cbBmpFileChosen nil; 0;; /******************************************************************************* cbClick_Col() - Change color buttons click callback but -> ObjButton : Clicked button p -> I : 0-Background color button, 1-progress bar color button <- I : Not used *******************************************************************************/ fun cbClick_Col(but, p) = _CRcolorMap _channel winEditor 100 100 (_locEditor "KW_CHGCOL" nil) (mkfun2 @cbColorChosen p) tabCol.p; 0;; /******************************************************************************* cbSave() - Standard callback - Saving parameters filename -> S : Not used n -> S : Not used <- [[S r1] r1] : DMI block *******************************************************************************/ fun cbSave(filename, n)= ("action"::"start"::nil):: ("action"::"destroy"::nil):: ("actionC"::"register_download"::nil):: ("actionC"::"register_file"::nil):: ("event"::"started"::nil):: ("event"::"destroyed"::nil):: ("event"::"ended"::nil):: ("zoneC"::"GlobalDownload"::nil):: SaveSupplementalData;; /******************************************************************************* cbLoad() - Standard callback - Loading parameters l -> [[S r1] r1] : DMI block <- I : Not used *******************************************************************************/ fun cbLoad(l)= if (l == nil) then 0 else let hd l -> [h t] in if !strcmp h "bgBmp" then ( if ((_checkpack hd t) != nil) then ( _SETtext txtCZB_File hd t; _SETcheck chkCZB_Col 0; _SETcheck chkCZB_Bmp 1; 0; ) else ( _DLGMessageBox _channel nil (_locEditor "KW_CHKERR" nil) (hd t) 0; 0; ); cbLoad tl l; ) else if !strcmp h "bgCol" then ( set tabCol.0 = atoi hd t; cbLoad tl l; ) else if !strcmp h "pgCol" then ( set tabCol.1 = atoi hd t; cbLoad tl l; ) else if !strcmp h "crCol" then ( set tabCol.2 = atoi hd t; cbLoad tl l; ) else cbLoad tl l;; /******************************************************************************* Functions: Editor's main function *******************************************************************************/ /******************************************************************************* IniEditor() - Standard IniEditor function param -> S : Not used <- I : Not used *******************************************************************************/ fun IniEditor(param)= let startEditor _channel nil 0 0 336 180 WN_MENU EDITOR_NORMAL nil nil nil nil @cbLoad @cbSave nil -> ed in ( set winEditor = getEditWin ed; set txtCZB_Title = _CRtext _channel winEditor 4 4 328 20 ET_ALIGN_CENTER|ET_BORDER _locEditor "KW_CZBTITLE" nil; set chkCZB_Bmp = _CRcheck _channel winEditor 4 28 60 20 0 _locEditor "KW_BMP" nil; set txtCZB_File = _CRtext _channel winEditor 68 28 200 20 ET_ALIGN_LEFT|ET_BORDER|ET_AHSCROLL ""; set butCZB_Bmp = _CRbutton _channel winEditor 272 28 60 20 0 _locEditor "KW_CHG" nil; set chkCZB_Col = _CRcheck _channel winEditor 4 52 60 20 0 _locEditor "KW_COL" nil; set winCZB_Col = _CRwindow _channel winEditor 68 52 198 18 WN_CHILD "CZB_COL"; set butCZB_Col = _CRbutton _channel winEditor 272 52 60 20 0 _locEditor "KW_CHG" nil; _CBwinPaint winCZB_Col @cbPaint 0; _CBcheck chkCZB_Bmp @cbCheck 0; _CBbutton butCZB_Bmp @cbClick_CZB_Bmp nil; _CBcheck chkCZB_Col @cbCheck 1; _CBbutton butCZB_Col @cbClick_Col 0; _SETcheck chkCZB_Col 1; set txtDPB_Title = _CRtext _channel winEditor 4 80 328 20 ET_ALIGN_CENTER|ET_BORDER _locEditor "KW_DPBTITLE" nil; set winDPB_Col = _CRwindow _channel winEditor 68 104 198 18 WN_CHILD "DPB_COL"; set butDPB_Col = _CRbutton _channel winEditor 272 104 60 20 0 _locEditor "KW_CHG" nil; _CBwinPaint winDPB_Col @cbPaint 1; _CBbutton butDPB_Col @cbClick_Col 1; set txtDAC_Title = _CRtext _channel winEditor 4 132 328 20 ET_ALIGN_CENTER|ET_BORDER _locEditor "KW_DACTITLE" nil; set winDAC_Col = _CRwindow _channel winEditor 68 156 198 18 WN_CHILD "DAC_COL"; set butDAC_Col = _CRbutton _channel winEditor 272 156 60 20 0 _locEditor "KW_CHG" nil; _CBwinPaint winDAC_Col @cbPaint 2; _CBbutton butDAC_Col @cbClick_Col 2; set tabWin = listtotab winCZB_Col::winDPB_Col::winDAC_Col::nil; set tabChk = listtotab chkCZB_Bmp::chkCZB_Col::nil; set tabCol = listtotab iBgCol::iPgCol::iCrCol::nil; openDMI ed; ); 0;;