/* --------------------------------------------------------------------- * * help.c * * --------------------------------------------------------------------- * * This file is part of the nebula irc client * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ #include #include #include #include #include #include "main.h" #include "help.h" #ifndef XmFONTLIST_DEFAULT_TAG #define XmFONTLIST_DEFAULT_TAG "" #endif extern systemStatusRecord sysState; extern Widget aboutDlgBox; extern Widget commandsHelpDlgBox; void createAboutBox(Widget parent) { XmString theXmString; XmString theXmString2; char theString[256]; Arg args[2]; Widget remove; sprintf(theString, "Nebula\n\ an IRC Client.\n\n\ version: %s\n\ %s\n\n\ Nebula IRC is distributed under BSD.",\ CLIENT_VERSION, sysState.systemInfo); theXmString = XmStringGenerate(theString, XmFONTLIST_DEFAULT_TAG, XmCHARSET_TEXT, NULL); theXmString2 = XmStringCreateLocalized("About"); XtSetArg(args[0], XmNdialogTitle, theXmString2); XtSetArg(args[1], XmNmessageString, theXmString); aboutDlgBox = XmCreateInformationDialog(parent, "about", args, 2); XmStringFree(theXmString); XmStringFree(theXmString2); remove = XmMessageBoxGetChild(aboutDlgBox, XmDIALOG_HELP_BUTTON); XtUnmanageChild(remove); remove = XmMessageBoxGetChild(aboutDlgBox, XmDIALOG_CANCEL_BUTTON); XtUnmanageChild(remove); } void displayAboutBox() { XtManageChild(aboutDlgBox); } void createCommandsHelpBox(Widget parent) { XmString theXmString; Arg args[8]; int argcount; Widget remove; Widget textArea; Widget form; argcount = 0; theXmString = XmStringCreateLocalized("Help"); XtSetArg(args[argcount], XmNdialogTitle, theXmString); argcount++; XtSetArg(args[argcount], XmNautoUnmanage, True); argcount++; commandsHelpDlgBox = XmCreatePromptDialog(parent, "help", args, argcount); XmStringFree(theXmString); /* Now get rid of the things we don't want */ remove = XmSelectionBoxGetChild(commandsHelpDlgBox, XmDIALOG_SELECTION_LABEL); XtUnmanageChild(remove); remove = XmSelectionBoxGetChild(commandsHelpDlgBox, XmDIALOG_TEXT); XtUnmanageChild(remove); remove = XmSelectionBoxGetChild(commandsHelpDlgBox, XmDIALOG_HELP_BUTTON); XtUnmanageChild(remove); remove = XmSelectionBoxGetChild(commandsHelpDlgBox, XmDIALOG_CANCEL_BUTTON); XtUnmanageChild(remove); form = XtVaCreateWidget("form", xmFormWidgetClass, commandsHelpDlgBox, NULL); argcount = 0; XtSetArg(args[argcount], XmNeditable, False); argcount++; XtSetArg(args[argcount], XmNeditMode, XmMULTI_LINE_EDIT); argcount++; XtSetArg(args[argcount], XmNrows, 10); argcount++; XtSetArg(args[argcount], XmNcolumns, 50); argcount++; XtSetArg(args[argcount], XmNtopAttachment, XmATTACH_FORM); argcount++; XtSetArg(args[argcount], XmNleftAttachment, XmATTACH_FORM); argcount++; XtSetArg(args[argcount], XmNbottomAttachment, XmATTACH_FORM); argcount++; XtSetArg(args[argcount], XmNrightAttachment, XmATTACH_FORM); argcount++; textArea = XmCreateScrolledText(form, "output", args, argcount); if (textArea == NULL) perror("textArea: "); XtManageChild(textArea); XtManageChild(form); /* now add the help text */ { XmTextInsert(textArea, XmTextGetLastPosition(textArea), "/deop NICK: removes op (shortcut for mode)"); XmTextInsert(textArea, XmTextGetLastPosition(textArea), "/mode CHANNEL {[+|-]|o|p|s|i|t|n|b|v} [] [USER] [BAN MASK] : change channel mode\n"); XmTextInsert(textArea, XmTextGetLastPosition(textArea), "/mode USER {[+|-]|i|w|s|o} : change user mode\n"); XmTextInsert(textArea, XmTextGetLastPosition(textArea), "/msg NICKNAME: sends private message (remember: channels are like users with # or & at the beginning)\n"); XmTextInsert(textArea, XmTextGetLastPosition(textArea), "/nick NICKNAME: change nickname\n"); XmTextInsert(textArea, XmTextGetLastPosition(textArea), "/ns command: shortcut for /msg nickserv command\n"); XmTextInsert(textArea, XmTextGetLastPosition(textArea), "/op NICK: gives op (shortcut for mode)\n"); XmTextInsert(textArea, XmTextGetLastPosition(textArea), "/query NICKNAME: start private conversation (empty nick ends)\n"); XmTextInsert(textArea, XmTextGetLastPosition(textArea), "/quit: quit nebula\n"); XmTextInsert(textArea, XmTextGetLastPosition(textArea), "/server SERVERNAME: connect to server\n"); XmTextInsert(textArea, XmTextGetLastPosition(textArea), "/whois NICKNAME: get user information from server\n"); XmTextInsert(textArea, XmTextGetLastPosition(textArea), "\nCTCP commands\n"); XmTextInsert(textArea, XmTextGetLastPosition(textArea), "/ctcp NICKNAME version: requests client versioni\n"); XmTextInsert(textArea, XmTextGetLastPosition(textArea), "/me ACTION: sends an action (typically a message starting with the nickname)"); XmTextSetInsertionPosition(textArea, 0); } } void displayCommandsHelpBox() { XtManageChild(commandsHelpDlgBox); } #include "copyright.h"