[Cpri-develop] cpri/examples ex.c,1.9,1.10
Brought to you by:
chrisan,
rasmusmyklebust
|
From: <ch...@pr...> - 2004-02-01 17:11:15
|
Update of /cvsroot/cpri/cpri/examples In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2313/examples Modified Files: ex.c Log Message: Fixed bug 888505 Doesn't build on Linux. Clearified some stuff in the readme. Removed misc/makedoc. There is already dependencies to cgui so cgui's makedoc can preferably be used (CGUIDIR is required for cpri and has so been all the time) Cleaned some other junk from makefiles. Corrected some syntactical matters in docs to avoid warnings from makedoc. Index: ex.c =================================================================== RCS file: /cvsroot/cpri/cpri/examples/ex.c,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** ex.c 30 Mar 2003 19:59:23 -0000 1.9 --- ex.c 1 Feb 2004 17:09:16 -0000 1.10 *************** *** 7,14 **** --- 7,20 ---- #define STRMAX 50 #define NROWS 38 + #define MAXCHARS 50 /* Just to have something to print: */ static char *names[NROWS]={"Jan","Habib","Ingela","Cecilia","Anders","Anna","Kenneth","Irina","Christer","Gert","Eva","Inezia","Gottfrid","Carin","Erik","Lennart","Louise","Katarina","John","Bettan","Kristina","Gunilla","Ernst","Madara","Jonas","Henrik","Johan","Bengt","Ingvar","Carl-Oskar","Karin","Fridjon","Gertrud","Jing","Helena","Joop","Ashafir","Birgitta"}; static int points[NROWS]={2638922,2565390,932183,740937,531658,463894,181237,135953,124439,124294,123616,112878,111848,107920,91055,51227,46144,40815,40356,37179,36336,34813,33270,25256,25153,20121,17096,17000,14950,4647,4296,3357,1353,755,725,601,182,18}; + typedef struct t_target { + int dest; + char name[MAXCHARS+1]; + } t_target; + typedef struct t_freecfg { int fontsize; *************** *** 22,25 **** --- 28,32 ---- int barcx; int barcy; + t_target *t; } t_freecfg; *************** *** 35,38 **** --- 42,46 ---- int grey; int embedded; + t_target *t; } t_diagramcfg; *************** *** 88,91 **** --- 96,100 ---- t_column column[5]; int idcont; + t_target *t; } t_tabcfg; *************** *** 113,117 **** t_handle hnd; ! hnd = CpriOpenEntry(0, "Print sample", 0, ""); if (hnd==NULL) { Req("Error!", "Print error| ~OK "); --- 122,129 ---- t_handle hnd; ! if (pr->t->dest) ! hnd = CpriOpenEntry(0, "Print sample", 0, pr->t->name); ! else ! hnd = CpriOpenEntry(0, "Print sample", 0, ""); if (hnd==NULL) { Req("Error!", "Print error| ~OK "); *************** *** 161,171 **** } ! static void show_freepos_sample(void *data nouse) { ! static t_freecfg prcfg={14, UNIVERS, 1, 1, 40, 40, 60, 7, 100, 100}; t_freecfg *pr; pr = &prcfg; ! CpriGetTypefaceNames(); MkDialogue(ADAPTIVE, "Specify free position print out", 0); StartContainer(RIGHT, ADAPTIVE, "Font properties", CT_BORDER); --- 173,184 ---- } ! static void show_freepos_sample(void *data) { ! static t_freecfg prcfg={14, UNIVERS, 1, 1, 40, 40, 60, 7, 100, 100, NULL}; t_freecfg *pr; pr = &prcfg; ! pr->t = data; ! CpriGetTypefaceNames(); MkDialogue(ADAPTIVE, "Specify free position print out", 0); StartContainer(RIGHT, ADAPTIVE, "Font properties", CT_BORDER); *************** *** 200,204 **** char s[1000]; ! hnd = CpriOpenEntry(0, "Print diagram sample", 0, ""); if (hnd==NULL) { Req("Error!", "Print error| ~OK "); --- 213,220 ---- char s[1000]; ! if (pr->t->dest) ! hnd = CpriOpenEntry(0, "Print diagram sample", 0, pr->t->name); ! else ! hnd = CpriOpenEntry(0, "Print diagram sample", 0, ""); if (hnd==NULL) { Req("Error!", "Print error| ~OK "); *************** *** 233,243 **** } ! static void show_diagram_sample(void *data nouse) { ! static t_diagramcfg prcfg={14, UNIVERS, 0, 0, 10, 12, 180, 6, 30, 1}; t_diagramcfg *pr; cgui_drop_down_list_row_spacing = 4; pr = &prcfg; MkDialogue(ADAPTIVE, "Specify diagram print out", 0); StartContainer(RIGHT, ADAPTIVE, "Font properties", CT_BORDER); --- 249,260 ---- } ! static void show_diagram_sample(void *data) { ! static t_diagramcfg prcfg={14, UNIVERS, 0, 0, 10, 12, 180, 6, 30, 1, NULL}; t_diagramcfg *pr; cgui_drop_down_list_row_spacing = 4; pr = &prcfg; + pr->t = data; MkDialogue(ADAPTIVE, "Specify diagram print out", 0); StartContainer(RIGHT, ADAPTIVE, "Font properties", CT_BORDER); *************** *** 274,278 **** hdr = &pr->header; thdr = &pr->table_header; ! hnd = CpriOpenEntry(QUEUE_OPTIMALPORT, "Print table sample", 0, ""); if (hnd==NULL) { Req("Error!", "Print error| ~OK "); --- 291,298 ---- hdr = &pr->header; thdr = &pr->table_header; ! if (pr->t->dest) ! hnd = CpriOpenEntry(QUEUE_OPTIMALPORT, "Print table sample", 0, pr->t->name); ! else ! hnd = CpriOpenEntry(QUEUE_OPTIMALPORT, "Print table sample", 0, ""); if (hnd==NULL) { Req("Error!", "Print error| ~OK "); *************** *** 395,399 **** } ! static void show_tabular_sample(void *data nouse) { static t_tabcfg prcfg={ --- 415,419 ---- } ! static void show_tabular_sample(void *data) { static t_tabcfg prcfg={ *************** *** 413,417 **** {{"", 0}, 10, 0, 0, 0}, /* Col 4 (n.u.) */ {{"", 0}, 10, 0, 0, 0} /* Col 5 (n.u.) */ ! }, 0}; static const char *const cols[]={"2", "3", "4", "5"}; int idn; --- 433,437 ---- {{"", 0}, 10, 0, 0, 0}, /* Col 4 (n.u.) */ {{"", 0}, 10, 0, 0, 0} /* Col 5 (n.u.) */ ! }, 0, NULL}; static const char *const cols[]={"2", "3", "4", "5"}; int idn; *************** *** 422,425 **** --- 442,446 ---- pr = &prcfg; + pr->t = data; hdr = &pr->header; thdr = &pr->table_header; *************** *** 481,491 **** } ! static void show_menu(void *data nouse) { MkMenuItem(0, "Display printer queues", "", show_queue, NULL); MkMenuItem(0, "Printer settings", "", show_settings, NULL); ! MkMenuItem(0, "Print sample (table)", "", show_tabular_sample, NULL); ! MkMenuItem(0, "Print sample (free pos)", "", show_freepos_sample, NULL); ! MkMenuItem(0, "Print sample (diagram)", "", show_diagram_sample, NULL); MkMenuItem(0, "Exit", "Ctrl-Q", quit, NULL); } --- 502,535 ---- } ! static void choose_filename(void *data) ! { ! t_target *t = data; ! MkDialogue(FILLSCREEN, "Enter a file name", 0); ! AddEditBox(DOWNLEFT, 200, "File name:", FSTRING, MAXCHARS, t->name); ! AddButton(DOWNLEFT, "~OK", CloseWin, NULL); ! DisplayWin(); ! } ! ! static void choose_output(void *data) ! { ! t_target *t = data; ! MkMenuRadio(&t->dest, 2, "Default printer", "Html file"); ! MkMenuItem(0, "Choose filename", "", choose_filename, t); ! } ! ! static void show_menu(void *data) { + (void)data; + #if defined ALLEGRO_LINUX + static t_target target = {1, "default.html"}; + #else + static t_target target = {0, ""}; + #endif MkMenuItem(0, "Display printer queues", "", show_queue, NULL); MkMenuItem(0, "Printer settings", "", show_settings, NULL); ! MkMenuItem(1, "Choose output", "", choose_output, &target); ! MkMenuItem(0, "Print sample (table)", "", show_tabular_sample, &target); ! MkMenuItem(0, "Print sample (free pos)", "", show_freepos_sample, &target); ! MkMenuItem(0, "Print sample (diagram)", "", show_diagram_sample, &target); MkMenuItem(0, "Exit", "Ctrl-Q", quit, NULL); } *************** *** 494,498 **** { allegro_init(); ! #ifdef WIN32 InitCguiWindowedMode(); #endif --- 538,542 ---- { allegro_init(); ! #ifdef ALLEGRO_WINDOWS InitCguiWindowedMode(); #endif *************** *** 503,507 **** MakeMenuBar(); MkMenuBarItem("File", show_menu, NULL); ! EndMenu(); AddTextBox(DOWNLEFT, "This example shows just a few of the features of " --- 547,551 ---- MakeMenuBar(); MkMenuBarItem("File", show_menu, NULL); ! EndMenuBar(); AddTextBox(DOWNLEFT, "This example shows just a few of the features of " |