void ui_draw_radio( UI_DIALOG *dlg, UI_GADGET_RADIO * radio ) { #if 0 //ndef OGL if ((radio->status==1) || (radio->position != radio->oldposition)) #endif { radio->status = 0; gr_set_current_canvas( radio->canvas ); if (dlg->keyboard_focus_gadget == (UI_GADGET *) radio) gr_set_fontcolor(CRED, -1); else gr_set_fontcolor(CBLACK, -1); if (radio->position == 0 ) { ui_draw_box_out( 0, 0, radio->width-1, radio->height-1 ); if (radio->flag) ui_string_centered(Middle(radio->width), Middle(radio->height), "O"); else ui_string_centered(Middle(radio->width), Middle(radio->height), " "); } else { ui_draw_box_in( 0, 0, radio->width-1, radio->height-1 ); if (radio->flag) ui_string_centered(Middle(radio->width) + 1, Middle(radio->height) + 1, "O"); else ui_string_centered(Middle(radio->width) + 1, Middle(radio->height) + 1, " "); } gr_ustring( radio->width+4, 2, radio->text ); } }
void ui_draw_checkbox( UI_GADGET_CHECKBOX * checkbox ) { if ((checkbox->status==1) || (checkbox->position != checkbox->oldposition)) { checkbox->status = 0; ui_mouse_hide(); gr_set_current_canvas( checkbox->canvas ); if (CurWindow->keyboard_focus_gadget == (UI_GADGET *)checkbox) gr_set_fontcolor( CRED, -1 ); else gr_set_fontcolor( CBLACK, -1 ); if (checkbox->position == 0 ) { ui_draw_box_out( 0, 0, checkbox->width-1, checkbox->height-1 ); if (checkbox->flag) ui_string_centered( Middle(checkbox->width), Middle(checkbox->height), "X" ); else ui_string_centered( Middle(checkbox->width), Middle(checkbox->height), " " ); } else { ui_draw_box_in( 0, 0, checkbox->width-1, checkbox->height-1 ); if (checkbox->flag) ui_string_centered( Middle(checkbox->width)+1, Middle(checkbox->height)+1, "X" ); else ui_string_centered( Middle(checkbox->width)+1, Middle(checkbox->height)+1, " " ); } gr_ustring( checkbox->width+4, 2, checkbox->text ); ui_mouse_show(); } }
void ui_draw_radio( UI_GADGET_RADIO * radio ) { if ((radio->status==1) || (radio->position != radio->oldposition)) { radio->status = 0; ui_mouse_hide(); gr_set_current_canvas( radio->canvas ); if (radio->flag) gr_set_fontcolor( CRED, -1 ); else gr_set_fontcolor( CBLACK, -1 ); if (radio->position == 0 ) { ui_draw_box_out( 0, 0, radio->width-1, radio->height-1 ); ui_string_centered( Middle(radio->width), Middle(radio->height), "þ" ); } else { ui_draw_box_in( 0, 0, radio->width-1, radio->height-1 ); ui_string_centered( Middle(radio->width)+1, Middle(radio->height)+1, "þ" ); } if (CurWindow->keyboard_focus_gadget == (UI_GADGET *)radio) gr_set_fontcolor( CRED, CWHITE ); else gr_set_fontcolor( CBLACK, CWHITE ); gr_ustring( radio->width+4, 2, radio->text ); ui_mouse_show(); } }
void item_show( MENU * menu, int n ) { ITEM * item = &menu->Item[n]; gr_set_current_canvas(NULL); // If this is a seperator, then draw it. if ( item->Text[0] == '-' ) { gr_setcolor( CBLACK ); gr_urect( item->x, item->y+item->h/2, item->x+item->w-1, item->y+item->h/2 ); return; } if ( menu->CurrentItem==n && menu->ShowBar ) { if ( menu != &Menu[0] ) { gr_setcolor( CBLACK ); gr_urect( item->x+1, item->y+1, item->x+menu->w-2, item->y+item->h-2 ); } gr_set_fontcolor( CWHITE, CBLACK ); }else { if ( menu != &Menu[0] ) { gr_setcolor( CGREY ); gr_urect( item->x+1, item->y+1, item->x+menu->w-2, item->y+item->h-2 ); } gr_set_fontcolor( CBLACK, CGREY ); } if ( menu != &Menu[0] ) { if ( menu->Active) gr_ustring( item->x+1, item->y+1, item->Text ); else gr_ustring( item->x+1, item->y+1, item->InactiveText ); } else { if ( menu->Active) gr_ustring( item->x, item->y, item->Text ); else gr_ustring( item->x, item->y, item->InactiveText ); } }
void ui_string_centered( short x, short y, char * s ) { int height, width, avg; gr_get_string_size(s, &width, &height, &avg ); //baseline = height-grd_curcanv->cv_font->ft_baseline; gr_ustring(x-((width-1)/2), y-((height-1)/2), s ); }
void ui_pad_draw(UI_DIALOG *dlg, int x, int y) { int bh, bw; bw = 56; bh = 30; ui_dialog_set_current_canvas( dlg ); ui_draw_box_in( x, y, x+(bw*4)+10 + 200, y+(bh*5)+45 ); gr_set_current_canvas( NULL ); gr_setcolor( CWHITE ); gr_urect( desc_x, desc_y, desc_x+ 56*4-1, desc_y+15 ); gr_set_fontcolor( CBLACK, CWHITE ); gr_ustring( desc_x, desc_y, KeyPad[active_pad]->description ); }
static void ui_pad_set_active( int n ) { int np; char * name; int i, j; gr_set_current_canvas( NULL ); gr_setcolor( CWHITE ); gr_urect( desc_x, desc_y, desc_x+ 56*4-1, desc_y+15 ); gr_set_fontcolor( CBLACK, CWHITE ); gr_ustring( desc_x, desc_y, KeyPad[n]->description ); for (i=0; i<17; i++ ) { Pad[i]->text = KeyPad[n]->buttontext[i]; Pad[i]->status = 1; Pad[i]->user_function = NULL; Pad[i]->dim_if_no_function = 1; Pad[i]->hotkey = -1; for (j=0; j< KeyPad[n]->numkeys; j++ ) { if (HotKey[i] == KeyPad[n]->keycode[j] ) { Pad[i]->hotkey = HotKey[i]; Pad[i]->user_function = func_nget( KeyPad[n]->function_number[j], &np, &name ); } if (HotKey1[i] == KeyPad[n]->keycode[j] ) { Pad[i]->hotkey1 = HotKey1[i]; Pad[i]->user_function1 = func_nget( KeyPad[n]->function_number[j], &np, &name ); } } } active_pad = n; }
void draw_world(grs_canvas *screen_canvas,editor_view *v,segment *mine_ptr,int depth) { vms_vector viewer_position; #if DOUBLE_BUFFER grs_canvas temp_canvas; // mprintf(0, "\n"); // if ( screen_canvas == LargeViewBox->canvas ) { // CurrentBigCanvas ^= 1; // // gr_set_current_canvas( BigCanvas[CurrentBigCanvas] ); // // } else { gr_init_sub_canvas(&temp_canvas,canv_offscreen,0,0, screen_canvas->cv_bitmap.bm_w,screen_canvas->cv_bitmap.bm_h); gr_set_current_canvas(&temp_canvas); // } #else gr_set_current_canvas(screen_canvas); #endif //mprintf(0, "\n"); ui_mouse_hide(); //g3_set_points(Segment_points,Vertices); viewer_position = v->ev_matrix.fvec; vm_vec_scale(&viewer_position,-v->ev_dist); vm_vec_add2(&viewer_position,&Ed_view_target); gr_clear_canvas(0); g3_start_frame(); g3_set_view_matrix(&viewer_position,&v->ev_matrix,v->ev_zoom); render_start_frame(); gr_setcolor(PLAINSEG_COLOR); // Draw all segments or only connected segments. // We might want to draw all segments if we have broken the mine into pieces. if (Draw_all_segments) draw_mine_all(Segments, Automap_test); else draw_mine(mine_ptr,depth); // Draw the found segments if (!Automap_test) { draw_warning_segments(); draw_group_segments(); draw_found_segments(); draw_selected_segments(); draw_special_segments(); // Highlight group segment and side. if (current_group > -1) if (Groupsegp[current_group]) { gr_setcolor(GROUPSEG_COLOR); draw_segment(Groupsegp[current_group]); gr_setcolor(GROUPSIDE_COLOR); draw_seg_side(Groupsegp[current_group],Groupside[current_group]); } // Highlight marked segment and side. if (Markedsegp) { gr_setcolor(MARKEDSEG_COLOR); draw_segment(Markedsegp); gr_setcolor(MARKEDSIDE_COLOR); draw_seg_side(Markedsegp,Markedside); } // Highlight current segment and current side. gr_setcolor(CURSEG_COLOR); draw_segment(Cursegp); gr_setcolor(CURSIDE_COLOR); draw_seg_side(Cursegp,Curside); gr_setcolor(CUREDGE_COLOR); draw_side_edge(Cursegp,Curside,Curedge); // Draw coordinate axes if we are rendering the large view. if (Show_axes_flag) if (screen_canvas == LargeViewBox->canvas) draw_coordinate_axes(); // Label the window gr_set_fontcolor((v==current_view)?CRED:CWHITE, -1 ); if ( screen_canvas == LargeViewBox->canvas ) { gr_ustring( 5, 5, "USER VIEW" ); switch (Large_view_index) { case 0: gr_ustring( 85, 5, "-- TOP"); break; case 1: gr_ustring( 85, 5, "-- FRONT"); break; case 2: gr_ustring( 85, 5, "-- RIGHT"); break; } } else #if ORTHO_VIEWS else if ( screen_canvas == TopViewBox->canvas ) gr_ustring( 5, 5, "TOP" ); else if ( screen_canvas == FrontViewBox->canvas ) gr_ustring( 5, 5, "FRONT" ); else if ( screen_canvas == RightViewBox->canvas ) gr_ustring( 5, 5, "RIGHT" ); #else Error("Ortho views have been removed, what gives?\n"); #endif }