📄 fontprefwinc.c
字号:
//// Update the rich font// if ( richFontStr.size() > 0 ) UpdateRich(*halApp, richFontStr);//// Update the message list font// if ( listFont && listFont->loaded && listFontStr.size() > 0 ) {//// Create a font list// XmFontListEntry fent; XmFontList flist; if ( listFont->IsBold() ) { fent = XmFontListEntryCreate("bold", XmFONT_IS_FONT, listFont->xfont); flist = XmFontListAppendEntry(NULL, fent); FontDataC *nonBold = listFont->NonBold(); fent = XmFontListEntryCreate("plain", XmFONT_IS_FONT, nonBold->xfont); flist = XmFontListAppendEntry(flist, fent); } else { fent = XmFontListEntryCreate("plain", XmFONT_IS_FONT,listFont->xfont); flist = XmFontListAppendEntry(NULL, fent); FontDataC *bold = listFont->Bold(); fent = XmFontListEntryCreate("bold", XmFONT_IS_FONT, bold->xfont); flist = XmFontListAppendEntry(flist, fent); }//// Update the font for all lists// args.FontList(flist); UpdateLists(*halApp, ARGS);//// Update the font for all view boxes// ishApp->mainWin->FolderVBox().SetFontList(flist); ishApp->mainWin->MsgVBox().SetFontList(flist); } // End if there is a list font BusyCursor(False); return True;} // End Apply/*--------------------------------------------------------------- * Callback used when a font pushbutton is selected */voidFontPrefWinC::PickFont(Widget w, FontPrefWinC *This, XtPointer){ This->BusyCursor(True); if ( !This->chooser ) { This->chooser = new FontChooserC(*This); This->chooser->AddOkCallback((CallbackFn*)FinishPickFont, This); } if ( w == This->pbChoosePB ) { This->curTF = This->pbTF; This->chooser->ShowProp(True); This->chooser->ShowFixed(True); This->chooser->AllowProp(True); } else if ( w == This->labelChoosePB ) { This->curTF = This->labelTF; This->chooser->ShowProp(True); This->chooser->ShowFixed(True); This->chooser->AllowProp(True); } else if ( w == This->textChoosePB ) { This->curTF = This->textTF; This->chooser->ShowProp(False); This->chooser->ShowFixed(True); This->chooser->AllowProp(False); } else if ( w == This->richChoosePB ) { This->curTF = This->richTF; This->chooser->ShowProp(True); This->chooser->ShowFixed(True); This->chooser->AllowProp(True); } else if ( w == This->listChoosePB ) { This->curTF = This->listTF; This->chooser->ShowProp(True); This->chooser->ShowFixed(True); This->chooser->AllowProp(True); } This->chooser->Show(); This->BusyCursor(False);} // End PickFontvoidFontPrefWinC::FinishPickFont(char *name, FontPrefWinC *This){ if ( debuglev > 0 ) cout <<"Selected font is: " <<name <<endl; XmTextFieldSetString(This->curTF, name);}/*--------------------------------------------------------------- * Callback used when a font menu is about to be posted */voidFontPrefWinC::SetField(Widget w, FontPrefWinC *This, XtPointer){ XtPointer data; XtVaGetValues(w, XmNuserData, &data, NULL); This->curTF = (Widget)data;} // End SetField/*--------------------------------------------------------------- * Method used to update the font for all pushbuttons */voidFontPrefWinC::UpdateButtons(Widget w, ArgList argv, Cardinal argc){ if ( !w || !XtIsWidget(w) ) return; if ( debuglev > 1 ) cout <<"Checking " <<w <<" (" <<XtName(w) <<")" <<endl;//// If this is a composite, loop through the children and check them.// Don't loop through our own menu because we don't want the fonts to// change there.// if ( XtIsComposite(w) && w != fontPD ) { WidgetList list; Cardinal count; XtVaGetValues(w, XmNnumChildren, &count, XmNchildren, &list, NULL); if ( debuglev > 1 ) cout <<" has " <<count <<" children" <<endl;//// Loop through children// for (int i=0; i<count; i++) UpdateButtons(list[i], argv, argc); } // End if this is a composite widget //// If this is a pushbutton or cascade button, update the resources// else if ( XmIsPushButton(w) || XmIsCascadeButton(w) ) { if ( debuglev > 1 ) cout <<"Found button: " <<XtName(w) <<endl; XtSetValues(w, argv, argc); }//// If there are any popups associated with this widget, check them// if ( w->core.num_popups > 0 ) { if ( debuglev > 1 ) cout <<" has " <<w->core.num_popups <<" popups" <<endl; for (int i=0; i<w->core.num_popups; i++) UpdateButtons(w->core.popup_list[i], argv, argc); } // End if there are any popups} // End UpdateButtons/*--------------------------------------------------------------- * Method used to update the font for all labels and toggle buttons */voidFontPrefWinC::UpdateLabels(Widget w, ArgList argv, Cardinal argc){ if ( !w || !XtIsWidget(w) ) return; if ( debuglev > 1 ) cout <<"Checking " <<XtName(w) <<endl;//// If this is a composite, loop through the children and check them.// Don't loop through our own menu because we don't want the fonts to// change there.// if ( XtIsComposite(w) && w != fontPD ) { WidgetList list; Cardinal count; XtVaGetValues(w, XmNnumChildren, &count, XmNchildren, &list, NULL);//// Loop through children// for (int i=0; i<count; i++) UpdateLabels(list[i], argv, argc); } // End if this is a composite widget //// If this is a pushbutton or cascade button, update the resources// else if ( XmIsLabel(w) && !(XmIsPushButton(w) || XmIsCascadeButton(w)) ) { if ( debuglev > 1 ) cout <<"Found label: " <<XtName(w) <<endl; XtSetValues(w, argv, argc); }//// If there are any popups associated with this widget, check them// if ( w->core.num_popups > 0 ) { for (int i=0; i<w->core.num_popups; i++) UpdateLabels(w->core.popup_list[i], argv, argc); } // End if there are any popups} // End UpdateLabels/*--------------------------------------------------------------- * Method used to update the font for all text and text field widgets */voidFontPrefWinC::UpdateText(Widget w, ArgList argv, Cardinal argc){ if ( !w || !XtIsWidget(w) ) return; if ( debuglev > 1 ) cout <<"Checking " <<XtName(w) <<endl;//// If this is a composite, loop through the children and check them.// Don't loop through our own menu because we don't want the fonts to// change there.// if ( XtIsComposite(w) && w != fontPD ) { WidgetList list; Cardinal count; XtVaGetValues(w, XmNnumChildren, &count, XmNchildren, &list, NULL);//// Loop through children// for (int i=0; i<count; i++) UpdateText(list[i], argv, argc); } // End if this is a composite widget //// If this is a pushbutton or cascade button, update the resources// else if ( XmIsText(w) || XmIsTextField(w) ) { if ( debuglev > 1 ) cout <<"Found text: " <<XtName(w) <<endl; XtSetValues(w, argv, argc); }//// If there are any popups associated with this widget, check them// if ( w->core.num_popups > 0 ) { for (int i=0; i<w->core.num_popups; i++) UpdateText(w->core.popup_list[i], argv, argc); } // End if there are any popups} // End UpdateText/*--------------------------------------------------------------- * Method used to update the base font for all richtext widgets */voidFontPrefWinC::UpdateRich(Widget w, const char *fontname){ if ( !w || !XtIsWidget(w) ) return; if ( debuglev > 1 ) cout <<"Checking " <<XtName(w) <<endl;//// If this is a richtext widget, get the object pointer from its user data// if ( strcasecmp(XtName(w), "richTextArea") == 0 ) { MimeRichTextC *rt; XtVaGetValues(w, XmNuserData, &rt, NULL); if ( rt ) rt->SetPlainFont(fontname); } // End if this is a richtext widget//// If this is a composite, loop through the children and check them.// Don't loop through our own menu because we don't want the fonts to// change there.// if ( XtIsComposite(w) && w != fontPD ) { WidgetList list; Cardinal count; XtVaGetValues(w, XmNnumChildren, &count, XmNchildren, &list, NULL);//// Loop through children// for (int i=0; i<count; i++) UpdateRich(list[i], fontname); } // End if this is a composite widget//// If there are any popups associated with this widget, check them// if ( w->core.num_popups > 0 ) { for (int i=0; i<w->core.num_popups; i++) UpdateRich(w->core.popup_list[i], fontname); } // End if there are any popups } // End UpdateRich/*--------------------------------------------------------------- * Method used to update the fixed font for all richtext widgets */voidFontPrefWinC::UpdateRichFixed(Widget w, const char *fontname){ if ( !w || !XtIsWidget(w) ) return; if ( debuglev > 1 ) cout <<"Checking " <<XtName(w) <<endl;//// If this is a richtext widget, get the object pointer from its user data// if ( strcasecmp(XtName(w), "richTextArea") == 0 ) { MimeRichTextC *rt; XtVaGetValues(w, XmNuserData, &rt, NULL); if ( rt ) rt->SetFixedFont(fontname); } // End if this is a richtext widget//// If this is a composite, loop through the children and check them.// Don't loop through our own menu because we don't want the fonts to// change there.// if ( XtIsComposite(w) && w != fontPD ) { WidgetList list; Cardinal count; XtVaGetValues(w, XmNnumChildren, &count, XmNchildren, &list, NULL);//// Loop through children// for (int i=0; i<count; i++) UpdateRichFixed(list[i], fontname); } // End if this is a composite widget//// If there are any popups associated with this widget, check them// if ( w->core.num_popups > 0 ) { for (int i=0; i<w->core.num_popups; i++) UpdateRichFixed(w->core.popup_list[i], fontname); } // End if there are any popups } // End UpdateRichFixed/*--------------------------------------------------------------- * Method used to update the font for all list widgets */voidFontPrefWinC::UpdateLists(Widget w, ArgList argv, Cardinal argc){ if ( !w || !XtIsWidget(w) ) return; if ( debuglev > 1 ) cout <<"Checking " <<XtName(w) <<endl;//// If this is a composite, loop through the children and check them.// Don't loop through our own menu because we don't want the fonts to// change there.// if ( XtIsComposite(w) && w != fontPD ) { WidgetList list; Cardinal count; XtVaGetValues(w, XmNnumChildren, &count, XmNchildren, &list, NULL);//// Loop through children// for (int i=0; i<count; i++) UpdateLists(list[i], argv, argc); } // End if this is a composite widget //// If this is a list widget, update the resources// else if ( XmIsList(w) ) { if ( debuglev > 1 ) cout <<"Found list: " <<XtName(w) <<endl; XtSetValues(w, argv, argc); }//// If there are any popups associated with this widget, check them// if ( w->core.num_popups > 0 ) { for (int i=0; i<w->core.num_popups; i++) UpdateLists(w->core.popup_list[i], argv, argc); } // End if there are any popups} // End UpdateLists
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -