static bool OpenStatusWindow( const char *title ) /***********************************************/ { gui_text_metrics metrics; // int i; gui_rect rect; // for( i = STAT_BLANK; i < sizeof( Messages ) / sizeof( Messages[0] ); ++i ) { // Messages[i] = GetVariableStrVal( Messages[i] ); // } GUIGetDlgTextMetrics( &metrics ); CharSize.x = metrics.avg.x; CharSize.y = 5 * metrics.avg.y / 4; GUITruncToPixel( &CharSize ); StatusInfo.parent = MainWnd; StatusInfo.title = GUIStrDup( title, NULL ); StatusInfo.rect.width = STATUS_WIDTH * CharSize.x; StatusInfo.rect.height = STATUS_HEIGHT * CharSize.y; GUIGetClientRect( MainWnd, &rect ); if( GUIIsGUI() ) { StatusInfo.rect.y = BitMapBottom; } else { StatusInfo.rect.y = (GUIScale.y - StatusInfo.rect.height) / 2; } if( StatusInfo.rect.y > rect.height - StatusInfo.rect.height ) { StatusInfo.rect.y = rect.height - StatusInfo.rect.height; } StatusInfo.rect.x = (GUIScale.x - StatusInfo.rect.width) / 2; StatusBarLen = 0; StatusWnd = GUICreateWindow( &StatusInfo ); GUIGetClientRect( StatusWnd, &StatusRect ); Cancel.parent = StatusWnd; Cancel.text = LIT( Cancel ); Cancel.rect.height = 7 * CharSize.y / 4; Cancel.rect.width = (strlen( Cancel.text ) + 4) * CharSize.x; Cancel.rect.x = (StatusRect.width - Cancel.rect.width) / 2; Cancel.rect.y = CANNERY_ROW * CharSize.y; StatusBarRect.x = BAR_INDENT * CharSize.x; StatusBarRect.width = StatusRect.width - 2 * BAR_INDENT * CharSize.x; StatusBarRect.y = STATUS_ROW * CharSize.y; StatusBarRect.height = CharSize.y; #ifndef _UI StatusBarRect.y -= CharSize.y / 2; StatusBarRect.height += CharSize.y; #endif StatusBarLen = StatusBarRect.width / CharSize.x; if( !GUIAddControl( &Cancel, &ToolPlain, &ToolStandout ) ) { SetupError( "IDS_CONTROLERROR" ); return( false ); } return( true ); }
int DUIGetMonitorType( void ) { if( GUIIsGUI() ) { return( 1 ); } else { gui_system_metrics metrics; GUIGetSystemMetrics( &metrics ); return( metrics.colour != 0 ); } }
void WndCreateFloatingPopup( a_window *wnd, gui_point *point, char num_popups, gui_menu_struct *menu, int *last_popup ) { gui_point mouse; if( !GUIIsGUI() ) { WndResetStatusText(); // wipe out 'Busy' } if( point == NULL ) { if( !GUIGetMousePosn( wnd->gui, &mouse ) ) { mouse.x = 0; mouse.y = 0; } point = &mouse; } GUICreateFloatingPopup( wnd->gui, point, num_popups, menu, GUI_TRACK_BOTH, last_popup ); }
STATIC bool sampleProcStatus( a_window *wnd, int row, int piece, wnd_line_piece *line ) /***************************************************************/ { sio_data *curr_sio; clicks_t abs_count; clicks_t rel_count; gui_ord point_adjust; row=row; if( piece >= PIECE_HEADER_LAST ) { return( false ); } curr_sio = WndExtra( wnd ); if( piece == PIECE_MOUSE_CATCHER ) { line->indent = 0; line->tabstop = false; line->attr = WPA_PLAIN; line->text = LIT( Empty_Str ); abs_count = curr_sio->abs_count; rel_count = curr_sio->rel_count; sprintf( relData, "%ld.%ld%%", rel_count/10, rel_count-((rel_count/10)*10) ); sprintf( absData, "%ld.%ld%%", abs_count/10, abs_count-((abs_count/10)*10) ); if( WPPixelTruncWidth( WndMaxCharX( wnd ) / 2 ) == 0 ) { point_adjust = WndMaxCharX( wnd ) / 2; } else { point_adjust = 0; } absPctStatusIndent = BAR_TAIL_POINT - WndExtentX( wnd, absData ) - point_adjust; indentPiece = BAR_TAIL_POINT - WndExtentX( wnd, "199.9%" ) - (2 * WndExtentX( wnd, " " )) - point_adjust; relPctStatusIndent = indentPiece - WndExtentX( wnd, relData ); indentPiece -= WndExtentX( wnd, "199.9%" ); if( GUIIsGUI() ) { indentPiece -= WndExtentX( wnd, LIT( Rel_Header ) ) + WndExtentX( wnd, LIT( Abs_Header ) ); relPctStatusIndent -= WndExtentX( wnd, LIT( Abs_Header ) ); line->extent = indentPiece; } } else if( piece == PIECE_REL_HEADER ) { line->indent = indentPiece; if( GUIIsGUI() ) { line->text = LIT( Rel_Header ); } else { line->text = LIT( Empty_Str ); } line->tabstop = false; if( relGraphBar ) { line->attr = WPA_REL_BAR; } else { line->attr = WPA_PLAIN_INACTIVE; } } else if( piece == PIECE_REL_PERCENT ) { line->text = relData; line->indent = relPctStatusIndent; line->tabstop = false; if( curr_sio->rel_on_screen ) { line->attr = WPA_REL_BAR; } else { line->attr = WPA_PLAIN_INACTIVE; } } else if( piece == PIECE_ABS_HEADER ) { indentPiece = BAR_TAIL_POINT - WndExtentX( wnd, "199.9%" ); if( GUIIsGUI() ) { line->text = LIT( Abs_Header ); indentPiece -= WndExtentX( wnd, LIT( Abs_Header ) ); } else { line->text = LIT( Empty_Str ); } line->indent = indentPiece; line->tabstop = false; if( curr_sio->abs_on_screen ) { line->attr = WPA_ABS_BAR; } else { line->attr = WPA_PLAIN_INACTIVE; } } else if( piece == PIECE_ABS_PERCENT ) { line->text = absData; line->indent = absPctStatusIndent; line->tabstop = false; if( curr_sio->abs_on_screen ) { line->attr = WPA_ABS_BAR; } else { line->attr = WPA_PLAIN_INACTIVE; } } else if( piece == PIECE_PERCENT_SEPARATOR ) { if( !GUIIsGUI() ) { line->vertical_line = true; } line->indent = SEPARATOR_POINT; line->text = LIT( Empty_Str ); line->attr = WPA_PLAIN; line->tabstop = false; } else if( piece == PIECE_DETAIL_TITLE ) { line->indent = SEPARATOR_POINT + WndMaxCharX( wnd ); curr_sio = WndExtra( wnd ); if( curr_sio->level_open == LEVEL_ROUTINE ) { sprintf( lineData, "%s: %.5d", statusHeaders[curr_sio->level_open], curr_sio->curr_display_row+1 ); line->text = lineData; } else { line->text = statusHeaders[curr_sio->level_open]; } line->tabstop = false; line->attr = WPA_PLAIN; } return( true ); }
static void WndDrawTheLine( a_window *wnd, wnd_line_piece *line, wnd_row row ) { gui_ord extent; gui_point start,end; gui_ord max_y; gui_ord max_x; wnd_bar_info *bar_info; if( _Isnt( wnd, WSW_NOT_TO_SCREEN ) ) { if( line->underline ) { max_y = WndMaxCharY( wnd ); start.x = line->indent; start.y = row * max_y + max_y / 2; end.x = line->indent + line->extent; end.y = start.y; GUIDrawLine( wnd->gui, &start, &end, GUI_PEN_SOLID, 0, line->attr ); return; } else if( line->vertical_line ) { max_y = WndMaxCharY( wnd ); max_x = WndAvgCharX( wnd ); start.x = line->indent + max_x / 2; end.x = start.x; start.y = row * max_y; end.y = start.y + max_y; GUIDrawLine( wnd->gui, &start, &end, GUI_PEN_SOLID, 0, line->attr ); return; } else if( line->draw_hook | line->draw_line_hook ) { if( GUIIsGUI() ) { max_y = WndMaxCharY( wnd ); max_x = WndAvgCharX( wnd ); start.x = line->indent + max_x / 2; end.x = start.x + max_x; start.y = row * max_y + max_y / 2; end.y = start.y; GUIDrawLine( wnd->gui, &start, &end, GUI_PEN_SOLID, 0, line->attr ); start.x = line->indent + max_x / 2; end.x = start.x; start.y = row * max_y; end.y = start.y; if( line->draw_hook ) { end.y += max_y / 2; } else { end.y += max_y; } GUIDrawLine( wnd->gui, &start, &end, GUI_PEN_SOLID, 0, line->attr ); } else { char ch[3]; if( line->draw_hook ) { ch[0] = GUIGetCharacter( GUI_INACT_FRAME_LL_CORNER ); } else { ch[0] = GUIGetCharacter( GUI_INACT_RIGHT_TITLE_MARK ); } ch[1] = GUIGetCharacter( GUI_INACT_FRAME_BOTTOM ); ch[2] = '\0'; GUIDrawText( wnd->gui, ch, 2, row, line->indent, line->attr ); } return; } else if( line->draw_bar ) { bar_info = (wnd_bar_info *)line->text; if( bar_info->bar_group ) { GUIDrawBarGroup( wnd->gui, row, line->indent, line->extent - bar_info->bar_size2, bar_info->bar_size2, bar_info->bar_style, bar_info->bar_colour, bar_info->bar_colour2, bar_info->bar_selected ); } else { GUIDrawBar( wnd->gui, row, line->indent, line->extent, bar_info->bar_style, bar_info->bar_colour, bar_info->bar_selected ); } return; } else if( line->bitmap ) { GUIDrawHotSpot( wnd->gui, line->text[0], row, line->indent, line->attr ); return; } else if( line->extent == WND_NO_EXTEND ) { GUIDrawText( wnd->gui, line->text, line->length, row, line->indent, line->attr ); } else { GUIDrawTextExtent( wnd->gui, line->text, line->length, row, line->indent, line->attr, line->extent ); } } extent = GUIGetExtentX( wnd->gui, line->text, line->length ); if( line->extent != WND_MAX_EXTEND ) { if( line->extent > extent ) { extent = line->extent; } } if( line->indent + extent > wnd->max_indent ) { wnd->max_indent = line->indent + extent; } }