Exemplo n.º 1
0
int Ge::get_ldhses_cb( void *ctx, ldh_tSesContext *ldhses, int load)
{
#if LDH
    Ge *gectx = (Ge *) ctx;
    ldh_tWBContext wbctx;
    int	sts;
    pwr_tVolumeId	volid = 0;
    pwr_tClassId	classid;
    ldh_tVolContext 	volctx;

    if ( gectx->ldhses) {
        *ldhses = gectx->ldhses;
        return 1;
    }
    else if ( !load)
        return 0;
    else {
        // Open workbench and attatch some volume
        sts = ldh_OpenWB( &wbctx, 0, 0);
        if ( EVEN(sts)) return sts;

        // Attach first rootvolume, or if no rootvolume exist some other volume
        sts = ldh_GetVolumeList( wbctx, &volid);
        while ( ODD(sts)) {
            sts = ldh_GetVolumeClass( wbctx, volid, &classid);
            if ( EVEN(sts)) return sts;

            if ( classid == pwr_eClass_RootVolume)
                break;
            sts = ldh_GetNextVolume( wbctx, volid, &volid);
        }
        if ( volid == 0) return sts;

        // Open ldh session
        sts = ldh_AttachVolume( wbctx, volid, &volctx);
        if ( EVEN(sts)) return sts;

        sts = ldh_OpenSession( ldhses, volctx, ldh_eAccess_ReadWrite,
                               ldh_eUtility_Pwr);
        if ( EVEN(sts)) return sts;
    }
    return 1;
#else
    return 0;
#endif
}
Exemplo n.º 2
0
//
// Constructor
//
WFoeMotif::WFoeMotif( void *f_parent_ctx,
		      Widget f_parent_wid,
		      const char *f_name,
		      pwr_tObjid plcprogram,
		      ldh_tWBContext ldhwbctx,
		      ldh_tSesContext ldhsesctx,
		      int f_map_window,
		      ldh_eAccess	f_access,
		      unsigned int f_options,
		      pwr_tStatus *sts) :
  WFoe(f_parent_ctx,f_name,plcprogram,ldhwbctx,ldhsesctx,f_map_window,
       f_access,f_options,sts),
  parent_wid(f_parent_wid), set_focus_disabled(0), focus_timerid(0)
{
  int		size;
  pwr_tFullName	new_name;
  ldh_tSesContext ldhses;

  memset( &widgets, 0, sizeof(widgets));

  /* Check that it is possible to open a session */
  *sts = ldh_OpenSession(&ldhses, ldh_SessionToVol( ldhsesctx),
			access, ldh_eUtility_PlcEditor);
  if ( EVEN(*sts)) return;

  *sts = ldh_CloseSession(ldhses);

  /* New title */
  *sts = ldh_ObjidToName( ldhsesctx, plcprogram, ldh_eName_Hierarchy,
			  new_name, sizeof( new_name), &size);
  error_msg(*sts);
  if( EVEN(*sts)) return;

  strcpy( name, new_name);
  *sts = new_local( plcprogram,
		    ldhwbctx, ldhsesctx, 0, 0, 0,
		    foe_eFuncAccess_Edit);

  wow = new CoWowMotif( parent_wid);
}
Exemplo n.º 3
0
Ge::Ge( 	void 	*x_parent_ctx,
            ldh_tSesContext	x_ldhses,
            int	x_exit_when_close,
            unsigned int x_options) :
    parent_ctx(x_parent_ctx), graph(0), subpalette(0),
    subgraphs(0), colorpalette_ctx(0), text_input_open(0), name_input_open(0),
    value_input_open(0), command_open(0), confirm_open(0), yesnodia_open(0),
    yesnodia_yes_cb(0), yesnodia_no_cb(0), india_ok_cb(0), current_text_object(0),
    current_value_object(0), current_confirm_object(0), ldhses(0), plantctx(0),
    exit_when_close(x_exit_when_close), prev_count(0), focused_component(0),
    recover_object(0), plant_mapped(0), subpalette_mapped(0), options(x_options)
{
    strcpy( name, "PwR Ge");

#ifdef LDH
    if ( x_ldhses) {
        // Open a new session
        pwr_tStatus sts = ldh_OpenSession( &ldhses, ldh_SessionToVol( x_ldhses),
                                           ldh_eAccess_ReadOnly, ldh_eUtility_PlcEditor);
        if ( EVEN(sts)) return;
    }
#endif
}
Exemplo n.º 4
0
int Cmd::attach_volume_cb( void *ctx,
			 pwr_tVolumeId	volid,
			 int pop)
{
  Cmd *cmd = (Cmd *) ctx;
  int	sts;
  pwr_tVolumeId	vid;
  pwr_tClassId	classid;

  if ( cmd->ldhses)
  {
//    cmd->wnav->message( 'E', "Other volume is already attached");
    return WNAV__VOLATTACHED;
  }

  if ( !cmd->wbctx)
  {
    sts = get_wbctx( (void *)cmd, &cmd->wbctx);
    if ( EVEN(sts)) return sts;
  }

  if ( volid == 0)
  {
    if ( cmd_volume_p != 0) {
      // Attach argument volume
      sts = ldh_VolumeNameToId( cmd->wbctx, cmd_volume_p, &volid);
    }
    if ( cmd_volume_p == 0 || EVEN(sts)) {
      // Attach first rootvolume, or if no rootvolume exist some other volume
      sts = ldh_GetVolumeList( cmd->wbctx, &vid);
      while ( ODD(sts)) {
	volid = vid;
	sts = ldh_GetVolumeClass( cmd->wbctx, vid, &classid);
	if ( EVEN(sts)) return sts;

	if ( classid == pwr_eClass_RootVolume)
	  break;
	sts = ldh_GetNextVolume( cmd->wbctx, vid, &vid);
      }
      if ( volid == 0) return sts;
    }
  }

  cmd->volid = volid;

  // Open ldh session
  sts = ldh_AttachVolume( cmd->wbctx, cmd->volid, &cmd->volctx);
  if ( EVEN(sts)) return sts;

  sts = ldh_OpenSession( &cmd->ldhses,
    cmd->volctx,
    ldh_eAccess_ReadWrite,
    ldh_eUtility_Pwr);
  if ( EVEN(sts)) {
    // Try read access
    sts = ldh_OpenSession( &cmd->ldhses,
			   cmd->volctx,
			   ldh_eAccess_ReadOnly,
			   ldh_eUtility_Pwr);
    if ( EVEN(sts)) return sts;
  }

  cmd->wnav->volume_attached( cmd->wbctx, cmd->ldhses, pop);

  return 1;
}