See CHANGES

This commit is contained in:
Mid Favila 2022-12-04 13:20:21 -04:00
parent 75df414091
commit bb06feab63
6 changed files with 74 additions and 24 deletions

View File

@ -0,0 +1,4 @@
2022/12/04 - Added LICENSE. Added CHANGES. Removed dependence on left-to-right
evaluation in XawVaCreateSimpleMenu().
2022/12/03 - Initial commit.

22
LICENSE
View File

@ -0,0 +1,22 @@
Copyright (C) 2022/12/04 Mid Favila
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL MID FAVILA BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Except as contained in this notice, the name of Mid Favila shall not be used in
advertising or otherwise to promote the sale, use or other dealings in this
Software without prior written authorization from Mid Favila.

17
src/Makefile Normal file
View File

@ -0,0 +1,17 @@
.POSIX:
SRC = \
callback.c \
dialogues.c \
main.c
LIBS = \
-lXawPlus \
-lXt \
-lX11
default: $(SRC)
$(CC) -o xirc $(SRC) $(CFLAGS) $(LIBS) $(LDFLAGS)
clean:
rm xirc *.o *~

View File

@ -1,6 +1,6 @@
#include "headers.h"
Widget XawMakeMenuEntry(Widget parent, const char *name, void *func, XtPointer data)
Widget XawVaMakeSimpleMenuEntry(Widget parent, const char *name, void *func, XtPointer data)
{
Widget w;
w = XtVaCreateManagedWidget(name, smeBSBObjectClass, parent, NULL);
@ -9,25 +9,25 @@ Widget XawMakeMenuEntry(Widget parent, const char *name, void *func, XtPointer d
return(w);
}
/* XawMakeMenu -- 0.1 */
/* XawVaMakeSimpleMenu -- 0.1 */
/* Accepts a parent that contains the menu, a name for the menu, and the quantity of argument pairs supplied */
/* an "argument pair" consists of a name, used as the menu entry's label, and a callback, which is assigned to it. */
/* Returns NULL on failure, or a pointer to the menu on success. */
Widget XawMakeMenu(Widget parent, const char *name, int argtrips, ...)
Widget XawVaMakeSimpleMenu(Widget parent, const char *name, int argtrips, ...)
{
va_list ap;
va_start(ap, argtrips);
void *labelp, *funcp, *datap;
int i;
Widget menu;
i = 0;
menu = 0;
if( (menu = XtVaCreatePopupShell(name, simpleMenuWidgetClass, parent, NULL)) == NULL)
{
return(NULL);
@ -36,7 +36,11 @@ Widget XawMakeMenu(Widget parent, const char *name, int argtrips, ...)
{
for(i = 0; i < argtrips; i++)
{
XawMakeMenuEntry(menu, va_arg(ap, void*), (XtCallbackProc *) va_arg(ap, void*), va_arg(ap, void*));
labelp = va_arg(ap, void*);
funcp = va_arg(ap, void*);
datap = va_arg(ap, void*);
XawVaMakeSimpleMenuEntry(menu, labelp, funcp, datap);
}
}
@ -63,19 +67,18 @@ Widget XawVaCreateSimpleMenuBar(Widget parent, const char *name, int menutrip, .
XtNborderWidth, 1,
XtNshadowWidth, 1,
NULL);
gridbox = XtVaCreateManagedWidget("Menu Gridbox", gridboxWidgetClass, frame,
XtNgridx, 0,
XtNgridy, 0,
XtNweightx, 1,
NULL);
for(i = 0; i < menutrip; i++)
{
bname = va_arg(ap, void*);
mname = va_arg(ap, void*);
button = va_arg(ap, void*);
if(i+1 == menutrip)
{
@ -95,5 +98,6 @@ Widget XawVaCreateSimpleMenuBar(Widget parent, const char *name, int menutrip, .
);
}
va_end(ap);
return(frame);
}

View File

@ -1,9 +1,9 @@
Widget XawMakeMenuEntry(Widget parent, const char *name, void *func, XtPointer data);
/* example: XawMakeMenu(tb_file, "File Menu", 2,
Widget XawVaMakeSimpleMenuEntry(Widget parent, const char *name, void *func, XtPointer data);
/* example: XawVaMakeSimpleMenu(tb_file, "File Menu", 2,
"Connect...", cb_connect, struct data_connect,
"Quit", cb_quit, EXIT_STATUS);
*/
Widget XawMakeMenu(Widget parent, const char *name, int argtrips, ...);
Widget XawVaMakeSimpleMenu(Widget parent, const char *name, int argtrips, ...);
/* Return a menu bar containing MenuButtons bound to the associated Menus. */
/* Example call: XawVaCreateSimpleMenuBar(foo, "Menu Bar", 3,

View File

@ -19,38 +19,40 @@ int main(int argc, char **argv)
toolbar = XawVaCreateSimpleMenuBar(toplevel, "Tool Bar", 4,
"File", "File Menu", &tb_file,
"View", "View Menu", &tb_view,
"Operations", "Operations Menu", &tb_oper,
"Edit", "Edit Menu", &tb_oper,
"Help", "Help Menu", &tb_help);
menu_file = XawMakeMenu(tb_file, "File Menu", 2,
menu_file = XawVaMakeSimpleMenu(tb_file, "File Menu", 2,
"Connect...", cb_errlog, "Connecting to: irc.libera.chat",
"Quit", cb_quit, EXIT_SUCCESS);
menu_view = XawMakeMenu(tb_view, "View Menu", 1,
menu_view = XawVaMakeSimpleMenu(tb_view, "View Menu", 1,
"Show Log", cb_errlog, "Showing log!");
menu_oper = XawMakeMenu(tb_oper, "Operations Menu", 4,
menu_oper = XawVaMakeSimpleMenu(tb_oper, "Edit Menu", 4,
"Join Channel", cb_errlog, "JOIN: foobaz",
"Privmsg", cb_errlog, "PRIVMSG: foobar",
"Whois", cb_errlog, "WHOIS: foobar",
"Ping", cb_errlog, "PING: foobar");
menu_help = XawMakeMenu(tb_help, "Help Menu", 1,
menu_help = XawVaMakeSimpleMenu(tb_help, "Help Menu", 1,
"About", cb_errlog, "Mockup of an IRC client GUI. WIP!");
tabs = XtVaCreateManagedWidget("Main Window", tabsWidgetClass, toplevel,
tabs = XtVaCreateManagedWidget("Main Window", tabsWidgetClass, toplevel,
XtNgridx, 0,
XtNgridy, -1,
XtNweighty, 1,
NULL);
tab_frame = XtVaCreateManagedWidget("##secret-project", frameWidgetClass, tabs,
XtNshadowType, Trough,
XtNshadowWidth, 1,
NULL);
tab_gbox = XtVaCreateManagedWidget("Tab Gridbox", gridboxWidgetClass, tab_frame,
XtNgridHeight, 10,
NULL);
tab_vpane = XtVaCreateManagedWidget("Chat/List Pane", panedWidgetClass, tab_gbox,
XtNorientation, XtorientHorizontal,
XtNgridy, 0,
@ -62,11 +64,12 @@ int main(int argc, char **argv)
XtNdefaultColumns, 1,
XtNforceColumns, True,
NULL);
tab_textout = XtVaCreateManagedWidget("Text Output", asciiTextWidgetClass, tab_vpane,
XtNtype, XawAsciiFile,
XtNstring, "/tmp/irc.txt",
XtNscrollVertical, XawtextScrollAlways,
XtNwrap, XawtextWrapLine,
XtNwrap, XawtextWrapWord,
NULL);
tab_textin = XtVaCreateManagedWidget("Text Input", asciiTextWidgetClass, tab_gbox,
@ -84,12 +87,12 @@ int main(int argc, char **argv)
users[0] = "foo";
users[1] = "bar";
users[2] = "baz";
users[3] = "Hello,";
users[4] = "all";
users[5] = "you";
users[6] = "sinners";
users[7] = "out";
users[8] = "there!";
users[3] = "alice";
users[4] = "bob";
users[5] = "ted";
users[6] = "mallory";
users[7] = "eve";
users[8] = "eren";
users[9] = NULL;