void InitScreen( void ) { if( setpgid( 0, 0 ) != 0 && errno != EPERM ) { StartupErr( "unable to create new process group" ); } if( TryTTY() ) { ConMode = C_TTY; } else if( TryQConsole() ) { ConMode = C_QCON; } else if( TryXWindows() ) { ConMode = C_XWIN; } else { StartupErr( "unable to initialize debugger screen" ); } _Free( DbgTerminal ); DbgTerminal = NULL; fcntl( DbgConHandle, F_SETFD, (int)FD_CLOEXEC ); UIConHandle = DbgConHandle; if( !uistart() ) { StartupErr( "unable to initialize user interface" ); } if( _IsOn( SW_USE_MOUSE ) ) GUIInitMouse( 1 ); DebugScreen(); }
void InitScreen( void ) { if( setpgid( 0, 0 ) != 0 && errno != EPERM ) { StartupErr( "unable to create new process group" ); } if( TryTTY() ) { ConMode = C_TTY; } else if( TryVC() ) { ConMode = C_VC; } else if( TryXWindows() ) { ConMode = C_XWIN; } else { /* backup: just use the current terminal */ ConMode = C_CURTTY; DbgConHandle = -1; } _Free( DbgTerminal ); DbgTerminal = NULL; if ( DbgConHandle != -1 ) { fcntl( DbgConHandle, F_SETFD, (int)FD_CLOEXEC ); UIConFile = fdopen( DbgConHandle, "w+" ); UIConHandle = DbgConHandle; } if( !uistart() ) { StartupErr( "unable to initialize user interface" ); } if( _IsOn( SW_USE_MOUSE ) ) { GUIInitMouse( 1 ); } DebugScreen(); }
void InitScreen( void ) { DebuggerHwnd = GetForegroundWindow(); GetConsoleTitle( OldTitle, sizeof( OldTitle ) ); SetConsoleTitle( LIT_DUI( The_WATCOM_Debugger ) ); if( uistart() ) { if( _IsOn( SW_USE_MOUSE ) ) { GUIInitMouse( INIT_MOUSE ); } } }
/* * ScreenInit - get screen info */ void ScreenInit( void ) { uistart(); BIOSKeyboardInit(); WindMaxHeight = LINES; WindMaxWidth = COLS; Scrn = (void *)(UIData->screen.origin); EditFlags.Color = TRUE; EditFlags.HasSystemMouse = TRUE; } /* ScreenInit */
void InitScreen( void ) { if( FlipMech == FLIP_SWAP ) { InitSwapper( WantFast ); } if( FlipMech == FLIP_SWAP ) { ToCharacter(); } uistart(); UIData->height = ScrnLines; if( _IsOn( SW_USE_MOUSE ) ) { GUIInitMouse( 1 ); } }
/* * ScreenInit - get screen info */ void ScreenInit( void ) { if( !uistart() ) StartupError( ERR_WIND_NO_MORE_WINDOWS ); BIOSKeyboardInit(); EditVars.WindMaxHeight = LINES; EditVars.WindMaxWidth = COLS; Scrn = (void *)(UIData->screen.origin); EditFlags.Color = true; EditFlags.HasSystemMouse = true; } /* ScreenInit */
bool UIAPI uiinit( int install ) /******************************/ { bool initialized; initialized = uistart(); if( initialized ) { #ifdef __UNIX__ _initmouse( install ); #else initmouse( install ); #endif } return( initialized ); }
void main( void ) /***************/ { ui_event ui_ev; SAREA area; char buff[80]; an_event_string *ptr; ORD evrow = TOP_ROW; int mrow, mcol; int diff; if( uistart() ) { #ifdef CHARMAP uiinitgmouse( INIT_MOUSE_INITIALIZED ); /* the 0=mouseless,1=mouse,2=initialized mouse */ // uivgaattrs(); FlipCharacterMap(); #else initmouse( INIT_MOUSE_INITIALIZED ); #endif uimenus( barmenu, pulldownuimenus, EV_F1 ); UIData->mouse_clk_delay = uiclockdelay( 250 /* ms */ ); UIData->tick_delay = uiclockdelay( 3000 /* ms */ ); mainwin.area.height = UIData->height - 7; if( uivopen( &mainwin ) ) { for( ;; ) { uipushlist( evlist ); ui_ev = uivgetevent( &mainwin ); uipoplist( /* evlist */ ); if( ui_ev == EV_MOUSE_PRESS_R ) { uimousepos( NULL, &mrow, &mcol ); mrow++; mcol++; uipushlist( evlist ); ui_ev = uicreatepopup( mrow, mcol, filemenu, false, true, EV_NO_EVENT ); uipoplist( /* evlist */ ); } switch( ui_ev ) { case EV_QUIT: break; case EV_BACKGROUND_RESIZE: uivclose( &mainwin ); mainwin.area.height = UIData->height - 7; uivopen( &mainwin ); if( evrow > mainwin.area.height ) { evrow = TOP_ROW; } break; case EV_SAMPLE_DIALOG: sample_dialog(); break; case EV_OPEN: open(); break; case EV_GO: uispawnstart(); uiblankscreen(); printf( "Type exit to return\n" ); #if defined( __QNX__ ) || defined( __UNIX__ ) system( "" ); #elif defined( __WINDOWS__ ) // do nothing #else { const char *command; command = getenv( "COMSPEC" ); if( command == NULL ) { command = "c:\\command.com"; } system( command ); } #endif uispawnend(); // uibackground( "wf.img" ); area.row = 0; area.col = 0; area.height = UIData->height; area.width = UIData->width; uidirty( area ); break; case EV_F1: area.width = 10; area.height = 10; area.row = 1; area.col = 1; uivattribute( &mainwin, area, (ATTR) 1 ); break; } if( ui_ev == EV_QUIT ) { break; } else if( ui_ev != EV_NO_EVENT ) { for( ptr = evstrs; ; ++ptr ) { if( ptr->ui_ev == EV_NO_EVENT ) { sprintf( buff, "event 0x%4.4x", ui_ev ); break; } else if( ptr->ui_ev == ui_ev ) { sprintf( buff, "event 0x%4.4x (%s)", ui_ev, ptr->str ); break; } } uivtextput( &mainwin, evrow, 2, UIData->attrs[ATTR_NORMAL], buff, 40 ); if( ++evrow >= mainwin.area.height ) { evrow = TOP_ROW; } uivtextput( &mainwin, evrow, 2, UIData->attrs[ATTR_NORMAL], "", 40 ); switch( ui_ev ) { case EV_MOUSE_PRESS: BandOn = 1; uimousepos( NULL, &mrow, &mcol ); BandArea.row = mrow; BandArea.col = mcol; BandArea.width = 0; BandArea.height = 0; uibandinit( BandArea, UIData->attrs[ATTR_ACTIVE] ); break; case EV_MOUSE_DRAG: if( BandOn ) { uimousepos( NULL, &mrow, &mcol ); diff = mcol - BandArea.col; if( diff < 0 ) diff = 0; BandArea.width = diff; diff = mrow - BandArea.row; if( diff < 0 ) diff = 0; BandArea.height = diff; uibandmove( BandArea ); } break; case EV_MOUSE_RELEASE: if( BandOn ) uibandfini(); BandOn = 0; break; } } } uivclose( &mainwin ); } uinomenus(); uiswap(); uirestorebackground(); /* must be after uiswap */ #ifdef CHARMAP FlipCharacterMap(); uifinigmouse(); #else finimouse(); #endif uistop(); } }
int PASCAL WinMain( HANDLE hInstance, HANDLE hPrevInstance, LPSTR lpCmdLine, int nShowCmd ) { EVENT ev; SAREA area; char buff[80]; an_event_string *ptr; ORD evrow = TOP_ROW; BOOL fixup = FALSE; int mrow, mcol; int diff; hInstance = hInstance; hPrevInstance = hPrevInstance; lpCmdLine = lpCmdLine; nShowCmd = nShowCmd; if( InitSwapper() ) return( 0 ); // Yes - well, I would make the swapper // return 1 on error, unlike everything // else, wouldn't I? if( !uistart() ) return( 0 ); ToCharacter(); initmouse( 2 ); uimenus( barmenu, pulldownuimenus, EV_FUNC( 1 ) ); UIData->mouse_clk_delay = uiclockdelay( 250 ); UIData->tick_delay = uiclockdelay( 3000 ); mainwin.area.height = UIData->height - 7; area.row = 0; area.col = 0; area.width = UIData->width; area.height = UIData->height; uidirty( area ); uirefresh(); if( uivopen( &mainwin ) ) { uirefresh(); sprintf( buff, "screen height : %d\0", UIData->height ); uivtextput( &mainwin, TOP_ROW - 1, 2, UIData->attrs[ ATTR_NORMAL ], buff, 30 ); for( ; ; ) { uipushlist( evlist ); ev = uivgetevent( NULL ); uipoplist(); if( ev == EV_QUIT ) break; if( ev == EV_ALT_R ) break; if( ev == EV_MOUSE_PRESS_R ) { uimousepos( NULL, &mrow, &mcol ); mrow++; mcol++; uipushlist( evlist ); ev = uicreatepopup( mrow, mcol, &filemenu, FALSE, TRUE, NULL ); uipoplist(); } switch ( ev ) { case EV_SAMPLE_DIALOG: sample_dialog(); break; case EV_OPEN: open(); break; case EV_FUNC(1): area.width = 10; area.height = 10; area.row = 1; area.col = 1; uivattribute( &mainwin, area, (ATTR) 1 ); break; case EV_CURSOR_RIGHT: mainwin.col++; if( mainwin.col >= mainwin.area.width ) mainwin.col--; fixup = TRUE; break; case EV_CURSOR_DOWN: mainwin.row++; if( mainwin.row >= mainwin.area.height ) mainwin.row--; fixup = TRUE; break; case EV_CURSOR_LEFT: if( mainwin.col > 0 ) { mainwin.col--; fixup = TRUE; } break; case EV_CURSOR_UP: if( mainwin.row > 0 ) { mainwin.row--; fixup = TRUE; } break; } if( fixup ) { fixup = FALSE; uivsetcursor( &mainwin ); } if( ev != EV_NO_EVENT ) { for( ptr=evstrs; ; ++ptr ){ if( ptr->ev == EV_NO_EVENT ) { sprintf( buff, "event 0x%4.4x", ev ); break; } else if( ptr->ev == ev ) { strcpy( buff, ptr->str ); break; } } uivtextput( &mainwin, evrow, 2, UIData->attrs[ ATTR_NORMAL ], buff, 30 ); if( ++evrow >= mainwin.area.height ){ evrow = TOP_ROW; } uivtextput( &mainwin, evrow, 2, UIData->attrs[ ATTR_NORMAL ], "", 30 ); switch( ev ) { case EV_MOUSE_PRESS: BandOn = 1; uimousepos( NULL, &mrow, &mcol ); BandArea.row = mrow; BandArea.col = mcol; BandArea.width = 0; BandArea.height = 0; uibandinit( BandArea, UIData->attrs[ ATTR_ACTIVE ] ); break; case EV_MOUSE_DRAG: if( BandOn ) { uimousepos( NULL, &mrow, &mcol ); diff = mcol - BandArea.col; if( diff < 0 ) diff = 0; BandArea.width = diff; diff = mrow - BandArea.row; if( diff < 0 ) diff = 0; BandArea.height = diff; uibandmove( BandArea ); } break; case EV_MOUSE_RELEASE: if( BandOn ) uibandfini(); BandOn = 0; break; } } } uivclose( &mainwin ); } uinomenus(); uiswap(); uirestorebackground(); /* must be after uiswap */ finimouse(); ToGraphical(); uistop(); FiniSwapper(); return( 0 ); }
void InitScreen( void ) { if( uistart() ) { GUIInitMouse( 1 ); } }