static bool RegEventProc( a_window * wnd, gui_event gui_ev, void *parm ) { reg_window *reg = WndReg( wnd ); parm=parm; switch( gui_ev ) { case GUI_RESIZE: if( RegResize( wnd ) ) { WndZapped( wnd ); } return( true ); case GUI_INIT_WINDOW: reg->info = NULL; reg->indents = NULL; RegResize( wnd ); reg->popup = WndAppendToggles( MADRegSetDisplayToggleList( reg->data ), ®->num_toggles, RegMenu, ArraySize( RegMenu ), MENU_REGISTER_TOGGLES ); WndSetPopUpMenu( wnd, reg->popup, ArraySize( RegMenu ) + reg->num_toggles ); return( true ); case GUI_DESTROY : WndDeleteToggles( reg->popup, ArraySize( RegMenu ), reg->num_toggles ); WndFree( reg->info ); WndFree( reg->indents ); WndFree( reg ); return( true ); } return( false ); }
static void CallClose( a_window *wnd ) { call_window *call = WndCall( wnd ); FiniTraceBack( &call->tb ); WndFree( call ); }
static void AsmResize( a_window *wnd ) { asm_window *asw = WndAsm( wnd ); asm_addr *new_ins; address first; int size; size = WndRows( wnd ); if( size <= 0 ) size = 1; first = asw->ins[ 0 ].addr; new_ins = WndAlloc( size*sizeof( *new_ins ) ); memset( new_ins, 0, size*sizeof( *new_ins ) ); if( new_ins == NULL ) { WndClose( wnd ); WndNoMemory(); } WndFree( asw->ins ); asw->ins = new_ins; asw->ins_size = size; AsmSetFirst( wnd, first, asw->ins[ 0 ].line != 0 ); CalcAddrLen( wnd, first ); if( asw->last_width != WndWidth( wnd ) ) { WndZapped( wnd ); } asw->last_width = WndWidth( wnd ); WndFixedThumb( wnd ); }
extern void WndDestroy( a_window *wnd ) { WndEvent( wnd, GUI_DESTROY, NULL ); GUIMemFree( wnd->searchitem ); wnd->searchitem = NULL; WndFree( wnd->popitem ); wnd->popitem = NULL; GUISetExtra( wnd->gui, NULL ); WndFree( wnd ); if( --NumWindows == 0 ) { WndFiniCacheLines(); WndCleanUp(); } if( wnd == WndMain ) { WndMain = NULL; } }
void WndFiniCacheLines() { int i; for( i = 0; i < NUM_CACHE_ENTRIES; ++i ) { WndFree( CacheLine[i].text ); CacheLine[i].text = NULL; } }
void Ctrl::WndDestroy() { GuiLock __; if(top && top->hwnd) { HWND hwnd = top->hwnd; WndFree(); // CXL 2007-06-04 to avoid loosing focus with maximize box owned dialogs bool result = ::DestroyWindow(hwnd); } }
OVL_EXTERN bool IOWndEventProc( a_window wnd, gui_event gui_ev, void *parm ) { io_window *io = WndIO( wnd ); /* unused parameters */ (void)parm; switch( gui_ev ) { case GUI_INIT_WINDOW: if( io->num_rows != 0 ) { IOMenuItem( wnd, MENU_IO_READ, 0, PIECE_VALUE ); } return( true ); case GUI_DESTROY : WndFree( io->list ); WndFree( io ); return( true ); } return( false ); }
extern void WndSelPopPiece( a_window *wnd, bool paint_immed ) { wnd_row row; wnd_coord *start; wnd_coord *end; int piece; int buff_size; char *ptr; int first; int len; wnd_line_piece line; _Clr( wnd, WSW_SELECTING ); _Clr( wnd, WSW_SELECTING_WITH_KEYBOARD ); WndSelEnds( wnd, &start, &end ); if( _Isnt( wnd, WSW_SUBWORD_SELECT ) || ( start->row == end->row && start->piece == end->piece && start->col == end->col ) ) { WndGetLine( wnd, start->row, start->piece, &line ); GoBackward( wnd, start, &line ); WndGetLine( wnd, end->row, end->piece, &line ); GoForward( wnd, end, &line ); if( end->row != start->row ) { GUIWndDirtyRow( wnd->gui, end->row ); GUIWndDirtyRow( wnd->gui, start->row ); } else if( paint_immed ) { GUIWndDirtyRow( wnd->gui, start->row ); } else { WndDirtyScreenRange( wnd, start, end->col ); } } buff_size = 0; for( row = start->row; row <= end->row; ++row ) { for( piece = 0; ; ++piece ) { if( !WndGetLine( wnd, row, piece, &line ) ) break; if( WndSelected( wnd, &line, row, piece, &first, &len ) ) { buff_size += len + 1; } } } WndFree( wnd->popitem ); wnd->popitem = WndMustAlloc( buff_size+2 ); ptr = wnd->popitem; for( row = start->row; row <= end->row; ++row ) { for( piece = 0; ; ++piece ) { if( !WndGetLine( wnd, row, piece, &line ) ) break; if( WndSelected( wnd, &line, row, piece, &first, &len ) ) { if( ptr != wnd->popitem ) *ptr++ = ' '; memcpy( ptr, line.text+first, len ); ptr += len; } } } *ptr = '\0'; }
static void DoSet( int i, a_window *wnd, int row, int piece, wnd_line_piece *line ) { CacheLine[i].line = *line; CacheLine[i].wnd = wnd; CacheLine[i].row = row; CacheLine[i].piece = piece; WndFree( CacheLine[i].text ); CacheLine[i].text = WndAlloc( strlen( line->text ) + 1 ); strcpy( CacheLine[i].text, line->text ); }
void Ctrl::WndDestroy0() { GuiLock __; LLOG("Ctrl::WndDestroy() in " <<UPP::Name(this) << BeginIndent); LLOG((DumpWindowOrder(false), "")); if(top && top->hwnd) { HWND hwnd = top->hwnd; WndFree(); // CXL 2007-06-04 to avoid loosing focus with maximize box owned dialogs ::DestroyWindow(hwnd); } }
void FiniPaint( void ) { wnd_class wndcls; for( wndcls = 0; wndcls < WND_NUM_CLASSES; ++wndcls ) { if( WndClassColour[wndcls] != NULL ) { WndFree( WndClassColour[wndcls] ); WndClassColour[wndcls] = NULL; } } }
extern bool CmdEvent( gui_window * gui, gui_event gui_ev, void * param ) { gui_ctl_id id; char *text; char *cmd; int i; cmd = GUIGetExtra( gui ); switch( gui_ev ) { case GUI_INIT_DIALOG: GUISetText( gui, CTL_CMD_EDIT, "Hi Lisa!" ); GUISetFocus( gui, CTL_CMD_EDIT ); GUIClearList( gui, CTL_CMD_HISTORY ); for( i = 0; i < ArraySize( Stuff ); ++i ) { GUIAddText( gui, CTL_CMD_HISTORY, Stuff[i] ); } GUISetCurrSelect( gui, CTL_CMD_HISTORY, 1 ); return( TRUE ); case GUI_KEY_CONTROL: GUISetCurrSelect( gui, CTL_CMD_HISTORY, 2 ); cmd = GUIGetText( gui, CTL_CMD_HISTORY ); GUISetText( gui, CTL_CMD_EDIT, cmd ); GUISelectAll( gui, CTL_CMD_EDIT, TRUE ); GUIMemFree( cmd ); return( TRUE ); case GUI_CONTROL_DCLICKED: case GUI_CONTROL_CLICKED: GUI_GETID( param, id ); switch( id ) { case CTL_CMD_HISTORY: text = GUIGetText( gui, CTL_CMD_HISTORY ); GUISetText( gui, CTL_CMD_EDIT, text ); GUIMemFree( text ); if( gui_ev == GUI_CONTROL_CLICKED ) return( TRUE ); /* fall through */ case CTL_CMD_OK: text = GUIGetText( gui, CTL_CMD_EDIT ); if( text != NULL ) DoCmd( text ); GUIMemFree( text ); break; case CTL_CMD_CHECK: return( FALSE ); } GUICloseDialog( gui ); /* fall through */ case GUI_DESTROY: WndFree( cmd ); return( TRUE ); default: return( FALSE ); } }
static bool ModEventProc( a_window * wnd, gui_event gui_ev, void *parm ) { mod_window *mod = WndMod( wnd ); parm=parm; switch( gui_ev ) { case GUI_INIT_WINDOW: ModListInit( ModList( mod ), NULL ); mod->info = NULL; WndSetKey( wnd, PIECE_MODULE ); ModSetOptions( wnd ); ModSetCurrent( wnd ); return( TRUE ); case GUI_RESIZE: ModCalcIndent( wnd ); return( TRUE ); case GUI_DESTROY : ModListFree( ModList( mod ) ); WndFree( mod->info ); WndFree( mod ); return( TRUE ); } return( FALSE ); }
static void ModInit( a_window *wnd ) { mod_window *mod = WndMod( wnd ); int size; ModListFree( ModList( mod ) ); ModListAddModules( ModList( mod ), mod->handle, mod->all_modules ); WndFree( mod->info ); mod->info = NULL; size = sizeof( modinfo ) * ModListNumRows( ModList( mod ) ); if( size != 0 ) { mod->info = WndAlloc( size ); memset( mod->info, 0, size ); } ModCalcIndent( wnd ); }
bool GlobEventProc( a_window * wnd, gui_event gui_ev, void *parm ) { glob_window *glob = WndGlob( wnd ); parm=parm; switch( gui_ev ) { case GUI_INIT_WINDOW: NameListInit( NameList( glob ), WF_DATA ); GlobSetOptions( wnd ); return( TRUE ); case GUI_DESTROY : NameListFree( NameList( glob ) ); WndFree( glob ); return( TRUE ); } return( FALSE ); }
static bool BrkEventProc( a_window * wnd, gui_event gui_ev, void *parm ) { break_window *wndbreak = WndBreak( wnd ); parm=parm; switch( gui_ev ) { case GUI_INIT_WINDOW: wndbreak->toggled_break = false; BrkInit( wnd ); return( true ); case GUI_RESIZE: BrkInit( wnd ); return( true ); case GUI_DESTROY: WndFree( wndbreak ); } return( false ); }
static int DoDlgSearch( a_window *wnd, void *history, bool want_prev ) { dlg_search *dlg; int direction; dlg = WndMustAlloc( sizeof( *dlg ) ); dlg->wnd = wnd; dlg->direction = 0; dlg->case_ignore = SrchIgnoreCase; dlg->use_rx = SrchRX; dlg->history = history; ResDlgOpen( &SrchEvent, dlg, GUI_MAKEINTRESOURCE( want_prev ? DIALOG_SEARCH : DIALOG_SEARCH_ALL ) ); direction = dlg->direction; SrchRX = dlg->use_rx; SrchIgnoreCase = dlg->case_ignore; if( dlg->use_rx ) { WndSetMagicStr( SrchMagicChars ); } else { WndSetMagicStr( "" ); } WndFree( dlg ); return( direction ); }
static bool FuncEventProc( a_window * wnd, gui_event gui_ev, void *parm ) { func_window *func = WndFunc( wnd ); parm=parm; switch( gui_ev ) { case GUI_INIT_WINDOW: NameListInit( NameList( func ), WF_CODE ); func->toggled_break = FALSE; FuncSetOptions( wnd ); WndSetKey( wnd, PIECE_NAME ); return( TRUE ); case GUI_RESIZE : CalcIndent( wnd ); WndZapped( wnd ); break; case GUI_DESTROY : NameListFree( NameList( func ) ); WndFree( func ); return( TRUE ); } return( FALSE ); }
void WndShowAll( void ) { gui_window *gui; gui_window **list; gui_window **pcurr; int count; // this is a kludge since UI brings windows to the front on show count = 0; for( gui = GUIGetFront(); gui != NULL; gui = GUIGetNextWindow( gui ) ) { ++count; } list = WndAlloc( count * sizeof( gui ) ); pcurr = list; for( gui = GUIGetFront(); gui != NULL; gui = GUIGetNextWindow( gui ) ) { if( WndMain != NULL && WndMain->gui == gui ) continue; *pcurr++ = gui; } while( pcurr > list ) { GUIShowWindow( *--pcurr ); } WndFree( list ); }
void Ctrl::NcDestroy() { GuiLock __; if(!parent) WndFree(); }
void WndFreeRX( void *rx ) { WndFree( (regexp *)rx ); }
extern bool WndSearch( a_window *wnd, bool from_top, int direction ) { wnd_line_piece line; regexp *rx; char *pos; char *endpos; bool wrap; int rows; bool rc; bool had_cache; char *not_found; char *top_of_window; char *end_of_window; char *search_wrapped; wnd_subpiece next_occurence; wnd_subpiece prev_occurence; wnd_subpiece curr; wnd_coord starting_pos; if( direction == 0 ) return( FALSE ); if( wnd == NULL ) return( FALSE ); if( wnd->searchitem == NULL ) return( FALSE ); rx = WndCompileRX( wnd->searchitem ); if( rx == NULL ) return( FALSE ); not_found = WndLoadString( LITERAL_Not_Found ); top_of_window = WndLoadString( LITERAL_Top_Of_Window ); end_of_window = WndLoadString( LITERAL_End_Of_Window ); search_wrapped = WndLoadString( LITERAL_Search_Wrapped ); wrap = FALSE; starting_pos.piece = 0; starting_pos.col = direction > 0 ? -1 : WND_MAX_COL; if( from_top ) { curr.row = 0; } else if( WndHasCurrent( wnd ) ) { curr.row = WndVirtualRow( wnd, wnd->current.row ); starting_pos.piece = wnd->current.piece; starting_pos.col = wnd->current.col; } else { curr.row = WndVirtualTop( wnd ); } starting_pos.row = curr.row; WndNextRow( wnd, WND_NO_ROW, WND_SAVE_ROW ); WndStatusText( "" ); WndDoingSearch = TRUE; had_cache = WndSetCache( wnd, FALSE ); for( ;; ) { if( curr.row < 0 ) { if( wrap ) { NotFound( wnd, rx, not_found ); rc = FALSE; goto done; } else if( _Is( wnd, WSW_SEARCH_WRAP ) ) { rows = WndNumRows( wnd ); if( rows == -1 ) { WndRepaint( wnd ); WndScrollAbs( wnd, -wnd->title_size ); rows = WndScrollAbs( wnd, WND_MAX_ROW ) + WndRows( wnd ); } curr.row = rows - 1; curr.col = 0; curr.piece = -1; wrap = TRUE; continue; } else { NotFound( wnd, rx, top_of_window ); rc = FALSE; goto done; } } next_occurence.col = -1; prev_occurence.col = -1; for( curr.piece = 0;; ++curr.piece ) { // look for both next and prev match if( !WndGetLineAbs( wnd, curr.row, curr.piece, &line ) ) { if( curr.piece != 0 ) break; if( wrap ) { NotFound( wnd, rx, not_found ); rc = FALSE; goto done; } else if( _Is( wnd, WSW_SEARCH_WRAP ) ) { curr.row = 0; curr.col = 0; curr.piece = -1; wrap = TRUE; continue; } else { NotFound( wnd, rx, end_of_window ); rc = FALSE; goto done; } } if( line.bitmap ) continue; pos = line.text; endpos = NULL; while( WndRXFind( rx, &pos, &endpos ) ) { curr.end = endpos - line.text; curr.col = pos - line.text; if( curr.piece < starting_pos.piece ) { prev_occurence = curr; } else if( curr.piece > starting_pos.piece ) { if( next_occurence.col == -1 ) { next_occurence = curr; } } else if( curr.col > starting_pos.col ) { if( next_occurence.col == -1 ) { next_occurence = curr; } } else if( curr.col < starting_pos.col ) { prev_occurence = curr; } ++pos; } } if( direction < 0 ) { next_occurence = prev_occurence; } if( next_occurence.col != -1 ) { WndDoingSearch = FALSE; WndKillCacheLines( wnd ); WndDirtyCurr( wnd ); WndNoSelect( wnd ); WndNoCurrent( wnd ); if( curr.row < WndVirtualTop( wnd ) ) { if( curr.row > wnd->rows / 2 ) { WndRepaint( wnd ); WndScrollAbs( wnd, curr.row - wnd->rows / 2 ); } else { WndRepaint( wnd ); WndScrollAbs( wnd, -wnd->title_size ); } } else if( curr.row >= WndVirtualBottom( wnd ) ) { WndRepaint( wnd ); WndScrollAbs( wnd, curr.row - wnd->rows / 2 ); } wnd->sel_start.row = WndScreenRow( wnd, curr.row ); wnd->sel_start.piece = next_occurence.piece; wnd->sel_start.col = next_occurence.col; wnd->sel_end = wnd->sel_start; wnd->sel_end.col = next_occurence.end - 1; wnd->current.col = wnd->sel_end.col; wnd->current = wnd->sel_start; WndSetCurrCol( wnd ); WndCurrVisible( wnd ); WndDirtyCurr( wnd ); WndFreeRX( rx ); if( wrap ) WndStatusText( search_wrapped ); rc = TRUE; goto done; } if( direction > 0 ) { if( wrap && curr.row > starting_pos.row ) { NotFound( wnd, rx, not_found ); rc = FALSE; goto done; } starting_pos.col = -1; starting_pos.piece = 0; curr.row = WndNextRow( wnd, curr.row, 1 ); } else { starting_pos.col = WND_MAX_COL; starting_pos.piece = WND_MAX_COL; curr.row = WndNextRow( wnd, curr.row, -1 ); } curr.piece = 0; } done:; WndSetCache( wnd, had_cache ); WndFree( not_found ); WndFree( top_of_window ); WndFree( end_of_window ); WndFree( search_wrapped ); return( rc ); }
static bool SourceEvent( gui_window *gui, gui_event gui_ev, void *param ) { gui_ctl_id id; void *curr; int i; int size; char *text; dlg_list *dlg; dlg = GUIGetExtra( gui ); switch( gui_ev ) { case GUI_DESTROY: WndFree( dlg->title ); return( true ); case GUI_INIT_DIALOG: GUISetWindowText( gui, dlg->title ); GUIClearList( gui, CTL_LIST_LIST ); for( curr = dlg->next( NULL ); curr != NULL; curr = dlg->next( curr ) ) { AddText( gui, dlg->name( curr ) ); } GUISetFocus( gui, CTL_LIST_EDIT ); return( true ); case GUI_CONTROL_CLICKED: GUI_GETID( param, id ); switch( id ) { case CTL_LIST_LIST: GUIDlgBuffGetText( gui, CTL_LIST_LIST, TxtBuff, TXT_LEN ); GUISetText( gui, CTL_LIST_EDIT, TxtBuff ); break; case CTL_LIST_DELETE: i = GUIGetCurrSelect( gui, CTL_LIST_LIST ); if( i != -1 ) { GUIDeleteItem( gui, CTL_LIST_LIST, i ); } size = GUIGetListSize( gui, CTL_LIST_LIST ); if( i < size ) { GUISetCurrSelect( gui, CTL_LIST_LIST, i ); } else { SelectListLast( gui ); } GUISetFocus( gui, CTL_LIST_LIST ); GUISetText( gui, CTL_LIST_EDIT, NULL ); break; case CTL_LIST_ADD: case CTL_LIST_OK: GUIDlgBuffGetText( gui, CTL_LIST_EDIT, TxtBuff, TXT_LEN ); if( TxtBuff[0] != '\0' ) AddText( gui, TxtBuff ); SelectListLast( gui ); GUIClearText( gui, CTL_LIST_EDIT ); GUISetFocus( gui, CTL_LIST_EDIT ); if( id == CTL_LIST_ADD ) break; dlg->clear(); size = GUIGetListSize( gui, CTL_LIST_LIST ); for( i = 0; i < size; ++i ) { text = GUIGetListItem( gui, CTL_LIST_LIST, i ); if( text != NULL ) { dlg->add( text, strlen( text ) ); GUIMemFree( text ); } } /* fall through */ case CTL_LIST_CANCEL: GUICloseDialog( gui ); break; case CTL_LIST_BROWSE: GUIDlgBuffGetText( gui, CTL_LIST_EDIT, TxtBuff, TXT_LEN ); if( !AllBrowse( TxtBuff ) ) return( true ); GUISetText( gui, CTL_LIST_EDIT, TxtBuff ); GUISetFocus( gui, CTL_LIST_EDIT ); return( true ); } return( true ); default: return( false ); } }
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->u.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; wnd->keypiece = 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->num_menus = 0; init->menu = NULL; } else { init->style &= ~GUI_VISIBLE; init->scroll = GUI_NOSCROLL; init->num_menus = WndNumMenus; init->menu = WndMainMenu; init->parent = NULL; } if( init->style & GUI_POPUP ) { init->parent = NULL; } init->num_attrs = WndNumColours; init->colours = info->colour; init->call_back = WndMainEventProc; init->extra = wnd; _Set( 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 ); }
static bool RegResize( a_window *wnd ) { reg_window *reg = WndReg( wnd ); gui_ord space; int old_up; int i,j; reg_display_piece disp; gui_ord max_extent; gui_ord max_descript; a_reg_info *info; gui_ord indent; gui_ord value,descript; char *p; unsigned len; old_up = reg->up; reg->up = 1; RegFindData( reg->kind, ®->data ); reg->count = 0; while( GetDisplayPiece( &disp, reg, DbgRegs, reg->count ) ) { reg->count++; } WndFree( reg->info ); reg->info = WndMustAlloc( reg->count * sizeof( *reg->info ) ); space = WndAvgCharX( wnd ); max_extent = 0; max_descript = 0; for( i = 0; i < reg->count; ++i ) { GetDisplayPiece( &disp, reg, DbgRegs, i ); if( disp.max_value == 0 && disp.reginfo != NULL ) { disp.max_value = GetMADMaxFormatWidth( disp.disp_type ); } info = ®->info[i]; info->max_value = disp.max_value; info->info = disp.reginfo; if( disp.max_descript > strlen( disp.descript ) ) { info->max_descript = space + disp.max_descript * WndAvgCharX( wnd ); } else { info->max_descript = space + WndExtentX( wnd, disp.descript ); } info->max_extent = space + disp.max_value * WndAvgCharX( wnd ); info->standout = false; if( max_extent < info->max_extent ) { max_extent = info->max_extent; } if( max_descript < info->max_descript ) { max_descript = info->max_descript; } } reg->up = MADRegSetDisplayGrouping( reg->data ); if( reg->up == 0 ) { reg->up = WndWidth( wnd ) / ( max_extent + max_descript ); if( reg->up < 1 ) reg->up = 1; if( reg->up > reg->count ) { reg->up = reg->count; } } reg->rows = ( reg->count + reg->up - 1 ) / reg->up; // calculate the indents WndFree( reg->indents ); reg->indents = WndMustAlloc( reg->count * sizeof( *reg->indents ) ); // For each column for( i = 0; i < reg->up; ++i ) { reg->indents[i].descript = 0; reg->indents[i].value = 0; // Calc max widths for column for( j = i; j < reg->count; j += reg->up ) { if( reg->indents[i].value < reg->info[j].max_extent ) { reg->indents[i].value = reg->info[j].max_extent; } if( reg->indents[i].descript < reg->info[j].max_descript ) { reg->indents[i].descript = reg->info[j].max_descript; } } } // Calc indents for each column indent = 0; value = 0; descript = 0; // For each column for( i = 0; i < reg->up; ++i ) { value = reg->indents[i].value; descript = reg->indents[i].descript; reg->indents[i].descript = indent; reg->indents[i].value = indent + descript; indent += value + descript; #if ( defined( __GUI__ ) && defined( __OS2__ ) ) // OS/2 PM GUI needs more space between columns indent += space; #endif } // Copy indents to all registers by column for( i = reg->up; i < reg->count; ++i ) { reg->indents[i] = reg->indents[i % reg->up]; } if( reg->up != old_up ) { WndScrollAbs( wnd, 0 ); WndNoCurrent( wnd ); } p = TxtBuff + MADCliString( MADRegSetName( reg->data ), TxtBuff, TXT_LEN ); *p++ = ' '; *p++ = '('; len = MADRegSetLevel( reg->data, p, TXT_LEN - ( p - TxtBuff ) ); if( len == 0 ) { p -= 2; } else { p += len; *p++ = ')'; } *p++ = NULLCHAR; WndSetTitle( wnd, TxtBuff ); return( true ); }
void FiniIOWindow( void ) { WndFree( IOTypeMenu ); MemFiniTypes( &IOData ); }
extern void WndNullPopItem( a_window *wnd ) { WndFree( wnd->popitem ); wnd->popitem = WndMustAlloc( 1 ); wnd->popitem[0] = '\0'; }