void Window_init( Handle self, HV * profile) { dPROFILE; SV * sv; inherited init( self, profile); opt_set( optSystemSelectable); opt_assign( optOwnerIcon, pget_B( ownerIcon)); opt_assign( optMainWindow, pget_B( mainWindow)); my-> set_icon( self, pget_H( icon)); my-> menuColorIndex( self, true, ciFore, pget_i( menuColor) ); my-> menuColorIndex( self, true, ciBack, pget_i( menuBackColor) ); my-> menuColorIndex( self, true, ciHiliteText, pget_i( menuHiliteColor) ); my-> menuColorIndex( self, true, ciHilite, pget_i( menuHiliteBackColor) ); my-> menuColorIndex( self, true, ciDisabledText, pget_i( menuDisabledColor) ); my-> menuColorIndex( self, true, ciDisabled, pget_i( menuDisabledBackColor)); my-> menuColorIndex( self, true, ciLight3DColor, pget_i( menuLight3DColor) ); my-> menuColorIndex( self, true, ciDark3DColor, pget_i( menuDark3DColor) ); SvHV_Font( pget_sv( menuFont), &Font_buffer, "Window::init"); my-> set_menu_font ( self, Font_buffer); if ( SvTYPE( sv = pget_sv( menuItems)) != SVt_NULL) my-> set_menuItems( self, sv); my-> set_modalResult( self, pget_i( modalResult)); my-> set_modalHorizon( self, pget_B( modalHorizon)); CORE_INIT_TRANSIENT(Window); }
void Window_update_sys_handle( Handle self, HV * profile) { dPROFILE; var-> widgetClass = wcWindow; if (!( pexist( owner) || pexist( syncPaint) || pexist( taskListed) || pexist( borderIcons) || pexist( onTop) || pexist( borderStyle) )) return; if ( pexist( owner)) my-> cancel_children( self); if ( !apc_window_create( self, pexist( owner ) ? pget_H( owner ) : var-> owner , pexist( syncPaint) ? pget_B( syncPaint) : my-> get_syncPaint( self), pexist( borderIcons) ? pget_i( borderIcons) : my-> get_borderIcons( self), pexist( borderStyle) ? pget_i( borderStyle) : my-> get_borderStyle( self), pexist( taskListed) ? pget_B( taskListed) : my-> get_taskListed( self), pexist( windowState) ? pget_i( windowState) : my-> get_windowState( self), pexist( onTop) ? pget_B( onTop) : -1, /* This is way better. I should've thought of this before! */ !( pexist( originDontCare) && pget_B( originDontCare)), !( pexist( sizeDontCare) && pget_B( sizeDontCare)) )) croak("Cannot create window"); pdelete( borderStyle); pdelete( borderIcons); pdelete( syncPaint); pdelete( taskListed); pdelete( windowState); pdelete( onTop); }
void Window_set( Handle self, HV * profile) { dPROFILE; Bool owner_icon = false; if ( pexist( menuFont)) { SvHV_Font( pget_sv( menuFont), &Font_buffer, "Window::set"); my-> set_menu_font( self, Font_buffer); pdelete( menuFont); } if ( pexist( owner)) { owner_icon = pexist( ownerIcon) ? pget_B( ownerIcon) : my-> get_ownerIcon( self); pdelete( ownerIcon); } if ( pexist( frameOrigin) || pexist( frameSize)) { Bool io = 0, is = 0; Point o, s; if ( pexist( frameOrigin)) { int set[2]; prima_read_point( pget_sv( frameOrigin), set, 2, "Array panic on 'frameOrigin'"); pdelete( frameOrigin); o. x = set[0]; o. y = set[1]; io = 1; } else { o.x = o. y = 0; } if ( pexist( frameSize)) { int set[2]; prima_read_point( pget_sv( frameSize), set, 2, "Array panic on 'frameSize'"); pdelete( frameSize); s. x = set[0]; s. y = set[1]; is = 1; } else { s.x = s. y = 0; } if ( is && io) apc_widget_set_rect( self, o. x, o. y, s. x, s. y); else if ( io) my-> set_frameOrigin( self, o); else my-> set_frameSize( self, s); } inherited set( self, profile); if ( owner_icon) { my-> set_ownerIcon( self, 1); opt_set( optOwnerIcon); } }
void AbstractMenu_set( Handle self, HV * profile) { dPROFILE; Bool select = false; if ( pexist( owner)) { select = pexist( selected) ? pget_B( selected) : my-> get_selected( self); pdelete( selected); } inherited set( self, profile); if ( select) my-> set_selected( self, true); }
void AbstractMenu_init( Handle self, HV * profile) { dPROFILE; inherited init( self, profile); var-> anchored = kind_of( self, CMenu); my-> update_sys_handle( self, profile); my-> set_items( self, pget_sv( items)); if ( var-> system) apc_menu_update( self, nil, var-> tree); if ( pget_B( selected)) my-> set_selected( self, true); CORE_INIT_TRANSIENT(AbstractMenu); }
void DeviceBitmap_init( Handle self, HV * profile) { dPROFILE; inherited init( self, profile); var-> w = pget_i( width); var-> h = pget_i( height); var-> monochrome = pget_B( monochrome); if ( !apc_dbm_create( self, var-> monochrome)) croak("RTC0110: Cannot create device bitmap"); inherited begin_paint( self); opt_set( optInDraw); CORE_INIT_TRANSIENT(DeviceBitmap); }
/* FFT profile keys: inverse => BOOL; direct or inverse transform */ PImage IPA__Global_fft(PImage img,HV *profile) { #define METHOD "IPA::Global::fft" dPROFILE; Bool inverse = 0, failed = false; PImage ret = nil; double * buffer = nil; if ( sizeof(double) % 2) { warn("%s:'double' is even-sized on this platform", METHOD); return nil; } if ( !img || !kind_of(( Handle) img, CImage)) croak("%s: not an image passed", METHOD); if ( !pow2( img-> w)) croak("%s: image width is not a power of 2", METHOD); if ( !pow2( img-> h)) croak("%s: image height is not a power of 2", METHOD); if ( pexist( inverse)) inverse = pget_B( inverse); /* preparing structures */ ret = ( PImage) img-> self-> dup(( Handle) img); if ( !ret) fail( "%s: Return image allocation failed"); ++SvREFCNT( SvRV( ret-> mate)); ret-> self-> set_type(( Handle) ret, imDComplex); if ( ret-> type != imDComplex) { warn("%s:Cannot set image to imDComplex", METHOD); failed = 1; goto EXIT; } buffer = malloc((sizeof(double) * img-> w * 2)); if ( !buffer) { warn("%s: Error allocating %d bytes", METHOD, (int)(sizeof(double) * img-> w * 2)); failed = 1; goto EXIT; } fft_2d(( double *) ret-> data, ret-> w, ret-> h, inverse ? FFT_INVERSE : FFT_DIRECT, buffer); EXIT: free( buffer); if ( ret) --SvREFCNT( SvRV( ret-> mate)); return failed ? nil : ret; #undef METHOD }
void Drawable_init( Handle self, HV * profile) { dPROFILE; inherited init( self, profile); apc_gp_init( self); var-> w = var-> h = 0; my-> set_color ( self, pget_i ( color)); my-> set_backColor ( self, pget_i ( backColor)); my-> set_fillWinding ( self, pget_B ( fillWinding)); my-> set_fillPattern ( self, pget_sv( fillPattern)); my-> set_lineEnd ( self, pget_i ( lineEnd)); my-> set_lineJoin ( self, pget_i ( lineJoin)); my-> set_linePattern ( self, pget_sv( linePattern)); my-> set_lineWidth ( self, pget_i ( lineWidth)); my-> set_region ( self, pget_H ( region)); my-> set_rop ( self, pget_i ( rop)); my-> set_rop2 ( self, pget_i ( rop2)); my-> set_textOpaque ( self, pget_B ( textOpaque)); my-> set_textOutBaseline( self, pget_B ( textOutBaseline)); my-> set_splinePrecision( self, pget_i ( splinePrecision)); if ( pexist( translate)) { AV * av = ( AV *) SvRV( pget_sv( translate)); Point tr = {0,0}; SV ** holder = av_fetch( av, 0, 0); if ( holder) tr.x = SvIV( *holder); else warn("RTC0059: Array panic on 'translate'"); holder = av_fetch( av, 1, 0); if ( holder) tr.y = SvIV( *holder); else warn("RTC0059: Array panic on 'translate'"); my-> set_translate( self, tr); } SvHV_Font( pget_sv( font), &Font_buffer, "Drawable::init"); my-> set_font( self, Font_buffer); my-> set_palette( self, pget_sv( palette)); CORE_INIT_TRANSIENT(Drawable); }