📄 readwinp.c
字号:
Widget forward822PB = XmCreatePushButton(replyPD, "forward822PB", 0,0); Widget resendPB = XmCreatePushButton(replyPD, "resendPB", 0,0);//// Manage widgets// wcount = 0; wlist[wcount++] = replyPB; wlist[wcount++] = replyIncPB; wlist[wcount++] = replyAllPB; wlist[wcount++] = replyAllIncPB; wlist[wcount++] = replySep1; wlist[wcount++] = forwardPB; wlist[wcount++] = forward822PB; wlist[wcount++] = resendPB; XtManageChildren(wlist, wcount);//// Add callbacks// AddActivate(replyPB, DoReply, this); AddActivate(replyIncPB, DoReplyInc, this); AddActivate(replyAllPB, DoReplyAll, this); AddActivate(replyAllIncPB, DoReplyAllInc, this); AddActivate(forwardPB, DoForward, this); AddActivate(forward822PB, DoForward822, this); AddActivate(resendPB, DoResend, this);} // End BuildReplyMenu/*--------------------------------------------------------------- * Method to build the option menu hierarchy */voidReadWinP::BuildOptMenu(){ Cardinal wcount; Widget wlist[8];//// Create cascade button and pulldown menu// Widget optCB = XmCreateCascadeButton(pub->menuBar, "optCB", 0,0); Widget optPD = XmCreatePulldownMenu(pub->menuBar, "optPD", 0,0); XtVaSetValues(optCB, XmNsubMenuId, optPD, NULL); XtManageChild(optCB);//// Create optPD hierarchy//// optPD// PushButton optPrefPB// PushButton optButtPB// PushButton optHeadTB// PushButton optWrapTB// CascadeButton optViewCB// PulldownMenu optViewPD// Widget optPrefPB; Widget optButtPB; if ( pub->fullFunction ) { optPrefPB = XmCreatePushButton(optPD, "optPrefPB", 0,0); optButtPB = XmCreatePushButton(optPD, "optButtPB", 0,0); } optHeadTB = XmCreateToggleButton (optPD, "optHeadTB", 0,0); optWrapTB = XmCreateToggleButton (optPD, "optWrapTB", 0,0); optViewCB = XmCreateCascadeButton(optPD, "optViewCB", 0,0); Widget optViewPD = XmCreatePulldownMenu(optPD, "optViewPD", 0,0); XtVaSetValues(optCB, XmNsubMenuId, optPD, NULL); XtVaSetValues(optViewCB, XmNsubMenuId, optViewPD, NULL); XtVaSetValues(optViewPD, XmNradioBehavior, True, NULL); wcount = 0; if ( pub->fullFunction ) { wlist[wcount++] = optPrefPB; wlist[wcount++] = optButtPB; } wlist[wcount++] = optHeadTB; wlist[wcount++] = optWrapTB; wlist[wcount++] = optViewCB; XtManageChildren(wlist, wcount); if ( pub->fullFunction ) { AddActivate(optPrefPB, DoOptPref, this); AddActivate(optButtPB, DoOptButt, this); } AddValueChanged(optHeadTB, DoOptHead, this); AddValueChanged(optWrapTB, DoOptWrap, this);//// Create optViewPD hierarchy//// optViewPD// ToggleButton viewFlatTB// ToggleButton viewOutlineTB// ToggleButton viewNestedTB// ToggleButton viewSourceTB// viewFlatTB = XmCreateToggleButton(optViewPD, "viewFlatTB", 0,0); viewOutlineTB = XmCreateToggleButton(optViewPD, "viewOutlineTB", 0,0); viewNestedTB = XmCreateToggleButton(optViewPD, "viewNestedTB", 0,0); viewSourceTB = XmCreateToggleButton(optViewPD, "viewSourceTB", 0,0); wcount = 0; wlist[wcount++] = viewFlatTB; wlist[wcount++] = viewOutlineTB;// wlist[wcount++] = viewNestedTB; wlist[wcount++] = viewSourceTB; XtManageChildren(wlist, wcount); AddValueChanged(viewFlatTB, DoOptView, this); AddValueChanged(viewOutlineTB, DoOptView, this); AddValueChanged(viewNestedTB, DoOptView, this); AddValueChanged(viewSourceTB, DoOptView, this); XtSetSensitive(optViewCB, False);//// Set initial values// XmToggleButtonSetState(optWrapTB, ishApp->readPrefs->wrap, False); viewType = ishApp->readPrefs->viewType; switch (viewType) { case (READ_VIEW_FLAT): XmToggleButtonSetState(viewFlatTB, True, False); break; case (READ_VIEW_OUTLINE): XmToggleButtonSetState(viewOutlineTB, True, False); break; case (READ_VIEW_CONTAINER): XmToggleButtonSetState(viewNestedTB, True, False); break; case (READ_VIEW_SOURCE): XmToggleButtonSetState(viewSourceTB, True, False); break; }} // End BuildOptMenu/*--------------------------------------------------------------- * Method to build the reading window widgets */voidReadWinP::BuildWidgets(){ WArgList args; Cardinal wcount; Widget wlist[8];//// Create appForm hierarchy//// appForm// Form titleForm// Label msgTitle// ToggleButton pushPinTB// PanedWindow msgPanes// args.Reset(); args.TopAttachment(XmATTACH_FORM); args.LeftAttachment(XmATTACH_FORM); args.RightAttachment(XmATTACH_FORM); args.BottomAttachment(XmATTACH_NONE); Widget titleForm = XmCreateForm(pub->appForm, "titleForm", ARGS); args.Reset(); args.TopAttachment(XmATTACH_NONE); args.LeftAttachment(XmATTACH_FORM); args.RightAttachment(XmATTACH_NONE); args.BottomAttachment(XmATTACH_FORM); msgTitle = XmCreateLabel(titleForm, "msgTitle", ARGS); msgTitleStr = get_string(msgTitle, "labelString", "Message $NUM"); noMsgTitleStr = get_string(msgTitle, "noMessageString", "No messages"); WXmString ws = (char *)noMsgTitleStr; XtVaSetValues(titleForm, XmNresizePolicy, XmRESIZE_NONE, NULL); XtVaSetValues(msgTitle, XmNlabelString, (XmString)ws, NULL); XtVaSetValues(titleForm, XmNresizePolicy, XmRESIZE_ANY, NULL); XtManageChild(msgTitle); pushPinTB = NULL; if ( pub->fullFunction ) { args.Reset(); args.TopAttachment(XmATTACH_NONE); args.LeftAttachment(XmATTACH_NONE); args.RightAttachment(XmATTACH_FORM); args.BottomAttachment(XmATTACH_FORM); pushPinTB = XmCreateToggleButton(titleForm, "pushPinTB", ARGS); XtManageChild(pushPinTB); } // End if fullFunction args.Reset(); args.TopAttachment(XmATTACH_WIDGET, titleForm); args.BottomAttachment(XmATTACH_FORM); args.LeftAttachment(XmATTACH_FORM); args.RightAttachment(XmATTACH_FORM); msgPanes = XmCreatePanedWindow(pub->appForm, "msgPanes", ARGS);//// Create msgPanes hierarchy//// msgPanes// MimeRichTextC msgHeadText// MimeRichTextC msgBodyText// args.Reset(); args.UserData(this); args.Rows(ishApp->readPrefs->visHeadRows); args.Columns(ishApp->readPrefs->visCols); msgHeadText = new MimeRichTextC(msgPanes, "msgHeadText", ARGS); msgHeadText->ResizeWidth(!ishApp->readPrefs->wrap); msgHeadText->SetTextType(TT_PLAIN); XtManageChild(msgHeadText->MainWidget()); args.Reset(); args.UserData(this); args.Rows(ishApp->readPrefs->visBodyRows); args.Columns(ishApp->readPrefs->visCols); msgBodyText = new MimeRichTextC(msgPanes, "msgBodyText", ARGS); msgBodyText->ResizeWidth(!ishApp->readPrefs->wrap); msgBodyText->SetTextType(TT_PLAIN); msgBodyText->SetExcerptString(ishApp->replyPrefs->indentPrefix); XtManageChild(msgBodyText->MainWidget());//// Register text widgets as drop sites for message icons// if ( pub->fullFunction ) { XmDropSiteUnregister(msgHeadText->TextArea()); XmDropSiteUnregister(msgBodyText->TextArea()); Atom impAtoms[1]; impAtoms[0] = ishApp->msgAtom; args.Reset(); args.ImportTargets(impAtoms); args.NumImportTargets(1); args.DragProc((XtCallbackProc)MsgDragOver); args.DropProc((XtCallbackProc)MsgTextDrop); XmDropSiteRegister(msgHeadText->TextArea(), ARGS); XmDropSiteRegister(msgBodyText->TextArea(), ARGS); } wcount = 0; wlist[wcount++] = titleForm; wlist[wcount++] = msgPanes; XtManageChildren(wlist, wcount); // appForm children pub->AddButtonBox();#if 0 if ( !pub->fullFunction ) { Widget okPB = XmCreatePushButton(pub->buttonRC, "okPB", 0,0); Widget helpPB = XmCreatePushButton(pub->buttonRC, "helpPB", 0,0); XtManageChild(okPB); XtManageChild(helpPB); AddActivate(okPB, DoClose, this); AddActivate(helpPB, HalAppC::DoHelp, "helpcard"); }#endif//// Create pixmap for this window's icon// readIcon = new PixmapC(reading_xpm, (Window)*halApp, XDefaultColormapOfScreen(halApp->screen)); if ( readIcon->reg ) XtVaSetValues(*pub, XmNiconPixmap, readIcon->reg, XmNiconMask, readIcon->mask, NULL); BuildMimePopupMenu();//// Add message line// pub->ShowInfoMsg(); pub->HandleHelp();#if 000//// Add callback to finish initialization// XtAddCallback(*this, XmNpopupCallback, (XtCallbackProc)DoPopup, (XtPointer)this);#endif} // End BuildWidgets/*--------------------------------------------------------------- * Method to build the mime graphic popup menu hierarchy */voidReadWinP::BuildMimePopupMenu(){//// Create mimePU hierarchy//// mimePU// PushButton mimePUShowPB// PushButton mimePUHidePB// PushButton mimePUSavePB// PushButton mimePUPrintPB// PushButton mimePUFetchPB// Separator mimePUSep// Label mimePULabel// mimePU = XmCreatePopupMenu(msgBodyText->TextArea(), "mimePU", 0,0); mimePUShowPB = XmCreatePushButton(mimePU, "mimePUShowPB", 0,0); mimePUHidePB = XmCreatePushButton(mimePU, "mimePUHidePB", 0,0); mimePUSavePB = XmCreatePushButton(mimePU, "mimePUSavePB", 0,0); mimePUPrintPB = XmCreatePushButton(mimePU, "mimePUPrintPB", 0,0); mimePUFetchPB = XmCreatePushButton(mimePU, "mimePUFetchPB", 0,0); Widget mimePUSep = XmCreateSeparator (mimePU, "mimePUSep", 0,0); mimePULabel = XmCreateLabel (mimePU, "mimePULabel", 0,0); Cardinal wcount = 0; Widget wlist[7]; wlist[wcount++] = mimePUShowPB; wlist[wcount++] = mimePUHidePB; wlist[wcount++] = mimePUSavePB; wlist[wcount++] = mimePUPrintPB; wlist[wcount++] = mimePUFetchPB; wlist[wcount++] = mimePUSep; wlist[wcount++] = mimePULabel; XtManageChildren(wlist, wcount); AddActivate(mimePUShowPB, DoShowPart, this); AddActivate(mimePUHidePB, DoHidePart, this); AddActivate(mimePUSavePB, DoSavePart, this); AddActivate(mimePUPrintPB, DoPrintPart, this); AddActivate(mimePUFetchPB, DoFetchPart, this);} // End BuildMimePopupMenu/*--------------------------------------------------------------- * Method to read the resources for this window */voidReadWinP::ReadResources(){ Pixel fg = msgBodyText->Foreground(); Pixel bg = msgBodyText->Background(); asciiBg = get_color (*pub, "asciiBackground", bg); imageBg = get_color (*pub, "imageBackground", bg); audioBg = get_color (*pub, "audioBackground", bg); videoBg = get_color (*pub, "videoBackground", bg); asciiFg = get_color (*pub, "asciiForeground", fg); imageFg = get_color (*pub, "imageForeground", fg); audioFg = get_color (*pub, "audioForeground", fg); videoFg = get_color (*pub, "videoForeground", fg); asciiShowStr = get_string(*pub, "asciiShowLabel", "Show"); imageShowStr = get_string(*pub, "imageShowLabel", "Show"); audioShowStr = get_string(*pub, "audioShowLabel", "Play"); videoShowStr = get_string(*pub, "videoShowLabel", "Play"); asciiHideStr = get_string(*pub, "asciiHideLabel", "Hide"); imageHideStr = get_string(*pub, "imageHideLabel", "Hide"); audioHideStr = get_string(*pub, "audioHideLabel", "Stop"); videoHideStr = get_string(*pub, "videoHideLabel", "Stop");} // End ReadResources/*--------------------------------------------------------------- * Method to update the name of the default save folder for this message */voidReadWinP::UpdateSaveFolder(){//// Get the name of the default save folder// ishApp->saveMgr->UpdateSaveFolder(pub->msg);//// Display folder name on button// StringC label = ishApp->saveMgr->curSaveFolder; ishApp->AbbreviateFolderName(label); label = "To: " + label; WXmString wstr = (char*)label; XtVaSetValues(fileSavePB, XmNlabelString, (XmString)wstr, NULL);// This causes too much re-sizing of the custom buttons#if 0//// Update custom button if present// if ( pub->fullFunction ) { Widget custom = buttMgr->ButtonFor(fileSavePB); if ( custom ) XtVaSetValues(custom, XmNlabelString, (XmString)wstr, NULL); }#endif} // End UpdateSaveFolder/*--------------------------------------------------------------- * Method to set button sensitivities */voidReadWinP::EnableButtons(){ MainWinC *mainWin = ishApp->mainWin; u_int folderSelCount = mainWin->FolderVBox().SelItems().size(); MsgC *msg = pub->msg; XtSetSensitive(replyCB, msg != NULL); XtSetSensitive(fileSavePB, msg != NULL); XtSetSensitive(fileSaveSelPB, msg != NULL && folderSelCount>0); XtSetSensitive(fileSaveToPB, msg != NULL); XtSetSensitive(fileSaveToFilePB, msg != NULL); XtSetSensitive(fileSaveRecentCB, msg != NULL && ishApp->appPrefs->recentFolders.size()>0); XtSetSensitive(fileSaveQuickCB, msg != NULL); XtSetSensitive(filePrintPB, msg != NULL); XtSetSensitive(filePipePB, msg != NULL); XtSetSensitive(optViewCB, msg != NULL /*&& msg->IsMime()*/); if ( pub->fullFunction ) { XtSetSensitive(fileMimePB, msg != NULL && !msg->IsDeleted() && msg->IsSet(MSG_SUN_ATTACH)); XtSetSensitive(fileUndeletePB, msg != NULL && msg->IsDeleted() && msg->folder->writable); XtSetSensitive(fileDeletePB, msg != NULL && !msg->IsDeleted() && msg->folder->writable); XtSetSensitive(fileDelClosePB, msg != NULL && !msg->IsDeleted() && msg->folder->writable); XtSetSensitive(fileNextPB, mainWin->NextReadable(msg) != NULL); XtSetSensitive(fileNextUnreadPB, mainWin->NextUnread(msg) != NULL); XtSetSensitive(fileNextSenderPB, mainWin->NextSender(msg) != NULL); XtSetSensitive(fileNextSubjectPB, mainWin->NextSubject(msg) != NULL); XtSetSensitive(filePrevPB, mainWin->PrevReadable(msg) != NULL); XtSetSensitive(filePrevUnreadPB, mainWin->PrevUnread(msg) != NULL); XtSetSensitive(filePrevSenderPB, mainWin->PrevSender(msg) != NULL); XtSetSensitive(filePrevSubjectPB, mainWin->PrevSubject(msg) != NULL); } // End if window is full function//// In rfc822 windows, the next and prev buttons are sensitive if this part// is in a digest and there are parts before or after.// else { XtSetSensitive(fileNextPB, pub->parentWin->priv->NextReadableIcon(pub) != NULL); XtSetSensitive(filePrevPB, pub->parentWin->priv->PrevReadableIcon(pub) != NULL); } pub->buttMgr->EnableButtons();} // End EnableButtons/*--------------------------------------------------------------- * Method to display the headers for the current message */voidReadWinP::DisplayHeaders(){ if ( !pub->msg ) { msgHeadText->Clear(); return; } msgHeadText->Defer(True); msgHeadText->Clear();//// Loop through headers// Boolean all = XmToggleButtonGetState(optHeadTB); HeaderC *head = pub->msg->Headers(); Boolean needNL = False; while ( head ) {//// See if this header should be displayed// if ( all || ishApp->headPrefs->HeaderShown(head->key) ) { if ( needNL ) msgHeadText->AddString("\n"); HeaderValC *val = head->value;//// See if this header has a complex value// if ( val->charset || val->next ) { msgHeadText->AddString(head->key); msgHeadText->AddString(": ");//
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -