diff --git a/ChangeLog b/ChangeLog index 3a0392f..6210bb1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -3,6 +3,7 @@ * Convert build system to plain Make. * Start removing references to FreeNode. * Move the repeated copyright banners out to a single header. + * Replace some of the macros with actual function calls. 2005-04-01 Riccardo Mottola * network.c : removed useless statement diff --git a/src/main.c b/src/main.c index 484ab61..c2600d4 100644 --- a/src/main.c +++ b/src/main.c @@ -61,46 +61,73 @@ int main (int argc, char *argv[]) Widget userForm; /* Menu Stuff */ + XmString filestr, userstr, prefstr, savconstr, quitstr, whostr, cliverstr, opstr, deopstr, abtstr, cmdstr; Widget menuBar, helpMenu; + filestr = XmStringCreateLocalized("File"); + userstr = XmStringCreateLocalized("User"); + prefstr = XmStringCreateLocalized("Preferences..."); + savconstr = XmStringCreateLocalized("Save Conversation"); + quitstr = XmStringCreateLocalized("Quit"); + whostr = XmStringCreateLocalized("Whois"); + cliverstr = XmStringCreateLocalized("Client version"); + opstr = XmStringCreateLocalized("Op"); + deopstr = XmStringCreateLocalized("Deop"); + abtstr = XmStringCreateLocalized("About"); + cmdstr = XmStringCreateLocalized("Commands"); + topWidget = XtVaAppInitialize(&nebulaIrcAppContext, "Nebula IRC", NULL, 0, &argc, argv, NULL, NULL); mainWindow = XtVaCreateManagedWidget("main_window", xmMainWindowWidgetClass, topWidget, XmNcommandWindowLocation, XmCOMMAND_BELOW_WORKSPACE, XmNwidth, 600, XmNheight, 500, NULL); menuBar = XmVaCreateSimpleMenuBar(mainWindow, "menubar", - XmVaCASCADEBUTTON, XmStringCreateLocalized("File"), 'F', - XmVaCASCADEBUTTON, XmStringCreateLocalized("User"), 'U', + XmVaCASCADEBUTTON, filestr, 'F', + XmVaCASCADEBUTTON, userstr, 'U', NULL); XmVaCreateSimplePulldownMenu(menuBar, "file_menu", 0, fileMenuCall, - XmVaPUSHBUTTON, XmStringCreateLocalized("Preferences..."), 'P', NULL, NULL, - XmVaPUSHBUTTON, XmStringCreateLocalized("Save Conversation"), 'S', NULL, NULL, - XmVaPUSHBUTTON, XmStringCreateLocalized("Quit"), 'Q', NULL, NULL, + XmVaPUSHBUTTON, prefstr, 'P', NULL, NULL, + XmVaPUSHBUTTON, savconstr, 'S', NULL, NULL, + XmVaPUSHBUTTON, quitstr, 'Q', NULL, NULL, NULL); + XmVaCreateSimplePulldownMenu(menuBar, "user_menu", 1, userMenuCall, - XmVaPUSHBUTTON, XmStringCreateLocalized("Whois"), 'W', NULL, NULL, - XmVaPUSHBUTTON, XmStringCreateLocalized("Client version"), '\0', NULL, NULL, - XmVaPUSHBUTTON, XmStringCreateLocalized("Op"), 'O', NULL, NULL, - XmVaPUSHBUTTON, XmStringCreateLocalized("Deop"), 'D', NULL, NULL, + XmVaPUSHBUTTON, whostr, 'W', NULL, NULL, + XmVaPUSHBUTTON, cliverstr, '\0', NULL, NULL, + XmVaPUSHBUTTON, opstr, 'O', NULL, NULL, + XmVaPUSHBUTTON, deopstr, 'D', NULL, NULL, NULL); helpMenu = XtVaCreateManagedWidget("Help", xmCascadeButtonWidgetClass, menuBar, XmNmnemonic, 'H', NULL); + XmVaCreateSimplePulldownMenu(menuBar, "Help", 2, helpMenuCall, - XmVaPUSHBUTTON, XmStringCreateLocalized("About..."), 'A', NULL, NULL, - XmVaPUSHBUTTON, XmStringCreateLocalized("Commands"), 'C', NULL, NULL, + XmVaPUSHBUTTON, abtstr, 'A', NULL, NULL, + XmVaPUSHBUTTON, cmdstr, 'C', NULL, NULL, NULL); XtVaSetValues(menuBar, XmNmenuHelpWidget, helpMenu, NULL); XtManageChild(menuBar); - + + XmStringFree(filestr); + XmStringFree(userstr); + XmStringFree(prefstr); + XmStringFree(savconstr); + XmStringFree(quitstr); + XmStringFree(whostr); + XmStringFree(cliverstr); + XmStringFree(opstr); + XmStringFree(deopstr); + XmStringFree(abtstr); + XmStringFree(cmdstr); + mainForm = XtVaCreateWidget("form", xmFormWidgetClass, mainWindow, XmNfractionBase, 3, NULL); userForm = XtVaCreateWidget("userform", xmFormWidgetClass, mainForm, diff --git a/src/main.h b/src/main.h index 24416fd..9b26ba4 100644 --- a/src/main.h +++ b/src/main.h @@ -4,8 +4,7 @@ * This file is part of the nebula irc client * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#include /* for MAXHOSTNAMELEN */ -#include /* for MAXHOSTNAMELEN on other systems */ +#include /* for MAXHOSTNAMELEN */ #define PREF_FILE_NAME ".nebula.rc"