/*===========================================================================*\ FILE : TestDrawTbl.c PURPOSE: DwgTable demo & test HISTORY: DATE AUTHOR MODIFICATIONS 26-Oct-99 I-03-20 mka $$1 Create 20-Dec-99 I-03-25 AKH $$2 Specify segment id when calling to ProDwgtableInfoGet(). 13-Mar-00 J-01-04 akh $$3 Modify ProTestDrwTable(). 07-Dec-00 J-01-23 JCN $$4 Remove potentially endless while-loops \*===========================================================================*/ /*--------------------------------------------------------------------*\ System includes \*--------------------------------------------------------------------*/ #include /*--------------------------------------------------------------------*\ ProToolkit includes \*--------------------------------------------------------------------*/ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include /*--------------------------------------------------------------------*\ ProDevelop includes \*--------------------------------------------------------------------*/ #include /*--------------------------------------------------------------------*\ Application includes \*--------------------------------------------------------------------*/ #include #include #include #include #include #include #include /*--------------------------------------------------------------------*\ Application macros \*--------------------------------------------------------------------*/ #define TBL_INFO_NAME "dwg_table.info" #define TBL_CREATE_DESCENDING 1 #define TBL_CREATE_ASCENDING 2 #define TBL_CREATE_RIGHTWARD 3 #define TBL_CREATE_LEFTWARD 4 #define TBL_CREATE_NUM_CHARS 5 #define TBL_CREATE_LENGTH 6 #define TBL_DESASC_TO_STRING(x) ((x==TBL_CREATE_DESCENDING)?"down":"upper") #define TBL_LR_TO_STRING(x) ((x==TBL_CREATE_LEFTWARD)?"left":"right") /*--------------------------------------------------------------------*\ Constants for application menu \*--------------------------------------------------------------------*/ #define TBL_TEST_MN_CREATE 1 #define TBL_TEST_MN_DELETE 2 #define TBL_TEST_MN_UPDATE 3 #define TBL_TEST_MN_MODIFY 4 #define TBL_TEST_MN_INFO 5 #define TBL_TEST_MN_RETRIVE 6 #define TBL_TEST_MN_MOD_TABLE 7 #define TBL_TEST_MN_MOD_ROW_COL 8 #define TBL_TEST_MN_MOD_TBL_MERGE 9 #define TBL_TEST_MN_MOD_TBL_REMESH 10 #define TBL_TEST_MN_MOD_TBL_ROTATE 11 #define TBL_TEST_MN_MOD_TBL_MERGE_ROW 12 #define TBL_TEST_MN_MOD_TBL_MERGE_COL 13 #define TBL_TEST_MN_MOD_TBL_MERGE_RC 14 #define TBL_TEST_MN_MOD_TBL_INSERT 15 #define TBL_TEST_MN_MOD_TBL_REMOVE 16 #define TBL_TEST_MN_PICK_POINT 17 #define TBL_TEST_MN_PICK_VERTEX 18 #define TBL_TEST_MN_PICK_ENTITY 19 #define TBL_TEST_MN_PICK_REL_COORDS 20 #define TBL_TEST_MN_PICK_ABS_COORDS 21 #define TBL_TEST_MN_MOD_TBL_ROW 22 #define TBL_TEST_MN_MOD_TBL_COL 23 #define TBL_TEST_MN_LEFT_RIGHT 24 #define TBL_TEST_MN_NUM_LEN 25 #define TBL_TEST_MN_DES_AS 26 #define TBL_TEST_MN_DONE 27 /*===========================================================================*\ FUNCTION: ProTestTableRemesh PURPOSE: merge/remesh table cells \*===========================================================================*/ int ProTestTableRemesh(ProDrawing drawing, int opt) { ProDwgtable table; ProError error; #if 0 ProSelection *sel; int tseg[2]; #else Select3d *sel; int table_id[2]; #endif int i,n; int row[2], col[2]; ProUtilMsgPrint("gen", "TEST %0s", "Pick pair of table cells"); /*--------------------------------------------------------------------*\ Select two table cells \*--------------------------------------------------------------------*/ #if 1 if(pro_select("table_cell", 1, &sel, NULL, NULL)!=1) return(PRO_TK_USER_ABORT); row[0] = (int)(sel->sel_param[0]) + 1; col[0] = (int)(sel->sel_param[1]) + 1; table_id[0] = sel->selected_id; if(pro_select("table_cell", 1, &sel, NULL, NULL)!=1) return(PRO_TK_USER_ABORT); row[1] = (int)(sel->sel_param[0]) + 1; col[1] = (int)(sel->sel_param[1]) + 1; table_id[1] = sel->selected_id; #else error = ProSelect("table_cell", 2, NULL, NULL, NULL, NULL, &sel, &n); TEST_CALL_REPORT("ProSelect()", "ProTestTableRemesh()", error, error!=PRO_TK_NO_ERROR); if ((error!=PRO_TK_NO_ERROR)||(n<2)) return(error); /*--------------------------------------------------------------------*\ Get cell position \*--------------------------------------------------------------------*/ for (i=0; i<2; i++) { error = ProSelectionDwgtblcellGet(sel[i], &tseg[i], &row[i], &col[i]); TEST_CALL_REPORT("ProSelectionDwgtblcellGet()", "ProTestTableRemesh()", error, error!=PRO_TK_NO_ERROR); row[i]++; col[i]++; table_id[i] = sel[i]->selected_id; } #endif /*--------------------------------------------------------------------*\ Both cells must be in the some table \*--------------------------------------------------------------------*/ if (table_id[0]!=table_id[1]) { ProUtilMsgPrint("gen", "TEST %0s", "Both points must be in the some table"); return(-1); } /*--------------------------------------------------------------------*\ Initialize table handle \*--------------------------------------------------------------------*/ error = ProModelitemInit((ProMdl)drawing, table_id[0], PRO_DRAW_TABLE, (ProModelitem*)&table); TEST_CALL_REPORT("ProModelitemInit()", "ProTestTableRemesh", error, error != PRO_TK_NO_ERROR); /*--------------------------------------------------------------------*\ Sorting the row and colums \*--------------------------------------------------------------------*/ if(row[1]0)) { error = ProSelectionModelitemGet(sel[0], (ProModelitem*)&table); TEST_CALL_REPORT("ProSelectionModelitemGet()", "ProTestTableRotate()", error, error!=PRO_TK_NO_ERROR); /*--------------------------------------------------------------------*\ Rotate table \*--------------------------------------------------------------------*/ error = ProDwgtableRotate(&table, 1); TEST_CALL_REPORT("ProDwgtableRotate()","ProTestTableRotate", error, error != PRO_TK_NO_ERROR); error = ProWindowRepaint(PRO_VALUE_UNUSED); TEST_CALL_REPORT("ProWindowRepaint()","ProTestTableRotate", error, error != PRO_TK_NO_ERROR); } return (PRO_TK_NO_ERROR); } /*=================================================================*\ FUNCTION : ProTestTableModTabMerge() PURPOSE : Create "TblMerge" menu \*=================================================================*/ int ProTestTableModTabMerge(ProDrawing drawing) { int n; ProError error; static ProUtilMenuButtons TMenu[] ={ {"TblMerge", -1, TEST_CALL_PRO_MENU_DELETE}, {"-Rows", TBL_TEST_MN_MOD_TBL_MERGE_ROW, 0}, {"-Columns", TBL_TEST_MN_MOD_TBL_MERGE_COL, 0}, {"-Row&Cols", TBL_TEST_MN_MOD_TBL_MERGE_RC, 0}, {"-Done/Return",-1, TEST_CALL_PRO_MENU_DELETE}, {"", -1,0}}; /*--------------------------------------------------------------------*\ Create "TblMerge" select "-Done/Return" for exit from menu \*--------------------------------------------------------------------*/ do { error = ProUtilMenuIntValueSelect(TMenu, &n); if((error!=PRO_TK_NO_ERROR)||(n<0)) return(PRO_TK_USER_ABORT); error = ProTestTableRemesh(drawing, n); if((error!=PRO_TK_NO_ERROR) && (error != PRO_TK_USER_ABORT)) return error; }while (error!=PRO_TK_USER_ABORT); return(PRO_TK_NO_ERROR); } /*=================================================================*\ FUNCTION : ProTestTableModTabMenu() PURPOSE : Create "TblModify" menu \*=================================================================*/ int ProTestTableModTabMenu(ProDrawing drawing) { int n ; ProError error; static ProUtilMenuButtons TMenu[] ={ {"TblModify", -1, TEST_CALL_PRO_MENU_DELETE}, {"-Merge", TBL_TEST_MN_MOD_TBL_MERGE, 0}, {"-Remesh", TBL_TEST_MN_MOD_TBL_REMESH, 0}, {"-Rotate", TBL_TEST_MN_MOD_TBL_ROTATE, 0}, {"-Done/Return",-1, TEST_CALL_PRO_MENU_DELETE}, {"", -1,0}}; /*--------------------------------------------------------------------*\ Create "TblModify" select "-Done/Return" for exit from menu \*--------------------------------------------------------------------*/ do { error = ProUtilMenuIntValueSelect(TMenu, &n); if((error!=PRO_TK_NO_ERROR)||(n<0)) return(PRO_TK_USER_ABORT); switch(n) { case TBL_TEST_MN_MOD_TBL_REMESH: error = ProTestTableRemesh(drawing, TBL_TEST_MN_MOD_TBL_REMESH); break; case TBL_TEST_MN_MOD_TBL_MERGE: ProTestTableModTabMerge(drawing); break; case TBL_TEST_MN_MOD_TBL_ROTATE: ProTestTableRotate(drawing); break; } }while ((error == PRO_TK_NO_ERROR)&&(n>0)); return(PRO_TK_NO_ERROR); } /*===========================================================================*\ FUNCTION: ProTestTableInsertRemove PURPOSE: insert/remove row/col into(from) a table \*===========================================================================*/ ProError ProTestTableInsertRemove(ProDrawing drawing, int action, int opt) { ProError error; ProDwgtable table; #if 0 ProSelection *sel; int tseg; #else Select3d *sel; #endif int table_id; int row,col, n; double d, range[2]={1, 20}; ProCharLine cstr; sprintf(cstr, "Pick location in the table to %s %s", (action == TBL_TEST_MN_MOD_TBL_INSERT) ? "insert":"remove", (opt == TBL_TEST_MN_MOD_TBL_ROW) ? "row" : "column"); ProUtilMsgPrint("gen", "TEST %0s", cstr); /*--------------------------------------------------------------------*\ Select place in the table for insert or remove row or columns \*--------------------------------------------------------------------*/ #if 1 if(pro_select("table_cell", 1, &sel, NULL, NULL)!=1) return(PRO_TK_USER_ABORT); row = (int)sel->sel_param[0] + 1; col = (int)sel->sel_param[1] + 1; table_id = sel->selected_id; #else error = ProSelect("table_cell", 1, NULL, NULL, NULL, NULL, &sel, &n); TEST_CALL_REPORT("ProSelect()", "ProTestTableInsertRemove()", error, error!=PRO_TK_NO_ERROR); if ((error!=PRO_TK_NO_ERROR)||(n<1)) return(PRO_TK_USER_ABORT); /*--------------------------------------------------------------------*\ Get cell position \*--------------------------------------------------------------------*/ error = ProSelectionDwgtblcellGet(sel[0], &tseg, &row, &col); TEST_CALL_REPORT("ProSelectionDwgtblcellGet()", "ProTestTableInsertRemove()", error, error!=PRO_TK_NO_ERROR); table_id = sel[0]->selected_id; #endif error = ProModelitemInit((ProMdl)drawing, table_id, PRO_DRAW_TABLE, (ProModelitem*)&table); TEST_CALL_REPORT("ProModelitemInit()", "ProTestTableInsertRemove()", error, error!=PRO_TK_NO_ERROR); if (action == TBL_TEST_MN_MOD_TBL_INSERT) { if(opt == TBL_TEST_MN_MOD_TBL_ROW) { /*--------------------------------------------------------------------*\ Insert row into the table \*--------------------------------------------------------------------*/ ProUtilMsgPrint("gen", "TEST %0s", "Enter row height in chars"); if (ProMessageDoubleRead(range, &d)!=PRO_TK_NO_ERROR) return (PRO_TK_USER_ABORT); error = ProDwgtableRowAdd(&table, row, 1, d); TEST_CALL_REPORT("ProDwgtableRowAdd()", "ProTestTableInsertRemove()", error, error != PRO_TK_NO_ERROR); } else { /*--------------------------------------------------------------------*\ Insert col into the table \*--------------------------------------------------------------------*/ ProUtilMsgPrint("gen", "TEST %0s", "Enter cell width in chars"); if (ProMessageDoubleRead(range, &d)!=PRO_TK_NO_ERROR) return (0); error = ProDwgtableColumnAdd(&table, col, 1,d); TEST_CALL_REPORT("ProDwgtableColumnAdd()", "ProTestTableInsertRemove()", error, error != PRO_TK_NO_ERROR); } } else { sprintf(cstr, "Do you really want to remove the %0s? [N]:", (opt == TBL_TEST_MN_MOD_TBL_ROW) ? "row" : "column"); ProUtilMsgPrint("gen", "TEST %0s", cstr); if (ProUtilYesnoGet("yes")==0) return (PRO_TK_USER_ABORT); if (opt == TBL_TEST_MN_MOD_TBL_ROW) { /*--------------------------------------------------------------------*\ Remove row from the table \*--------------------------------------------------------------------*/ error = ProDwgtableRowDelete(&table, row, 1); TEST_CALL_REPORT("ProDwgtableRowDelete()", "ProTestTableInsertRemove()", error, error != PRO_TK_NO_ERROR); } else { /*--------------------------------------------------------------------*\ Remove column from the table \*--------------------------------------------------------------------*/ error = ProDwgtableColumnDelete(&table, col, 1); TEST_CALL_REPORT("ProDwgtableColumnDelete()", "ProTestTableInsertRemove()", error, error != PRO_TK_NO_ERROR); } } return (PRO_TK_NO_ERROR); } /*=================================================================*\ FUNCTION : ProTestTableInsertRemoveMenu() PURPOSE : Create "TblInsRm" menu \*=================================================================*/ ProError ProTestTableInsertRemoveMenu(ProDrawing drawing) { int n1, n2; ProError error; static ProUtilMenuButtons TMenu1[] ={ {"TblInsRm", -1, TEST_CALL_PRO_MENU_DELETE}, {"-Insert", TBL_TEST_MN_MOD_TBL_INSERT, 0}, {"-Remove", TBL_TEST_MN_MOD_TBL_REMOVE, 0}, {"-Done/Return",-1, TEST_CALL_PRO_MENU_DELETE}, {"", -1,0}}; static ProUtilMenuButtons TMenu2[] ={ {"TblRowCol", -1, TEST_CALL_PRO_MENU_DELETE}, {"-Row", TBL_TEST_MN_MOD_TBL_ROW, 0}, {"-Col", TBL_TEST_MN_MOD_TBL_COL, 0}, {"-Done/Return",-1, TEST_CALL_PRO_MENU_DELETE}, {"", -1,0}}; /*--------------------------------------------------------------------*\ Show "Insert/Remove" menu \*--------------------------------------------------------------------*/ do { error = ProUtilMenuIntValueSelect(TMenu1, &n1); if((error!=PRO_TK_NO_ERROR)||(n1<0)) return(PRO_TK_NO_ERROR); do { error = ProUtilMenuIntValueSelect(TMenu2, &n2); if((error!=PRO_TK_NO_ERROR)||(n2<0)) break; error = ProTestTableInsertRemove(drawing, n1, n2); } while((error==PRO_TK_NO_ERROR)); }while(1); } /*=================================================================*\ FUNCTION : ProTestTableModifyMenu() PURPOSE : Create "TkModify" menu \*=================================================================*/ int ProTestTableModifyMenu(ProDrawing drawing) { int n; ProError error; static ProUtilMenuButtons TMenu[] ={ {"TkModify", -1, TEST_CALL_PRO_MENU_DELETE}, {"-Table", TBL_TEST_MN_MOD_TABLE, 0}, {"-Row/Cols", TBL_TEST_MN_MOD_ROW_COL, 0}, {"-Done/Return",-1, TEST_CALL_PRO_MENU_DELETE}, {"", -1,0}}; /*--------------------------------------------------------------------*\ Show "TkModify" menu \*--------------------------------------------------------------------*/ error = ProUtilMenuIntValueSelect(TMenu, &n); if((error!=PRO_TK_NO_ERROR)||(n<0)) return(PRO_TK_NO_ERROR); switch(n) { case TBL_TEST_MN_MOD_TABLE: ProTestTableModTabMenu(drawing); break; case TBL_TEST_MN_MOD_ROW_COL: ProTestTableInsertRemoveMenu(drawing); break; } return(PRO_TK_NO_ERROR); } /*===========================================================================*\ FUNCTION: ProTestTableDelete PURPOSE: delete the table from drawing \*===========================================================================*/ int ProTestTableDelete(ProDrawing drawing) { ProError error; ProDwgtable table; ProSelection *sel; int n; ProUtilMsgPrint("gen", "TEST %0s", "Pick the table to be deleted."); /*--------------------------------------------------------------------*\ Select table for delete \*--------------------------------------------------------------------*/ error = ProSelect("dwg_table", 1, NULL, NULL, NULL, NULL, &sel, &n); TEST_CALL_REPORT("ProSelect()", "ProTestTableDelete()", error, error!=PRO_TK_NO_ERROR); if((error == PRO_TK_NO_ERROR)&&(n>0)) { ProUtilMsgPrint("gen", "TEST %0s", "Do you really want to delete the table [N]:"); if (ProUtilYesnoGet("yes")==1) { error = ProSelectionModelitemGet(sel[0], (ProModelitem*)&table); TEST_CALL_REPORT("ProSelectionModelitemGet()", "ProTestTableDelete()", error, error!=PRO_TK_NO_ERROR); /*--------------------------------------------------------------------*\ Delete selected table \*--------------------------------------------------------------------*/ error = ProDwgtableDelete(&table, 1); TEST_CALL_REPORT("ProDwgtableDelete()", "ProTestTableDelete()", error, error!=PRO_TK_NO_ERROR); } } return (PRO_TK_NO_ERROR); } /*===========================================================================*\ FUNCTION: ProTestTableInfo PURPOSE: list parameters of table \*===========================================================================*/ int ProTestTableInfo (ProDrawing drawing) { ProPath f_name; ProCharLine cstr; int i, j, cur_sheet, n, ncols, nrows; FILE *fp; ProDwgtableInfo table_info; ProDwgtable table; ProBoolean from_format, is_comment; ProAsmcomppath component; ProError error; ProMdldata mdl_data; ProMdl mdl; ProSelection *sel; double sw, sl; /*--------------------------------------------------------------------*\ Get current sheet number \*--------------------------------------------------------------------*/ error = ProDrawingCurrentSheetGet(drawing, &cur_sheet); TEST_CALL_REPORT ("ProDrawingCurrentSheetGet()", "ProTestTableInfo()", error, error!=PRO_TK_NO_ERROR); ProUtilMsgPrint("gen", "TEST %0s", "Select a drawing table to parameters listing"); /*--------------------------------------------------------------------*\ Select table from the current drawing \*--------------------------------------------------------------------*/ error = ProSelect("dwg_table", 1, NULL, NULL, NULL, NULL, &sel, &n); TEST_CALL_REPORT("ProSelect()", "ProTestTableInfo()", error, error!=PRO_TK_NO_ERROR); if((error!=PRO_TK_NO_ERROR)||(n<1)) return(-1); error = ProSelectionModelitemGet(sel[0], (ProModelitem*)&table); TEST_CALL_REPORT("ProSelectionModelitemGet()", "ProTestTableInfo()", error, error!=PRO_TK_NO_ERROR); /*--------------------------------------------------------------------*\ Open file for output information about selected table \*--------------------------------------------------------------------*/ fp = fopen(TBL_INFO_NAME, "w"); if (fp == NULL) return (-1); /*--------------------------------------------------------------------*\ Get parameters of table. \*--------------------------------------------------------------------*/ fprintf (fp, "Table %d.\n", table.id); error = ProDwgtableRowsCount (&table, &nrows); TEST_CALL_REPORT("ProDwgtableRowsCount()", "ProTestTableInfo()", error, error!=PRO_TK_NO_ERROR); fprintf (fp, "Number of row %d. ", nrows); error = ProDwgtableColumnsCount (&table, &ncols); TEST_CALL_REPORT("ProDwgtableColumnsCount()", "ProTestTableInfo()", error, error!=PRO_TK_NO_ERROR); fprintf (fp, "Number of column %d\n", ncols); /*--------------------------------------------------------------------*\ Calculate table size \*--------------------------------------------------------------------*/ for(i=0, sw=0; i"); fprintf (fp, "the model of the record of the cell)\n"); for (j=1; j<=table_info.nrows; j++) { for (i=1; i<=table_info.ncols; i++) { error = ProDwgtableCellIsComment(&table, i, j, &is_comment); TEST_CALL_REPORT ("ProDwgtableCellIsComment()", "ProTestTableInfo()", error, error!=PRO_TK_NO_ERROR); fprintf (fp,"\t%s/",(is_comment)?"yes":"no"); /*--------------------------------------------------------------------*\ Get specified member identifier table. \*--------------------------------------------------------------------*/ error = ProDwgtableCellComponentGet(&table, i, j, &component); TEST_CALL_REPORT ("ProDwgtableCellComponentGet()", "ProTestTableInfo()", error, error == PRO_TK_NO_ERROR); fprintf (fp, "%d", component.table_num); /*--------------------------------------------------------------------*\ Get a model pointer by decoding a cell in a repeat region. \*--------------------------------------------------------------------*/ if (error != PRO_TK_NO_ERROR) { fprintf (fp, "(none->none)"); } else { error = ProMdlDataGet(component.owner, &mdl_data); TEST_CALL_REPORT ("ProMdldata()", "ProTestTableInfo()", error, error != PRO_TK_NO_ERROR); fprintf (fp, "(%s->", ProWstringToString(cstr, mdl_data.name)); error = ProAsmcomppathMdlGet(&component, &mdl); TEST_CALL_REPORT ("ProAsmcomppathMdlGet()", "ProTestTableInfo()", error, error != PRO_TK_NO_ERROR); error = ProMdlDataGet(mdl, &mdl_data); TEST_CALL_REPORT ("ProMdldata()", "ProTestTableInfo()", error, error != PRO_TK_NO_ERROR); fprintf (fp, "%s)", ProWstringToString(cstr, mdl_data.name)); } } fprintf (fp,"\n"); } fclose (fp); /*--------------------------------------------------------------------*\ Display information \*--------------------------------------------------------------------*/ error = ProInfoWindowDisplay(ProStringToWstring(f_name,TBL_INFO_NAME),NULL,NULL); TEST_CALL_REPORT ("ProInfoWindowDisplay()","ProTestTableInfo()", error, error != PRO_TK_NO_ERROR); return (PRO_TK_NO_ERROR); } /*===========================================================================*\ FUNCTION: ProTestTableRetrieve PURPOSE: retrieve table from disk \*===========================================================================*/ int ProTestTableRetrieve(ProDrawing drawing) { ProError error; ProDwgtable table; ProCharLine f_name, c_name; ProPath w_full_name, w_path; ProName w_name, w_type; int ver, mdl_num,i; ProMouseButton but; ProPoint3d point; ProMdl mdl = NULL, *mdl_arr = NULL; /*--------------------------------------------------------------------*\ Display information \*--------------------------------------------------------------------*/ error = ProUtilFileOpen("*.tbl", f_name); if(error!=PRO_TK_NO_ERROR) return(error); ProUtilMsgPrint("gen", "TEST %0s", "Select table origin."); /*--------------------------------------------------------------------*\ Collect all models in the current session \*--------------------------------------------------------------------*/ error = ProSessionMdlList ( PRO_MDL_ASSEMBLY, &mdl_arr, &mdl_num); if (error == PRO_TK_NO_ERROR && mdl_num>0) { for (i=0; i0) { error = ProGraphicsPolygonDraw(arr, 4, PRO_COLOR_BACKGROUND); TEST_CALL_REPORT ("ProGraphicsPolygonDraw()", "ProTestTableCreate()", error, error != PRO_TK_NO_ERROR); } error = ProGraphicsColorSet(PRO_COLOR_DRAWING, &old_color); TEST_CALL_REPORT ("ProGraphicsColorSet()", "ProTestTableCreate()", error, error != PRO_TK_NO_ERROR); ProGraphicsPenPosition(pos); pos[1]-=sh; ProGraphicsLineDraw(pos); pos[1]+=sh; error = ProGraphicsColorSet(PRO_COLOR_BACKGROUND, &old_color); TEST_CALL_REPORT ("ProGraphicsColorSet()", "ProTestTableCreate()", error, error != PRO_TK_NO_ERROR); ProUtilMsgPrint("gen", "TEST %0s", (ncols == 0) ? (" Mark off the %0s of the first column. (Middle buton - to quit.)"): (" Mark the next column. (Middle buton - to quit.) width Enter the height of the next row in the drawing units ( INCH ) [DONE]:")); memcpy(point, pos, sizeof(double)*3); if (right_left == TBL_CREATE_LEFTWARD) { point[0] -= sw * len; error = ProGraphicsTextDisplay(point, ProStringToWstring(w_size, sizo)); TEST_CALL_REPORT ("ProGraphicsTextDisplay()", "ProTestTableCreate()", error, error != PRO_TK_NO_ERROR); } else { error = ProGraphicsTextDisplay(pos, ProStringToWstring(w_size, size)); TEST_CALL_REPORT ("ProGraphicsTextDisplay()", "ProTestTableCreate()", error, error != PRO_TK_NO_ERROR); } arr[0][0] = arr[3][0] = point[0]; arr[1][0] = arr[2][0] = point[0] + sw*len; arr[0][1] = arr[1][1] = point[1]; arr[2][1] = arr[3][1] = point[1] + sh; error = ProMousePickGet(PRO_ANY_BUTTON, &but, point); TEST_CALL_REPORT ("ProMousePickGet()", "ProTestTableCreate()", error, error != PRO_TK_NO_ERROR); if ((error!=PRO_TK_NO_ERROR)||(but == PRO_MIDDLE_BUTTON)) break; if ((point[0]-pos[0])*sign<=sw) { ProUtilMsgPrint("gen", "TEST %0s", "Less than minimal size - ignored."); continue; } width[ncols] = (point[0]-pos[0])*sign/sw; pos[0] += width[ncols]*sw*sign; ncols++; } error = ProGraphicsPolygonDraw(arr, 4, PRO_COLOR_BACKGROUND); TEST_CALL_REPORT ("ProGraphicsPolygonDraw()", "ProTestTableCreate()", error, error != PRO_TK_NO_ERROR); sign = (desc_asc == TBL_CREATE_DESCENDING) ? -1: 1; start = (desc_asc == TBL_CREATE_DESCENDING) ? 0: 1; len = 5; if (ncols!=0) while (nrows0) { error = ProGraphicsPolygonDraw(arr, 4, PRO_COLOR_BACKGROUND); TEST_CALL_REPORT ("ProGraphicsPolygonDraw()", "ProTestTableCreate()", error, error != PRO_TK_NO_ERROR); } error = ProGraphicsColorSet(PRO_COLOR_DRAWING, &old_color); TEST_CALL_REPORT ("ProGraphicsColorSet()", "ProTestTableCreate()", error, error != PRO_TK_NO_ERROR); pos[0]+=sw; ProGraphicsPenPosition(pos); pos[0]+=sw; ProGraphicsLineDraw(pos); pos[0]-=2*sw; error = ProGraphicsColorSet(PRO_COLOR_BACKGROUND, &old_color); TEST_CALL_REPORT ("ProGraphicsColorSet()", "ProTestTableCreate()", error, error != PRO_TK_NO_ERROR); ProUtilMsgPrint("gen", "TEST %0s", (nrows == 0) ? ("USER Mark off the %0s of the first column. (Middle buton - to quit.)"): ("USER Mark the next column. (Middle buton - to quit.) height")); for (i=0; i0) && (nrows>0)) { if (right_left == TBL_CREATE_LEFTWARD) { d=ProTestTableLength(width,ncols); origin[0] -= d*sw; } if (desc_asc == TBL_CREATE_ASCENDING) { d=ProTestTableLength(height,nrows); origin[1] += d*sh; } } } /*--------------------------------------------------------------------*\ Create table \*--------------------------------------------------------------------*/ if (ncols>0 && nrows>0) { if (right_left == TBL_CREATE_LEFTWARD) error = ProTestTableFlip(width, ncols); if (desc_asc == TBL_CREATE_ASCENDING) error = ProTestTableFlip(height, nrows); error = ProDwgtabledataAlloc(&table_data); TEST_CALL_REPORT ("ProDwgtabledataAlloc()", "ProTestTableCreate()", error, error != PRO_TK_NO_ERROR); if(error!=PRO_TK_NO_ERROR) return(-1); error = ProDwgtabledataOriginSet(table_data, origin); TEST_CALL_REPORT ("ProDwgtabledataOriginSet()", "ProTestTableCreate()", error, error != PRO_TK_NO_ERROR); for (i=0; i