int Color_Change( PtWidget_t *widget, ApInfo_t *apinfo, PtCallbackInfo_t *cbinfo ) { int i, previous; PtWidget_t* thisWindow; /* eliminate 'unreferenced' warnings */ widget = widget, apinfo = apinfo, cbinfo = cbinfo; thisWindow = ApGetInstance( widget ); if(ApName(widget) == ABN_ButtonRed) { PtSetResource(ApGetWidgetPtr(thisWindow, ABN_ColorRect), Pt_ARG_FILL_COLOR, Pg_RED, 0); } else if(ApName(widget) == ABN_ButtonGreen) { PtSetResource(ApGetWidgetPtr(thisWindow, ABN_ColorRect), Pt_ARG_FILL_COLOR, Pg_GREEN, 0); } else if(ApName(widget) == ABN_ButtonBlue) { PtSetResource(ApGetWidgetPtr(thisWindow, ABN_ColorRect), Pt_ARG_FILL_COLOR, Pg_BLUE, 0); } else if(ApName(widget) == ABN_ButtonPrevious) { previous = -1; for(i = 0; i < WindowCounter; i++) { if(Windows[i] == thisWindow) { previous = i - 1; break; } } if(previous != -1 && Windows[previous]) { base_Color++; if(base_Color >= 5) { base_Color = 0; } //PtSetResource(Windows[previous], Pt_ARG_FILL_COLOR, Colors[base_Color], 0); PtSetResource(ApGetWidgetPtr(Windows[previous], ABN_ColorRect), Pt_ARG_FILL_COLOR, Colors[base_Color], 0); } } return( Pt_CONTINUE ); }
SDL_GrabMode ph_GrabInputNoLock(_THIS, SDL_GrabMode mode) { short abs_x, abs_y; if( mode == SDL_GRAB_OFF ) { PtSetResource(window, Pt_ARG_WINDOW_STATE, Pt_FALSE, Ph_WM_STATE_ISALTKEY); } else { PtSetResource(window, Pt_ARG_WINDOW_STATE, Pt_TRUE, Ph_WM_STATE_ISALTKEY); PtGetAbsPosition(window, &abs_x, &abs_y); PhMoveCursorAbs(PhInputGroup(NULL), abs_x + SDL_VideoSurface->w/2, abs_y + SDL_VideoSurface->h/2); } SDL_Unlock_EventThread(); return(mode); }
/* Set window caption */ void ph_SetCaption(_THIS, const char *title, const char *icon) { SDL_Lock_EventThread(); /* sanity check for set caption call before window init */ if (window!=NULL) { PtSetResource(window, Pt_ARG_WINDOW_TITLE, title, 0); } SDL_Unlock_EventThread(); }
void ph_SetCaption(_THIS, const char *title, const char *icon) { SDL_Lock_EventThread(); if (window!=NULL) { PtSetResource(window, Pt_ARG_WINDOW_TITLE, title, 0); } SDL_Unlock_EventThread(); }
int BigButton( PtWidget_t *widget, ApInfo_t *apinfo, PtCallbackInfo_t *cbinfo ) { /* eliminate 'unreferenced' warnings */ widget = widget, apinfo = apinfo, cbinfo = cbinfo; printf("console output\n"); PtSetResource(ABW_PtBigButton, Pt_ARG_FILL_COLOR, Pg_RED, 0); return( Pt_CONTINUE ); }
//------------------------------------------------------------------------- // // Move this component // //------------------------------------------------------------------------- NS_METHOD nsWidget::Move( PRInt32 aX, PRInt32 aY ) { if( ( mBounds.x == aX ) && ( mBounds.y == aY ) ) return NS_OK; mBounds.x = aX; mBounds.y = aY; if( mWidget ) { if(( mWidget->area.pos.x != aX ) || ( mWidget->area.pos.y != aY )) { PhPoint_t pos = { aX, aY }; PtSetResource( mWidget, Pt_ARG_POS, &pos, 0 ); } } return NS_OK; }
void ph_FreeWMCursor(_THIS, WMcursor *cursor) { if (window != NULL) { SDL_Lock_EventThread(); if (PtSetResource(window, Pt_ARG_CURSOR_TYPE, Ph_CURSOR_INHERIT, 0) < 0) { /* TODO: output error msg */ } SDL_Unlock_EventThread(); } free(cursor); }
NS_METHOD nsWidget::Resize( PRInt32 aWidth, PRInt32 aHeight, PRBool aRepaint ) { if( ( mBounds.width == aWidth ) && ( mBounds.height == aHeight ) ) return NS_OK; mBounds.width = aWidth; mBounds.height = aHeight; if( mWidget ) { PhDim_t dim = { aWidth, aHeight }; //EnableDamage( mWidget, PR_FALSE ); PtSetResource( mWidget, Pt_ARG_DIM, &dim, 0 ); //EnableDamage( mWidget, PR_TRUE ); } return NS_OK; }
void stateDebugDialogSetUser(int stateIndex) { PtArg_t args[2]; STATE *thisState; extern STATE *snames[]; thisState = snames[stateIndex]; PtSetResource(ABW_stateDebugDialog, Pt_ARG_WINDOW_TITLE, thisState->statename, 0); PtSetArg(&args[0], Pt_ARG_USER_DATA, &stateIndex, sizeof(int)); PtSetArg(&args[1], Pt_ARG_NUMERIC_VALUE, thisState->preset, 0); PtSetResources(ABW_stateTime, 2, args); PtSetArg(&args[0], Pt_ARG_USER_DATA, &stateIndex, sizeof(int)); PtSetArg(&args[1], Pt_ARG_NUMERIC_VALUE, thisState->random, 0); PtSetResources(ABW_stateRandom, 2, args); PtSetArg(&args[0], Pt_ARG_USER_DATA, &stateIndex, sizeof(int)); PtSetResources(ABW_stateRunLineToggleGroup, 1, args); /* set the state of the running line flag toggles */ if(thisState->rlflag == 0) { PtSetArg(&args[1], Pt_ARG_FLAGS, Pt_FALSE, Pt_SET); PtSetResources(ABW_stateRunLineAbsToggle, 1, &args[1]); PtSetArg(&args[1], Pt_ARG_FLAGS, Pt_FALSE, Pt_SET); PtSetResources(ABW_stateRunLineRelToggle, 1, &args[1]); PtSetArg(&args[0], Pt_ARG_USER_DATA, &stateIndex, sizeof(int)); PtSetArg(&args[1], Pt_ARG_NUMERIC_VALUE, thisState->rlval, 0); PtSetResources(ABW_runningLine, 2, args); } if(thisState->rlflag == 1) { PtSetArg(&args[1], Pt_ARG_FLAGS, Pt_TRUE, Pt_SET); PtSetResources(ABW_stateRunLineAbsToggle, 1, &args[1]); PtSetArg(&args[1], Pt_ARG_FLAGS, Pt_FALSE, Pt_SET); PtSetResources(ABW_stateRunLineRelToggle, 1, &args[1]); PtSetArg(&args[0], Pt_ARG_USER_DATA, &stateIndex, sizeof(int)); PtSetArg(&args[1], Pt_ARG_NUMERIC_VALUE, thisState->rlval, 0); PtSetResources(ABW_runningLine, 2, args); } else if(thisState->rlflag == 2) { PtSetArg(&args[1], Pt_ARG_FLAGS, Pt_FALSE, Pt_SET); PtSetResources(ABW_stateRunLineAbsToggle, 1, &args[1]); PtSetArg(&args[1], Pt_ARG_FLAGS, Pt_TRUE, Pt_SET); PtSetResources(ABW_stateRunLineRelToggle, 1, &args[1]); PtSetArg(&args[0], Pt_ARG_USER_DATA, &stateIndex, sizeof(int)); PtSetArg(&args[1], Pt_ARG_NUMERIC_VALUE, thisState->rlval, 0); PtSetResources(ABW_runningLine, 2, args); } else if(thisState->rlflag == 3) { PtSetArg(&args[1], Pt_ARG_FLAGS, Pt_FALSE, Pt_SET); PtSetResources(ABW_stateRunLineAbsToggle, 1, &args[1]); PtSetArg(&args[1], Pt_ARG_FLAGS, Pt_TRUE, Pt_SET); PtSetResources(ABW_stateRunLineRelToggle, 1, &args[1]); PtSetArg(&args[0], Pt_ARG_USER_DATA, &stateIndex, sizeof(int)); PtSetArg(&args[1], Pt_ARG_NUMERIC_VALUE, -thisState->rlval, 0); PtSetResources(ABW_runningLine, 2, args); } PtSetArg(&args[0], Pt_ARG_USER_DATA, &stateIndex, sizeof(int)); PtSetResources(ABW_stateArg1ToggleGroup, 1, args); PtSetArg(&args[0], Pt_ARG_USER_DATA, &stateIndex, sizeof(int)); PtSetArg(&args[1], Pt_ARG_NUMERIC_VALUE, thisState->device.act_code, 0); PtSetResources(ABW_stateArg1, 2, args); PtSetArg(&args[0], Pt_ARG_USER_DATA, &stateIndex, sizeof(int)); PtSetResources(ABW_stateArg2ToggleGroup, 1, args); PtSetArg(&args[0], Pt_ARG_USER_DATA, &stateIndex, sizeof(int)); PtSetArg(&args[1], Pt_ARG_NUMERIC_VALUE, thisState->device.act_2code, 0); PtSetResources(ABW_stateArg2, 2, args); PtSetArg(&args[0], Pt_ARG_USER_DATA, &stateIndex, sizeof(int)); PtSetResources(ABW_stateArg3ToggleGroup, 1, args); PtSetArg(&args[0], Pt_ARG_USER_DATA, &stateIndex, sizeof(int)); PtSetArg(&args[1], Pt_ARG_NUMERIC_VALUE, thisState->device.act_3code, 0); PtSetResources(ABW_stateArg3, 2, args); PtSetArg(&args[0], Pt_ARG_USER_DATA, &stateIndex, sizeof(int)); PtSetResources(ABW_stateArg4ToggleGroup, 1, args); PtSetArg(&args[0], Pt_ARG_USER_DATA, &stateIndex, sizeof(int)); PtSetArg(&args[1], Pt_ARG_NUMERIC_VALUE, thisState->device.act_4code, 0); PtSetResources(ABW_stateArg4, 2, args); PtSetArg(&args[0], Pt_ARG_USER_DATA, &stateIndex, sizeof(int)); PtSetResources(ABW_stateArg5ToggleGroup, 1, args); PtSetArg(&args[0], Pt_ARG_USER_DATA, &stateIndex, sizeof(int)); PtSetArg(&args[1], Pt_ARG_NUMERIC_VALUE, thisState->device.act_5code, 0); PtSetResources(ABW_stateArg5, 2, args); PtSetArg(&args[0], Pt_ARG_USER_DATA, &stateIndex, sizeof(int)); PtSetResources(ABW_stateArg6ToggleGroup, 1, args); PtSetArg(&args[0], Pt_ARG_USER_DATA, &stateIndex, sizeof(int)); PtSetArg(&args[1], Pt_ARG_NUMERIC_VALUE, thisState->device.act_6code, 0); PtSetResources(ABW_stateArg6, 2, args); if(thisState->escape[0].stateptr) { PtSetArg(&args[0], Pt_ARG_TEXT_STRING, thisState->escape[0].stateptr->statename, 0); } else PtSetArg(&args[0], Pt_ARG_TEXT_STRING, "", 0); PtSetResources(ABW_stateEsc1Button, 1, &args[0]); if(thisState->escape[1].stateptr) { PtSetArg(&args[0], Pt_ARG_TEXT_STRING, thisState->escape[1].stateptr->statename, 0); } else PtSetArg(&args[0], Pt_ARG_TEXT_STRING, "", 0); PtSetResources(ABW_stateEsc2Button, 1, &args[0]); if(thisState->escape[2].stateptr) { PtSetArg(&args[0], Pt_ARG_TEXT_STRING, thisState->escape[2].stateptr->statename, 0); } else PtSetArg(&args[0], Pt_ARG_TEXT_STRING, "", 0); PtSetResources(ABW_stateEsc3Button, 1, &args[0]); if(thisState->escape[3].stateptr) { PtSetArg(&args[0], Pt_ARG_TEXT_STRING, thisState->escape[3].stateptr->statename, 0); } else PtSetArg(&args[0], Pt_ARG_TEXT_STRING, "", 0); PtSetResources(ABW_stateEsc4Button, 1, &args[0]); if(thisState->escape[4].stateptr) { PtSetArg(&args[0], Pt_ARG_TEXT_STRING, thisState->escape[4].stateptr->statename, 0); } else PtSetArg(&args[0], Pt_ARG_TEXT_STRING, "", 0); PtSetResources(ABW_stateEsc5Button, 1, &args[0]); if(thisState->escape[5].stateptr) { PtSetArg(&args[0], Pt_ARG_TEXT_STRING, thisState->escape[5].stateptr->statename, 0); } else PtSetArg(&args[0], Pt_ARG_TEXT_STRING, "", 0); PtSetResources(ABW_stateEsc6Button, 1, &args[0]); if(thisState->escape[6].stateptr) { PtSetArg(&args[0], Pt_ARG_TEXT_STRING, thisState->escape[6].stateptr->statename, 0); } else PtSetArg(&args[0], Pt_ARG_TEXT_STRING, "", 0); PtSetResources(ABW_stateEsc7Button, 1, &args[0]); if(thisState->escape[7].stateptr) { PtSetArg(&args[0], Pt_ARG_TEXT_STRING, thisState->escape[7].stateptr->statename, 0); } else PtSetArg(&args[0], Pt_ARG_TEXT_STRING, "", 0); PtSetResources(ABW_stateEsc8Button, 1, &args[0]); if(thisState->escape[8].stateptr) { PtSetArg(&args[0], Pt_ARG_TEXT_STRING, thisState->escape[8].stateptr->statename, 0); } else PtSetArg(&args[0], Pt_ARG_TEXT_STRING, "", 0); PtSetResources(ABW_stateEsc9Button, 1, &args[0]); if(thisState->escape[9].stateptr) { PtSetArg(&args[0], Pt_ARG_TEXT_STRING, thisState->escape[9].stateptr->statename, 0); } else PtSetArg(&args[0], Pt_ARG_TEXT_STRING, "", 0); PtSetResources(ABW_stateEsc10Button, 1, &args[0]); return; }
int base_resize( PtWidget_t *widget, ApInfo_t *apinfo, PtCallbackInfo_t *cbinfo ) { unsigned short height; unsigned short width; /* eliminate 'unreferenced' warnings */ widget = widget, apinfo = apinfo, cbinfo = cbinfo; PtContainerCallback_t * cbdata = (PtContainerCallback_t *)cbinfo->cbdata; //PtGetResource( widget, Pt_ARG_HEIGHT, &height, 0 ); //PtGetResource( widget, Pt_ARG_WIDTH, &width, 0 ); height = cbdata->new_dim.h; width = cbdata->new_dim.w; H = (height) - ((H * 0.2 ) + 50); W = (width) - 20; if (uu != NULL) delete []uu; uu = new double[W]; if (vv != NULL) delete []vv; vv = new double[H]; double dx = (double)net_img_w / (double)W; double dy = (double)net_img_h / (double)H; double uu_temp[W]; double vv_temp[H]; uu[0] = 0; vv[0] = 0; uu_temp[0] = 0; vv_temp[0] = 0; double integer_part; double fractional_part; for (int i = 1; i < H; i++) { vv_temp[i] = vv_temp[i-1] + dy; fractional_part = modf(vv_temp[i], &integer_part); vv[i] = (fractional_part < 0.5) ? integer_part : (integer_part + 1); } for (int j = 1; j < W; j++) { uu_temp[j] = uu_temp[j-1] + dx; fractional_part = modf(uu_temp[j], &integer_part); uu[j] = (fractional_part < 0.5) ? integer_part : (integer_part + 1); } if( phimage_vis != NULL ) { phimage_vis->flags = Ph_RELEASE_IMAGE_ALL; PhReleaseImage(phimage_vis); } //Create new image with the new window dimension phimage_vis = PhCreateImage( NULL, W, H, Pg_IMAGE_DIRECT_888, NULL, 0, 1); phimage_vis->bpl = W * 3; PhPoint_t new_pos; new_pos.x = 10; new_pos.y = H +5; PtSetResource( ABW_name_text, Pt_ARG_POS, &new_pos, 0 ); return( Pt_CONTINUE ); }
/***************************************************************************** * QNXManage: handle QNX events ***************************************************************************** * This function should be called regularly by video output thread. It allows * window resizing. It returns a non null value on error. *****************************************************************************/ static int QNXManage( vout_thread_t *p_vout ) { int i_ev, i_buflen; PhEvent_t *p_event; bool b_repos = 0; if (!vlc_object_alive (p_vout)) { return ( 0 ); } /* allocate buffer for event */ i_buflen = sizeof( PhEvent_t ) * 4; if( ( p_event = malloc( i_buflen ) ) == NULL ) return( 1 ); /* event loop */ do { memset( p_event, 0, i_buflen ); i_ev = PhEventPeek( p_event, i_buflen ); if( i_ev == Ph_RESIZE_MSG ) { PhEvent_t *buf; i_buflen = PhGetMsgSize( p_event ); buf = realloc( p_event, i_buflen ); if( buf == NULL ) { free( p_event ); return( 1 ); } p_event = buf; } else if( i_ev == Ph_EVENT_MSG ) { PtEventHandler( p_event ); if( p_event->type == Ph_EV_WM ) { PhWindowEvent_t *p_ev = PhGetData( p_event ); switch( p_ev->event_f ) { case Ph_WM_CLOSE: p_vout->p_libvlc->b_die = true; break; case Ph_WM_MOVE: p_vout->p_sys->pos.x = p_ev->pos.x; p_vout->p_sys->pos.y = p_ev->pos.y; b_repos = 1; break; case Ph_WM_RESIZE: p_vout->p_sys->old_dim.w = p_vout->p_sys->dim.w; p_vout->p_sys->old_dim.h = p_vout->p_sys->dim.h; p_vout->p_sys->dim.w = p_ev->size.w; p_vout->p_sys->dim.h = p_ev->size.h; p_vout->i_changes |= VOUT_SIZE_CHANGE; break; } } else if( p_event->type == Ph_EV_KEY ) { PhKeyEvent_t *p_ev = PhGetData( p_event ); long i_key = p_ev->key_sym; if( ( p_ev->key_flags & Pk_KF_Key_Down ) && ( p_ev->key_flags & Pk_KF_Sym_Valid ) ) { switch( i_key ) { case Pk_q: case Pk_Q: p_vout->p_libvlc->b_die = true; break; case Pk_f: case Pk_F: p_vout->i_changes |= VOUT_FULLSCREEN_CHANGE; break; default: break; } } } } } while( i_ev != -1 && i_ev != 0 ); free( p_event ); /* * fullscreen */ if( p_vout->i_changes & VOUT_FULLSCREEN_CHANGE ) { PhDim_t dim; p_vout->b_fullscreen = !p_vout->b_fullscreen; p_vout->i_changes &= ~VOUT_FULLSCREEN_CHANGE; if( p_vout->b_fullscreen ) { p_vout->p_sys->old_pos.x = p_vout->p_sys->pos.x; p_vout->p_sys->old_pos.y = p_vout->p_sys->pos.y; p_vout->p_sys->pos.x = p_vout->p_sys->pos.y = 0; dim.w = p_vout->p_sys->screen_dim.w + 1; dim.h = p_vout->p_sys->screen_dim.h + 1; } else { p_vout->p_sys->pos.x = p_vout->p_sys->old_pos.x; p_vout->p_sys->pos.y = p_vout->p_sys->old_pos.y; dim.w = p_vout->p_sys->old_dim.w + 1; dim.h = p_vout->p_sys->old_dim.h + 1; } /* modify render flags, border */ PtSetResource( p_vout->p_sys->p_window, Pt_ARG_WINDOW_RENDER_FLAGS, p_vout->b_fullscreen ? Pt_FALSE : Pt_TRUE, Ph_WM_RENDER_BORDER | Ph_WM_RENDER_TITLE ); /* set position and dimension */ PtSetResource( p_vout->p_sys->p_window, Pt_ARG_POS, &p_vout->p_sys->pos, 0 ); PtSetResource( p_vout->p_sys->p_window, Pt_ARG_DIM, &dim, 0 ); /* mark as damaged to force redraw */ PtDamageWidget( p_vout->p_sys->p_window ); } /* * size change */ if( p_vout->i_changes & VOUT_SIZE_CHANGE ) { p_vout->i_changes &= ~VOUT_SIZE_CHANGE; if( p_vout->p_sys->i_mode == MODE_VIDEO_OVERLAY ) { ResizeOverlayOutput(p_vout); } #if 0 else { p_vout->output.i_width = p_vout->p_sys->dim.w; p_vout->output.i_height = p_vout->p_sys->dim.h; p_vout->i_changes |= VOUT_YUV_CHANGE; QNXEnd( p_vout ); if( QNXInit( p_vout ) ) { msg_Err( p_vout, "cannot resize display" ); return( 1 ); } } #endif msg_Dbg( p_vout, "video display resized (%dx%d)", p_vout->p_sys->dim.w, p_vout->p_sys->dim.h ); } /* * position change, move video channel */ if( b_repos && p_vout->p_sys->i_mode == MODE_VIDEO_OVERLAY ) { ResizeOverlayOutput(p_vout); } return( i_ev == -1 ); }
/* * Function - wgt_settext() * * Arguments - <widget_name> Name of the widget * - <str> Source string pointer * * Return Value - None */ void wgt_settext(const sint32_t widget_name, const char * str) { // Set widget text PtSetResource(AbGetABW(widget_name), Pt_ARG_TEXT_STRING, str, 0); }