STATIC void *sampleCreateWin( void ) /**********************************/ { a_window *wnd; wnd_create_struct info; char *title; #define TITLE_LEN 255 title = alloca( TITLE_LEN ); if( title == NULL ) return( NULL ); WndInitCreateStruct( &info ); snprintf( title, TITLE_LEN, LIT( Sample_Data ), CurrSIOData->samp_file_name ); info.text = title; info.info = &WPSampleInfo; info.extra = CurrSIOData; // info.colour = GetWndColours( class ); info.title_size = STATUS_ROW + 1; info.style |= GUI_INIT_INVISIBLE; wnd = WndCreateWithStruct( &info ); if( wnd == NULL ) return( wnd ); // WndSetFontInfo( wnd, GetWndFont( wnd ) ); //-// WndSetSysFont( wnd, P_TRUE ); WndClrSwitches( wnd, WSW_MUST_CLICK_ON_PIECE|WSW_ONLY_MODIFY_TABSTOP ); WndSetSwitches( wnd, WSW_RBUTTON_CHANGE_CURR ); return( wnd ); }
static a_window WndCreateWithStructBody( wnd_create_struct *info, gui_create_info *init ) { a_window wnd; gui_window *gui; char buff[256]; int size; if( info->title == NULL ) { buff[0] = '\0'; } else { // might be clobbered by create strcpy( buff, info->title ); } if( info->title != NULL ) strcpy( buff, info->title ); // might be clobbered by create size = sizeof( *wnd ) + ( WndMaxDirtyRects - 1 ) * sizeof( wnd->dirty ); wnd = WndAlloc( size ); if( wnd == NULL ) { WndFree( info->extra ); WndNoMemory(); } memset( wnd, 0, size ); wnd->button_down.row = (char)-1; wnd->gui = NULL; wnd->info = info->info; wnd->wndclass = info->wndclass; wnd->extra = info->extra; wnd->title_size = info->title_size; wnd->rows = 1; // just so it's not zero in init code WndNoSelect( wnd ); WndNoCurrent( wnd ); WndSetCurrCol( wnd ); WndNullPopItem( wnd ); wnd->dirtyrects= 0; // wndnoselect changes this! wnd->vscroll_pending = 0; wnd->hscroll_pending = -1; WndSetKeyPiece( wnd, WND_NO_PIECE ); wnd->switches = WSW_SELECT_IN_TABSTOP | WSW_MUST_CLICK_ON_PIECE | WSW_ALLOW_POPUP | WSW_SEARCH_WRAP | WSW_HIGHLIGHT_CURRENT | WSW_ONLY_MODIFY_TABSTOP | WSW_MENU_ACCURATE_ROW; if( info->rect.width == 0 || info->rect.height == 0 ) { init->rect.x = 0; init->rect.y = 0; init->rect.width = WndMax.x; init->rect.height = WndMax.y; } else { init->rect.x = info->rect.x; init->rect.y = info->rect.y; init->rect.width = info->rect.width; init->rect.height = info->rect.height; } init->scroll = info->scroll; init->style = info->style; init->style |= GUI_VSCROLL_EVENTS; init->style &= ~GUI_HSCROLL_EVENTS; init->title = ( info->title == NULL ) ? NULL : ""; if( WndMain != NULL ) { init->style |= GUI_VISIBLE; init->parent = WndMain->gui; init->menu.num_items = 0; init->menu.menu = NULL; } else { init->style &= ~GUI_VISIBLE; init->scroll = GUI_NOSCROLL; init->menu.num_items = WndNumMenus; init->menu.menu = WndMainMenuPtr; init->parent = NULL; } if( init->style & GUI_POPUP ) { init->parent = NULL; } init->colours.num_items = WndNumColours; init->colours.colours = info->colour; init->gui_call_back = WndMainGUIEventProc; init->extra = wnd; WndSetSwitches( wnd, WSW_ACTIVE ); gui = GUICreateWindow( init ); if( gui == NULL ) { WndFree( info->extra ); WndFree( wnd ); WndNoMemory(); return( NULL ); } else { if( buff[0] != '\0' ) { WndSetTitle( wnd, buff ); } } ++NumWindows; return( wnd ); }