Ejemplo n.º 1
0
BroadPhase::BroadPhase(void) : needsResync(false)
{
    first = 0;
    second = 1;
    third = 2;
    overlapMask = (unsigned char*)malloc(sizeof(unsigned char) * 2500);
    for (int i = 0; i < 8; ++i)
    {
        overlapBitMask[i] = 1 << i;
    }
    maxPairs = 10000;
    maskByteSize = 2500;
    for (int i = 0; i < 10; ++i)
    {
        bodies.push_back(new RigidBody());
    }
    memset(overlapMask, 0, sizeof(unsigned char) * maskByteSize);
    SetMask(0, 4, 1);
    SetMask(5, 5, 0);
    SetMask(1, 4, 0);
    SetMask(2, 6, 1);
    if (!CheckMask(0, 4, 1) || !CheckMask(5, 5, 0) || !CheckMask(1, 4, 0) || !CheckMask(2, 6, 1))
    {
        int k = 0;
    }
    if (CheckMask(3, 7, 1) || CheckMask(2, 8, 0) || CheckMask(3, 1, 1) || CheckMask(2, 9, 9))
    {
        int k = 0;
    }
    for (int i = 0; i < 10; ++i)
    {
        delete bodies[i];
    }
    bodies.clear();
}
Ejemplo n.º 2
0
void imprimetela(WINDOW *w1, PIC P, PIC P1, MASK msk1, PIC P2, MASK msk2, int posx1, int posy1, int posx2, int posy2){
	PutPic(w1, P, 0, 0, 801, 801, 0, 0);
	SetMask(w1, msk1);
	PutPic(w1, P1, 0, 0, 35, 35, posx1, posy1);
	UnSetMask(w1);
	SetMask(w1, msk2);
	PutPic(w1, P2, 0, 0, 35, 35, posx2, posy2);
	UnSetMask(w1);
}
Ejemplo n.º 3
0
void Mask::LoadMaskAndAbortOnFailure(const char *maskFileName)
{
    int retval=SetMask (maskFileName);
    if (retval)
       exit (EXIT_FAILURE);
    validateMask();
}
Ejemplo n.º 4
0
// setup gui elements and signal/slot connections
void QmitkGibbsTrackingView::CreateQtPartControl( QWidget *parent )
{
  // build up qt view, unless already done
  if ( !m_Controls )
  {
    // create GUI widgets from the Qt Designer's .ui file
    m_Controls = new Ui::QmitkGibbsTrackingViewControls;
    m_Controls->setupUi( parent );

    AdvancedSettings();

    connect( m_TrackingTimer, SIGNAL(timeout()), this, SLOT(TimerUpdate()) );
    connect( m_Controls->m_TrackingStop, SIGNAL(clicked()), this, SLOT(StopGibbsTracking()) );
    connect( m_Controls->m_TrackingStart, SIGNAL(clicked()), this, SLOT(StartGibbsTracking()) );
    connect( m_Controls->m_SetMaskButton, SIGNAL(clicked()), this, SLOT(SetMask()) );
    connect( m_Controls->m_SetGfaButton, SIGNAL(clicked()), this, SLOT(SetGfaImage()) );
    connect( m_Controls->m_AdvancedSettingsCheckbox, SIGNAL(clicked()), this, SLOT(AdvancedSettings()) );
    connect( m_Controls->m_SaveTrackingParameters, SIGNAL(clicked()), this, SLOT(SaveTrackingParameters()) );
    connect( m_Controls->m_LoadTrackingParameters, SIGNAL(clicked()), this, SLOT(LoadTrackingParameters()) );
    connect( m_Controls->m_IterationsSlider, SIGNAL(valueChanged(int)), this, SLOT(SetIterations(int)) );
    connect( m_Controls->m_ParticleWidthSlider, SIGNAL(valueChanged(int)), this, SLOT(SetParticleWidth(int)) );
    connect( m_Controls->m_ParticleLengthSlider, SIGNAL(valueChanged(int)), this, SLOT(SetParticleLength(int)) );
    connect( m_Controls->m_InExBalanceSlider, SIGNAL(valueChanged(int)), this, SLOT(SetInExBalance(int)) );
    connect( m_Controls->m_FiberLengthSlider, SIGNAL(valueChanged(int)), this, SLOT(SetFiberLength(int)) );
    connect( m_Controls->m_ParticleWeightSlider, SIGNAL(valueChanged(int)), this, SLOT(SetParticleWeight(int)) );
    connect( m_Controls->m_StartTempSlider, SIGNAL(valueChanged(int)), this, SLOT(SetStartTemp(int)) );
    connect( m_Controls->m_EndTempSlider, SIGNAL(valueChanged(int)), this, SLOT(SetEndTemp(int)) );
  }
Ejemplo n.º 5
0
LONG CSerialEx::StopListener (DWORD dwTimeout)
{
	// Check if the thread is running
	if (m_hThread)
	{
		// Set the flag that the thread must be stopped
		m_fStopping = true;

		// Cancel the pending WaitEvent, but we won't do this using
		// CancelIo. This would break Win95 compatibility and some
		// USB serial dongles cannot handle CancelIo correctly. By
		// setting the event mask again, the call will also be
		// completed before the thread exits.
		SetMask(GetEventMask());
		
		// Wait until the watcher thread has stopped
		::WaitForSingleObject(m_hThread,dwTimeout);

		// The thread has stopped
		m_fStopping = false;

		// Close handle to the thread
		::CloseHandle(m_hThread);
		m_hThread = 0;
	}

	// Return the error
	m_lLastError = ERROR_SUCCESS;
	return m_lLastError;
}
Ejemplo n.º 6
0
MaskedDateReader :: MaskedDateReader( const string & mask,
                                      const string & months,
                                      unsigned int ybase ) {
    SetMask( mask );
    SetYearBase( ybase );
    SetMonths( months );
}
Ejemplo n.º 7
0
BOOL Gadgets2NetworkPrefs(struct NetPEditor_DATA *data)

{
    STRPTR str = NULL;
    IPTR lng = 0;

    GET(data->netped_deviceString, MUIA_String_Contents, &str);
    SetDevice(str);
    GET(data->netped_IPString, MUIA_String_Contents, &str);
    SetIP(str);
    GET(data->netped_maskString, MUIA_String_Contents, &str);
    SetMask(str);
    GET(data->netped_gateString, MUIA_String_Contents, &str);
    SetGate(str);
    GET(data->netped_DNSString[0], MUIA_String_Contents, &str);
    SetDNS(0, str);
    GET(data->netped_DNSString[1], MUIA_String_Contents, &str);
    SetDNS(1, str);
    GET(data->netped_hostString, MUIA_String_Contents, &str);
    SetHost(str);
    GET(data->netped_domainString, MUIA_String_Contents, &str);
    SetDomain(str);
    GET(data->netped_DHCPState, MUIA_Cycle_Active, &lng);
    SetDHCP(lng);
    GET(data->netped_Autostart, MUIA_Selected, &lng);
    SetAutostart(lng);

    return TRUE;
}
void
select_scanned_file_dlg::set_column_image(size_t column,
                                          int image) {
  auto item = wxListItem{};
  item.SetMask(wxLIST_MASK_IMAGE);
  item.SetImage(image);
  m_lc_files->SetColumn(column, item);
}
Ejemplo n.º 9
0
void SGameMtlPair::FillProp(PropItemVec& items)
{
	PropValue::TOnChange OnChange	= 0;
    u32 show_CB			= 0;
    SGameMtlPair* P		= 0;
    if (ID_parent!=GAMEMTL_NONE_ID){ 
       	OnChange.bind	(this,&SGameMtlPair::OnFlagChange);
        show_CB		    = PropItem::flShowCB;
	    P				= m_Owner->GetMaterialPair(ID_parent);
    }
    ButtonValue* B;
    B					= PHelper().CreateButton(items,		"Command",			"Set As Parent To...",0);
    B->OnBtnClickEvent.bind(this,&SGameMtlPair::OnCommandClick);
    B					= PHelper().CreateButton(items,		"Parent", 			P?m_Owner->MtlPairToName(P->GetMtl0(),P->GetMtl1()):NONE_CAPTION,0);
    B->OnBtnClickEvent.bind(this,&SGameMtlPair::OnParentClick);
    
    propBreakingSounds	= PHelper().CreateChoose	(items,	"Breaking Sounds",	&BreakingSounds, 	smSoundSource, 0,0, GAMEMTL_SUBITEM_COUNT);
    propStepSounds		= PHelper().CreateChoose	(items,	"Step Sounds",		&StepSounds, 		smSoundSource, 0,0, GAMEMTL_SUBITEM_COUNT+2);
    propCollideSounds	= PHelper().CreateChoose	(items,	"Collide Sounds",	&CollideSounds, 	smSoundSource, 0,0, GAMEMTL_SUBITEM_COUNT);
    propCollideParticles= PHelper().CreateChoose	(items,	"Collide Particles",&CollideParticles, 	smParticles, 0,0, GAMEMTL_SUBITEM_COUNT);
    propCollideMarks	= PHelper().CreateChoose	(items,	"Collide Marks",	&CollideMarks,		smTexture, 0,0, GAMEMTL_SUBITEM_COUNT);

    propBreakingSounds->Owner()->m_Flags.assign	(SetMask(show_CB,OwnProps,flBreakingSounds));
    propStepSounds->Owner()->m_Flags.assign		(SetMask(show_CB,OwnProps,flStepSounds));
    propCollideSounds->Owner()->m_Flags.assign	(SetMask(show_CB,OwnProps,flCollideSounds));
    propCollideParticles->Owner()->m_Flags.assign(SetMask(show_CB,OwnProps,flCollideParticles));
    propCollideMarks->Owner()->m_Flags.assign	(SetMask(show_CB,OwnProps,flCollideMarks));

    propBreakingSounds->OnChangeEvent			= OnChange;
    propStepSounds->OnChangeEvent				= OnChange;
    propCollideSounds->OnChangeEvent			= OnChange;
    propCollideParticles->OnChangeEvent			= OnChange;
    propCollideMarks->OnChangeEvent				= OnChange;

    if (show_CB)
    {
		SGameMtlPair* O; 
    	if (0!=(O=GetLastParentValue(this,flBreakingSounds)))	BreakingSounds	= O->BreakingSounds;
    	if (0!=(O=GetLastParentValue(this,flStepSounds))) 		StepSounds		= O->StepSounds;
    	if (0!=(O=GetLastParentValue(this,flCollideSounds))) 	CollideSounds	= O->CollideSounds;
    	if (0!=(O=GetLastParentValue(this,flCollideParticles))) CollideParticles= O->CollideParticles;
    	if (0!=(O=GetLastParentValue(this,flCollideMarks))) 	CollideMarks	= O->CollideMarks;
    }
}
Ejemplo n.º 10
0
/*****************************************************************
関数名	: SetUpServer
機能	: クライアントとのコネクションを設立し,
		  ユーザーの名前の送受信を行う
引数	: int		num		  : クライアント数
出力	: コネクションに失敗した時-1,成功した時0
*****************************************************************/
int SetUpServer(int num)
{
    struct sockaddr_in	server;
    int			request_soc;
    int                 maxfd;
    int			val = 1;
 
	int i;
    for (i=0;i<MAX_CLIENTS;i++){
	clientsRPS[i] = NOTHING_COMMAND;
    }
    /* 引き数チェック */
    assert(0<num && num<=MAX_CLIENTS);

    gClientNum = num;
    bzero((char*)&server,sizeof(server));
    server.sin_family = AF_INET;
    server.sin_port = htons(PORT);
    server.sin_addr.s_addr = htonl(INADDR_ANY);

    /* ソケットを作成する */
    if((request_soc = socket(AF_INET,SOCK_STREAM,0)) < 0){
		fprintf(stderr,"Socket allocation failed\n");
		return -1;
    }
    setsockopt(request_soc,SOL_SOCKET,SO_REUSEADDR,&val,sizeof(val));

    /* ソケットに名前をつける */
    if(bind(request_soc,(struct sockaddr*)&server,sizeof(server))==-1){
		fprintf(stderr,"Cannot bind\n");
		close(request_soc);
		return -1;
    }
    fprintf(stderr,"Successfully bind!\n");
    
    /* クライアントからの接続要求を待つ */
    if(listen(request_soc, gClientNum) == -1){
		fprintf(stderr,"Cannot listen\n");
		close(request_soc);
		return -1;
    }
    fprintf(stderr,"Listen OK\n");

    /* クライアントと接続する */
    maxfd = MultiAccept(request_soc, gClientNum);
    close(request_soc);
    if(maxfd == -1)return -1;

    /* 全クライアントの全ユーザー名を送る */
    SendAllName();

    /* select()のためのマスク値を設定する */
    SetMask(maxfd);

    return 0;
}
Ejemplo n.º 11
0
status_t
InterfaceAddress::SetTo(const ifaliasreq& request)
{
	status_t status = SetLocal((const sockaddr*)&request.ifra_addr);
	if (status == B_OK)
		status = SetDestination((const sockaddr*)&request.ifra_broadaddr);
	if (status == B_OK)
		status = SetMask((const sockaddr*)&request.ifra_mask);

	return status;
}
Ejemplo n.º 12
0
LONG CSerial::SetEventChar (BYTE bEventChar, bool fAdjustMask)
{
	// Reset error state
	m_lLastError = ERROR_SUCCESS;

	// Check if the device is open
	if (m_hFile == 0)
	{
		// Set the internal error code
		m_lLastError = ERROR_INVALID_HANDLE;

		// Issue an error and quit
		_RPTF0(_CRT_WARN,"CSerial::SetEventChar - Device is not opened\n");
		return m_lLastError;
	}

	// Obtain the DCB structure for the device
	CDCB dcb;
	if (!::GetCommState(m_hFile,&dcb))
	{
		// Obtain the error code
		m_lLastError = ::GetLastError();

		// Display a warning
		_RPTF0(_CRT_WARN,"CSerial::SetEventChar - Unable to obtain DCB information\n");
		return m_lLastError;
	}

	// Set the new event character
	dcb.EvtChar = char(bEventChar);

	// Adjust the event mask, to make sure the event will be received
	if (fAdjustMask)
	{
		// Enable 'receive event character' event.  Note that this
		// will generate an EEventNone if there is an asynchronous
		// WaitCommEvent pending.
		SetMask(GetEventMask() | EEventRcvEv);
	}

	// Set the new DCB structure
	if (!::SetCommState(m_hFile,&dcb))
	{
		// Obtain the error code
		m_lLastError = ::GetLastError();

		// Display a warning
		_RPTF0(_CRT_WARN,"CSerial::SetEventChar - Unable to set DCB information\n");
		return m_lLastError;
	}

	// Return successful
	return m_lLastError;
}
Ejemplo n.º 13
0
/***************************************************
OnSetFocus
	Retrieves the cells input mask
Params:
	See CWnd::OnSetFocus
Return
	See CWnd::OnSetFocus
****************************************************/
void CUGMaskedEdit::OnSetFocus(CWnd* pOldWnd) 
{
	
	SetMask(m_ctrl->m_editCell.GetMask());

	m_cancel = FALSE;
	m_continueFlag = FALSE;

	SetSel(0,-1);
	
	CEdit::OnSetFocus(pOldWnd);
}
Ejemplo n.º 14
0
/*****************************************************************
関数名	: SetUpClient
機能	: サーバーとのコネクションを設立し,
		  ユーザーの名前の送受信を行う
引数	: char	*hostName		: ホスト
		  int	*num			: 全クライアント数
		  char	clientNames[][]		: 全クライアントのユーザー名
出力	: コネクションに失敗した時-1,成功した時0
*****************************************************************/
int SetUpClient(char *hostName,int *clientID,int *num,char clientNames[][MAX_NAME_SIZE])
{
    struct hostent	*servHost;
    struct sockaddr_in	server;
    int			len;
    char		str[BUF_SIZE];

/*変更点 フラグを作成してクライアントがすでに情報を送ったあとに結果がくるまで変更できないようにする*/
    buttonlock = 0;
    /* ホスト名からホスト情報を得る */
    if((servHost = gethostbyname(hostName))==NULL){
		fprintf(stderr,"Unknown host\n");
		return -1;
    }

    bzero((char*)&server,sizeof(server));
    server.sin_family = AF_INET;
    server.sin_port = htons(PORT);
    bcopy(servHost->h_addr,(char*)&server.sin_addr,servHost->h_length);

    /* ソケットを作成する */
    if((gSocket = socket(AF_INET,SOCK_STREAM,0)) < 0){
		fprintf(stderr,"socket allocation failed\n");
		return -1;
    }

    /* サーバーと接続する */
    if(connect(gSocket,(struct sockaddr*)&server,sizeof(server)) == -1){
		fprintf(stderr,"cannot connect\n");
		close(gSocket);
		return -1;
    }
    fprintf(stderr,"connected\n");

    /* 名前を読み込みサーバーに送る */
    do{
		printf("Enter Your Name\n");
		fgets(str,BUF_SIZE,stdin);
		len = strlen(str)-1;
		str[len]='\0';
    }while(len>MAX_NAME_SIZE-1 || len==0);
    SendData(str,MAX_NAME_SIZE);

    printf("Please Wait\n");

    /* 全クライアントのユーザー名を得る */
    GetAllName(clientID,num,clientNames);

    /* select()のためのマスク値を設定する */
    SetMask();
    
    return 0;
}
Ejemplo n.º 15
0
void COXCalendarEdit::SetDateFormat(LPCTSTR lpszDateFormat)
{
	m_strDateFormat = lpszDateFormat;
	m_strDateFormat.MakeUpper();

	// Set the masked edit format
	CString strMaskedEditFormat(m_strDateFormat);
	strMaskedEditFormat.Replace('D', '#');
	strMaskedEditFormat.Replace('M', '#');
	strMaskedEditFormat.Replace('Y', '#');
	SetMask(strMaskedEditFormat);
}
Ejemplo n.º 16
0
/** 
 * @brief Set filter.
 *
 * Simple-to-use function to select filter. This function determines
 * filter type so caller doesn't need to care about it.
 *
 * @param [in] filter File mask or filter name.
 * @return TRUE if given filter was set, FALSE if default filter was set.
 * @note If function returns FALSE, you should ask filter set with
 * GetFilterNameOrMask().
 */
BOOL FileFilterHelper::SetFilter(const String &filter)
{
	// If filter is empty string set default filter
	if (filter.empty())
	{
		UseMask(TRUE);
		SetMask(_T("*.*"));
		SetFileFilterPath(_T(""));
		return FALSE;
	}

	// Remove leading and trailing whitespace characters from the string.
	String flt = string_trim_ws(filter);

	// Star means we have a file extension mask
	if (flt[0] == '*')
	{
		UseMask(TRUE);
		SetMask(flt.c_str());
		SetFileFilterPath(_T(""));
	}
	else
	{
		CString path = GetFileFilterPath(flt.c_str());
		if (!path.IsEmpty())
		{
			UseMask(FALSE);
			SetFileFilterPath(path);
		}
		// If filter not found with given name, use default filter
		else
		{
			UseMask(TRUE);
			SetMask(_T("*.*"));
			SetFileFilterPath(_T(""));
			return FALSE;
		}
	}
	return TRUE;
}
void CXTPPropertyGridItemDate::Init(const COleDateTime& oleDate)
{
	m_nFlags = xtpGridItemHasComboButton | xtpGridItemHasEdit;
	m_strFormat = _T("%d/%m/%Y");
	m_strValue = _T("00/00/0000");
	m_strNullValue.Empty();

	SetMask(_T("00/00/0000"), _T("__/__/____"));

	SetDate(oleDate);

	EnableAutomation();
	m_strDefaultValue = m_strValue;
}
Ejemplo n.º 18
0
wxMaskController::wxMaskController(const wxString& mask, const wxString &value)
        : m_bInsertMode(TRUE), m_chPromptSymbol(chSPACE),
			m_chIntlDecimal(chPERIOD), m_chIntlThousands(chCOMMA), m_chIntlTime(chCOLON), m_chIntlDate(chSLASH),
			m_bAutoTab(FALSE), m_bBackwardLocationRight(TRUE), m_dtMinDateTime(wxInvalidDateTime),
			m_dtDateTime(wxInvalidDateTime), m_dtMaxDateTime(wxInvalidDateTime),
			m_bNeedValidation(TRUE), m_bValidation(FALSE)
{
	SetMask(wxString(mask));
	
	SetValue( (wxString&)value );

	if(m_listData.GetCount() != 0)
		Update();
}
Ejemplo n.º 19
0
status_t
FFont::Unflatten(type_code c, const void *buf, ssize_t size)
{
    if( c != FONT_TYPE ) return B_BAD_TYPE;

    // Make sure buffer contains all data.  If we later want
    // to add new attributes, we can make a more sophisticated
    // check to allow partial structures.
    if( size < sizeof(flat_font_data) ) return B_BAD_VALUE;

    // Easy reference to the buffer.
    flat_font_data* fdat = (flat_font_data*)buf;

    // Initialize from default font, just in case.
    *this = FFont();

    // Set up family and style for font.
    SetFamilyAndStyle(fdat->family,fdat->style);

    // This is used as a temporary when byte-swapping floats.
    // Note that this assumes a float is 4 bytes.
    union {
        uint32 aslong;
        float asfloat;
    } swap;

    // Byte-swap size, shear, and rotation out of the flattened
    // structure.  This is written for clarity more than speed,
    // since the additional overhead will be entirely subsumed
    // by everything else going on.
    swap.asfloat = fdat->size;
    swap.aslong = ntohl(swap.aslong);
    SetSize(swap.asfloat);
    swap.asfloat = fdat->shear;
    swap.aslong = ntohl(swap.aslong);
    SetShear(swap.asfloat);
    swap.asfloat = fdat->rotation;
    swap.aslong = ntohl(swap.aslong);
    SetRotation(swap.asfloat);

    // Byte-swap the remaining data from the flattened structure.
    SetFlags(ntohl(fdat->flags));
    SetFace(ntohs(fdat->face));
    SetSpacing(fdat->spacing);
    SetEncoding(fdat->encoding);
    SetMask(ntohl(fdat->mask));

    return B_NO_ERROR;
}
Ejemplo n.º 20
0
FileFilterParams::FileFilterParams():
	FDate(),
	FSize(),
	FHardLinks(),
	FAttr(),
	FHighlight(),
	FFlags()
{
	SetMask(1,L"*");

	std::for_each(RANGE(FHighlight.Colors.Color, i)
	{
		MAKE_OPAQUE(i.FileColor.ForegroundColor);
		MAKE_OPAQUE(i.MarkColor.ForegroundColor);
	});
Ejemplo n.º 21
0
HRESULT CLR_RT_HeapBlock_XmlNameTable::Grow()
{
    TINYCLR_HEADER();
    
    CLR_RT_HeapBlock_Array*              oldEntries;
    CLR_RT_HeapBlock                     newEntriesHB;
    CLR_RT_HeapBlock_Array*              newEntries;
    CLR_RT_HeapBlock_XmlNameTable_Entry* entry;
    CLR_RT_HeapBlock_XmlNameTable_Entry* next;
    CLR_RT_HeapBlock*                    newEntryHB;

    CLR_UINT32                           i;
    CLR_INT32                            newIndex;
    CLR_INT32                            newMask;

    newMask = GetMask() * 2 + 1;

    // allocate a new instance of Entry array
    TINYCLR_CHECK_HRESULT(CLR_RT_HeapBlock_Array::CreateInstance( newEntriesHB, newMask + 1, g_CLR_RT_WellKnownTypes.m_XmlNameTable_Entry ));

    newEntries = newEntriesHB.DereferenceArray();
    oldEntries = GetEntries();

    // Go through the old buckets, and resort them
    for(i = 0; i < oldEntries->m_numOfElements; i++)
    {
        entry = (CLR_RT_HeapBlock_XmlNameTable_Entry*)((CLR_RT_HeapBlock*)oldEntries->GetElement( i ))->Dereference();
    
        while(entry != NULL)
        {
            newIndex = entry->GetHashCode() & newMask;
            next = entry->GetNext();
    
            newEntryHB = (CLR_RT_HeapBlock*)newEntries->GetElement( newIndex );
    
            entry->SetNext( (CLR_RT_HeapBlock_XmlNameTable_Entry*)newEntryHB->Dereference() );
    
            newEntryHB->SetObjectReference( entry );
    
            entry = next;
        }
    }

    SetEntries( newEntries );
    SetMask   ( newMask    );

    TINYCLR_NOCLEANUP();
}
Ejemplo n.º 22
0
/*
*****************************************************************************
**函 数 名:void ReGather(BYTE period)
**功能描述:调整数据采集时间间隔  用GatDat->TempLoad[0]作缓存
**输    入: 
**输    出:
*****************************************************************************
*/
void ReGather(Uint8 period)
{
	SysDat.NumRegather++;
	if(period)
	{
		GatDat->TempLoad[0] = period*ParDat.TimeUnit;
		if(ParDat.TimeUnit==((BYTE)(GatDat->TempLoad[0]/96)+1))
			ParDat.TimeUnit = (BYTE)(GatDat->TempLoad[0]/96);
		else
			ParDat.TimeUnit = (BYTE)(GatDat->TempLoad[0]/96)+1;
	}
	else
	{
		ParDat.TimeUnit += 2;
	}
	SysDat.flagGather = 2;
	SetMask(SysDat.Flag,SYS_BE_WORKING);
	
}
Ejemplo n.º 23
0
OutPutAgent::OutPutAgent(const char  * const logfilename) : WObject( ), outMode(OUT_STDOUT), log( )
{
	SetMask(evPrint);

	if (logfilename != NULL)
	{
		log.SetFileName(logfilename);
		outMode |= OUT_FILE;
		log.OpenFile( );
	}
	/*
	else
	{
		log.SetFileName("mtp3.log");    // Set the default file name. Set the
										// module name as the log file name.
	}
	log.OpenFile( );
	*/
}
Ejemplo n.º 24
0
const FileFilterParams &FileFilterParams::operator=(const FileFilterParams &FF)
{
	if (this != &FF)
	{
		SetTitle(FF.GetTitle());
		const wchar_t *Mask;
		FF.GetMask(&Mask);
		SetMask(FF.GetMask(nullptr),Mask);
		FSize=FF.FSize;
		FDate=FF.FDate;
		FAttr=FF.FAttr;
		FF.GetColors(&FHighlight.Colors);
		FHighlight.SortGroup=FF.GetSortGroup();
		FHighlight.bContinueProcessing=FF.GetContinueProcessing();
		memcpy(FFlags,FF.FFlags,sizeof(FFlags));
	}

	return *this;
}
Ejemplo n.º 25
0
FileFilterParams::FileFilterParams()
{
    SetMask(1,L"*");
    SetSize(0,L"",L"");
    SetHardLinks(0,0,0);
    ClearStruct(FDate);
    ClearStruct(FAttr);
    ClearStruct(FHighlight.Colors);
    for(size_t i = 0; i < 2; ++i)
    {
        for(size_t j = 0; j < 4; ++j)
        {
            MAKE_OPAQUE(FHighlight.Colors.Color[i][j].ForegroundColor);
        }
    }

    FHighlight.SortGroup=DEFAULT_SORT_GROUP;
    FHighlight.bContinueProcessing=false;
    ClearAllFlags();
}
Ejemplo n.º 26
0
//  Gets the current mask if any.
//  If no mask exists then create one using fOn and fNoUndo.
//  bCreated is TRUE if a new mask was created. 
LPMASK CImage::GetMaskEx(BOOL fOn, BOOL fNoUndo, LPINT bCreated, LPRECT lpUpdateRect)
{
    LPMASK lpMask;
    LPFRAME lpFrame;
    FRMTYPEINFO TypeInfo;
    FRMDATATYPE FrameType = FDT_GRAYSCALE;

    AstralSetRectEmpty(lpUpdateRect);
    if (lpMask = GetMask())
    {
        if (bCreated)
            *bCreated = FALSE;
        return(lpMask);
    }
    lpFrame = GetBaseEditFrame();
    FrameGetTypeInfo(lpFrame, &TypeInfo);
    if (TypeInfo.DataType == FDT_LINEART && Mask.OneBitMask)
       FrameType = FDT_LINEART;
    if (!(lpMask = MaskCreate(NULL, FrameXSize(lpFrame),
                                FrameYSize(lpFrame),
                                fOn, 
                                fNoUndo, FrameType)))
    {
        Message( IDS_EMEMALLOC );
        return(NULL);
    }
	// sync up the resolution of the image data and the mask
	// don't ever rely on the mask's resolution being correct
	// cause other size can change the image data resolution
	// without changing the mask's resolution.  Also, there are
	// other places the mask gets created without syncing up
	// the resolution.  I am doing it here so we can begin
	// to track it correctly (Ted)
	FrameSetResolution(AlphaGetEditFrame(lpMask), FrameResolution(lpFrame));
    if (bCreated)
        *bCreated = TRUE;
    if (!Control.UseMaskAndObjects)
        GetObjectMarqueeRect(this, lpUpdateRect);
    SetMask(lpMask);
    return(lpMask);
}
Ejemplo n.º 27
0
// conversion to mono bitmap:
bool wxBitmap::CreateFromImageAsBitmap(const wxImage& img)
{
    // convert alpha channel to mask, if it is present:
    wxImage image(img);
    image.ConvertAlphaToMask();
    
    int width = image.GetWidth();
    int height = image.GetHeight();

    SetHeight( height );
    SetWidth( width );

    SetBitmap( gdk_pixmap_new( wxGetRootWindow()->window, width, height, 1 ) );

    SetDepth( 1 );

    GdkVisual *visual = wxTheApp->GetGdkVisual();

    // Create picture image

    unsigned char *data_data = (unsigned char*)malloc( ((width >> 3)+8) * height );

    GdkImage *data_image =
        gdk_image_new_bitmap( visual, data_data, width, height );

    // Create mask image

    GdkImage *mask_image = (GdkImage*) NULL;

    if (image.HasMask())
    {
        unsigned char *mask_data = (unsigned char*)malloc( ((width >> 3)+8) * height );

        mask_image =  gdk_image_new_bitmap( visual, mask_data, width, height );

        wxMask *mask = new wxMask();
        mask->m_bitmap = gdk_pixmap_new( wxGetRootWindow()->window, width, height, 1 );

        SetMask( mask );
    }
Ejemplo n.º 28
0
COXMaskedEdit::COXMaskedEdit(LPCTSTR pszMask/*=_T("")*/) : 
	m_bInsertMode(TRUE),
	m_chPromptSymbol(chSPACE),
	m_chIntlDecimal(chPERIOD),
	m_chIntlThousands(chCOMMA),
	m_chIntlTime(chCOLON),
	m_chIntlDate(chSLASH),
	m_bAutoTab(FALSE),
	m_nSetTextSemaphor(0),
	m_bNotifyParent(TRUE)
{
	int nLength;

	nLength=::GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_SDECIMAL, 
		&m_chIntlDecimal, 0);
	if(nLength)
	{
		::GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_SDECIMAL ,
			&m_chIntlDecimal, nLength);
	}
	nLength=::GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_STHOUSAND, 
		&m_chIntlThousands, 0);
	if(nLength)
	{
		::GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_STHOUSAND, 
			&m_chIntlThousands , nLength);
	}
	nLength=::GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_STIME, &m_chIntlTime, 0);
	if(nLength)
	{
		::GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_STIME, &m_chIntlTime, nLength);
	}
	nLength=::GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_SDATE, &m_chIntlDate, 0);
	if(nLength)
	{
		::GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_SDATE, &m_chIntlDate, nLength);
	}

	SetMask(pszMask);
}
Ejemplo n.º 29
0
LONG CSerial::Open (LPCTSTR lpszDevice, DWORD dwInQueue, DWORD dwOutQueue, bool fOverlapped)
{
	// Reset error state
	m_lLastError = ERROR_SUCCESS;

	// Check if the port isn't already opened
	if (m_hFile)
	{
		m_lLastError = ERROR_ALREADY_INITIALIZED;
		_RPTF0(_CRT_WARN,"CSerial::Open - Port already opened\n");
		return m_lLastError;
	}

	// Open the device
	m_hFile = ::CreateFile(lpszDevice,
						   GENERIC_READ|GENERIC_WRITE,
						   0,
						   0,
						   OPEN_EXISTING,
						   fOverlapped?FILE_FLAG_OVERLAPPED:0,
						   0);
	if (m_hFile == INVALID_HANDLE_VALUE)
	{
		// Reset file handle
		m_hFile = 0;

		// Display error
		m_lLastError = ::GetLastError();
		_RPTF0(_CRT_WARN, "CSerial::Open - Unable to open port\n");
		return m_lLastError;
	}

#ifndef SERIAL_NO_OVERLAPPED
	// We cannot have an event handle yet
	_ASSERTE(m_hevtOverlapped == 0);

	// Create the event handle for internal overlapped operations (manual reset)
	if (fOverlapped)
	{
		m_hevtOverlapped = ::CreateEvent(0,true,false,0);
		if (m_hevtOverlapped == 0)
		{
			// Obtain the error information
			m_lLastError = ::GetLastError();
			_RPTF0(_CRT_WARN,"CSerial::Open - Unable to create event\n");

			// Close the port
			::CloseHandle(m_hFile);
			m_hFile = 0;

			// Return the error
			return m_lLastError;
		}
	}
#else
	
	// Overlapped flag shouldn't be specified
	_ASSERTE(!fOverlapped);

#endif

	// Setup the COM-port
	if (dwInQueue || dwOutQueue)
	{
		// Make sure the queue-sizes are reasonable sized. Win9X systems crash
		// if the input queue-size is zero. Both queues need to be at least
		// 16 bytes large.
		_ASSERTE(dwInQueue >= 16);
		_ASSERTE(dwOutQueue >= 16);

		if (!::SetupComm(m_hFile,dwInQueue,dwOutQueue))
		{
			// Display a warning
			long lLastError = ::GetLastError();
			_RPTF0(_CRT_WARN,"CSerial::Open - Unable to setup the COM-port\n");

			// Close the port
			Close();

			// Save last error from SetupComm
			m_lLastError = lLastError;
			return m_lLastError;	
		}
	}

	// Setup the default communication mask
	SetMask();

	// Non-blocking reads is default
	SetupReadTimeouts(EReadTimeoutNonblocking);

	// Setup the device for default settings
 	COMMCONFIG commConfig = {0};
	DWORD dwSize = sizeof(commConfig);
	commConfig.dwSize = dwSize;
	if (::GetDefaultCommConfig(lpszDevice,&commConfig,&dwSize))
	{
		// Set the default communication configuration
		if (!::SetCommConfig(m_hFile,&commConfig,dwSize))
		{
			// Display a warning
			_RPTF0(_CRT_WARN,"CSerial::Open - Unable to set default communication configuration.\n");
		}
	}
	else
	{
		// Display a warning
		_RPTF0(_CRT_WARN,"CSerial::Open - Unable to obtain default communication configuration.\n");
	}

	// Return successful
	return m_lLastError;
}
Ejemplo n.º 30
0
 // set the HBITMAP to use as the mask
 void SetMask(HBITMAP hbmpMask)
 {
     SetMask(new wxMask((WXHBITMAP)hbmpMask));
 }