📄 includewinc.c
字号:
XtAddCallback(charIso5PB, XmNactivateCallback, (XtCallbackProc)DoCharset, this); XtAddCallback(charIso6PB, XmNactivateCallback, (XtCallbackProc)DoCharset, this); XtAddCallback(charIso7PB, XmNactivateCallback, (XtCallbackProc)DoCharset, this); XtAddCallback(charIso8PB, XmNactivateCallback, (XtCallbackProc)DoCharset, this); XtAddCallback(charIso9PB, XmNactivateCallback, (XtCallbackProc)DoCharset, this); XtAddCallback(charIso13PB, XmNactivateCallback, (XtCallbackProc)DoCharset, this); wlist[0] = charAsciiPB; wlist[1] = charIso1PB; wlist[2] = charIso2PB; wlist[3] = charIso3PB; wlist[4] = charIso4PB; wlist[5] = charIso5PB; wlist[6] = charIso6PB; wlist[7] = charIso7PB; wlist[8] = charIso8PB; wlist[9] = charIso9PB; wlist[10] = charIso13PB; XtManageChildren(wlist, 11); // charPD children args.Reset(); args.SubMenuId(charPD); Widget charCB = XmCreateCascadeButton(charMB, "charCB", ARGS); XtManageChild(charCB); wlist[0] = charMB; wlist[1] = charTF; XtManageChildren(wlist, 2); // charForm children//// Create ftpModeFrame hierarchy//// Frame ftpModeFrame// RadioBox ftpModeRadio// ToggleButton (buttons)// args.Reset(); args.Packing(XmPACK_TIGHT); args.Orientation(XmHORIZONTAL); Widget ftpModeRadio = XmCreateRadioBox(ftpModeFrame, "ftpModeRadio", ARGS); ftpModeAsciiTB = XmCreateToggleButton(ftpModeRadio, "ftpModeAsciiTB", 0,0); ftpModeEbcdicTB = XmCreateToggleButton(ftpModeRadio, "ftpModeEbcdicTB", 0,0); ftpModeImageTB = XmCreateToggleButton(ftpModeRadio, "ftpModeImageTB", 0,0);// ftpModeLocalTB = XmCreateToggleButton(ftpModeRadio, "ftpModeLocalTB", 0,0); XtManageChild(ftpModeAsciiTB); XtManageChild(ftpModeEbcdicTB); XtManageChild(ftpModeImageTB);// XtManageChild(ftpModeLocalTB); XtManageChild(ftpModeRadio);//// Create tftpModeFrame hierarchy//// Frame tftpModeFrame// RadioBox tftpModeRadio// ToggleButton (buttons)// args.Reset(); args.Packing(XmPACK_TIGHT); args.Orientation(XmHORIZONTAL); Widget tftpModeRadio = XmCreateRadioBox(tftpModeFrame, "tftpModeRadio",ARGS); tftpModeNetAsciiTB = XmCreateToggleButton(tftpModeRadio, "tftpModeNetAsciiTB", 0,0); tftpModeOctetTB = XmCreateToggleButton(tftpModeRadio, "tftpModeOctetTB",0,0); tftpModeMailTB = XmCreateToggleButton(tftpModeRadio, "tftpModeMailTB", 0,0); XtManageChild(tftpModeNetAsciiTB); XtManageChild(tftpModeOctetTB); XtManageChild(tftpModeMailTB); XtManageChild(tftpModeRadio);//// Create permFrame hierarchy//// Frame permFrame// RadioBox permRadio// ToggleButton (buttons)// args.Reset(); args.Packing(XmPACK_TIGHT); args.Orientation(XmHORIZONTAL); Widget permRadio = XmCreateRadioBox(permFrame, "permRadio", ARGS); permRoTB = XmCreateToggleButton(permRadio, "permRoTB", 0,0); permRwTB = XmCreateToggleButton(permRadio, "permRwTB", 0,0); XtManageChild(permRoTB); XtManageChild(permRwTB); XtManageChild(permRadio); XmToggleButtonSetState(permRoTB, True, True);#if 0//// Add paramRC children// paramRC->AddChild(charLabel); paramRC->AddChild(charForm); paramRC->AddChild(outNameLabel); paramRC->AddChild(outNameTF); paramRC->AddChild(octTypeLabel); paramRC->AddChild(octTypeTF); paramRC->AddChild(octPadLabel); paramRC->AddChild(octPadTF); paramRC->AddChild(otherLabel); paramRC->AddChild(otherText); paramRC->AddChild(hostLabel); paramRC->AddChild(hostTF); paramRC->AddChild(dirLabel); paramRC->AddChild(dirTF); paramRC->AddChild(ftpModeLabel); paramRC->AddChild(ftpModeFrame); paramRC->AddChild(tftpModeLabel); paramRC->AddChild(tftpModeFrame); paramRC->AddChild(serverLabel); paramRC->AddChild(serverTF); paramRC->AddChild(subjectLabel); paramRC->AddChild(subjectTF); paramRC->AddChild(bodyLabel); paramRC->AddChild(bodyText); paramRC->AddChild(expLabel); paramRC->AddChild(expTF); paramRC->AddChild(sizeLabel); paramRC->AddChild(sizeTF); paramRC->AddChild(permLabel); paramRC->AddChild(permFrame); paramRC->Defer(False);#endif int rowNum = 0; charsetRow = rowNum++; outNameRow = rowNum++; octTypeRow = rowNum++; octPadRow = rowNum++; otherRow = rowNum++; hostRow = rowNum++; dirRow = rowNum++; ftpModeRow = rowNum++; tftpModeRow = rowNum++; serverRow = rowNum++; subjectRow = rowNum++; bodyRow = rowNum++; expRow = rowNum++; sizeRow = rowNum++; permRow = rowNum++; XtManageChild(*fileRC); XtManageChild(includeForm); XtManageChild(encodeForm); //XtManageChild(paramForm); XtManageChild(appPanes);//// Add buttons// AddButtonBox(); Widget okPB = XmCreatePushButton(buttonRC, "okPB", 0,0); skipPB = XmCreatePushButton(buttonRC, "skipPB", 0,0); Widget cancelPB = XmCreatePushButton(buttonRC, "cancelPB", 0,0); Widget helpPB = XmCreatePushButton(buttonRC, "helpPB", 0,0); XtAddCallback(okPB, XmNactivateCallback, (XtCallbackProc)DoOk, this); XtAddCallback(skipPB, XmNactivateCallback, (XtCallbackProc)DoSkip, this); XtAddCallback(cancelPB, XmNactivateCallback, (XtCallbackProc)DoHide, this); XtAddCallback(helpPB, XmNactivateCallback, (XtCallbackProc)HalAppC::DoHelp, (char *) "helpcard"); XtManageChild(okPB); XtManageChild(cancelPB); XtManageChild(helpPB); HandleHelp();//// Add callbacks to finish initialization// XtAddCallback(shell, XmNpopupCallback, (XtCallbackProc)DoPopup, (XtPointer)this); XtAddCallback(*fileRC, XmNexposeCallback, (XtCallbackProc)DoFileExpose, this); XtAddEventHandler(includeForm, StructureNotifyMask, False, (XtEventHandler)DoIncludeResize, this); XtAddEventHandler(encodeForm, StructureNotifyMask, False, (XtEventHandler)DoEncodeResize, this); XtAddCallback(*paramRC, XmNexposeCallback, (XtCallbackProc)DoParamExpose, this); return;} // End constructor/*--------------------------------------------------------------- * Method to build a list of file types */voidIncludeWinC::BuildTypeList(){ typeList.SetSorted(FALSE); typeList.removeAll();//// Build a sorted list of the standard types plus any additional types found// in the mailcap and mime-types files.// StringC typeStr; typeStr = "application/octet-stream"; typeList.add(typeStr); typeStr = "application/postscript"; typeList.add(typeStr); typeStr = "audio/basic"; typeList.add(typeStr); typeStr = "image/gif"; typeList.add(typeStr); typeStr = "image/jpeg"; typeList.add(typeStr); typeStr = "message/rfc822"; typeList.add(typeStr); typeStr = "text/enriched"; typeList.add(typeStr); typeStr = "text/plain"; typeList.add(typeStr); typeStr = "video/mpeg"; typeList.add(typeStr);//// Loop through the mailcap tree// MailcapFileC *mfile = MailcapFiles; while ( mfile ) { u_int count = mfile->entryList.size(); for (int i=0; i<count; i++) { MailcapC *ent = mfile->entryList[i]; if ( ent->conType != "*" && ent->subType != "*" ) { typeList.add(ent->fullType);#if 0 typeStr = ent->conType; typeStr += "/"; typeStr += ent->subType; typeStr.Trim(); if ( typeStr.size() > 0 ) typeList.add(typeStr);#endif } } // End for each mailcap entry mfile = mfile->next; } // End for each mailcap file//// Loop through the mime types dictionary// StringDictC& dict = MimeTypeDict(); u_int count = dict.size(); for (int i=0; i<count; i++) { StringDictCEntry *ent = dict[i]; typeList.add(ent->val); }//// Sort the types// typeList.SetSorted(TRUE);//// Mark the time this list was created// typeListTime = time(0);} // End BuildTypeList/*--------------------------------------------------------------- * Method to build an option menu of file types */voidIncludeWinC::BuildTypeMenu(){//// Delete existing buttons// unsigned count = typePbList.size(); int i; for (i=0; i<count; i++) XtDestroyWidget(*typePbList[i]); typePbList.removeAll();//// Create new buttons// WArgList args; WXmString wstr; count = typeList.size(); for (i=0; i<count; i++) { StringC *label = typeList[i];//// See which menu these are to be added to. If there is no match, add them// to the top level menu// Widget parent = typePD; if ( label->StartsWith("application/", IGNORE_CASE) ) parent = typeAppPD; else if ( label->StartsWith("audio/", IGNORE_CASE) ) parent = typeAudioPD; else if ( label->StartsWith("image/", IGNORE_CASE) ) parent = typeImagePD; else if ( label->StartsWith("message/", IGNORE_CASE) ) parent = typeMsgPD; else if ( label->StartsWith("multipart/", IGNORE_CASE) ) parent = typeMultPD; else if ( label->StartsWith("text/", IGNORE_CASE) ) parent = typeTextPD; else if ( label->StartsWith("video/", IGNORE_CASE) ) parent = typeVideoPD;//// Create a button// wstr = (char*)*label; args.LabelString(wstr); Widget pb = XmCreatePushButton(parent, "typePB", ARGS); XtManageChild(pb); XtAddCallback(pb, XmNactivateCallback, (XtCallbackProc)FileTypeChanged, this); typePbList.add(pb); } // End for each button to be added//// Unmanage cascade buttons with no children// Cardinal childCount; XtVaGetValues(typeAppPD, XmNnumChildren, &childCount, NULL); if ( childCount > 0 ) XtManageChild(typeAppCB); else XtUnmanageChild(typeAppCB); XtVaGetValues(typeAudioPD, XmNnumChildren, &childCount, NULL); if ( childCount > 0 ) XtManageChild(typeAudioCB); else XtUnmanageChild(typeAudioCB); XtVaGetValues(typeImagePD, XmNnumChildren, &childCount, NULL); if ( childCount > 0 ) XtManageChild(typeImageCB); else XtUnmanageChild(typeImageCB); XtVaGetValues(typeMsgPD, XmNnumChildren, &childCount, NULL); if ( childCount > 0 ) XtManageChild(typeMsgCB); else XtUnmanageChild(typeMsgCB); XtVaGetValues(typeMultPD, XmNnumChildren, &childCount, NULL); if ( childCount > 0 ) XtManageChild(typeMultCB); else XtUnmanageChild(typeMultCB); XtVaGetValues(typeTextPD, XmNnumChildren, &childCount, NULL); if ( childCount > 0 ) XtManageChild(typeTextCB); else XtUnmanageChild(typeTextCB); XtVaGetValues(typeVideoPD, XmNnumChildren, &childCount, NULL); if ( childCount > 0 ) XtManageChild(typeVideoCB); else XtUnmanageChild(typeVideoCB);} // End BuildTypeMenus/*--------------------------------------------------------------- * Callback routine to handle initial display. */voidIncludeWinC::DoPopup(Widget, IncludeWinC *This, XtPointer){ XtRemoveCallback(This->shell, XmNpopupCallback, (XtCallbackProc)DoPopup, (XtPointer)This);//// Finish initializing paramRC// WidgetList wlist; Cardinal wcount; XtVaGetValues(*This->paramRC, XmNchildren, &wlist, XmNnumChildren, &wcount, NULL); This->paramRC->SetChildren(wlist, wcount); This->paramRC->Defer(False);}/*----------------------------------------------------------------------- * Handle initial exposure of fileRC */voidIncludeWinC::DoFileExpose(Widget, IncludeWinC *This, XtPointer){//// Remove this callback// XtRemoveCallback(*This->fileRC, XmNexposeCallback, (XtCallbackProc)DoFileExpose, This);//// Fix sizes of pane// Dimension ht; XtVaGetValues(*This->fileRC, XmNheight, &ht, NULL); XtVaSetValues(*This->fileRC, XmNpaneMinimum, ht, XmNpaneMaximum, ht, NULL);} // End DoFileExpose/*----------------------------------------------------------------------- * Handle resize of includeForm */voidIncludeWinC::DoIncludeResize(Widget, IncludeWinC *This, XEvent *ev, Boolean*){ if ( ev->type != ConfigureNotify ) return;//// Fix sizes of pane// Dimension ht; XtVaGetValues(This->includeForm, XmNheight, &ht, NULL); XtVaSetValues(This->includeForm, XmNpaneMinimum, ht, XmNpaneMaximum, ht, 0);} // End DoIncludeResize/*----------------------------------------------------------------------- * Handle resize of encodeForm */voidIncludeWinC::DoEncodeResize(Widget, IncludeWinC *This, XEvent *ev, Boolean*){ if ( ev->type != ConfigureNotify ) return;//// Fix sizes of pane// Dimension ht; XtVaGetValues(This->encodeForm, XmNheight, &ht, NULL); XtVaSetValues(This->encodeForm, XmNpaneMinimum, ht, XmNpaneMaximum, ht, 0);} // End DoEncodeResize/*----------------------------------------------------------------------- * Handle initial exposure of paramRC
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -