📄 includewinc.c
字号:
/* * $Id: IncludeWinC.C,v 1.4 2000/06/06 12:46:10 evgeny Exp $ * * Copyright (c) 1993 HAL Computer Systems International, Ltd. * * HAL COMPUTER SYSTEMS INTERNATIONAL, LTD. * 1315 Dell Avenue * Campbell, CA 95008 * * Author: Greg Hilton * Contributors: Tom Lang, Frank Bieser, and others * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * http://www.gnu.org/copyleft/gpl.html * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */#include <config.h>#include "IncludeWinC.h"#include "Mailcap.h"#include "SendIconC.h"#include "FileMisc.h"#include "Misc.h"#include "MsgPartC.h"#include "ParamC.h"#include <hgl/HalAppC.h>#include <hgl/WArgList.h>#include <hgl/StringListC.h>#include <hgl/RowColC.h>#include <hgl/WXmString.h>#include <hgl/StrCase.h>#include <hgl/rsrc.h>#include <hgl/TextMisc.h>#include <hgl/StringDictC.h>#include <hgl/MemMap.h>#include <Xm/PanedW.h>#include <Xm/Form.h>#include <Xm/Label.h>#include <Xm/TextF.h>#include <Xm/Frame.h>#include <Xm/Text.h>#include <Xm/PushB.h>#include <Xm/ToggleB.h>#include <Xm/RowColumn.h>#include <Xm/CascadeB.h>#include <time.h>#include <unistd.h> // For access#include <sys/stat.h>/*--------------------------------------------------------------- * IncludeWinC constructor */IncludeWinC::IncludeWinC(Widget parent, const char *name): HalDialogC(name, parent){ WArgList args; Widget wlist[11]; int wcount; fileList.AllowDuplicates(FALSE); fileList.SetSorted(FALSE);//// Create appForm hierarchy//// appForm// PanedWindow appPanes// args.Reset(); args.LeftAttachment(XmATTACH_FORM); args.RightAttachment(XmATTACH_FORM); args.TopAttachment(XmATTACH_FORM); args.BottomAttachment(XmATTACH_FORM); Widget appPanes = XmCreatePanedWindow(appForm, "appPanes", ARGS);//// Create appPanes hierarchy//// appPanes// RowColC *fileRC// Form includeForm// Form encodeForm// RowColC *paramRC// fileRC = new RowColC (appPanes, "fileRC", 0,0); includeForm = XmCreateForm(appPanes, "includeForm", 0,0); encodeForm = XmCreateForm(appPanes, "encodeForm", 0,0); paramRC = new RowColC (appPanes, "paramRC", 0,0);//// Create fileRC hierarchy//// fileRC// Label nameLabel// TextField nameTF// Label descLabel// TextField descTF// Label typeLabel// OptionMenu typeOM////// Set up 2 columns in fileRC// fileRC->Defer(True); fileRC->SetOrientation(RcROW_MAJOR); fileRC->SetColCount(2); fileRC->SetColAlignment(XmALIGNMENT_END); fileRC->SetColWidthAdjust(0, RcADJUST_NONE); fileRC->SetColWidthAdjust(1, RcADJUST_ATTACH); fileRC->SetColResize(0, False); fileRC->SetColResize(1, True); Widget nameLabel = XmCreateLabel (*fileRC, "nameLabel", 0,0); nameTF = CreateTextField (*fileRC, "nameTF", 0,0); Widget descLabel = XmCreateLabel (*fileRC, "descLabel", 0,0); descTF = CreateTextField (*fileRC, "descTF", 0,0); Widget typeLabel = XmCreateLabel (*fileRC, "typeLabel", 0,0); typePD = XmCreatePulldownMenu(*fileRC, "typePD", 0,0); args.Reset(); args.SubMenuId(typePD); typeOM = XmCreateOptionMenu (*fileRC, "typeOM", ARGS); fileRC->AddChild(nameLabel); fileRC->AddChild(nameTF); fileRC->AddChild(descLabel); fileRC->AddChild(descTF); fileRC->AddChild(typeLabel); fileRC->AddChild(typeOM); fileRC->Defer(False);//// Create typePD hierarchy//// typePD// CascadeButton typeAppCB// PulldownMenu typeAppPD// CascadeButton typeAudioCB// PulldownMenu typeAudioPD// CascadeButton typeImageCB// PulldownMenu typeImagePD// CascadeButton typeMsgCB// PulldownMenu typeMsgPD// CascadeButton typeMultCB// PulldownMenu typeMultPD// CascadeButton typeTextCB// PulldownMenu typeTextPD// CascadeButton typeVideoCB// PulldownMenu typeVideoPD// typeAppPD = XmCreatePulldownMenu(typePD, "typeAppPD", 0,0); typeAudioPD = XmCreatePulldownMenu(typePD, "typeAudioPD", 0,0); typeImagePD = XmCreatePulldownMenu(typePD, "typeImagePD", 0,0); typeMsgPD = XmCreatePulldownMenu(typePD, "typeMsgPD", 0,0); typeMultPD = XmCreatePulldownMenu(typePD, "typeMultPD", 0,0); typeTextPD = XmCreatePulldownMenu(typePD, "typeTextPD", 0,0); typeVideoPD = XmCreatePulldownMenu(typePD, "typeVideoPD", 0,0); args.Reset(); args.SubMenuId(typeAppPD); typeAppCB = XmCreateCascadeButton(typePD, "typeAppCB", ARGS); args.SubMenuId(typeAudioPD); typeAudioCB = XmCreateCascadeButton(typePD, "typeAudioCB", ARGS); args.SubMenuId(typeImagePD); typeImageCB = XmCreateCascadeButton(typePD, "typeImageCB", ARGS); args.SubMenuId(typeMsgPD); typeMsgCB = XmCreateCascadeButton(typePD, "typeMsgCB", ARGS); args.SubMenuId(typeMultPD); typeMultCB = XmCreateCascadeButton(typePD, "typeMultCB", ARGS); args.SubMenuId(typeTextPD); typeTextCB = XmCreateCascadeButton(typePD, "typeTextCB", ARGS); args.SubMenuId(typeVideoPD); typeVideoCB = XmCreateCascadeButton(typePD, "typeVideoCB", ARGS); wcount = 0; wlist[wcount++] = typeAppCB; wlist[wcount++] = typeAudioCB; wlist[wcount++] = typeImageCB; wlist[wcount++] = typeMsgCB; wlist[wcount++] = typeMultCB; wlist[wcount++] = typeTextCB; wlist[wcount++] = typeVideoCB; XtManageChildren(wlist, wcount); // typePD children typeList.AllowDuplicates(FALSE); BuildTypeList(); BuildTypeMenu();//// Create includeForm hierarchy//// includeForm// Label includeLabel// Frame includeFrame// RadioBox includeRadio// ToggleButton (radioButtons)// args.Reset(); args.TopAttachment(XmATTACH_FORM); args.LeftAttachment(XmATTACH_FORM); args.RightAttachment(XmATTACH_NONE); args.BottomAttachment(XmATTACH_NONE); Widget includeLabel = XmCreateLabel(includeForm, "includeLabel", ARGS); args.TopAttachment(XmATTACH_WIDGET, includeLabel); args.RightAttachment(XmATTACH_FORM); Widget includeFrame = XmCreateFrame(includeForm, "includeFrame", ARGS); args.Reset(); args.Packing(XmPACK_COLUMN); args.Orientation(XmVERTICAL); Widget includeRadio = XmCreateRadioBox(includeFrame, "includeRadio", ARGS); includeAsTextTB = XmCreateToggleButton(includeRadio, "includeAsTextTB", 0,0); includeAsFileTB = XmCreateToggleButton(includeRadio, "includeAsFileTB", 0,0); attachLocalTB = XmCreateToggleButton(includeRadio, "attachLocalTB", 0,0); attachAnonTB = XmCreateToggleButton(includeRadio, "attachAnonTB", 0,0); attachFtpTB = XmCreateToggleButton(includeRadio, "attachFtpTB", 0,0); attachTftpTB = XmCreateToggleButton(includeRadio, "attachTftpTB", 0,0); attachMailTB = XmCreateToggleButton(includeRadio, "attachMailTB", 0,0); XtManageChild(includeAsTextTB); XtManageChild(includeAsFileTB); XtManageChild(attachLocalTB); XtManageChild(attachAnonTB); XtManageChild(attachFtpTB); XtManageChild(attachTftpTB); XtManageChild(attachMailTB); XtManageChild(includeRadio); XtManageChild(includeLabel); XtManageChild(includeFrame); XtAddCallback(includeAsTextTB, XmNvalueChangedCallback, (XtCallbackProc)IncludeTypeChanged, this); XtAddCallback(includeAsFileTB, XmNvalueChangedCallback, (XtCallbackProc)IncludeTypeChanged, this); XtAddCallback(attachLocalTB, XmNvalueChangedCallback, (XtCallbackProc)IncludeTypeChanged, this); XtAddCallback(attachAnonTB, XmNvalueChangedCallback, (XtCallbackProc)IncludeTypeChanged, this); XtAddCallback(attachFtpTB, XmNvalueChangedCallback, (XtCallbackProc)IncludeTypeChanged, this); XtAddCallback(attachTftpTB, XmNvalueChangedCallback, (XtCallbackProc)IncludeTypeChanged, this); XtAddCallback(attachMailTB, XmNvalueChangedCallback, (XtCallbackProc)IncludeTypeChanged, this);//// Create encodeForm hierarchy//// encodeForm// Label encodeLabel// Frame encodeFrame// RadioBox encodeRadio// ToggleButton (radioButtons)// ToggleButton preEncodeTB// args.Reset(); args.TopAttachment(XmATTACH_FORM); args.LeftAttachment(XmATTACH_FORM); args.RightAttachment(XmATTACH_NONE); args.BottomAttachment(XmATTACH_NONE); Widget encodeLabel = XmCreateLabel(encodeForm, "encodeLabel", ARGS); args.TopAttachment(XmATTACH_WIDGET, encodeLabel); args.RightAttachment(XmATTACH_FORM); Widget encodeFrame = XmCreateFrame(encodeForm, "encodeFrame", ARGS); args.TopAttachment(XmATTACH_WIDGET, encodeFrame); args.RightAttachment(XmATTACH_NONE); preEncodeTB = XmCreateToggleButton(encodeForm, "preEncodeTB", ARGS); args.Reset(); args.Packing(XmPACK_TIGHT); args.Orientation(XmHORIZONTAL); Widget encodeRadio = XmCreateRadioBox(encodeFrame, "encodeRadio", ARGS); encodeNoneTB = XmCreateToggleButton(encodeRadio, "encodeNoneTB", 0,0); encode8bitTB = XmCreateToggleButton(encodeRadio, "encode8bitTB", 0,0); encodeQpTB = XmCreateToggleButton(encodeRadio, "encodeQpTB", 0,0); encode64TB = XmCreateToggleButton(encodeRadio, "encode64TB", 0,0); encodeUuTB = XmCreateToggleButton(encodeRadio, "encodeUuTB", 0,0); encodeBinHexTB = XmCreateToggleButton(encodeRadio, "encodeBinHexTB", 0,0); XtManageChild(encodeNoneTB); XtManageChild(encode8bitTB); XtManageChild(encodeQpTB); XtManageChild(encode64TB); XtManageChild(encodeUuTB);// XtManageChild(encodeBinHexTB); XtManageChild(encodeRadio); XtManageChild(encodeLabel); XtManageChild(encodeFrame); XtManageChild(preEncodeTB);//// Create paramForm hierarchy//// paramRC// Label charLabel// Form charForm// Label octTypeLabel// TextField octTypeTF// Label octPaddingLabel// TextField octPaddingTF// Label otherLabel// Text otherText// Label hostLabel// TextField hostTF// Label dirLabel// TextField dirTF// Label ftpModeLabel// TextField ftpModeFrame// Label tftpModeLabel// Text tftpModeFrame// Label serverLabel// TextField serverTF// Label subjectLabel// TextField subjectTF// Label bodyLabel// Text bodyText// Label expLabel// TextField expTF// Label sizeLabel// TextField sizeTF// Label permLabel// TextField permFrame////// Set up 2 columns in paramRC// paramRC->Defer(True); paramRC->SetOrientation(RcROW_MAJOR); paramRC->SetColCount(2); paramRC->SetColAlignment(XmALIGNMENT_END); paramRC->SetColWidthAdjust(0, RcADJUST_NONE); paramRC->SetColWidthAdjust(1, RcADJUST_ATTACH); paramRC->SetColResize(0, False); paramRC->SetColResize(1, True); Widget charLabel = XmCreateLabel (*paramRC, "charLabel", 0,0); Widget charForm = XmCreateForm (*paramRC, "charForm", 0,0); Widget outNameLabel = XmCreateLabel (*paramRC, "outNameLabel", 0,0); outNameTF = CreateTextField(*paramRC, "outNameTF", 0,0); Widget octTypeLabel = XmCreateLabel (*paramRC, "octTypeLabel", 0,0); octTypeTF = CreateTextField(*paramRC, "octTypeTF", 0,0); Widget octPadLabel = XmCreateLabel (*paramRC, "octPadLabel", 0,0); octPadTF = CreateTextField(*paramRC, "octPadTF", 0,0); Widget otherLabel = XmCreateLabel (*paramRC, "otherLabel", 0,0); args.Reset(); args.EditMode(XmMULTI_LINE_EDIT); otherText = CreateText (*paramRC, "otherText", ARGS); Widget hostLabel = XmCreateLabel (*paramRC, "hostLabel", 0,0); hostTF = CreateTextField(*paramRC, "hostTF", 0,0); Widget dirLabel = XmCreateLabel (*paramRC, "dirLabel", 0,0); dirTF = CreateTextField(*paramRC, "dirTF", 0,0); Widget ftpModeLabel = XmCreateLabel (*paramRC, "ftpModeLabel", 0,0); Widget ftpModeFrame = XmCreateFrame (*paramRC, "ftpModeFrame", 0,0); Widget tftpModeLabel = XmCreateLabel (*paramRC, "tftpModeLabel", 0,0); Widget tftpModeFrame = XmCreateFrame (*paramRC, "tftpModeFrame", 0,0); Widget serverLabel = XmCreateLabel (*paramRC, "serverLabel", 0,0); serverTF = CreateTextField(*paramRC, "serverTF", 0,0); Widget subjectLabel = XmCreateLabel (*paramRC, "subjectLabel", 0,0); subjectTF = CreateTextField(*paramRC, "subjectTF", 0,0); Widget bodyLabel = XmCreateLabel (*paramRC, "bodyLabel", 0,0); args.Reset(); args.EditMode(XmMULTI_LINE_EDIT); bodyText = CreateText (*paramRC, "bodyText", ARGS); Widget expLabel = XmCreateLabel (*paramRC, "expLabel", 0,0); expTF = CreateTextField(*paramRC, "expTF", 0,0); Widget sizeLabel = XmCreateLabel (*paramRC, "sizeLabel", 0,0); sizeTF = CreateTextField(*paramRC, "sizeTF", 0,0); Widget permLabel = XmCreateLabel (*paramRC, "permLabel", 0,0); Widget permFrame = XmCreateFrame (*paramRC, "permFrame", 0,0);//// Create charForm hierarchy//// charForm// TextField charTF// MenuBar charMB// CascadeButton charCB// PulldownMenu charPD// PushButton charAsciiPB// PushButton charIso1PB// PushButton charIso2PB// PushButton charIso3PB// PushButton charIso4PB// PushButton charIso5PB// PushButton charIso6PB// PushButton charIso7PB// PushButton charIso8PB// PushButton charIso9PB// PushButton charIso13PB// args.Reset(); args.TopAttachment(XmATTACH_FORM); args.LeftAttachment(XmATTACH_NONE); args.RightAttachment(XmATTACH_FORM); args.BottomAttachment(XmATTACH_FORM); Widget charMB = XmCreateMenuBar(charForm, "charMB", ARGS); args.LeftAttachment(XmATTACH_FORM); args.RightAttachment(XmATTACH_WIDGET, charMB); args.Value("us-ascii"); charTF = CreateTextField(charForm, "charTF", ARGS); Widget charPD = XmCreatePulldownMenu(charMB, "charPD", 0,0); charAsciiPB = XmCreatePushButton(charPD, "us-ascii", 0,0); charIso1PB = XmCreatePushButton(charPD, "iso-8859-1", 0,0); charIso2PB = XmCreatePushButton(charPD, "iso-8859-2", 0,0); charIso3PB = XmCreatePushButton(charPD, "iso-8859-3", 0,0); charIso4PB = XmCreatePushButton(charPD, "iso-8859-4", 0,0); charIso5PB = XmCreatePushButton(charPD, "iso-8859-5", 0,0); charIso6PB = XmCreatePushButton(charPD, "iso-8859-6", 0,0); charIso7PB = XmCreatePushButton(charPD, "iso-8859-7", 0,0); charIso8PB = XmCreatePushButton(charPD, "iso-8859-8", 0,0); charIso9PB = XmCreatePushButton(charPD, "iso-8859-9", 0,0); charIso13PB = XmCreatePushButton(charPD, "iso-8859-13", 0,0); XtAddCallback(charAsciiPB, XmNactivateCallback, (XtCallbackProc)DoCharset, this); XtAddCallback(charIso1PB, XmNactivateCallback, (XtCallbackProc)DoCharset, this); XtAddCallback(charIso2PB, XmNactivateCallback, (XtCallbackProc)DoCharset, this); XtAddCallback(charIso3PB, XmNactivateCallback, (XtCallbackProc)DoCharset, this); XtAddCallback(charIso4PB, XmNactivateCallback, (XtCallbackProc)DoCharset, this);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -