nsCOMPtr<nsIPrintOptions> printOptionsService = do_GetService("@mozilla.org/gfx/printoptions;1");
static pascal TPPrDlg MyJobDlgInit(THPrint aHPrint){  PRInt32 i;  short   itemType;  Handle  itemH;  Rect    itemBox;  PRBool  isOn;  PRInt16 howToEnableFrameUI = nsIPrintOptions::kFrameEnableNone;  prFirstItem = AppendToDialog(gPrtJobDialog, DITL_ADDITIONS);  nsCOMPtr<nsIPrintOptions> printOptionsService = do_GetService("@mozilla.org/gfx/printoptions;1");  if (printOptionsService) {    printOptionsService->GetPrintOptions(nsIPrintOptions::kPrintOptionsEnableSelectionRB, &isOn);    printOptionsService->GetHowToEnableFrameUI(&howToEnableFrameUI);  }  ::GetDialogItem((DialogPtr) gPrtJobDialog, prFirstItem+ePrintSelectionCheckboxID-1, &itemType, &itemH, &itemBox);  if ( isOn ) {    ::HiliteControl((ControlHandle)itemH, 0);  } else {    ::HiliteControl((ControlHandle)itemH, 255);   }    gPrintSelection = PR_FALSE;  ::SetControlValue((ControlHandle) itemH, gPrintSelection);  if (howToEnableFrameUI == nsIPrintOptions::kFrameEnableAll) {    for (i = ePrintFrameAsIsCheckboxID; i <= ePrintAllFramesCheckboxID; i++){      ::GetDialogItem((DialogPtr) gPrtJobDialog, prFirstItem+i-1, &itemType, &itemH, &itemBox);      ::SetControlValue((ControlHandle) itemH, (i==4));      ::HiliteControl((ControlHandle)itemH, 0);    }  }  else if (howToEnableFrameUI == nsIPrintOptions::kFrameEnableAsIsAndEach) {    for (i = ePrintFrameAsIsCheckboxID; i <= ePrintAllFramesCheckboxID; i++){      ::GetDialogItem((DialogPtr) gPrtJobDialog, prFirstItem+i-1, &itemType, &itemH, &itemBox);      ::SetControlValue((ControlHandle) itemH, (i==4));      if ( i == 3){        ::HiliteControl((ControlHandle)itemH, 255);      }    }  }  else {    for (i = ePrintFrameAsIsCheckboxID; i <= ePrintAllFramesCheckboxID; i++){      ::GetDialogItem((DialogPtr) gPrtJobDialog, prFirstItem+i-1, &itemType, &itemH, &itemBox);      ::SetControlValue((ControlHandle) itemH, FALSE);      ::HiliteControl((ControlHandle)itemH, 255);     }  }    // attach our handler  prPItemProc = gPrtJobDialog->pItemProc;  gPrtJobDialog->pItemProc = NewPItemUPP(MyJobItems);  // attach a draw routine  gDrawListUPP = NewUserItemProc(MyBBoxDraw);  ::GetDialogItem((DialogPtr)gPrtJobDialog, prFirstItem+eDrawFrameID-1, &itemType, &itemH, &itemBox);  ::SetDialogItem((DialogPtr)gPrtJobDialog, prFirstItem+eDrawFrameID-1, itemType, (Handle)gDrawListUPP, &itemBox);  return gPrtJobDialog;}