Index: work/lesstif/lesstif_tabs/main.c =================================================================== --- work/lesstif/lesstif_tabs/main.c (revision 35666) +++ work/lesstif/lesstif_tabs/main.c (nonexistent) @@ -1,201 +0,0 @@ -#include -#include -#include -#include -#include - -/* Arbitrary data for the first "page" */ -char *page1_labels[] = { - "Introduction", - "+", - "The Motif Programming Model", - "Overview of the Motif Toolkit", - "The Main Window", - "Introduction to Dialogs", - (char *)0 -}; - -/* Arbitrary data for the second "page" */ -char *page2_labels[] = { - "Selection Dialogs", - "Custom Dialogs", - "Manager Widgets", - "The Container and IconGadget Widgets", - "Scrolled Windows and ScrollBars", - (char *)0 -}; - -/* Arbitrary data for the third "page" */ -char *page3_labels[] = { - "The DrawingArea", - "Labels and Buttons", - "The List Widget", - "The ComboBox Widget", - "The SpinBox and SimpleSpinBox Widgets", - (char *)0 -}; - -/* Arbitrary data for the fourth "page" */ -char *page4_labels[] = { - "The Scale Widget", - "The Notebook Widget", - "Text Widgets", - "Menus", - (char *)0 -}; - -/* A pointer to all the "page" data */ -char **pages[] = { - page1_labels, - page2_labels, - page3_labels, - page4_labels, - (char **)0 -}; - -void cb(Widget w, XtPointer client_data, XtPointer call_data) -{ - XmNotebookCallbackStruct *nptr; - nptr = (XmNotebookCallbackStruct *) call_data; - - printf("New Page: %d %s Old page: %d %s\n", - nptr->page_number-1, (nptr->page_widget ? XtName(nptr->page_widget) : "(blank)"), - nptr->prev_page_number-1, (nptr->prev_page_widget ? XtName(nptr->prev_page_widget) : "(blank)") - ); -} - - -void main(int argc, char **argv) -{ - Widget toplevel, notebook, page, label, tab, cnt; - XtAppContext app; - Arg args[16]; - XmString xms; - int i, j, n; - char buffer[128]; - Dimension wi, minwi = 0; - - XtSetLanguageProc(NULL, NULL, NULL); - - toplevel = XtVaOpenApplication(&app, "Demos", NULL, 0, &argc, argv, NULL, sessionShellWidgetClass, NULL); - - - XtVaSetValues(toplevel, XmNallowShellResize, 1, NULL); - - n = 0; - XtSetArg(args[n], XmNalignment, XmALIGNMENT_END); - n++; - XtSetArg(args[n], XmNmarginHeight, 20); - n++; - XtSetArg(args[n], XmNshadowThickness, 20); - n++; - cnt = XmCreateFrame(toplevel, "box-frame", args, n); - XtManageChild(cnt); - - -#if 0 - n = 0; - XtSetArg(args[n], XmNorientation, XmVERTICAL); - n++; - XtSetArg(args[n], XmNpacking, XmPACK_TIGHT); - n++; - XtSetArg(args[n], XmNresizeWidth, 1); - n++; - XtSetArg(args[n], XmNresizeHeight, 1); - n++; - cnt = XmCreateRowColumn(cnt, "ROW", args, n); - XtManageChild(cnt); -#endif - - n = 0; - XtSetArg(args[n], XmNlabelString, XmStringGenerate(pages[0][0], XmFONTLIST_DEFAULT_TAG, XmCHARSET_TEXT, NULL)); - n++; - label = XmCreateLabel(cnt, "label", args, n); - XtManageChild(label); - - n = 0; - XtSetArg(args[n], XmNlabelString, XmStringGenerate(pages[0][1], XmFONTLIST_DEFAULT_TAG, XmCHARSET_TEXT, NULL)); - n++; - label = XmCreateLabel(cnt, "label", args, n); - XtManageChild(label); - - /* Create the Notebook */ - n = 0; - XtSetArg(args[n], XmNbackPagePlacement, XmTOP_RIGHT); - n++; - XtSetArg(args[n], XmNbackPageNumber, 1); - n++; - XtSetArg(args[n], XmNbackPageSize, 1); - n++; - XtSetArg(args[n], XmNbindingType, XmNONE); - n++; - XtSetArg(args[n], XmNleftAttachment, XmATTACH_FORM); - n++; - XtSetArg(args[n], XmNtopAttachment, XmATTACH_FORM); - n++; - XtSetArg(args[n], XmNrightAttachment, XmATTACH_FORM); - n++; - XtSetArg(args[n], XmNbottomAttachment, XmATTACH_FORM); - n++; - XtSetArg(args[n], XmNresizable, 1); - n++; - notebook = XmCreateNotebook(cnt, "notebook", args, n); - - XtAddCallback(notebook, XmNpageChangedCallback, (XtCallbackProc)cb, (XtPointer)0); - - /* remove the page scroller */ - { - Widget scroller; - scroller = XtNameToWidget (notebook, "PageScroller"); - XtUnmanageChild (scroller); - } - - /* Create the "pages" */ - for (i = 0; pages[i] != (char **)0; i++) { - Dimension wi; - page = XmCreateRowColumn(notebook, "page", NULL, 0); - for (j = 0; pages[i][j] != (char *)0; j++) { - xms = XmStringGenerate(pages[i][j], XmFONTLIST_DEFAULT_TAG, XmCHARSET_TEXT, NULL); - n = 0; - XtSetArg(args[n], XmNlabelString, xms); - n++; - label = XmCreateLabel(page, "label", args, n); - XtManageChild(label); - XmStringFree(xms); - } - - n = 0; - XtSetArg(args[n], XmNnotebookChildType, XmMINOR_TAB); - n++; - sprintf(buffer, "tab %d", i); - tab = XmCreatePushButton(notebook, buffer, args, n); - XtManageChild(tab); -/* XtRealizeWidget(tab);*/ - - n = 0; - XtSetArg(args[n], XmNwidth, &wi);n++; - XtGetValues(tab, args, n); - printf("wi=%d\n", wi); - minwi+=wi+10; - - XtManageChild(page); - } - printf("minwi=%d\n", wi); - - n = 0; - XtSetArg(args[n], XmNminWidth, minwi);n++; - XtSetValues(toplevel, args, n); - printf("wi=%d\n", minwi); - - - XtManageChild(notebook); - XtRealizeWidget(toplevel); - - - - /* set tab to 2 */ - XtVaSetValues(notebook, XmNcurrentPageNumber, 2+1, NULL); - - - XtAppMainLoop(app); -} Index: work/lesstif/lesstif_tabs/Makefile =================================================================== --- work/lesstif/lesstif_tabs/Makefile (revision 35666) +++ work/lesstif/lesstif_tabs/Makefile (nonexistent) @@ -1,9 +0,0 @@ -#CFLAGS = -Wall -g -LDFLAGS = -lXm -lXt - -all: main - -main: main.c - -#a: a.c - Index: work/lesstif/xmFillBox/color.h =================================================================== --- work/lesstif/xmFillBox/color.h (revision 35666) +++ work/lesstif/xmFillBox/color.h (nonexistent) @@ -1,6 +0,0 @@ -typedef struct pcb_color_s { - unsigned char r, g, b, a; /* primary storage; alpha is not really supported at the moment */ - unsigned long packed; /* cache: 32 bit portable (byte-order-safe) packed version used for lookups */ - float fr, fg, fb, fa; /* cache: 0..1 version; using float to save memory^1 */ - char str[10]; /* cache: "#rrggbb[aa]" \0 terminated string version */ -} pcb_color_t; Index: work/lesstif/xmFillBox/main.c =================================================================== --- work/lesstif/xmFillBox/main.c (revision 35666) +++ work/lesstif/xmFillBox/main.c (nonexistent) @@ -1,102 +0,0 @@ -#include -#include -#include -#include "FillBox.h" -#include - -#define HORIZONTAL 1 - -static const char *LAB[] = {"one", "two", "three", "four", "five", "six", NULL }; -static const char *LAB2[] = {"111", "222", "333", "444", "555", "666", NULL }; - - -int main(int argc, char **argv) -{ - Widget toplevel, label[16], cnt, left, right, topform; - XtAppContext app; - Arg args[16]; - int n, i, vertical = 0; - char *expmask = argv[1]; - - if (expmask == NULL) expmask = "0100"; - else if (argv[2] != NULL) vertical = 1; - - XtSetLanguageProc(NULL, NULL, NULL); - - toplevel = XtVaOpenApplication(&app, "Demos", NULL, 0, &argc, argv, NULL, sessionShellWidgetClass, NULL); - - XtVaSetValues(toplevel, XmNallowShellResize, 1, NULL); - - XtRealizeWidget(toplevel); - - topform = XmCreateFormDialog(toplevel, "DIALOG", args, 0); - XtManageChild(topform); - - n = 0; - XtSetArg(args[n], PxmNfillBoxVertical, vertical); n++; -/* XtSetArg(args[n], XmNmarginWidth, 0); n++; - XtSetArg(args[n], XmNmarginHeight, 0); n++; - XtSetArg(args[n], XmNalignment, XmALIGNMENT_END); n++;*/ - XtSetArg(args[n], PxmNfillBoxFill, 1); n++; - XtSetArg(args[n], XmNtopAttachment, XmATTACH_FORM); n++; - XtSetArg(args[n], XmNbottomAttachment, XmATTACH_FORM); n++; - XtSetArg(args[n], XmNleftAttachment, XmATTACH_FORM); n++; - XtSetArg(args[n], XmNrightAttachment, XmATTACH_FORM); n++; - cnt = PxmCreateFillBox(topform, "form", args, n); - XtManageChild(cnt); - - - n = 0; - XtSetArg(args[n], PxmNfillBoxVertical, !vertical); n++; - XtSetArg(args[n], XmNmarginWidth, 0); n++; - XtSetArg(args[n], XmNmarginHeight, 0); n++; - XtSetArg(args[n], XmNalignment, XmALIGNMENT_END); n++; - XtSetArg(args[n], PxmNfillBoxFill, 1); n++; - left = PxmCreateFillBox(cnt, "left", args, n); - XtManageChild(left); - - n = 0; - XtSetArg(args[n], PxmNfillBoxVertical, !vertical); n++; - XtSetArg(args[n], XmNmarginWidth, 0); n++; - XtSetArg(args[n], XmNmarginHeight, 0); n++; - XtSetArg(args[n], XmNalignment, XmALIGNMENT_END); n++; - XtSetArg(args[n], PxmNfillBoxFill, 1); n++; - right = PxmCreateFillBox(cnt, "right", args, n); - XtManageChild(right); - - n = 0; - XtSetArg(args[n], PxmNfillBoxVertical, !!vertical); n++; - XtSetArg(args[n], XmNmarginWidth, 0); n++; - XtSetArg(args[n], XmNmarginHeight, 0); n++; - XtSetArg(args[n], XmNalignment, XmALIGNMENT_END); n++; - XtSetArg(args[n], PxmNfillBoxFill, 1); n++; - right = PxmCreateFillBox(right, "right2", args, n); - XtManageChild(right); - - for(i = 0; (expmask[i] != '\0') && (LAB[i] != NULL); i++) { - n = 0; - XtSetArg(args[n], XmNlabelString, XmStringCreateLtoR((char *)LAB[i], XmFONTLIST_DEFAULT_TAG)); - n++; - XtSetArg(args[n], PxmNfillBoxFill, (expmask[i] != '0')); - n++; - XtSetArg(args[n], XmNalignment, XmALIGNMENT_END); n++; - label[i] = XmCreateLabel(left, "label", args, n); - XtManageChild(label[i]); - } - - for(i = 0; (expmask[i] != '\0') && (LAB2[i] != NULL); i++) { - n = 0; - XtSetArg(args[n], XmNlabelString, XmStringCreateLtoR((char *)LAB2[i], XmFONTLIST_DEFAULT_TAG)); - n++; - XtSetArg(args[n], PxmNfillBoxFill, (expmask[i+1] != '0')); - n++; - XtSetArg(args[n], XmNalignment, XmALIGNMENT_END); n++; - label[i] = XmCreateLabel(right, "label", args, n); - XtManageChild(label[i]); - } - - - - XtAppMainLoop(app); - return 0; -} Index: work/lesstif/xmFillBox/config.h =================================================================== --- work/lesstif/xmFillBox/config.h (revision 35666) +++ work/lesstif/xmFillBox/config.h (nonexistent) @@ -1 +0,0 @@ -#define PCB_INLINE static inline \ No newline at end of file Index: work/lesstif/xmFillBox/Makefile =================================================================== --- work/lesstif/xmFillBox/Makefile (revision 35666) +++ work/lesstif/xmFillBox/Makefile (nonexistent) @@ -1,13 +0,0 @@ -LTF=../../../trunk/src_plugins/hid_lesstif -CFLAGS = -Wall -g -I. -I$(LTF) -#CFLAGS += -std=c89 -pedantic -LDFLAGS = -lXm -lXt -lX11 - -OBJS = main.o $(LTF)/FillBox.o - -all: main - -main: $(OBJS) - $(CC) -o main $(OBJS) $(LDFLAGS) - - Index: work/lesstif/winmove/main.c =================================================================== --- work/lesstif/winmove/main.c (revision 35666) +++ work/lesstif/winmove/main.c (nonexistent) @@ -1,42 +0,0 @@ -#include -#include - -#include -#include -#include -#include -#include -#include -#include - - -XtAppContext app_context; -Widget appwidget, w; -Display *display; - - -int main(int argc, char *argv[]) -{ - XrmOptionDescRec *new_options = NULL; - Arg args[30]; - - appwidget = XtAppInitialize(&app_context, "Pcb", new_options, 0, &argc, argv, 0, args, 0); - if (appwidget == NULL) - return 1; - XtSetErrorMsgHandler(NULL); /* restore the default handler */ - - XtRealizeWidget(appwidget); - - w = XmCreateLabel(appwidget, "hello world!", args, 0); - XtManageChild(w); - - - display = XtDisplay(appwidget); - - printf("move=%d !!\n", XMoveWindow(display, XtWindow(appwidget), 200, 50)); - printf("resi=%d !!\n", XResizeWindow(display, XtWindow(appwidget), 200, 50)); - - - XtAppMainLoop(app_context); - -} Index: work/lesstif/winmove/Makefile =================================================================== --- work/lesstif/winmove/Makefile (revision 35666) +++ work/lesstif/winmove/Makefile (nonexistent) @@ -1,8 +0,0 @@ -CFLAGS = -Wall -g -LDFLAGS = -L/opt/X11/lib -lXm -lXt -lX11 - -all: main - -main: main.c - - Index: work/lesstif/xmPages/main.c =================================================================== --- work/lesstif/xmPages/main.c (revision 35666) +++ work/lesstif/xmPages/main.c (nonexistent) @@ -1,63 +0,0 @@ -#include -#include -#include -#include "Pages.h" -#include -#include - -static const char *LAB[] = {"one\ntwo\nthree", "four", "five\nsix", NULL }; - -int main(int argc, char **argv) -{ - Widget toplevel, ch[16], pages; - XtAppContext app; - Arg args[16]; - char *ats = "0"; - int n, i; - - if (argc > 1) - ats = argv[1]; - - XtSetLanguageProc(NULL, NULL, NULL); - toplevel = XtVaOpenApplication(&app, "Demos", NULL, 0, &argc, argv, NULL, sessionShellWidgetClass, NULL); - XtVaSetValues(toplevel, XmNallowShellResize, 1, NULL); - - n = 0; - XtSetArg(args[n], PxmNpagesAt, atoi(ats)); - n++; - pages = PxmCreatePages(toplevel, "form", args, n); - XtManageChild(pages); - - for(i = 0; LAB[i] != NULL; i++) { - char *s, *next, tmp[512]; - - n = 0; - ch[i] = XmCreateRowColumn(pages, "pages", args, n); - - strcpy(tmp, LAB[i]); - for(s = tmp; s != NULL; s = next) { - Widget lab; - - next = strchr(s, '\n'); - if (next != NULL) { - *next = '\0'; - next++; - if (*next == '\0') - next = NULL; - } - n = 0; - XtSetArg(args[n], XmNlabelString, XmStringCreateLtoR(s, XmFONTLIST_DEFAULT_TAG)); - n++; - lab = XmCreateLabel(ch[i], "label", args, n); - XtManageChild(lab); - } - XtManageChild(ch[i]); - } - - XtManageChild(pages); - - XtRealizeWidget(toplevel); - - XtAppMainLoop(app); - return 0; -} Index: work/lesstif/xmPages/Makefile =================================================================== --- work/lesstif/xmPages/Makefile (revision 35666) +++ work/lesstif/xmPages/Makefile (nonexistent) @@ -1,11 +0,0 @@ -CFLAGS = -Wall -g -std=c89 -pedantic -LDFLAGS = -lXm -lXt -lX11 - -OBJS = main.o Pages.o - -all: main - -main: $(OBJS) - $(CC) -o main $(OBJS) $(LDFLAGS) - - Index: work/lesstif/tree_table/demo.c =================================================================== --- work/lesstif/tree_table/demo.c (revision 35666) +++ work/lesstif/tree_table/demo.c (nonexistent) @@ -1,202 +0,0 @@ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "../src_plugins/hid_lesstif/xm_tree_table_widget.h" - -extern char *strdup(const char *s); -extern char *strndup(const char *s, size_t n); - - -void xt_event_handler(const tt_table_event_data_t *data) -{ - tt_entry_t *item = NULL; - if (data->type == ett_key || data->type == ett_none) { - char text[64] = { 0 }; - KeySym key = { 0 }; - printf("some key event, parse XEvent*, please.\n"); - if (KeyPress == data->event->type && 1 == XLookupString(&(data->event->xkey), text, sizeof(text), &key, 0)) { - if (text[0] == '0') { - xm_tree_table_scrollbar_vertical_set(data->current_widget, 30); - xm_tree_table_scrollbar_horizontal_set(data->current_widget, 100); - xm_draw_tree_table_widget(data->current_widget); - } - else if (text[0] == '9') - { - static int row = 77; - xm_tree_table_focus_row(data->current_widget, row++); - xm_draw_tree_table_widget(data->current_widget); - } - } - - return; - } - printf("\nevent (%d), screen pos {x:%d, y:%d} [cur_row_idx %d, cur_cell_idx %d]\n", - (int)data->type, data->position.mouse.x, data->position.mouse.y, - data->current_row, data->current_cell); - - item = (tt_entry_t *) gdl_first(data->root_entry); - for(; item && item->row_index != (unsigned)data->current_row;) { - item = (tt_entry_t *) gdl_next(data->root_entry, (void *)item); - } - - if (item) { - unsigned char hid = item->flags.is_uhidden || item->flags.is_thidden; - unsigned char fold = item->flags.is_unfolded; - unsigned char sel = item->flags.is_selected; - if (Button1 == data->event->xbutton.button) { - /* lmb does collapse/expand */ - item->flags.is_unfolded = fold ? 0 : 1; - } - else if (Button3 == data->event->xbutton.button) { - /* rmb does selection. */ - item->flags.is_selected = sel ? 0 : 1; - } - else if (Button2 == data->event->xbutton.button) { - /* middle button hides */ - item->flags.is_uhidden = 1; - } - printf("flags [%u %u %u] row str: %s\n", hid, fold, sel, tt_get_cell(item, 0)[0]); - xm_draw_tree_table_widget(data->current_widget); - } -} - -void draw_event_handler(const tt_cb_draw_t *data) -{ - (void)data; -} - -void lock(gdl_list_t *entry, void *user_data) -{ - (void)entry; - pthread_mutex_lock((pthread_mutex_t *) user_data); -} - -void unlock(gdl_list_t *entry, void *user_data) -{ - (void)entry; - pthread_mutex_unlock((pthread_mutex_t *) user_data); -} - -int main(int argc, char *argv[]) -{ - static pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER; - static tt_table_access_cb_t padlock; - padlock.p_user_data = (void *)&mutex; - padlock.lock = &lock; - padlock.unlock = &unlock; - - - printf("User interaction:\n" "LMB(Button1) -- does tree item collapse/expand;\n" "mid. (Button2) -- hides the item(one can show it again only through the API);\n" "RMB(Button3) -- selects the item;\n\n\n"); - - { - gdl_list_t root; - memset(&root, 0x00, sizeof(gdl_list_t)); - { - int i = 0; - new_tt_entry(&root, 8); - - for(i = 0; i < 10; i++) - new_tt_entry(&root, i + 1); - - } - { - tt_entry_t *item = gdl_first(&root); - for(; item; item = gdl_first(&root)) - delete_tt_entry(&root, item); - } - } - { - XtAppContext app_context; - char **header_strings = NULL; - Widget appwidget = XtAppInitialize(&app_context, "test", NULL, 0, &argc, argv, 0, NULL, 0); - - const char *months[] = { "January", "February", "March", "April", "May", "June", - "July", "August", "September", "October", "November", "December" - }; - char buff[128] = "\0"; - int len = 0; - unsigned n_cols = 301; - - int year = 2018; - tt_entry_t *branch = NULL; - gdl_list_t root; - memset(&root, 0x00, sizeof(gdl_list_t)); - - for(; year >= 2017; --year) { - len = sprintf(buff, "%d", year); - branch = new_tt_entry(&root, n_cols); - tt_get_cell(branch, 0)[0] = strndup(buff, (size_t) len); - branch->flags.is_branch = 1; - { - int n = 0, i = 0, z = 0; - tt_entry_t *entry = NULL; - for(n = 0; n < XtNumber(months); n++) { - len = sprintf(buff, "%s", months[n]); - entry = new_tt_entry(&root, n_cols); - tt_get_cell(entry, 0)[0] = strndup(buff, (size_t) len); - entry->flags.is_branch = 1; - entry->level = 1; - for(i = 0; i < 2; i++) { - len = sprintf(buff, "%d month item %d 12345 ---", year, i); - entry = new_tt_entry(&root, n_cols); - tt_get_cell(entry, 0)[0] = strndup(buff, (size_t) len); - entry->flags.is_branch = 0; - entry->level = 2; - for(z = 1; z < (int)entry->n_cells; ++z) { - len = sprintf(buff, "z(%d)value %f", z, z + .547f); - tt_get_cell(entry, z)[0] = strndup(buff, (size_t) len); - } - } - } - for(i = 0; i < 4; i++) { - len = sprintf(buff, "year item1 %d", i); - entry = new_tt_entry(&root, n_cols); - tt_get_cell(entry, 0)[0] = strndup(buff, (size_t) len); - entry->flags.is_branch = 0; - entry->level = 1; - - for(z = 1; z < (int)entry->n_cells; ++z) { - len = sprintf(buff, "value %f", 100.0f + z); - tt_get_cell(entry, z)[0] = strndup(buff, (size_t) len); - } - } - } - } - { - Widget table = xm_create_tree_table_widget_cb(appwidget, &root, NULL, - &xt_event_handler, &draw_event_handler, &padlock); - unsigned col = 0; - header_strings = calloc(n_cols, sizeof(char *)); - - for(; col < branch->n_cells; ++col) { - len = sprintf(buff, "header(%u)", col); - header_strings[col] = strndup(buff, (size_t) len); - } - xm_attach_tree_table_header(table, n_cols, (const char**)header_strings); - XtManageChild(table); - } - - XtRealizeWidget(appwidget); - XtAppMainLoop(app_context); - - { - tt_entry_t *item = gdl_first(&root); - unsigned col = 0; - for(; item; item = gdl_first(&root)) { - delete_tt_entry(&root, item); - } - for (; col < n_cols; ++col) { - free(header_strings[col]); - } - free(header_strings); - } - } - return 0; -} Index: work/lesstif/tree_table/Makefile =================================================================== --- work/lesstif/tree_table/Makefile (revision 35666) +++ work/lesstif/tree_table/Makefile (nonexistent) @@ -1,44 +0,0 @@ -HID=../../../trunk/src_plugins/hid_lesstif -SRC=../../../trunk/src -CFLAGS = -Wall -Werror -g -O0 -std=c89 -pedantic -CFLAGS += -I./ -I./../../../trunk/src_3rd -I$(SRC) -I$(SRC)/.. # -fsanitize=address -LDFLAGS = -lXm -lX11 -lXt -lXpm -lm - - -all: - mkdir -p ./.objs - $(MAKE) demo - -OBJS = ./.objs/demo.o ./.objs/genadlist.o ./.objs/genlistalloc.o \ - ./.objs/xm_tree_table_widget.o ./.objs/xm_tree_table_pixmaps.o \ - ./.objs/xm_tree_table_priv.o ./.objs/vtp0.o - -./.objs/demo.o: demo.c - $(CC) -c $(CFLAGS) demo.c -o ./.objs/demo.o - -./.objs/xm_tree_table_widget.o: $(HID)/xm_tree_table_widget.c - $(CC) -c $(CFLAGS) $(HID)/xm_tree_table_widget.c -o ./.objs/xm_tree_table_widget.o - -./.objs/xm_tree_table_pixmaps.o: $(HID)/xm_tree_table_pixmaps.c - $(CC) -c $(CFLAGS) $(HID)/xm_tree_table_pixmaps.c -o ./.objs/xm_tree_table_pixmaps.o - -./.objs/xm_tree_table_priv.o: $(HID)/xm_tree_table_priv.c - $(CC) -c $(CFLAGS) $(HID)/xm_tree_table_priv.c -o ./.objs/xm_tree_table_priv.o - -./.objs/genadlist.o: ./../../../trunk/src_3rd/genlist/genadlist.c - $(CC) -c $(CFLAGS) ./../../../trunk//src_3rd/genlist/genadlist.c -o ./.objs/genadlist.o - -./.objs/genlistalloc.o: ./../../../trunk/src_3rd/genlist/genlistalloc.c - $(CC) -c $(CFLAGS) ./../../../trunk//src_3rd/genlist/genlistalloc.c -o ./.objs/genlistalloc.o - -./.objs/vtp0.o: ./../../../trunk/src_3rd/genvector/vtp0.c - $(CC) -c $(CFLAGS) ./../../../trunk//src_3rd/genvector/vtp0.c -o ./.objs/vtp0.o - -demo: $(OBJS) - $(CC) $(OBJS) -o demo $(LDFLAGS) - -clean: $(OBJS) - rm -R ./.objs - rm demo_xm_tree_table - - Index: work/lesstif/lesstif_scroll/main.c =================================================================== --- work/lesstif/lesstif_scroll/main.c (revision 35666) +++ work/lesstif/lesstif_scroll/main.c (nonexistent) @@ -1,111 +0,0 @@ -#include - -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - - -Arg stdarg_args[30]; -int stdarg_n; -#define stdarg(t,v) XtSetArg(stdarg_args[stdarg_n], t, v), stdarg_n++ - -Widget pcb_motif_box(Widget parent, char *name, char type, int num_table_rows, int scroll) -{ - Widget cnt; - - if (scroll) { - stdarg_n = 0; - stdarg(XmNscrollingPolicy, XmAUTOMATIC); - parent = XmCreateScrolledWindow(parent, "scrolled_box", stdarg_args, stdarg_n); - XtManageChild(parent); - } - - stdarg_n = 0; - switch(type) { - case 'h': /* "hbox" */ - stdarg(XmNorientation, XmHORIZONTAL); - stdarg(XmNisHomogeneous, False); - stdarg(XmNisAligned, False); - stdarg(XmNpacking, XmPACK_TIGHT); -// stdarg(XmNpacking, XmPACK_COLUMN); - break; - case 'v': /* "vbox" */ - stdarg(XmNorientation, XmVERTICAL); - stdarg(XmNpacking, XmPACK_COLUMN); - break; - case 't': /* "table" */ - stdarg(XmNorientation, XmHORIZONTAL); - stdarg(XmNpacking, XmPACK_COLUMN); - stdarg(XmNnumColumns, num_table_rows); - stdarg(XmNisAligned, True); - stdarg(XmNentryAlignment, XmALIGNMENT_END); - break; - default: - abort(); - } - - - cnt = XmCreateRowColumn(parent, name, stdarg_args, stdarg_n); - return cnt; -} - -int main(int argc, char *argv[]) -{ - Widget w, appwidget, cnt; - XtAppContext app_context; - char *mode = "vbox"; - int n; - - stdarg_n = 0; - appwidget = XtAppInitialize(&app_context, "test", NULL, 0, &argc, argv, 0, stdarg_args, stdarg_n); - - - if (argv[1] != NULL) - mode = argv[1]; - - cnt = pcb_motif_box(appwidget, "cont", mode[0], 2, 1); - XtManageChild(cnt); - - for(n = 0; n < 8; n++) { - char buff[32]; - strcpy(buff, "abcdefghijklmnopqrstuvxyz"); - buff[n*3+1] = '\0'; - stdarg_n = 0; -/* stdarg(XmNlabelString, XmStringCreateLtoR(buff, XmSTRING_DEFAULT_CHARSET)); - w = XmCreateLabel(cnt, "hello", stdarg_args, stdarg_n);*/ - - stdarg(XmNalignment, XmALIGNMENT_BEGINNING); - w = XmCreateLabel(cnt, buff, stdarg_args, stdarg_n); - - XtManageChild(w); - } - - - - XtRealizeWidget(appwidget); - XtAppMainLoop(app_context); -} Index: work/lesstif/lesstif_scroll/URLS =================================================================== --- work/lesstif/lesstif_scroll/URLS (revision 35666) +++ work/lesstif/lesstif_scroll/URLS (nonexistent) @@ -1,3 +0,0 @@ -http://www.ist.co.uk/motif/books/vol6A/ch-9.fm.html -http://www.ist.co.uk/motif/books/vol6A/ch-24.fm.html#711442 -http://www.softlab.ntua.gr/miscellaneous/faq/motif/part3/faq-doc-4.html Index: work/lesstif/lesstif_scroll/Makefile =================================================================== --- work/lesstif/lesstif_scroll/Makefile (revision 35666) +++ work/lesstif/lesstif_scroll/Makefile (nonexistent) @@ -1,9 +0,0 @@ -#CFLAGS = -Wall -g -LDFLAGS = -lXm -lXt - -all: main - -main: main.c - -#a: a.c - Index: work/lesstif/icon/wt_xpm.c =================================================================== --- work/lesstif/icon/wt_xpm.c (revision 35666) +++ work/lesstif/icon/wt_xpm.c (nonexistent) @@ -1,222 +0,0 @@ -#include -#include - -#include -#include -#include - - -static unsigned long hex_digit(char c) -{ - if ((c >= '0') && (c <= '9')) return c - '0'; - if ((c >= 'a') && (c <= 'f')) return c - 'a' + 10; - if ((c >= 'A') && (c <= 'F')) return c - 'A' + 10; - return 0; -} - -static unsigned long hex_byte(const char *s) -{ - return (hex_digit(s[0]) << 12) + (hex_digit(s[1]) << 8); -} - -static unsigned long hex_raw(unsigned long byte) -{ - return (byte && 0xff) << 8; -} - -Pixmap pcb_ltf_parse_xpm(Display *display, const char **xpm, Pixel bgcolor) -{ - int i, j, width, height, n_colors, depth = 0; - const char **p, *hdr; - char *q; - unsigned long colors[256]; - int bytes_per_pixel; - XGCValues gcv; - Visual *visual; - Pixmap pixmap; - XImage *image; - Colormap colormap; - GC gc; - - depth = DefaultDepth(display, DefaultScreen(display)); - visual = DefaultVisual(display, DefaultScreen(display)); - colormap = DefaultColormap(display, DefaultScreen(display)); - p = xpm; - - /* Parse header */ - hdr = p[0]; - width = atoi(hdr); - hdr = strchr(hdr, ' '); - if (hdr == NULL) - return 0; - hdr++; - height = atoi(hdr); - hdr = strchr(hdr, ' '); - if (hdr == NULL) - return 0; - hdr++; - n_colors = atoi(hdr); - - /* sanity checks */ - if (n_colors > sizeof(colors) / sizeof(colors[0])) - return 0; - if ((height < 1) || (width < 1)) - return 0; - - pixmap = XCreatePixmap(display, DefaultRootWindow(display), width, height, depth); - gc = XCreateGC(display, pixmap, 0, &gcv); - image = XCreateImage(display, visual, depth, ZPixmap, 0, 0, width, height, 8, 0); - image->data = malloc(image->bytes_per_line * height + 16); - - /* Parse and store colors */ - for(p = p + 1, i = 0; i < n_colors; p++, i++) { - XColor c, c1; - const char *x; - int idx = ((*p)[0]); - - x = *p + 4; - if (*x == '#') { - c.red = hex_byte(x+1); - c.green = hex_byte(x+3); - c.blue = hex_byte(x+5); - if (!XAllocColor(display, colormap, &c)) - goto error; - } - else if (strcasecmp(x, "None") == 0) { -/* c.red = hex_raw((bgcolor & 0xff0000) >> 16); - c.green = hex_raw((bgcolor & 0x00ff00) >> 8); - c.blue = hex_raw(bgcolor & 0x0000ff); - if (!XAllocColor(display, colormap, &c)) - goto error;*/ - c.pixel = bgcolor; - } - else { - if (!XAllocNamedColor(display, colormap, (char *)x, &c, &c1)) - goto error; - } - colors[idx] = c.pixel; - } - - bytes_per_pixel = image->bytes_per_line / width; - - /* convert to server's format */ - for(j = 0; j < height; j++, p++) { - const char *r; - unsigned long c; - q = image->data + image->bytes_per_line * j; - r = *p; - if (image->byte_order == MSBFirst) { - switch (bytes_per_pixel) { - case 4: - for(i = 0; i < width; i++) { - c = colors[(int)(*r++)]; - *q++ = c >> 24; - *q++ = c >> 16; - *q++ = c >> 8; - *q++ = c; - } - break; - case 3: - for(i = 0; i < width; i++) { - c = colors[(int)(*r++)]; - *q++ = c >> 16; - *q++ = c >> 8; - *q++ = c; - } - break; - case 2: - for(i = 0; i < width; i++) { - c = colors[(int)(*r++)]; - *q++ = c >> 8; - *q++ = c; - } - break; - case 1: - for(i = 0; i < width; i++) - *q++ = colors[(int)(*r++)]; - break; - } - } - else { - switch (bytes_per_pixel) { - case 4: - for(i = 0; i < width; i++) { - c = colors[(int)(*r++)]; - *q++ = c; - *q++ = c >> 8; - *q++ = c >> 16; - *q++ = c >> 24; - } - break; - case 3: - for(i = 0; i < width; i++) { - c = colors[(int)(*r++)]; - *q++ = c; - *q++ = c >> 8; - *q++ = c >> 16; - } - break; - case 2: - for(i = 0; i < width; i++) { - c = colors[(int)(*r++)]; - *q++ = c; - *q++ = c >> 8; - } - break; - case 1: - for(i = 0; i < width; i++) - *q++ = colors[(int)(*r++)]; - break; - } - } - } - - XPutImage(display, pixmap, gc, image, 0, 0, 0, 0, width, height); - free(image->data); - return pixmap; - - error:; - free(image->data); - return 0; -} - - -Widget pcb_ltf_xpm_label(Display *display, Widget parent, String name, const char **xpm) -{ - Widget Label1; - Pixel background; - Pixmap px_disarm; - Arg args[3]; - int n = 0; - - Label1 = XmCreateLabel(parent, name, (Arg *)NULL, (Cardinal) 0); - XtVaGetValues(Label1, XmNbackground, &background, NULL); - - px_disarm = pcb_ltf_parse_xpm(display, xpm, background); - - XtSetArg(args[n], XmNlabelType, XmPIXMAP); n++; - XtSetArg(args[n], XmNlabelPixmap, px_disarm); n++; - XtSetValues(Label1, args, n); - - return Label1; -} - -Widget pcb_ltf_xpm_button(Display *display, Widget parent, String name, const char **xpm) -{ - Widget Label1; - Pixel background; - Pixmap px_disarm; - Arg args[3]; - int n = 0; - - Label1 = XmCreatePushButton(parent, name, (Arg *)NULL, (Cardinal) 0); - XtVaGetValues(Label1, XmNbackground, &background, NULL); - - px_disarm = pcb_ltf_parse_xpm(display, xpm, background); - - XtSetArg(args[n], XmNlabelType, XmPIXMAP); n++; - XtSetArg(args[n], XmNarmPixmap, px_disarm); n++; - XtSetValues(Label1, args, n); - - return Label1; -} Index: work/lesstif/icon/wt_xpm.h =================================================================== --- work/lesstif/icon/wt_xpm.h (revision 35666) +++ work/lesstif/icon/wt_xpm.h (nonexistent) @@ -1,7 +0,0 @@ - -Widget pcb_ltf_xpm_label(Display *display, Widget parent, String name, const char **xpm); -Widget pcb_ltf_xpm_button(Display *display, Widget parent, String name, const char **xpm); - - -Pixmap pcb_ltf_parse_xpm(Display *display, const char **xpm, Pixel bgcolor); - Index: work/lesstif/icon/bitmap.c =================================================================== --- work/lesstif/icon/bitmap.c (revision 35666) +++ work/lesstif/icon/bitmap.c (nonexistent) @@ -1,132 +0,0 @@ -/* based on motif-faq 156 */ -#include -#include -#include -#include - -#include "wt_xpm.h" - -/* XPM */ -static const char * question_xpm[] = { -"48 48 26 1", -" c None", -". c #000100", -"+ c #000509", -"@ c #020D14", -"# c #000E1A", -"$ c #011321", -"% c #02192B", -"& c #001C32", -"* c #002036", -"= c #00243F", -"- c #012945", -"; c #002D4E", -"> c #003254", -", c #06365E", -"' c #023D69", -") c #004374", -"! c #08497C", -"~ c #004D85", -"{ c #005290", -"] c #005593", -"^ c #005B99", -"/ c #0060A4", -"( c #0065A9", -"_ c #1862A8", -": c #006AB4", -"< c #0E69B5", -" ", -" ", -" ", -" ", -" ", -" ", -" <<<<<<<<<<<< ", -" :<<<<<<<<<<<<<<< ", -" :<<<<<<{)','!/<<<<<< ", -" <<<<('%........$)<<<<<< ", -" <<<<,+............*:<<<<< ", -" <<<<<@....+%=*#.....&:<<<<< ", -" <<<<<<@.+;]<<<<<~$....'<<<<<< ", -" <<<<<<<#>_<<<<<<<<_@...%<<<<<<< ", -" <<<<<<<...><<<<<<<<<<<<<<<<< ", -" <<<<<<<<<<<<<<<;...,<<<<<<<<<<<<<<<<< ", -" <<<<<<<<<<<<<<<;...,<<<<<<<<<<<<<<<< ", -" <<<<<<<<<<<<<<<;...,<<<<<<<<<<<<<<<< ", -" <<<<<<<<<<<<<<^~~~/<<<<<<<<<<<<<<<: ", -" <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< ", -" <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< ", -" <<<<<<<<<<<<<-@@@><<<<<<<<<<<<<< ", -" <<<<<<<<<<<<*...-<<<<<<<<<<<<<: ", -" :<<<<<<<<<<<*...-<<<<<<<<<<<<< ", -" <<<<<<<<<<<*...-<<<<<<<<<<<< ", -" :<<<<<<<<<*...-<<<<<<<<<<< ", -" <<<<<<<<<<<<<<<<<<<<<<<< ", -" <<<<<<<<<<<<<<<<<<<<<: ", -" :<<<<<<<<<<<<<<<<< ", -" <<<<<<<<<<<<<< ", -" <<<<<<<: ", -" ", -" ", -" ", -" ", -" "}; - -int main(int argc, char **argv) -{ - XtSetLanguageProc(NULL, NULL, NULL); - Widget toplevel,box; - XtAppContext app; - Display *display; - int mtn_width = 16, mtn_height = 16, mtn_ins_width = 16, mtn_ins_height = 16; - char mtn[16*16]; - char mtn_ins[16*16]; - int n; - Widget Label1; - Arg args[4]; - - for(n = 0; n < 16*16; n++) { - mtn[n] = n; - mtn_ins[n] = ~n; - } - - toplevel = XtVaOpenApplication(&app, "Demos", NULL, 0, &argc, argv, NULL, sessionShellWidgetClass, NULL); - - display = XtDisplay(toplevel); - - n = 0; - box = XmCreateRowColumn(toplevel, "box", args, n); - XtManageChild(box); - - n = 0; - Label1 = XmCreateLabel(box, (char *)("hello"), args, n); - XtManageChild(Label1); - - Label1 = pcb_ltf_xpm_label(display, box, "Label1", question_xpm); - XtManageChild(Label1); - - n = 0; - Label1 = XmCreateLabel(box, (char *)("world"), args, n); - XtManageChild(Label1); - - Label1 = pcb_ltf_xpm_button(display, box, "Label1", question_xpm); - XtManageChild(Label1); - - XtRealizeWidget(toplevel); - XtAppMainLoop(app); - XtUnrealizeWidget(toplevel); - XtDestroyWidget(toplevel); - return 0; -} Index: work/lesstif/icon/Makefile =================================================================== --- work/lesstif/icon/Makefile (revision 35666) +++ work/lesstif/icon/Makefile (nonexistent) @@ -1,9 +0,0 @@ -#CFLAGS = -Wall -g -LDFLAGS = -lXm -lXt -lX11 - -all: bitmap - -bitmap: bitmap.o wt_xpm.o - -#a: a.c - Index: work/lesstif/fsb/fsb.c =================================================================== --- work/lesstif/fsb/fsb.c (revision 35666) +++ work/lesstif/fsb/fsb.c (nonexistent) @@ -1,95 +0,0 @@ -#include -#include -#include - -XtAppContext app_context; - -static XmString XmStringCreatePCB(const char *x) -{ - return XmStringCreateLtoR((char *)x, XmFONTLIST_DEFAULT_TAG); -} - -static int wait_for_dialog(Widget w) -{ - int ok = -1; - XtManageChild(w); - while (ok == -1 && XtIsManaged(w)) { - XEvent e; - XtAppNextEvent(app_context, &e); - XtDispatchEvent(&e); - } - if (XtIsManaged(w)) - XtUnmanageChild(w); - return ok; -} - -#define stdarg(t,v) XtSetArg(args[argn], t, v), argn++ - -int main(int argc, char *argv[]) -{ - Widget fsb, mainwind, w, cnt; - Arg args[32]; - int argn; -/* - argn = 0; - appwidget = XtAppInitialize(&app_context, "foo", 0, 0, &argc, argv, 0, args, argn); - if (appwidget == NULL) - return 1; - - argn = 0; - mainwind = XmCreateMainWindow(appwidget, (char *)"mainWind", args, argn); - XtManageChild(mainwind); -*/ - - argn = 0; - mainwind = XtAppInitialize(&app_context, "test", NULL, 0, &argc, argv, 0, args, argn); - - argn = 0; - w = XmCreateLabel(mainwind, "hello", args, argn); - XtManageChild(w); - - - XtRealizeWidget(mainwind); - - - argn = 0; - fsb = XmCreateFileSelectionDialog(mainwind, "file", args, argn); - - - argn = 0; - stdarg(XmNorientation, XmVERTICAL); - stdarg(XmNpacking, XmPACK_COLUMN); - cnt = XmCreateRowColumn(fsb, "extra", args, argn); - XtManageChild(cnt); - - argn = 0; - w = XmCreateLabel(cnt, "hello", args, argn); XtManageChild(w); - w = XmCreateLabel(cnt, "world", args, argn); XtManageChild(w); - - -/* XtAddCallback(fsb, XmNokCallback, (XtCallbackProc) dialog_callback_ok_value, (XtPointer) 1); - XtAddCallback(fsb, XmNcancelCallback, (XtCallbackProc) dialog_callback_ok_value, (XtPointer) 0);*/ - - argn = 0; - stdarg(XmNtitle, "test fsb dialog"); - XtSetValues(XtParent(fsb), args, argn); - - argn = 0; -/* stdarg(XmNpattern, (char *)"*"); - stdarg(XmNmustMatch, True); - stdarg(XmNselectionLabelString, XmStringCreatePCB("Whatever"));*/ - XtSetValues(fsb, args, argn); - - if (!wait_for_dialog(fsb)) { - return 1; - } - -/* - argn = 0; - stdarg(XmNdirSpec, &xmname); - XtGetValues(fsb, args, argn); - - XmStringGetLtoR(xmname, XmFONTLIST_DEFAULT_TAG, &name); - */ - return 0; -} Index: work/lesstif/fsb/Makefile =================================================================== --- work/lesstif/fsb/Makefile (revision 35666) +++ work/lesstif/fsb/Makefile (nonexistent) @@ -1,9 +0,0 @@ -CFLAGS = -Wall -g -LDFLAGS = -lXm -lXt - -all: fsb - -fsb: fsb.c - -#a: a.c - Index: work/lesstif/formbox_override/main.c =================================================================== --- work/lesstif/formbox_override/main.c (revision 35666) +++ work/lesstif/formbox_override/main.c (nonexistent) @@ -1,161 +0,0 @@ -#include -#include -#include -#include - -#define HORIZONTAL 1 - -#define att() \ -do { \ - XtSetArg(args[n], XmNleftAttachment, XmATTACH_NONE); \ - n++; \ - XtSetArg(args[n], XmNtopAttachment, XmATTACH_NONE); \ - n++; \ - XtSetArg(args[n], XmNrightAttachment, XmATTACH_NONE); \ - n++; \ - XtSetArg(args[n], XmNbottomAttachment, XmATTACH_NONE); \ - n++; \ -} while(0) - -void pcb_ltf_box_update(Widget parent, Dimension avail_w, Dimension avail_h) -{ - Dimension offs, totreq, pad = 2, extra, cextra; - Cardinal n, numch, numfill; - WidgetList children; - Dimension cw_req[64], cw_have[64], cs_req[64], cs_have[64]; - int cfill[64] = {0, 0, 1, 0}; - XtWidgetGeometry req, pref; - - XtVaGetValues(parent, XmNnumChildren, &numch, XmNchildren, &children, NULL); - - totreq = 0; - numfill = 0; - for(n = 0; n < numch; n++) { - XtQueryGeometry(children[n], NULL, &pref); - cw_have[n] = pref.width; - cs_have[n] = pref.x; - totreq = totreq + pref.width + pad; - if (cfill[n]) - numfill++; - } - - if (avail_w < totreq) - avail_w = totreq; - - extra = avail_w - totreq; - if (numfill > 0) - cextra = extra / numfill; - offs = 0; - for(n = 0; n < numch; n++) { - Dimension local_extra = 0; - cs_req[n] = offs; - if (cfill[n]) { - local_extra = (extra < cextra ? extra : cextra); - offs += local_extra; - extra -= cextra; - } - cw_req[n] = cw_have[n] + local_extra; - offs += cw_have[n] + pad; - } - - for(n = 0; n < numch; n++) { - XtVaSetValues(children[n], XmNx, cs_req[n], XmNwidth, cw_req[n], NULL); - printf("[%d] req: start=%d (%d) len=%d (%d)\n", n, cs_req[n], cs_have[n], cw_req[n], cw_have[n]); - } - -#if 0 - for(wi = 0, n = 0; n < numch; n++) { - Widget child = children[n]; - Dimension dim; - - XtQueryGeometry(child, NULL, &pref); - dim = pref.width; - if (n == 2) - dim *=3; - XtVaSetValues(child, XmNx, wi, XmNwidth, dim, NULL); - wi += dim + 2; - - XtQueryGeometry(child, NULL, &pref); - printf("[%d] dim alloced=%d requested=%d\n", n, dim, pref.width); - } -#endif - - req.request_mode = CWWidth; - req.width = avail_w; - XtQueryGeometry(parent, &req, &pref); -} - -void pcb_ltf_box_config_cb(Widget w, XtPointer data, XEvent *xevent, char *dummy) -{ - XConfigureEvent *cevent = (XConfigureEvent *)xevent; - - if (cevent->type != ConfigureNotify) - return; - - printf("new size: %d %d\n", (int)cevent->width, (int)cevent->height); - - pcb_ltf_box_update(w, cevent->width, cevent->height); -} - - -int main(int argc, char **argv) -{ - Widget toplevel, label[4], cnt; - XtAppContext app; - Arg args[16]; - int n; - - XtSetLanguageProc(NULL, NULL, NULL); - - toplevel = XtVaOpenApplication(&app, "Demos", NULL, 0, &argc, argv, NULL, sessionShellWidgetClass, NULL); - - - XtVaSetValues(toplevel, XmNallowShellResize, 1, NULL); - - - n = 0; - XtSetArg(args[n], XmNrubberPositioning, 0); - n++; - att(); - cnt = XmCreateBulletinBoard(toplevel, "form", args, n); - XtManageChild(cnt); - - XtAddEventHandler(cnt, StructureNotifyMask, False, pcb_ltf_box_config_cb, NULL); - - - n = 0; - XtSetArg(args[n], XmNlabelString, XmStringGenerate("foo", XmFONTLIST_DEFAULT_TAG, XmCHARSET_TEXT, NULL)); - n++; - att(); - label[0] = XmCreateLabel(cnt, "label", args, n); - XtManageChild(label[0]); - - n = 0; - XtSetArg(args[n], XmNlabelString, XmStringGenerate("bar12", XmFONTLIST_DEFAULT_TAG, XmCHARSET_TEXT, NULL)); - n++; - att(); - label[1] = XmCreateLabel(cnt, "label", args, n); - XtManageChild(label[1]); - - n = 0; - XtSetArg(args[n], XmNlabelString, XmStringGenerate("blobb", XmFONTLIST_DEFAULT_TAG, XmCHARSET_TEXT, NULL)); - n++; - att(); - label[2] = XmCreateLabel(cnt, "label", args, n); - XtManageChild(label[2]); - - n = 0; - XtSetArg(args[n], XmNlabelString, XmStringGenerate("baz", XmFONTLIST_DEFAULT_TAG, XmCHARSET_TEXT, NULL)); - n++; - att(); - label[3] = XmCreateLabel(cnt, "label", args, n); - XtManageChild(label[3]); - - - pcb_ltf_box_update(cnt, 200, 0); - - XtRealizeWidget(toplevel); - - XtAppMainLoop(app); - return 0; -} Index: work/lesstif/formbox_override/Makefile =================================================================== --- work/lesstif/formbox_override/Makefile (revision 35666) +++ work/lesstif/formbox_override/Makefile (nonexistent) @@ -1,9 +0,0 @@ -CFLAGS = -Wall -g -LDFLAGS = -lXm -lXt - -all: main - -main: main.c - -#a: a.c - Index: work/lesstif/formbox/main.c =================================================================== --- work/lesstif/formbox/main.c (revision 35666) +++ work/lesstif/formbox/main.c (nonexistent) @@ -1,133 +0,0 @@ -#include -#include -#include -#include - -#define HORIZONTAL 1 - -static const char *LAB[] = {"one", "two", "three", "four", "five", "six", NULL }; - -typedef struct { - Widget last; - int cnt, right, fills; - int vertical; -} pcb_ltf_boxadd_t; - -void pcb_ltf_box_postadd(pcb_ltf_boxadd_t *ctx, Widget child, int expfill) -{ - if (ctx->vertical) { - XtVaSetValues(child, XmNleftAttachment, XmATTACH_FORM, NULL); - XtVaSetValues(child, XmNrightAttachment, XmATTACH_FORM, NULL); - - if (ctx->cnt == 0) - XtVaSetValues(child, XmNtopAttachment, XmATTACH_FORM, NULL); - else if (ctx->right) - XtVaSetValues(ctx->last, XmNbottomAttachment, XmATTACH_WIDGET, XmNbottomWidget, child, NULL); - else { - XtVaSetValues(ctx->last, XmNbottomAttachment, XmATTACH_NONE, NULL); - XtVaSetValues(child, XmNtopAttachment, XmATTACH_WIDGET, XmNtopWidget, ctx->last, NULL); - } - } - else { - XtVaSetValues(child, XmNtopAttachment, XmATTACH_FORM, NULL); - XtVaSetValues(child, XmNbottomAttachment, XmATTACH_FORM, NULL); - - if (ctx->cnt == 0) - XtVaSetValues(child, XmNleftAttachment, XmATTACH_FORM, NULL); - else if (ctx->right) - XtVaSetValues(ctx->last, XmNrightAttachment, XmATTACH_WIDGET, XmNrightWidget, child, NULL); - else { - XtVaSetValues(ctx->last, XmNrightAttachment, XmATTACH_NONE, NULL); - XtVaSetValues(child, XmNleftAttachment, XmATTACH_WIDGET, XmNleftWidget, ctx->last, NULL); - } - } - - if (expfill) { - ctx->right = 1; - ctx->fills++; - } - - if (ctx->fills) { - if (ctx->vertical) - XtVaSetValues(child, XmNbottomAttachment, XmATTACH_FORM, NULL); - else - XtVaSetValues(child, XmNrightAttachment, XmATTACH_FORM, NULL); - } - - ctx->last = child; - ctx->cnt++; -} - - -char *aname(unsigned char a) -{ - if (a == XmATTACH_WIDGET) return "w"; - if (a == XmATTACH_FORM) return "f"; - if (a == XmATTACH_NONE) return "x"; - return "?"; -} - - -int main(int argc, char **argv) -{ - Widget toplevel, label[16], cnt; - XtAppContext app; - Arg args[16]; - int n, i; - char *expmask = argv[1]; - pcb_ltf_boxadd_t bx = {0}; - - if (expmask == NULL) expmask = "0000"; - else if (argv[2] != NULL) bx.vertical = 1; - - XtSetLanguageProc(NULL, NULL, NULL); - - toplevel = XtVaOpenApplication(&app, "Demos", NULL, 0, &argc, argv, NULL, sessionShellWidgetClass, NULL); - - - XtVaSetValues(toplevel, XmNallowShellResize, 1, NULL); - - - n = 0; - XtSetArg(args[n], XmNrubberPositioning, 0); - n++; - cnt = XmCreateForm(toplevel, "form", args, n); - XtManageChild(cnt); - - for(i = 0; (expmask[i] != '\0') && (LAB[i] != NULL); i++) { - n = 0; - XtSetArg(args[n], XmNlabelString, XmStringGenerate((char *)LAB[i], XmFONTLIST_DEFAULT_TAG, XmCHARSET_TEXT, NULL)); - n++; - label[i] = XmCreateLabel(cnt, "label", args, n); - XtManageChild(label[i]); - pcb_ltf_box_postadd(&bx, label[i], expmask[i] != '0'); - } - - { - Cardinal numch; - WidgetList children; - XtVaGetValues(cnt, XmNnumChildren, &numch, XmNchildren, &children, NULL); - - for(i = 0; i < numch; i++) { - unsigned char la, ra; - Widget lw, rw; - XmString s; - char *cs; - XtVaGetValues(children[i], XmNleftAttachment, &la, XmNrightAttachment, &ra, XmNlabelString, &s, XmNleftWidget, &lw, XmNrightWidget, &rw, NULL); - XmStringGetLtoR(s, XmFONTLIST_DEFAULT_TAG, &cs); - if ((la == XmATTACH_WIDGET) && (lw != children[i-1])) - printf("!l!"); - if ((ra == XmATTACH_WIDGET) && (rw != children[i+1])) - printf("!r!"); - - printf(" %s[%s]%s ", aname(la), cs, aname(ra)); - } - printf("\n"); - } - - - XtRealizeWidget(toplevel); - - XtAppMainLoop(app); - return 0; -} Index: work/lesstif/formbox/main_multif.c =================================================================== --- work/lesstif/formbox/main_multif.c (revision 35666) +++ work/lesstif/formbox/main_multif.c (nonexistent) @@ -1,162 +0,0 @@ -#include -#include -#include -#include - -/* Theoretical support for multiple expfills */ - -#define HORIZONTAL 1 - -static const char *LAB[] = {"one", "two", "three", "four", "five", "six", NULL }; - -typedef struct { - Widget box; - Widget last; - int cnt, right, fills; - int vertical; -} pcb_ltf_boxadd_t; - -void pcb_ltf_box_preadd(pcb_ltf_boxadd_t *ctx, int expfill) -{ - if (expfill && ctx->right) { - Widget w; - Arg args[16]; - int n; - n = 0; - XtSetArg(args[n], XmNlabelString, XmStringGenerate("||", XmFONTLIST_DEFAULT_TAG, XmCHARSET_TEXT, NULL)); - n++; - w = XmCreateLabel(ctx->box, "label", args, n); - XtManageChild(w); - - XtVaSetValues(w, XmNtopAttachment, XmATTACH_FORM, NULL); - XtVaSetValues(w, XmNbottomAttachment, XmATTACH_FORM, NULL); - XtVaSetValues(w, XmNleftAttachment, XmATTACH_NONE, NULL); - XtVaSetValues(w, XmNrightAttachment, XmATTACH_FORM, NULL); - - XtVaSetValues(ctx->last, XmNrightAttachment, XmATTACH_WIDGET, XmNrightWidget, w, NULL); - - ctx->right = 0; - ctx->last = w; - } -} - - -void pcb_ltf_box_postadd(pcb_ltf_boxadd_t *ctx, Widget child, int expfill) -{ - if (vertical) { - XtVaSetValues(child, XmNleftAttachment, XmATTACH_FORM, NULL); - XtVaSetValues(child, XmNroghtAttachment, XmATTACH_FORM, NULL); - - if (ctx->cnt == 0) - XtVaSetValues(child, XmNtopAttachment, XmATTACH_FORM, NULL); - else if (ctx->right) - XtVaSetValues(ctx->last, XmNbottomAttachment, XmATTACH_WIDGET, XmNbottomWidget, child, NULL); - else { - XtVaSetValues(ctx->last, XmNbottomAttachment, XmATTACH_NONE, NULL); - XtVaSetValues(child, XmNtopAttachment, XmATTACH_WIDGET, XmNtopWidget, ctx->last, NULL); - } - } - else { - XtVaSetValues(child, XmNtopAttachment, XmATTACH_FORM, NULL); - XtVaSetValues(child, XmNbottomAttachment, XmATTACH_FORM, NULL); - - if (ctx->cnt == 0) - XtVaSetValues(child, XmNleftAttachment, XmATTACH_FORM, NULL); - else if (ctx->right) - XtVaSetValues(ctx->last, XmNrightAttachment, XmATTACH_WIDGET, XmNrightWidget, child, NULL); - else { - XtVaSetValues(ctx->last, XmNrightAttachment, XmATTACH_NONE, NULL); - XtVaSetValues(child, XmNleftAttachment, XmATTACH_WIDGET, XmNleftWidget, ctx->last, NULL); - } - } - - if (expfill) { - ctx->right = 1; - ctx->fills++; - } - - if (ctx->fills) { - if (vertical) - XtVaSetValues(child, XmNbottomAttachment, XmATTACH_FORM, NULL); - else - XtVaSetValues(child, XmNrightAttachment, XmATTACH_FORM, NULL); - } - - ctx->last = child; - ctx->cnt++; -} - - -char *aname(unsigned char a) -{ - if (a == XmATTACH_WIDGET) return "w"; - if (a == XmATTACH_FORM) return "f"; - if (a == XmATTACH_NONE) return "x"; - return "?"; -} - -int main(int argc, char **argv) -{ - Widget toplevel, label[16], cnt; - XtAppContext app; - Arg args[16]; - int n, i; - char *expmask = argv[1]; - pcb_ltf_boxadd_t bx = {0}; - - if (expmask == NULL) expmask = "0000"; - else if (argv[2] != NULL) bx.vertical = 1; - - XtSetLanguageProc(NULL, NULL, NULL); - - toplevel = XtVaOpenApplication(&app, "Demos", NULL, 0, &argc, argv, NULL, sessionShellWidgetClass, NULL); - - - XtVaSetValues(toplevel, XmNallowShellResize, 1, NULL); - - - n = 0; - XtSetArg(args[n], XmNrubberPositioning, 0); - n++; - cnt = XmCreateForm(toplevel, "form", args, n); - XtManageChild(cnt); - - bx.box = cnt; - - for(i = 0; (expmask[i] != '\0') && (LAB[i] != NULL); i++) { - pcb_ltf_box_preadd(&bx, expmask[i] != '0'); - n = 0; - XtSetArg(args[n], XmNlabelString, XmStringGenerate(LAB[i], XmFONTLIST_DEFAULT_TAG, XmCHARSET_TEXT, NULL)); - n++; - label[i] = XmCreateLabel(cnt, "label", args, n); - XtManageChild(label[i]); - pcb_ltf_box_postadd(&bx, label[i], expmask[i] != '0'); - } - - { - Cardinal numch; - WidgetList children; - XtVaGetValues(cnt, XmNnumChildren, &numch, XmNchildren, &children, NULL); - - for(i = 0; i < numch; i++) { - unsigned char la, ra; - Widget lw, rw; - XmString s; - char *cs; - XtVaGetValues(children[i], XmNleftAttachment, &la, XmNrightAttachment, &ra, XmNlabelString, &s, XmNleftWidget, &lw, XmNrightWidget, &rw, NULL); - XmStringGetLtoR(s, XmFONTLIST_DEFAULT_TAG, &cs); - if ((la == XmATTACH_WIDGET) && (lw != children[i-1])) - printf("!l!"); - if ((ra == XmATTACH_WIDGET) && (rw != children[i+1])) - printf("!r!"); - - printf(" %s[%s]%s ", aname(la), cs, aname(ra)); - } - printf("\n"); - } - - XtRealizeWidget(toplevel); - - XtAppMainLoop(app); - return 0; -} Index: work/lesstif/formbox/Makefile =================================================================== --- work/lesstif/formbox/Makefile (revision 35666) +++ work/lesstif/formbox/Makefile (nonexistent) @@ -1,9 +0,0 @@ -CFLAGS = -Wall -g -LDFLAGS = -lXm -lXt - -all: main - -main: main.c - -#a: a.c -