📄 sendwinp.c
字号:
// args.Reset(); args.MappedWhenManaged(False); XtSetValues(p->subDummyPB, ARGS); XtSetValues(p->fccDummyPB, ARGS); XtSetValues(p->otherDummyPB, ARGS);//// Add callbacks to edit aliases// AddActivate(p->toAliasPB, PickToAlias, this); AddActivate(p->ccAliasPB, PickCcAlias, this); AddActivate(p->bccAliasPB, PickBccAlias, this); wcount = 0; wlist[wcount++] = p->toAliasPB; wlist[wcount++] = p->ccAliasPB; wlist[wcount++] = p->bccAliasPB; XtManageChildren(wlist, wcount); wcount = 0; wlist[wcount++] = labelForm; wlist[wcount++] = textForm; wlist[wcount++] = buttonForm; XtManageChildren(wlist, wcount);} // End BuildOldHeadPane/*--------------------------------------------------------------- * Routine to create the new-style header pane */voidSendWinP::BuildNewHeadPane(){ WArgList args; HeaderPaneT *p = newHeadPane;//// Create headForm hierarchy//// headForm// Form toForm// Form subForm// Form ccForm// Form bccForm// Form fccForm// Form otherForm// args.Reset(); args.TopAttachment(XmATTACH_FORM); args.LeftAttachment(XmATTACH_FORM); args.RightAttachment(XmATTACH_NONE); args.BottomAttachment(XmATTACH_NONE); p->toForm = XmCreateForm(p->headForm, "toForm", ARGS); p->subForm = XmCreateForm(p->headForm, "subjectForm", ARGS); p->ccForm = XmCreateForm(p->headForm, "ccForm", ARGS); p->bccForm = XmCreateForm(p->headForm, "bccForm", ARGS); p->fccForm = XmCreateForm(p->headForm, "fccForm", ARGS); p->otherForm = XmCreateForm(p->headForm, "otherForm", ARGS);//// Create ??Form hierarchy//// ??Form// Form ??TopForm// Label ??Label// PushButton ??AliasPB// MimeRichTextC ??Text// args.Reset(); args.TopAttachment(XmATTACH_FORM); args.LeftAttachment(XmATTACH_FORM); args.RightAttachment(XmATTACH_FORM); args.BottomAttachment(XmATTACH_NONE); Widget toTopForm = XmCreateForm(p->toForm, "toTopForm", ARGS); Widget subTopForm = XmCreateForm(p->subForm, "subTopForm", ARGS); Widget ccTopForm = XmCreateForm(p->ccForm, "ccTopForm", ARGS); Widget bccTopForm = XmCreateForm(p->bccForm, "bccTopForm", ARGS); Widget fccTopForm = XmCreateForm(p->fccForm, "fccTopForm", ARGS); Widget otherTopForm = XmCreateForm(p->otherForm, "otherTopForm", ARGS); args.Reset(); args.TopAttachment(XmATTACH_NONE); args.LeftAttachment(XmATTACH_FORM); args.RightAttachment(XmATTACH_NONE); args.BottomAttachment(XmATTACH_FORM); p->toLabel = XmCreateLabel(toTopForm, "toLabel", ARGS); p->subLabel = XmCreateLabel(subTopForm, "subjectLabel", ARGS); p->ccLabel = XmCreateLabel(ccTopForm, "ccLabel", ARGS); p->bccLabel = XmCreateLabel(bccTopForm, "bccLabel", ARGS); p->fccLabel = XmCreateLabel(fccTopForm, "fccLabel", ARGS); p->otherLabel = XmCreateLabel(otherTopForm, "otherLabel", ARGS); args.LeftAttachment(XmATTACH_NONE); args.RightAttachment(XmATTACH_FORM); p->toAliasPB = XmCreatePushButton(toTopForm, "toAliasPB", ARGS); p->ccAliasPB = XmCreatePushButton(ccTopForm, "ccAliasPB", ARGS); p->bccAliasPB = XmCreatePushButton(bccTopForm, "bccAliasPB", ARGS);//// Create these buttons to simplify the layout code// args.MappedWhenManaged(False); p->subDummyPB = XmCreatePushButton(subTopForm, "subAliasPB", ARGS); p->fccDummyPB = XmCreatePushButton(fccTopForm, "fccAliasPB", ARGS); p->otherDummyPB = XmCreatePushButton(otherTopForm, "otherAliasPB", ARGS); XtManageChild(p->toLabel); XtManageChild(p->toAliasPB); XtManageChild(toTopForm); XtManageChild(p->subLabel); XtManageChild(p->subDummyPB); XtManageChild(subTopForm); XtManageChild(p->ccLabel); XtManageChild(p->ccAliasPB); XtManageChild(ccTopForm); XtManageChild(p->bccLabel); XtManageChild(p->bccAliasPB); XtManageChild(bccTopForm); XtManageChild(p->fccLabel); XtManageChild(p->fccDummyPB); XtManageChild(fccTopForm); XtManageChild(p->otherLabel); XtManageChild(p->otherDummyPB); XtManageChild(otherTopForm); args.Reset(); args.LeftAttachment(XmATTACH_FORM); args.RightAttachment(XmATTACH_FORM); args.BottomAttachment(XmATTACH_FORM); args.TopAttachment(XmATTACH_WIDGET, toTopForm); p->toText = new MimeRichTextC(p->toForm, "toText", ARGS); p->toText->Defer(True); p->toText->SetEditable(True); p->toText->ResizeWidth(True);// p->toText->SetString("_"); p->toText->Defer(False); args.TopAttachment(XmATTACH_WIDGET, subTopForm); p->subText = new MimeRichTextC(p->subForm, "subjectText", ARGS); p->subText->Defer(True); p->subText->SetEditable(True); p->subText->ResizeWidth(True);// p->subText->SetString("_"); p->subText->Defer(False); args.TopAttachment(XmATTACH_WIDGET, ccTopForm); p->ccText = new MimeRichTextC(p->ccForm, "ccText", ARGS); p->ccText->Defer(True); p->ccText->SetEditable(True); p->ccText->ResizeWidth(True);// p->ccText->SetString("_"); p->ccText->Defer(False); args.TopAttachment(XmATTACH_WIDGET, bccTopForm); p->bccText = new MimeRichTextC(p->bccForm, "bccText", ARGS); p->bccText->Defer(True); p->bccText->SetEditable(True); p->bccText->ResizeWidth(True);// p->bccText->SetString("_"); p->bccText->Defer(False); args.TopAttachment(XmATTACH_WIDGET, fccTopForm); p->fccText = new MimeRichTextC(p->fccForm, "fccText", ARGS); p->fccText->Defer(True); p->fccText->SetEditable(True); p->fccText->ResizeWidth(True);// p->fccText->SetString("_"); p->fccText->Defer(False); args.TopAttachment(XmATTACH_WIDGET, otherTopForm); p->otherText = new MimeRichTextC(p->otherForm, "otherText", ARGS); p->otherText->Defer(True); p->otherText->SetEditable(True); p->otherText->ResizeWidth(True);// p->otherText->SetString("_"); p->otherText->Defer(False); XtManageChild(p->toText->MainWidget()); XtManageChild(p->subText->MainWidget()); XtManageChild(p->ccText->MainWidget()); XtManageChild(p->bccText->MainWidget()); XtManageChild(p->fccText->MainWidget()); XtManageChild(p->otherText->MainWidget());//// Add callbacks to look for changes to fields// p->toText->AddTextChangeCallback ((CallbackFn*)TextChanged, this); p->subText->AddTextChangeCallback ((CallbackFn*)TextChanged, this); p->ccText->AddTextChangeCallback ((CallbackFn*)TextChanged, this); p->bccText->AddTextChangeCallback ((CallbackFn*)TextChanged, this); p->otherText->AddTextChangeCallback((CallbackFn*)TextChanged, this); p->fccText->AddTextChangeCallback ((CallbackFn*)TextChanged, this);//// Add callbacks to edit aliases// AddActivate(p->toAliasPB, PickToAlias, this); AddActivate(p->ccAliasPB, PickCcAlias, this); AddActivate(p->bccAliasPB, PickBccAlias, this);} // End BuildNewHeadPane/*--------------------------------------------------------------- * Routine to position the header fields */voidSendWinP::PlaceHeaderFields(){ u_int visCount = 2; // To and Subject if ( pub->ccVis ) visCount++; if ( pub->bccVis ) visCount++; if ( pub->fccVis ) visCount++; if ( pub->otherVis ) visCount++;//// See which pane we need// HeaderPaneT *pane = (ishApp->compPrefs->maxFieldsPerLine <= 1) ? oldHeadPane : newHeadPane;//// See if there are any changes// Boolean rowsChanged = (pane->toText->RowCount() != ishApp->compPrefs->headRows); Boolean changed = (rowsChanged || pane != curHeadPane || pub->maxFieldsPerLine != ishApp->compPrefs->maxFieldsPerLine); pub->maxFieldsPerLine = ishApp->compPrefs->maxFieldsPerLine;//// Save the width of the pane. We'll need to restore it later// Dimension paneWd = 0; if ( curHeadPane ) { XtVaGetValues(curHeadPane->headForm, XmNwidth, &paneWd, NULL); XtUnmanageChild(curHeadPane->headForm); }//// If we've got only one per line, turn on the visible rows// WArgList args; if ( pub->maxFieldsPerLine <= 1 ) {//// Build lists of the visible and hidden fields// WidgetListC visLabList, hidLabList; WidgetListC visTexList, hidTexList; WidgetListC visButList, hidButList; visLabList.add(pane->toLabel); visTexList.add(pane->toText->MainWidget()); visButList.add(pane->toAliasPB); visLabList.add(pane->subLabel); visTexList.add(pane->subText->MainWidget()); visButList.add(pane->subDummyPB); if ( pub->ccVis ) { visLabList.add(pane->ccLabel); visTexList.add(pane->ccText->MainWidget()); visButList.add(pane->ccAliasPB); } else { hidLabList.add(pane->ccLabel); hidTexList.add(pane->ccText->MainWidget()); hidButList.add(pane->ccAliasPB); } if ( pub->bccVis ) { visLabList.add(pane->bccLabel); visTexList.add(pane->bccText->MainWidget()); visButList.add(pane->bccAliasPB); } else { hidLabList.add(pane->bccLabel); hidTexList.add(pane->bccText->MainWidget()); hidButList.add(pane->bccAliasPB); } if ( pub->fccVis ) { visLabList.add(pane->fccLabel); visTexList.add(pane->fccText->MainWidget()); visButList.add(pane->fccDummyPB); } else { hidLabList.add(pane->fccLabel); hidTexList.add(pane->fccText->MainWidget()); hidButList.add(pane->fccDummyPB); } if ( pub->otherVis ) { visLabList.add(pane->otherLabel); visTexList.add(pane->otherText->MainWidget()); visButList.add(pane->otherDummyPB); } else { hidLabList.add(pane->otherLabel); hidTexList.add(pane->otherText->MainWidget()); hidButList.add(pane->otherDummyPB); } visCount = visLabList.size(); int i; for (i=0; !changed && i<visCount; i++) { Widget w = *visLabList[i]; if ( !XtIsManaged(w) ) changed = True; } u_int hidCount = hidLabList.size(); for (i=0; !changed && i<hidCount; i++) { Widget w = *hidLabList[i]; if ( XtIsManaged(w) ) changed = True; } if ( !changed ) return;//// Unmanage all children// if ( hidLabList.size() > 0 ) { XtUnmanageChildren(hidLabList.start(), hidLabList.size()); XtUnmanageChildren(hidTexList.start(), hidTexList.size()); if ( hidButList.size() > 0 ) XtUnmanageChildren(hidButList.start(), hidButList.size()); } if ( visLabList.size() > 0 ) { XtUnmanageChildren(visLabList.start(), visLabList.size()); XtUnmanageChildren(visTexList.start(), visTexList.size()); if ( visButList.size() > 0 ) XtUnmanageChildren(visButList.start(), visButList.size()); }#if 0//// Set position attachments// Widget lw1 = pane->toLabel; Widget tw1 = pane->toText->MainWidget(); Widget bw1 = pane->toAliasPB; Widget lw2 = pane->subLabel; Widget tw2 = pane->subText->MainWidget(); Widget bw2 = pane->subDummyPB;//// Get widget ids of parent forms// Widget labForm = XtParent(lw1); Widget texForm = XtParent(tw1); Widget butForm = XtParent(bw1);#else Widget labForm = XtParent(pane->toLabel); Widget texForm = XtParent(pane->toText->MainWidget()); Widget butForm = XtParent(pane->toAliasPB);#endif args.FractionBase(visCount); XtSetValues(labForm, ARGS); XtSetValues(texForm, ARGS); XtSetValues(butForm, ARGS); args.Reset();#if 0 if ( visCount == 2 ) { args.TopAttachment(XmATTACH_FORM); args.BottomAttachment(XmATTACH_POSITION, 1); XtSetValues(tw1, ARGS); args.BottomAttachment(XmATTACH_NONE); XtSetValues(lw1, ARGS); XtSetValues(bw1, ARGS); args.TopAttachment(XmATTACH_POSITION, 1); args.BottomAttachment(XmATTACH_FORM); XtSetValues(tw2, ARGS); args.BottomAttachment(XmATTACH_NONE); XtSetValues(lw2, ARGS); XtSetValues(bw2, ARGS); } else if ( visCount == 3 ) { Widget lw3 = *visLabList[2]; Widget tw3 = *visTexList[2]; Widget bw3 = *visButList[2]; args.TopAttachment(XmATTACH_FORM); args.BottomAttachment(XmATTACH_POSITION, 1); XtSetValues(tw1, ARGS); args.BottomAttachment(XmATTACH_NONE); XtSetValues(lw1, ARGS); XtSetValues(bw1, ARGS); args.TopAttachment(XmATTACH_POSITION, 1); args.BottomAttachment(XmATTACH_POSITION, 2); XtSetValues(tw2, ARGS); args.BottomAttachment(XmATTACH_NONE); XtSetValues(lw2, ARGS); XtSetValues(bw2, ARGS); args.TopAttachment(XmATTACH_POSITION, 2); args.BottomAttachment(XmATTACH_FORM); XtSetValues(tw3, ARGS); args.BottomAttachment(XmATTACH_NONE); XtSetValues(lw3, ARGS); XtSetValues(bw3, ARGS); } else if ( visCount == 4 ) { Widget lw3 = *visLabList[2]; Widget tw3 = *visTexList[2]; Widget bw3 = *visButList[2]; Widget lw4 = *visLabList[3]; Widget tw4 = *visTexList[3]; Widget bw4 = *visButList[3];
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -