Exemple #1
0
/**
 * \brief Get all the possible commands and match them with the string given
 *        We can use common regexs to match what we are looking for
 *        (.*)sometext(.*)that(.*)ignores(.*)spaces
 *
 *        remember that we need to escape all the '.' that are in the commands, (file names can have special chars).
 *        If a user is looking for "google.bat" are they looking for "google\.bat" or "google(.*)bat" or "google(.)bat"?
 */
std::wstring Actions::ToChar()
{
  //  get the current command, colors and style
  CommandsValue cv(  false, false );
  GetCommandValue( L"current", cv );

  // the default item
  CommandsValue cvDef( false, false );
  GetCommandValue( L"default", cvDef );

  // and the selected item
  CommandsValue cvSel( true, true );
  GetCommandValue( L"selected", cvSel );

  myodd::threads::Lock guard(_mutexActionsMatch );

  //  the return string
  //  we keep it as global 'cause we are returning it.
  auto szCurrentView = ToChar( GetActionAsTyped(), cv );
  size_t count =  0;
  for ( auto it =  _actionsMatch.begin(); it != _actionsMatch.end(); ++it )
  {
    //  we need a break after the previous line, (even for the current action)
    szCurrentView += L"<br>";
    const auto& acc = *(*it);

    szCurrentView += ToChar( acc.Command(), (count==m_uCommand) ? cvSel:cvDef );
    ++count;
  }
  return szCurrentView;
}
Exemple #2
0
uchar   GetModemAnswer(void)
{
uchar   i,j;
uchar   w;

  if ((IndexInBuff() >= 2) && (IndexInBuff() <= 4))
  {
    w = 0;
    for (i=0; i<IndexInBuff()-1; i++)
    {
      j = InBuff(i);
      if ((j >= '0') && (j <= '9'))
        w = w*10 + ToChar(j);
      else
      {
        w = 0xFF;
        break;
      }
    }
  }
  else w = 0xFE;

  if (w < 0x100)
    return(w);
  else
    return(0xFD);
}
Exemple #3
0
char* GetDataHPGLOption(cngplpData *data, int id)
{
	char *option = NULL;
	int index = id - ID_HPGL_OPTION - 1;
	if((option = IDtoHPGLOption(index)) != NULL)
		return ToChar(GetCupsValue(data->cups_opt->hpgl->option, option));
	return NULL;
}
Exemple #4
0
float   GetRealLo(uchar  ibBeg, uchar  ibEnd)
{
    float re = 0;

    while (ibBeg <= ibEnd)
        re = re*10 + ToChar( szLo[ibBeg++] );

    return re;
}
Exemple #5
0
char* cngplpGetValue(cngplpData *data, char *key)
{
	if(data == NULL)
		return NULL;

	if(key == NULL)
		return GetAllUIValue(data);
	else
		return ToChar(GetUIValue(data, key));
}
Exemple #6
0
uint    GetIntLo(uchar  ibBeg, uchar  ibEnd)
{
    uint  w;

    w = 0;

    while (ibBeg <= ibEnd)
        w = w*10 + ToChar( szLo[ibBeg++] );

    return(w);
}
Exemple #7
0
ulong   GetLongLo(uchar  ibBeg, uchar  ibEnd)
{
    ulong	dw;

    dw = 0;

    while (ibBeg <= ibEnd)
        dw = dw*10 + ToChar( szLo[ibBeg++] );

    return dw;
}
Exemple #8
0
char* GetDataTextOption(cngplpData *data, int id)
{
	if(id <= ID_PRETTYPRINT){
		char *option = NULL;
		int index = id - ID_TEXT_OPTION - 1;
		if((option = IDtoTextOption(index)) != NULL)
			return ToChar(GetCupsValue(data->cups_opt->text->option, option));
	}else if(id == ID_MARGIN){
		return IntToChar(data->cups_opt->text->margin_on);
	}
	return NULL;
}
Exemple #9
0
char* GetDataImageOption(cngplpData *data, int id)
{
	if(id <= ID_POSITION){
		char *option = NULL;
		int index = id - ID_IMAGE_OPTION - 1;
		if((option = IDtoImageOption(index)) != NULL)
			return ToChar(GetCupsValue(data->cups_opt->image->option, option));
	}else if(id == ID_RESO_SCALE){
		return IntToChar(data->cups_opt->image->img_reso_scale);
	}
	return NULL;
}
std::string lerpFromSide( const std::string& From, const std::string& To, const Real32& t)
{
    UInt32 MaxSize(osgMax<UInt32>(From.size(),To.size()));
    Real32 TimePerChar(1.0f/static_cast<Real32>(MaxSize));
    Real32 FromChar(' '),ToChar(' ');
    
    std::string Result("");

    if(From.size() < To.size())
    {
        //Left To Right
        Int32 Index(osgFloor<Int32>(static_cast<Real32>(MaxSize)*t));
        Real32 CharT((t-Index*TimePerChar)/TimePerChar);

        Result = To.substr(0,osgMin<Int32>(To.size(),Index));
        Result.resize(Index, ' ');
        if(Index<To.size())
        {
            ToChar = To[Index];
        }
        if(Index<From.size())
        {
            FromChar = From[Index];
        }
        Result += static_cast<Char8>(FromChar +( (ToChar - FromChar) * CharT ));           //Interp Index
        Result += From.substr(osgMin<Int32>(Index+1,From.size()),std::string::npos); 
    }
    else
    {
        //Right to Left
        Int32 Index(osgMax<Int32>(0,MaxSize - osgFloor(static_cast<Real32>(MaxSize)*t) - 1));
        Real32 CharT((t-osgFloor<Int32>(static_cast<Real32>(MaxSize)*t)*TimePerChar)/TimePerChar);

        Result = From.substr(0,osgMin<Int32>(From.size(),Index));
        Result.resize(Index, ' ');
        if(Index<To.size())
        {
            ToChar = To[Index];
        }
        if(Index<From.size())
        {
            FromChar = From[Index];
        }
        Result += static_cast<Char8>(FromChar +( (ToChar - FromChar) * CharT ));           //Interp Index
        Result += To.substr(osgMin<Int32>(Index+1,To.size()),std::string::npos); 
    }

    return Result;
}
Exemple #11
0
/**
 * Converts a DB2 Bind timestamp to a human readable date.
 * @returns 0 on success.
 *          -1 on error.(invalid timestamp)
 * @param   pszTimeStamp    Input timestamp string. Assumes it is 8 chars long.
 * @param   pTS             Output structure.
 * @sketch
 * @status  Completely implemented.
 * @author  knut st. osmundsen ([email protected])
 * @remark  Let's hope this don't change for later releases of DB2.
 */
int BindMakeTS(char *pszTimeStamp, PTIMESTAMP pTS)
{
    int i;
    int rc = 0;

    /*
     * Validate
     */
    if (    pTS->iYear < 1984
        ||  pTS->iYear > 1984+67
        ||  pTS->iMonth < 1
        ||  pTS->iMonth > 12
        ||  pTS->iDay < 1
        ||  pTS->iDay > 31
        ||  pTS->iHour > 23
        ||  pTS->iHour < 0
        ||  pTS->iMinutte > 59
        ||  pTS->iMinutte < 0
        ||  pTS->iSecond > 59
        ||  pTS->iSecond < 0
        ||  pTS->i100 < 0
        ||  pTS->i100 > 99
        )
        return -1;

    pszTimeStamp[7] = ToChar(pTS->iYear - 1984);
    pszTimeStamp[6] = ToChar(pTS->iMonth);
    pszTimeStamp[5] = ToChar(pTS->iDay);
    pszTimeStamp[4] = ToChar(pTS->iHour);
    pszTimeStamp[3] = ToChar(pTS->iMinutte);
    pszTimeStamp[2] = ToChar(pTS->iSecond);
    pszTimeStamp[1] = ToChar(pTS->i100 / 62);
    pszTimeStamp[0] = ToChar(pTS->i100 % 62);

    return rc;
}
Exemple #12
0
char* cngplpIDtoKey(int id)
{
	char *ret = NULL;

	if(id < ID_DEVICE_INFO){
		ret = ToChar(IDtoPPDOption(id - 1));
	}else if(id < ID_COMMON_OPTION){
		ret = ToChar(IDtoDevOption(id));
	}else if(id < ID_IMAGE_OPTION){
		ret = ToChar(IDtoCommonOption(id - ID_COMMON_OPTION - 1));
	}else if(id < ID_TEXT_OPTION){
		ret = ToChar(IDtoImageOption(id - ID_IMAGE_OPTION - 1));
	}else if(id < ID_HPGL_OPTION){
		ret = ToChar(IDtoTextOption(id - ID_TEXT_OPTION - 1));
	}else if(id < ID_BOTTON_EVENT){
		ret = ToChar(IDtoHPGLOption(id - ID_HPGL_OPTION - 1));
	}
	return ret;
}
Exemple #13
0
char* GetDataPPDOption(cngplpData *data, int id)
{
	char *option = NULL;

	switch(id){
	case ID_SELECTBY:
		return IntToChar(data->ppd_opt->selectby);
	case ID_JOBACCOUNT:
		if(data->ppd_opt->special == NULL)
			return NULL;
		else{
#ifndef	__APPLE__
			return IntToChar(data->ppd_opt->special->job_account);
#else
			return ToChar(data->ppd_opt->special->job_account == 0 ? "False" : "True");
#endif
		}
	case ID_JOBACCOUNT_ID:
		if(data->ppd_opt->special == NULL)
			return NULL;
		else
		return ToChar(data->ppd_opt->special->job_account_id);
	case ID_JOBACCOUNT_PASSWD:
		if(data->ppd_opt->special == NULL)
			return NULL;
		else
		return ToChar(data->ppd_opt->special->job_account_passwd);
	case ID_CNUSRPASSWORD:
		if(data->ppd_opt->special == NULL)
			return NULL;
		else
		return ToChar(data->ppd_opt->special->usr_passwd);
	case ID_DATANAME:
		if(data->ppd_opt->special == NULL)
			return NULL;
		else
		return IntToChar(data->ppd_opt->special->data_name);
	case ID_ENTERNAME:
		if(data->ppd_opt->special == NULL)
			return NULL;
		else
#ifndef _OPAL
		return ToChar(data->ppd_opt->special->enter_name);
#else
		if(data->ppd_opt->special->enter_name == NULL){
			return ToChar("");
		}else {
			return ToChar(data->ppd_opt->special->enter_name);
		}
#endif
	case ID_BOXIDNUM:
		if(data->ppd_opt->special == NULL)
			return NULL;
		else
#ifndef __APPLE__
		return IntToChar(data->ppd_opt->special->box_num);
#else
		return ToChar(data->ppd_opt->special->box_num);
#endif
	case ID_MAX_BOXIDNUM:
		return IntToChar(data->ppd_opt->max_box_num);
	case ID_GUTTER:
		if(data->ppd_opt->summary_flag & CNSUMMARY_FLG_GUTTER)
			return NULL;
                if(data->ppd_opt->us_type)
                        return DoubleToChar(data->ppd_opt->gutter_value_d);
                else
                        return IntToChar(data->ppd_opt->gutter_value);
	case ID_MAX_GUTTER:
                if(data->ppd_opt->us_type)
                        return DoubleToChar(data->ppd_opt->max_gutter_value_d);
                else
                        return IntToChar(data->ppd_opt->max_gutter_value);
        case ID_USTYPE:
                return ToChar(data->ppd_opt->us_type == 0 ? "False" : "True");
	case ID_LIST_MEDIATYPE:
		return IntToChar(data->ppd_opt->list_mediatype_value);
  case ID_LIST_PAGESIZE:
      return IntToChar(data->ppd_opt->list_pagesize_value);
	case ID_SECURED_DOCNAME:
		if(data->ppd_opt->special == NULL)
			return NULL;
		else
#ifndef _OPAL
		return ToChar(data->ppd_opt->special->doc_name);
#else
		if(data->ppd_opt->special->doc_name == NULL){
			return ToChar("");
		}else {
			return ToChar(data->ppd_opt->special->doc_name);
		}
#endif
	case ID_SECURED_USRNAME:
		if(data->ppd_opt->special == NULL)
			return NULL;
		else
		return ToChar(data->ppd_opt->special->usr_name);
	case ID_SECURED_PASSWD:
		if(data->ppd_opt->special == NULL)
			return NULL;
		else
		return ToChar(data->ppd_opt->special->passwd_array);
	case ID_COLOR_MODE:
		return IntToChar(data->ppd_opt->color_mode);
	case ID_PRINTERTYPE:
		return IntToChar(data->ppd_opt->printer_type);
	case ID_MAX_COPIES:
		return IntToChar(data->ppd_opt->max_copy_num);
	case ID_SPECIAL_FUNC:
		return ToChar(data->ppd_opt->special != NULL ? "1" : "0");
	case ID_DOC_LENGTH:
		return IntToChar(data->ppd_opt->max_doc_length);
	case ID_DUPLEX:
		option = IDtoPPDOption(id - 1);
		if(option == NULL)
			return NULL;
#ifdef	__APPLE__
			return MakePPDOptionList(data->ppd_opt, "Duplex");
#else
			return MakeDuplexBoolList(data->ppd_opt);
#endif
	case ID_BOOKLET:
	case ID_CNSADDLESTITCH:
	case ID_CNTRIMMING:
	case ID_CNZFOLDING:
	case ID_CNINSERTER:
	case ID_CNPUREBLACKPROCESS:
	case ID_CNPUNCHER:
	case ID_CNFOLDER:
	case ID_CNINSERTUNIT:
	case ID_CNTRIMMER:
	case ID_CNDUPLEXUNIT:
	case ID_CNSUPERSMOOTH:
	case ID_CNBACKPAPERPRINT:
	case ID_CNROTATEPRINT:
	case ID_CNCOPYSETNUMBERING:
	case ID_CNINTERLEAFSHEET:
	case ID_CNINTERLEAFPRINT:
	case ID_CNSKIPBLANK:
	case ID_CNDETECTPAPERSIZE:
	case ID_CNRGBPUREBLACKPROCESS:
	case ID_CNUSEGRAYSCALEPROFILE:
	case ID_CNLASTPAGEPRINTMODE:
	case ID_CNSET_FRONT_COVER:
	case ID_CNSET_BACK_COVER:
	case ID_CNSPECIFYNUMOFCOPIESSTACK:
	case ID_CNVFOLDING:
	case ID_CNPROPUNCHER:
		option = IDtoPPDOption(id - 1);
		if(option == NULL)
			return NULL;
#ifdef	__APPLE__
		if(data->ppd_opt->printer_type != PRINTER_TYPE_CAPT)
		{
			switch(id){
			case ID_CNPUNCHER:
			case ID_BOOKLET:
			case ID_CNFOLDER:
			case ID_CNTRIMMER:
			case ID_CNINSERTUNIT:
			case ID_CNLASTPAGEPRINTMODE:
			case ID_CNPROPUNCHER:
				return MakePPDOptionList(data->ppd_opt, option);
			default:
				return MakePPDBoolList(data->ppd_opt, option);
			}
		}
		else {
			switch(id){
			case ID_CNSUPERSMOOTH:
				return MakePPDOptionList(data->ppd_opt, option);
			default:
				return MakePPDBoolList(data->ppd_opt, option);
			}
#endif
			return MakePPDBoolList(data->ppd_opt, option);
#ifdef	__APPLE__
		}
#endif
	case ID_CNPUNCH:
		option = IDtoPPDOption(id - 1);
		if(option == NULL)
			return NULL;
		return MakeCNPunchBoolList(data->ppd_opt, option);
	case ID_BOOKLET_DLG:
		option = IDtoPPDOption(ID_BOOKLET - 1);
		if(option == NULL)
			return NULL;
		return MakePPDOptionList(data->ppd_opt, option);
	case ID_STARTNUM:
		return IntToChar(data->ppd_opt->startnum_value);
	case ID_USERID:
		return IntToChar(getuid());
	case ID_BACKPAPERPRINT_LABEL:
		return ToChar(GetItemString(data->ppd_opt->items_list, "CNBackPaperPrint"));
	case ID_DISABLE_JOBACCOUNT_BW:
		if(data->ppd_opt->special == NULL)
			return NULL;
		else
#ifndef	__APPLE__
			return IntToChar(data->ppd_opt->special->disable_job_account_bw);
#else
			return ToChar(data->ppd_opt->special->disable_job_account_bw == 0 ? "False:True<0>,False<0>" : "True:True<0>,False<0>");
#endif
#if !defined(__APPLE__) && !defined(_OPAL)
	case ID_SHOW_JOBACCOUNT:
		if(data->ppd_opt->special == NULL)
		{
			return NULL;
		}
		else
		{
			return IntToChar(data->ppd_opt->special->show_job_account);
		}
		break;
#endif
	case ID_SHOW_DISABLE_JOBACCOUNT_BW:
		if(data->ppd_opt->special == NULL)
			return NULL;
		else
		return IntToChar(data->ppd_opt->special->show_disable_job_account_bw);
	case ID_DETECTPAPER_LABEL:
		return ToChar(GetItemString(data->ppd_opt->items_list, "CNDetectPaperSize"));
	case ID_CNDPICONPICTID:
		if(data->ppd_opt->dpicon_pictid > 0)
			return IntToChar(data->ppd_opt->dpicon_pictid);
		break;
	case ID_CNENABLEFINISHFLAG:
		if(data->ppd_opt->enable_finishflag > 0)
			return IntToChar(data->ppd_opt->enable_finishflag);
		break;
	case ID_CNENABLEINPUTFLAG:
		if(data->ppd_opt->enable_inputflag > 0)
			return IntToChar(data->ppd_opt->enable_inputflag);
		break;
	case ID_CNENABLEQUALITYTYPE:
		if(data->ppd_opt->enable_qualitytype > 0)
			return IntToChar(data->ppd_opt->enable_qualitytype);
		break;
	case ID_INPUTSLOT_TYPE:
		return IntToChar(data->ppd_opt->input_slot_type);

	case ID_CNSHIFTTYPE:
		return IntToChar(data->ppd_opt->shift_pos_type);
	case ID_CNSHIFTUPWARDS:
		if((option = GetUIValue(data, "CNEnableDetailShiftPosition")) != NULL){
			if(strcasecmp(option,"True") == 0){
				return DoubleToChar(data->ppd_opt->detail_shift_upwards);
			}
		}
		return IntToChar(data->ppd_opt->shift_upwards);
	case ID_CNSHIFTRIGHT:
		if((option = GetUIValue(data, "CNEnableDetailShiftPosition")) != NULL){
			if(strcasecmp(option,"True") == 0){
				return DoubleToChar(data->ppd_opt->detail_shift_right);
			}
		}
		return IntToChar(data->ppd_opt->shift_right);
	case ID_CNSHIFTFRLONGEDGE:
		if((option = GetUIValue(data, "CNEnableDetailShiftPosition")) != NULL){
			if(strcasecmp(option,"True") == 0){
				return DoubleToChar(data->ppd_opt->detail_shift_front_long);
			}
		}
		return IntToChar(data->ppd_opt->shift_front_long);
	case ID_CNSHIFTFRSHORTEDGE:
		if((option = GetUIValue(data, "CNEnableDetailShiftPosition")) != NULL){
			if(strcasecmp(option,"True") == 0){
				return DoubleToChar(data->ppd_opt->detail_shift_front_short);
			}
		}
		return IntToChar(data->ppd_opt->shift_front_short);
	case ID_CNSHIFTBKLONGEDGE:
		if((option = GetUIValue(data, "CNEnableDetailShiftPosition")) != NULL){
			if(strcasecmp(option,"True") == 0){
				return DoubleToChar(data->ppd_opt->detail_shift_back_long);
			}
		}
		return IntToChar(data->ppd_opt->shift_back_long);
	case ID_CNSHIFTBKSHORTEDGE:
		if((option = GetUIValue(data, "CNEnableDetailShiftPosition")) != NULL){
			if(strcasecmp(option,"True") == 0){
				return DoubleToChar(data->ppd_opt->detail_shift_back_short);
			}
		}
		return IntToChar(data->ppd_opt->shift_back_short);
	case ID_CNSHIFTPOSITIONMAX:
		return cngplpGetValue(data,kPPD_Items_CNShiftPositionMax);
	case ID_CNSHIFTPOSITIONMIN:
		return cngplpGetValue(data,kPPD_Items_CNShiftPositionMin);
	case ID_CNJOBNOTE:
		if(data->ppd_opt->job_note == NULL)
			return NULL;
		else
		return ToChar(data->ppd_opt->job_note->note);
	case ID_CNJOBDETAILS:
		if(data->ppd_opt->job_note == NULL)
			return NULL;
		else
		return ToChar(data->ppd_opt->job_note->details);
	case ID_CNFINDETAILS:
      option = GetUIValue(data, kPPD_Items_CNFinDetails);
      if(option == NULL)
		return 0;
      return IntToChar((strcasecmp(option, "true") == 0) ? 1 : 0);
	case ID_CNOFFSETNUM:
		return IntToChar(data->ppd_opt->offset_num);
	case ID_CNUIOFFSETMAX:
		return cngplpGetValue(data,kPPD_Items_CNUIOffsetMax);
	case ID_CNGUTTERSHIFTNUM:
		return DoubleToChar2(data->ppd_opt->guttershiftnum_value_d);

	case ID_MAX_GUTTER_SHIFT_NUM:
		return cngplpGetValue(data,kPPD_Items_CNMAXGutterShiftNum);
	case ID_MIN_GUTTER_SHIFT_NUM:
		return cngplpGetValue(data,kPPD_Items_CNMINGutterShiftNum);
	case ID_CNTABSHIFT:
		return DoubleToChar(data->ppd_opt->tab_shift);
	case ID_DRIVERROOTPATH:
		if(data->ppd_opt->drv_root_path == NULL)
			return NULL;
		else
			return ToChar(data->ppd_opt->drv_root_path);
	case ID_CNMEDIABRANDLIST:
		return MakeMediaBrandListChar(data->ppd_opt);
	case ID_CNMEDIABRAND:
		return MakeMediaBrandChar(data->ppd_opt);
	case ID_CNINSERTMEDIABRANDLIST:
		return MakeInsertMediaBrandListChar(data->ppd_opt);
	case ID_CNINSERTMEDIABRAND:
		return MakeInsertMediaBrandChar(data->ppd_opt);
	case ID_CNINTERLEAFMEDIABRANDLIST:
		return MakeInterleafMediaBrandListChar(data->ppd_opt);
	case ID_CNINTERLEAFMEDIABRAND:
		return MakeInterleafMediaBrandChar(data->ppd_opt);
	case ID_CNPBINDCOVERMEDIABRANDLIST:
		return MakePBindCoverMediaBrandListChar(data->ppd_opt);
	case ID_CNPBINDCOVERMEDIABRAND:
		return MakePBindCoverMediaBrandChar(data->ppd_opt);
	case ID_CNINSERTTABSHIFT:
		return DoubleToChar(data->ppd_opt->ins_tab_shift);
	case ID_CNINSERTPOS:
		return ToChar(data->ppd_opt->ins_pos);
	case ID_CNINSERTPOSPAPERSOURCE:
		return ToChar(data->ppd_opt->ins_pos_papersource);
	case ID_CNINSERTPOSPRINTON:
		return ToChar(data->ppd_opt->ins_pos_printon);
	case ID_CNTABINSERTPOS:
		return ToChar(data->ppd_opt->tab_ins_pos);
	case ID_CNTABINSERTPOSPAPERSOURCE:
		return ToChar(data->ppd_opt->tab_ins_pos_papersource);
	case ID_CNTABINSERTPOSPRINTON:
		return ToChar(data->ppd_opt->tab_ins_pos_printon);
	case ID_CNTABINSERTMULTIPAPERNUMBER:
		return IntToChar(data->ppd_opt->tab_ins_multi_number);
	case ID_CNTABINSERTMULTIPAPERSOURCE:
		return ToChar(data->ppd_opt->tab_ins_multi_papersource);
	case ID_CNTABINSERTMULTIPAPERTYPE:
		return ToChar(data->ppd_opt->tab_ins_multi_papertype);
	case ID_CNBINNAME:
		return ToChar(data->ppd_opt->bin_name);
	case ID_CNBINNAME_ARRAY:
		return ToChar(data->ppd_opt->bin_name_array);
	case ID_CNOVERLAYFILENAME:
		if(data->ppd_opt->special == NULL)
			return NULL;
		else
		return ToChar(data->ppd_opt->special->form_name);
	case ID_CNFORMHANDLE:
		if(data->ppd_opt->special == NULL)
			return NULL;
		else
		return ToChar(data->ppd_opt->special->form_handle);
	case ID_CNFORMLIST:
		return MakeFormListChar(data->ppd_opt);
	case ID_CNADJUSTTRIMNUM:
		return DoubleToChar(data->ppd_opt->adjust_trim_num);
	case ID_CNUITRIMVALMAX:
		return cngplpGetValue(data, kPPD_Items_CNUITrimValMax);
	case ID_CNUITRIMVALMIN:
		return cngplpGetValue(data, kPPD_Items_CNUITrimValMin);
	case ID_CNADJUSTFORETRIMNUM:
		return DoubleToChar(data->ppd_opt->adjust_frtrim_num);
	case ID_CNADJUSTTOPBOTTOMTRIMNUM:
		return DoubleToChar(data->ppd_opt->adjust_tbtrim_num);
	case ID_CNPBINDFINISHFORETRIMNUM:
		return DoubleToChar(data->ppd_opt->pb_fin_fore_trim_num);
	case ID_CNPBINDFINISHTOPBOTTOMTRIMNUM:
		return DoubleToChar(data->ppd_opt->pb_fin_topbtm_trim_num);
	case ID_CNSENDTIMENUM:
		if(data->ppd_opt->fax_setting == NULL)
			return NULL;
		else
		return ToChar(data->ppd_opt->fax_setting->send_time);
	case ID_CNOUTSIDELINENUMBER:
		if(data->ppd_opt->fax_setting == NULL)
			return NULL;
		else
		return ToChar(data->ppd_opt->fax_setting->outside_line_number);
	case ID_CNOUTSIDELINENUMINTRA:
		if(data->ppd_opt->fax_setting == NULL)
			return NULL;
		else
		return ToChar(data->ppd_opt->fax_setting->outside_line_number_intra);
	case ID_CNOUTSIDELINENUMNGN:
		if(data->ppd_opt->fax_setting == NULL)
			return NULL;
		else
		return ToChar(data->ppd_opt->fax_setting->outside_line_number_ngn);
	case ID_CNOUTSIDELINENUMMYNUMBERNGN:
		if(data->ppd_opt->fax_setting == NULL)
			return NULL;
		else
		return ToChar(data->ppd_opt->fax_setting->outside_line_number_ngnmynum);
	case ID_CNOUTSIDELINENUMVOIP:
		if(data->ppd_opt->fax_setting == NULL)
			return NULL;
		else
		return ToChar(data->ppd_opt->fax_setting->outside_line_number_voip);
	case ID_CNSENDER:
		if(data->ppd_opt->fax_setting == NULL)
			return NULL;
		else
			return ToChar(data->ppd_opt->fax_setting->sender_name);
	case ID_HOLD_NAME:
		if(data->ppd_opt->special == NULL)
			return NULL;
		else
		return ToChar(data->ppd_opt->special->hold_name);
	case ID_HOLDQUEUE_DATANAME:
		if(data->ppd_opt->special == NULL)
			return NULL;
		else
		return IntToChar(data->ppd_opt->special->holddata_name);
	case ID_CNFEEDPAPERNAME:
		if(data->ppd_opt->feed_paper_name == NULL)
			return NULL;
		else
			return ToChar(data->ppd_opt->feed_paper_name);
	case ID_CNSADDLESETTING:
		option = IDtoPPDOption(id - 1);
		if(option == NULL)
			return NULL;
		return MakeCNSaddleSettingList(data->ppd_opt, option);
	case ID_CNSTACKCOPIESNUM:
		return IntToChar(data->ppd_opt->stack_copies_num);
	case ID_CNSADDLEPRESSADJUSTMENT:
		return IntToChar(data->ppd_opt->saddle_press_adjust);
	case ID_CNLISTIDSPECIALPRINTMODE:
		return IntToChar(data->ppd_opt->list_specialprintmode_value);
#ifndef	__APPLE__
	case ID_ENABLECNOFFSETNUM:
		return ToChar(GetUIValue(data, "EnableCNOffsetNum"));
	case ID_CNFOLDSETTING:
		option = IDtoPPDOption(id - 1);
		if(option == NULL){
			return NULL;
		}
		return MakeCNFoldSettingList(data->ppd_opt, option);
	case ID_CNPRINTSTYLE:
		option = IDtoPPDOption(id - 1);
		if(option == NULL){
			return NULL;
		}
		return MakeCNPrintStyleList(data->ppd_opt, option);
#endif
	case ID_PCFILENAME:
		return ToChar(data->ppd_opt->pcfile_name);
	case ID_MANUFACTURER:
		return ToChar(data->ppd_opt->manufacturer);
	case ID_NICKNAME:
		return ToChar(data->ppd_opt->nickname);
	case ID_CNPDLTYPE:
		return ToChar(data->ppd_opt->cnpdl_type);
	case ID_APPRINTERICONPATH:
		return ToChar(data->ppd_opt->ap_printer_icon_path);
	case ID_CONFLICTCNOFFSETNUM:
		return IntToChar(GetOffsetNumConflict(data));
	case ID_ENABLEINSERTPOSPAPERSOURCE:
		return MakeEnableInsertPosPaperSource(data, 0);
	case ID_ENABLETABINSERTPOSPAPERSOURCE:
		return MakeEnableInsertPosPaperSource(data, 1);
	default:
		option = IDtoPPDOption(id - 1);
		if(option == NULL)
			return NULL;
		return MakePPDOptionList(data->ppd_opt, option);
	}

	return NULL;
}
Exemple #14
0
char* GetDataCommonOption(cngplpData *data, int id)
{
	char *list = NULL;
	int i;
	char curr[256];
	char *option = NULL;
	int index = id - ID_COMMON_OPTION - 1;
	option = IDtoCommonOption(index);

	memset(curr, 0, 255);

	switch(id){
	case ID_PRINTERNAME:
		snprintf(curr, 255, "%s:%s<0>", data->curr_printer, data->printer_names[0]);
		list = AddList(list, curr);
		for(i = 1; i < data->printer_num; i++){
			char tmp[256];
			memset(tmp, 0, 255);
			snprintf(tmp, 255, "%s<0>", data->printer_names[i]);
			list = AddList(list, tmp);
		}
		break;
	case ID_NUMBER_UP:
		snprintf(curr, 255, "%s:%s<0>", GetCupsValue(data->cups_opt->common->option, "number-up"), NupTextValue_table[0].text);
		list = AddList(list, curr);
		for(i = 1; NupTextValue_table[i].text != NULL; i++){
			char tmp[256];
			memset(tmp, 0, 255);
			snprintf(tmp, 255, "%s<0>", NupTextValue_table[i].text);
			list = AddList(list, tmp);
		}
		break;
	case ID_FILTER:
		snprintf(curr, 255, "%s:%s<0>", GetCupsValue(data->cups_opt->common->option, "Filter"), g_filter_options[0]);
		list = AddList(list, curr);
		for(i = 1; g_filter_options[i] != NULL; i++){
			char tmp[256];
			memset(tmp, 0, 255);
			snprintf(tmp, 255, "%s<0>", g_filter_options[i]);
			list = AddList(list, tmp);
		}
		break;
	case ID_JOB_SHEETS_START:
		snprintf(curr, 255, "%s:%s<0>", GetCupsValue(data->cups_opt->common->option, "job-sheets-start"), g_banner_option[0]);
		list = AddList(list, curr);
		for(i = 1; g_banner_option[i] != NULL; i++){
			char tmp[256];
			memset(tmp, 0, 255);
			snprintf(tmp, 255, "%s<0>", g_banner_option[i]);
			list = AddList(list, tmp);
		}
		break;
	case ID_JOB_SHEETS_END:
		snprintf(curr, 255, "%s:%s<0>", GetCupsValue(data->cups_opt->common->option, "job-sheets-end"), g_banner_option[0]);
		list = AddList(list, curr);
		for(i = 1; g_banner_option[i] != NULL; i++){
			char tmp[256];
			memset(tmp, 0, 255);
			snprintf(tmp, 255, "%s<0>", g_banner_option[i]);
			list = AddList(list, tmp);
		}
		break;
	default:
		if(option != NULL)
			return ToChar(GetCupsValue(data->cups_opt->common->option, option));
		break;
	}
	return list;
}