/*****************************************************************************\ FILE : UgNotesColor.c PURPOSE : Pro/TOOLKIT User Guide Example - change the notes' color HISTORY.. DATE BUILD AUTHOR MODIFICATIONS 04-Dec-97 H-02-02 Philippe $$1 Created \*****************************************************************************/ /*-------------------------- Pro/Develop includes ---------------------------*/ #include #include /*-------------------------- Pro/Toolkit includes ---------------------------*/ #include #include #include /*-------------------------- Application includes ---------------------------*/ #include /*================================================================*\ FUNCTION : UserNotesColor PURPOSE : Creates both general and projection type drawing views. \*================================================================*/ ProError UserNotesColor () { int status; int color; ProMdl p_draw; int sheet, n_notes, *notes, n; int i_range[2] = {0 , PRO_COLOR_MAX}; Prodtl_note *p_note; ProFileName WMSGFIL = {'m','s','g','_','u','g','d','w','g','.','t','x','t','\0'}; /*------------------------------------------------------------*\ Ask the user the color of the notes \*------------------------------------------------------------*/ status = ProMessageDisplay(WMSGFIL, "USER %0s", "Enter the color index : "); ERROR_CHECK("UserNotesColor","ProMessageDisplay",status); status = ProMessageIntegerRead(i_range, &color); ERROR_CHECK("UserNotesColor","ProMessageIntegerRead",status); if (status != PRO_TK_NO_ERROR) return(status); /*------------------------------------------------------------*\ Get the current model \*------------------------------------------------------------*/ status = ProMdlCurrentGet(&p_draw); ERROR_CHECK("UserNotesColor","ProMdlCurrentGet",status); if (status != PRO_TK_NO_ERROR) return(status); /*------------------------------------------------------------*\ Get the list of notes on the current sheet. \*------------------------------------------------------------*/ sheet = prodrw_get_current_sheet ((Prohandle) p_draw); ERROR_CHECK("UserNotesColor","prodrw_get_current_sheet", (sheet <= 0)); if (sheet <=0) return (PRO_TK_NOT_VALID); n_notes = prodtl_get_ids ((Prohandle) p_draw, NULL, sheet, PRODTL_NOTE, 0, ¬es); ERROR_CHECK("UserNotesColor","prodtl_get_ids", (n_notes <0)); if (n_notes < 0) return (PRO_TK_E_NOT_FOUND); for (n = 0; n < n_notes; n++) { /*--------------------------------------------------------*\ Get the note description. \*--------------------------------------------------------*/ status = prodtl_get_item ((Prohandle) p_draw, NULL, PRODTL_NOTE, notes[n], 1, (Prodtl_item**)&p_note); ERROR_CHECK("UserNotesColor","prodtl_get_item",(status < 0)); if (status < 0) return (PRO_TK_GENERAL_ERROR); /*--------------------------------------------------------*\ Modify the note color. \*--------------------------------------------------------*/ p_note->color.type = PTC_COLOR_INDEX; p_note->color.color = color; /*--------------------------------------------------------*\ Erase, modify, and redraw the note. \*--------------------------------------------------------*/ status = prodtl_display ((Prohandle) p_draw, PRODTL_NOTE, notes[n], PRODTL_ERASE); ERROR_CHECK("UserNotesColor","prodtl_display", (status <= 0)); if (status <=0) return (PRO_TK_GENERAL_ERROR); status = prodtl_modify ((Prohandle) p_draw, NULL, (Prodtl_item*)p_note); ERROR_CHECK("UserNotesColor","prodtl_modify", (status <= 0)); if (status <=0) return (PRO_TK_GENERAL_ERROR); status = prodtl_display ((Prohandle) p_draw, PRODTL_NOTE, notes[n], PRODTL_DRAW); ERROR_CHECK("UserNotesColor","prodtl_display", (status <= 0)); if (status <=0) return (PRO_TK_GENERAL_ERROR); } return (PRO_TK_NO_ERROR); }