📄 sendedit.c
字号:
/* * $Id: SendEdit.C,v 1.5 2000/05/07 12:26:12 fnevgeny Exp $ * * Copyright (c) 1994 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 "IshAppC.h"#include "SendWinP.h"#include "SendWinC.h"#include "ButtonMgrC.h"#include "IncludeWinC.h"#include "SendIconC.h"#include "FileMsgC.h"#include "MsgPartC.h"#include "ConfPrefC.h"#include "Misc.h"#include "FileChooserWinC.h"#include "Query.h"#include "FileMisc.h"#include "HeaderC.h"#include "HeaderValC.h"#include "CompPrefC.h"#include "edit.h"#include "SendMisc.h"#ifdef HGLTERM#include "TermWinC.h"#endif#include <hgl/MimeRichTextC.h>#include <hgl/WXmString.h>#include <hgl/WArgList.h>#include <hgl/PixmapC.h>#include <hgl/SysErr.h>#include <hgl/rsrc.h>#include <hgl/MemMap.h>#include <Xm/MessageB.h>#include <Xm/RowColumn.h> // For XmMenuPosition#include <Xm/ToggleB.h>#include <unistd.h>#include <errno.h>/*--------------------------------------------------------------- * Callbacks to handle enriched editing commands */voidSendWinP::DoUndelete(Widget, SendWinP *This, XtPointer){ This->bodyText->Undelete(); XtSetSensitive(This->editUndeletePB, False); This->buttMgr->SensitivityChanged(This->editUndeletePB);}voidSendWinP::DoPlain(Widget, SendWinP *This, XtPointer){ This->bodyText->ChangeFont(FC_PLAIN);}voidSendWinP::DoBold(Widget, SendWinP *This, XtPointer){ This->bodyText->ChangeFont(FC_BOLD);}voidSendWinP::DoItalic(Widget, SendWinP *This, XtPointer){ This->bodyText->ChangeFont(FC_ITALIC);}voidSendWinP::DoFixed(Widget, SendWinP *This, XtPointer){ This->bodyText->ChangeFont(FC_FIXED);}voidSendWinP::DoBigger(Widget, SendWinP *This, XtPointer){ This->bodyText->ChangeFont(FC_BIGGER);}voidSendWinP::DoSmaller(Widget, SendWinP *This, XtPointer){ This->bodyText->ChangeFont(FC_SMALLER);}voidSendWinP::DoUnderline(Widget, SendWinP *This, XtPointer){ This->bodyText->ChangeFont(FC_UNDERLINE);}voidSendWinP::DoCenter(Widget, SendWinP *This, XtPointer){ This->bodyText->ChangeJust(JC_CENTER);}voidSendWinP::DoFlushLeft(Widget, SendWinP *This, XtPointer){ This->bodyText->ChangeJust(JC_LEFT);}voidSendWinP::DoFlushRight(Widget, SendWinP *This, XtPointer){ This->bodyText->ChangeJust(JC_RIGHT);}voidSendWinP::DoFlushBoth(Widget, SendWinP *This, XtPointer){ This->bodyText->ChangeJust(JC_BOTH);}voidSendWinP::DoNoFill(Widget, SendWinP *This, XtPointer){ This->bodyText->ChangeJust(JC_NOFILL);}voidSendWinP::DoExcerptMore(Widget, SendWinP *This, XtPointer){ This->bodyText->ChangeJust(JC_EXCERPT_MORE);}voidSendWinP::DoExcerptLess(Widget, SendWinP *This, XtPointer){ This->bodyText->ChangeJust(JC_EXCERPT_LESS);}voidSendWinP::DoLeftMarginIn(Widget, SendWinP *This, XtPointer){ This->bodyText->ChangeMargin(MC_LEFT_IN);}voidSendWinP::DoLeftMarginOut(Widget, SendWinP *This, XtPointer){ This->bodyText->ChangeMargin(MC_LEFT_OUT);}voidSendWinP::DoRightMarginIn(Widget, SendWinP *This, XtPointer){ This->bodyText->ChangeMargin(MC_RIGHT_IN);}voidSendWinP::DoRightMarginOut(Widget, SendWinP *This, XtPointer){ This->bodyText->ChangeMargin(MC_RIGHT_OUT);}voidSendWinP::DoColorRed(Widget, SendWinP *This, XtPointer){ This->bodyText->ChangeColor("Red");}voidSendWinP::DoColorGreen(Widget, SendWinP *This, XtPointer){ This->bodyText->ChangeColor("Green");}voidSendWinP::DoColorBlue(Widget, SendWinP *This, XtPointer){ This->bodyText->ChangeColor("Blue");}voidSendWinP::DoColorYellow(Widget, SendWinP *This, XtPointer){ This->bodyText->ChangeColor("Yellow");}voidSendWinP::DoColorMagenta(Widget, SendWinP *This, XtPointer){ This->bodyText->ChangeColor("Magenta");}voidSendWinP::DoColorCyan(Widget, SendWinP *This, XtPointer){ This->bodyText->ChangeColor("Cyan");}voidSendWinP::DoColorBlack(Widget, SendWinP *This, XtPointer){ This->bodyText->ChangeColor("Black");}voidSendWinP::DoColorWhite(Widget, SendWinP *This, XtPointer){ This->bodyText->ChangeColor("White");}voidSendWinP::DoColorOther(Widget, SendWinP *This, XtPointer){}voidSendWinP::DoColorNone(Widget, SendWinP *This, XtPointer){ This->bodyText->ChangeColor("None");}/*----------------------------------------------------------------------- * Handle display of part popup menu */voidSendWinP::PostPartMenu(SendIconC *icon, SendWinP *This){ This->popupIcon = icon; MsgPartC *part = icon->data; if ( part->IsMultipart() ) { XtUnmanageChild(This->mimePUEditPB); XtManageChild (This->mimePUContPB); XtManageChild (This->mimePUTypeCB); } else if ( part->Is822() ) { XtManageChild (This->mimePUEditPB); XtManageChild (This->mimePUContPB); XtUnmanageChild(This->mimePUTypeCB); } else { XtManageChild (This->mimePUEditPB); XtUnmanageChild(This->mimePUContPB); XtUnmanageChild(This->mimePUTypeCB); } WXmString wstr = (char *)This->popupIcon->labelStr; XtVaSetValues(This->mimePULabel, XmNlabelString, (XmString)wstr, NULL); XtManageChild(This->mimePULabel); XmMenuPosition(This->mimePU, icon->lastEvent); XtManageChild(This->mimePU);} // End PostPartMenu/*--------------------------------------------------------------- * Callback to handle double-click on a part icon */voidSendWinP::OpenPart(SendIconC *icon, SendWinP *This){ This->popupIcon = icon; MsgPartC *part = icon->data;//// Call appropriate edit methods, depending on type// if ( part->IsMultipart() || part->Is822() ) DoEditContents(NULL, This, NULL); else DoEditPart(NULL, This, NULL);} // End OpenPart/*--------------------------------------------------------------- * Callback to handle edit of part attributes */voidSendWinP::DoEditPart(Widget, SendWinP *This, XtPointer){//// Get pointer to this part// SendIconC *icon = This->popupIcon; This->pub->BusyCursor(True); This->modifying = True; This->modIcon = icon; icon->Highlight();//// Set up include window// if ( !This->fileDataWin ) { This->fileDataWin = new IncludeWinC(*This->pub, "fileDataWin"); This->fileDataWin->AddOkCallback ((CallbackFn *)IncludeFileOk, This); This->fileDataWin->AddHideCallback((CallbackFn *)IncludeFileHide, This); } This->fileDataWin->Show(icon); This->LoadEditPixmaps(icon); icon->Animate(This->editPixmaps); This->pub->BusyCursor(False);} // End DoEditPart/*--------------------------------------------------------------- * Callback to handle edit of part contents */voidSendWinP::DoEditContents(Widget, SendWinP *This, XtPointer){//// See if this part is already being edited// u_int count = This->editWinList.size(); for (int i=0; i<count; i++) { SendWinC *editWin = (SendWinC*)*This->editWinList[i]; if ( editWin->priv->editIcon == This->popupIcon ) { editWin->HalTopLevelC::Show(); return; } } This->pub->BusyCursor(True); This->popupIcon->Highlight();//// Bring up a window showing the contents// SendWinC *editWin = This->GetEditWin(); editWin->priv->Edit(This->popupIcon); This->LoadEditPixmaps(This->popupIcon); This->popupIcon->Animate(This->editPixmaps); This->pub->BusyCursor(False);} // End DoEditContents/*--------------------------------------------------------------- * Method to find or create a new edit window */SendWinC*SendWinP::GetEditWin(){//// First look for an existing, unused window// SendWinC *editWin = NULL; unsigned count = editWinList.size(); Boolean found = False; for (int i=0; !found && i<count; i++) { editWin = (SendWinC*)*editWinList[i]; if ( !editWin->IsShown() ) found = True; } // End for each existing edit window//// If we didn't find a window, we need to create a new one// if ( !found ) { pub->BusyCursor(True); editWin = new SendWinC("sendWin", *pub, SEND_EDIT); void *tmp = (void*)editWin; editWinList.add(tmp);//// Set the values to support queries// editWin->priv->optCcTB = optCcTB; editWin->priv->optBccTB = optBccTB; editWin->priv->optFccTB = optFccTB; editWin->priv->optOtherTB = optOtherTB; editWin->priv->optMimeTB = optMimeTB; editWin->priv->optAddSigTB = optAddSigTB; editWin->priv->optDigSignTB = optDigSignTB; editWin->priv->optEncryptTB = optEncryptTB; editWin->priv->optCheckAddrTB = optCheckAddrTB; editWin->priv->optMsgAltTB = optMsgAltTB; editWin->priv->optMsgMimeTB = optMsgMimeTB; editWin->priv->optMsgPlainTB = optMsgPlainTB; editWin->priv->optTextRichTB = optTextRichTB; editWin->priv->optTextPlainTB = optTextPlainTB; pub->BusyCursor(False); } return editWin;} // End GetEditWin/*--------------------------------------------------------------- * Method used to edit an rfc822 part or container */voidSendWinP::Edit(SendIconC *icon){ pub->HalTopLevelC::Show(); editIcon = icon; bodyText->Defer(True); bodyText->Clear(); if ( icon->data->Is822() ) {//// Turn on the header text field//
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -