예제 #1
0
SSRVideoStreamWriter::SSRVideoStreamWriter(const std::string& channel, const std::string& source) {

    std::string stream_name = NumToString(hrt_time_micro()) + "-" + NumToString(getpid()) + "-" + source + "-" + GetProgramName();

    m_channel_directory = "/dev/shm/ssr-" + ((channel.empty())? "channel-" + GetUserName() : channel);
    m_filename_main = m_channel_directory + "/video-" + stream_name;
    m_page_size = sysconf(_SC_PAGE_SIZE);
    m_width = 0;
    m_height = 0;
    m_stride = 0;
    m_next_frame_time = hrt_time_micro();

    m_fd_main = -1;
    m_mmap_ptr_main = MAP_FAILED;
    m_mmap_size_main = 0;

    for(unsigned int i = 0; i < GLINJECT_RING_BUFFER_SIZE; ++i) {
        FrameData &fd = m_frame_data[i];
        fd.m_filename_frame = m_channel_directory + "/videoframe" + NumToString(i) + "-" + stream_name;
        fd.m_fd_frame = -1;
        fd.m_mmap_ptr_frame = MAP_FAILED;
        fd.m_mmap_size_frame = 0;
    }

    try {
        Init();
    } catch(...) {
        Free();
        throw;
    }

}
예제 #2
0
파일: Map.cpp 프로젝트: kchrome01/Bit-Box
void Map::printBlank(bool invert)
{

	int neg;
	std::string id, temp;
	if (!invert){
		neg = 0;
		xpass++;
		temp = "Blank";
		id = NumToString(xpass);
		temp += id;
	}
	else{
		neg = 1;
		ypass++;
		temp = "Inverse_Blank";
		id = NumToString(ypass);
		temp += id;
	}

	save(temp);
	std::ofstream fout(path);
	for (int r = 0; r < y; r++)
	{
		for (int c = 0; c < x; c++)
		{
			fout << neg;
			if (r != (y - 1) || c != (x - 1))
				fout << ", ";
		}
		fout << std::endl;
	}
}
static CFStringRef BIMCreatePortName( const ProcessSerialNumber *inProcessSerialNumber )
{
    CFMutableStringRef	portName;
    CFStringRef		processSerialNumberStringRef;
    Str255		processSerialNumberString;
    Str255		processSerialNumberLowString;

    //  Convert the high and low parts of the process serial number into a string.

    NumToString( inProcessSerialNumber->highLongOfPSN, processSerialNumberString );
    NumToString( inProcessSerialNumber->lowLongOfPSN, processSerialNumberLowString );
    BlockMoveData( processSerialNumberLowString + 1,
                   processSerialNumberString + processSerialNumberString [0] + 1,
                   processSerialNumberLowString [0] );
    processSerialNumberString [0] += processSerialNumberLowString [0];

    //  Create a CFString and append the process serial number string onto the end.

    portName = CFStringCreateMutableCopy( NULL, 255, CFSTR( kBasicServerPortName ) );
    processSerialNumberStringRef = CFStringCreateWithPascalString( NULL,
                                                                   processSerialNumberString,
                                                                   CFStringGetSystemEncoding() );
    CFStringAppend( portName, processSerialNumberStringRef );
    CFRelease( processSerialNumberStringRef );
    return portName;
}
예제 #4
0
void UpdateHistories(GPtr globals, DialogPtr dp, short count, Str255 hS)
{
	Str255 	s = "";
	Str255  n1 = "";
	Str255	n2 = "";
	Str255	nT = "";
	Str255	ss = "";
	long	x = gCurrentHistory + (kDHistTotal - 1);
	short	loop;

	PICopy(ss, hS, hS[0]+1); // make a new copy

	for (loop = gCurrentHistory; loop < gCurrentHistory + kDHistTotal; loop++)
	{
		GetHistory (globals, loop, s);
		if (loop == gCurrentHistory && !s[0])
		{
			PIGetString(kNoHistories, s);
			PIResetString(ss);
		}
		StuffText (dp, kDHistItem1 + (loop - gCurrentHistory), s);
		if (s[0] < 1 && x > loop-1)
			x = loop-1;
	}

	if (ss[0] > 0)
	{ // got the display string.  Populate it.
		NumToString(gCurrentHistory, n1);
		NumToString(x, n2);
		NumToString(count, nT);
		PIParamText(ss, n1, n2, nT);
	}
	StuffText (dp, kDStatusText, ss);
	// even if nothing, stuff empty or string in field
}
예제 #5
0
std::string cEpgsearchServiceHandler::ReadSetupValue(const std::string& entry)
{
   if (entry == "DefPriority") return NumToString(EPGSearchConfig.DefPriority);
   if (entry == "DefLifetime") return NumToString(EPGSearchConfig.DefLifetime);
   if (entry == "DefMarginStart") return NumToString(EPGSearchConfig.DefMarginStart);
   if (entry == "DefMarginStop") return NumToString(EPGSearchConfig.DefMarginStop);
   return "";
}
예제 #6
0
// Set the value of one of the members of a table's vector.
static void BuildVectorOfTable(const StructDef &struct_def,
                               const FieldDef &field,
                               std::string *code_ptr) {
  std::string &code = *code_ptr;
  code += "def " + struct_def.name + "Start";
  code += MakeCamel(field.name);
  code += "Vector(builder, numElems): return builder.StartVector(";
  auto vector_type = field.value.type.VectorType();
  auto alignment = InlineAlignment(vector_type);
  auto elem_size = InlineSize(vector_type);
  code += NumToString(elem_size);
  code += ", numElems, " + NumToString(alignment);
  code += ")\n";
}
예제 #7
0
// A single enum member.
static void EnumMember(const EnumVal ev, std::string *code_ptr) {
  std::string &code = *code_ptr;
  code += Indent;
  code += ev.name;
  code += " = ";
  code += NumToString(ev.value) + "\n";
}
예제 #8
0
// Most field accessors need to retrieve and test the field offset first,
// this is the prefix code for that.
std::string OffsetPrefix(const FieldDef &field) {
  return "\n" + Indent + Indent +
         "o = flatbuffers.number_types.UOffsetTFlags.py_type" +
         "(self._tab.Offset(" +
         NumToString(field.value.offset) +
         "))\n" + Indent + Indent + "if o != 0:\n";
}
예제 #9
0
/* デバッグファイルに数字を出力 */
void WriteNumToDebugFile(short num)
{
	Str255	str;
	
	NumToString(num,str);
	WriteStrToDebugFile(str);
}
예제 #10
0
McoStatus TechkonDialog::SetSheetStripText(void)
{
	Rect r;
	short itemType;
	Handle cn1;
	Str255 theString;
	int32 current_row;
	
	
GetDItem ( dp,ids[Cur_sheet], &itemType, (Handle*)&cn1, &r );
NumToString(current_strip+1,theString);
SetIText(cn1,theString);
GetDItem ( dp,ids[Cur_strip], &itemType, (Handle*)&cn1, &r );
current_row = current_patch % patch_per_strip;
if (current_row+1 > 26) 
	{
	theString[0] = 2;
	theString[1] = 'A';
	theString[2] = 'A'+current_row-26;
	}
else
	{
	theString[0] = 1;
	theString[1] = 'A'+current_row;
	}
SetIText(cn1,theString);
return MCO_SUCCESS;
}
SSRVideoStreamReader::SSRVideoStreamReader(const std::string& channel, const SSRVideoStream& stream) {

	m_stream = stream;
	m_channel_directory = "/dev/shm/ssr-" + ((channel.empty())? "channel-" + GetUserName() : channel);
	m_filename_main = m_channel_directory + "/video-" + stream.m_stream_name;
	m_page_size = sysconf(_SC_PAGE_SIZE);

	m_fd_main = -1;
	m_mmap_ptr_main = MAP_FAILED;
	m_mmap_size_main = 0;

	for(unsigned int i = 0; i < GLINJECT_RING_BUFFER_SIZE; ++i) {
		FrameData &fd = m_frame_data[i];
		fd.m_filename_frame = m_channel_directory + "/videoframe" + NumToString(i) + "-" + stream.m_stream_name;
		fd.m_fd_frame = -1;
		fd.m_mmap_ptr_frame = MAP_FAILED;
		fd.m_mmap_size_frame = 0;
	}

	try {
		Init();
	} catch(...) {
		Free();
		throw;
	}

}
예제 #12
0
// Ensure that integer values we parse fit inside the declared integer type.
static void CheckBitsFit(int64_t val, size_t bits) {
  auto mask = (1ll << bits) - 1;  // Bits we allow to be used.
  if (bits < 64 &&
      (val & ~mask) != 0 &&  // Positive or unsigned.
      (val |  mask) != -1)   // Negative.
    Error("constant does not fit in a " + NumToString(bits) + "-bit field");
}
예제 #13
0
파일: JACKInput.cpp 프로젝트: Faik-man/ssr
void JACKInput::PortConnectCallback(jack_port_id_t a, jack_port_id_t b, int connect, void* arg) {
	// This callback is called from the notification thread (not the realtime processing thread), so sadly the timing can never be fully accurate.
	// To make things worse, we're not allowed to connect/disconnect ports from this thread, so we have to send a command to the input thread instead.
	JACKInput *input = (JACKInput*) arg;
	if(input->m_connect_system_playback) {
		jack_port_t *port_a = jack_port_by_id(input->m_jack_client, a);
		if(port_a == NULL)
			return;
		jack_port_t *port_b = jack_port_by_id(input->m_jack_client, b);
		if(port_b == NULL)
			return;
		const char *port_a_name = jack_port_name(port_a);
		const char *port_b_name = jack_port_name(port_b);
		for(unsigned int i = 0; i < input->m_channels; ++i) {
			std::string playback_name = "system:playback_" + NumToString(i + 1);
			if(port_b_name == playback_name) {
				std::string port_name_full = std::string(jack_get_client_name(input->m_jack_client)) + ":in_" + NumToString(i + 1);
				SharedLock lock(&input->m_shared_data);
				ConnectCommand cmd;
				cmd.m_connect = connect;
				cmd.m_source = port_a_name;
				cmd.m_destination = port_name_full;
				lock->m_connect_commands.push_back(cmd);
			}
		}
	}
}
예제 #14
0
//---------------------------------------------------------------------------
static BaseString ParTextOf(int Error)
{
    switch(Error)
    {
        case 0 :                       return "";
        case errParAddressInUse      : return "PAR : Local address already in use";
        case errParNoRoom            : return "PAR : No more partners available";
        case errServerNoRoom         : return "PAR : No more servers available";
        case errParInvalidParams     : return "PAR : Invalid parameter supplied";
        case errParNotLinked         : return "PAR : Cannot perform, Partner not linked";
        case errParBusy              : return "PAR : Cannot perform, Partner Busy";
        case errParFrameTimeout      : return "PAR : Frame timeout";
        case errParInvalidPDU        : return "PAR : Invalid PDU received";
        case errParSendTimeout       : return "PAR : Send timeout";
        case errParRecvTimeout       : return "PAR : Recv timeout";
        case errParSendRefused       : return "PAR : Send refused by peer";
        case errParNegotiatingPDU    : return "PAR : Error negotiating PDU";
        case errParSendingBlock      : return "PAR : Error Sending Block";
        case errParRecvingBlock      : return "PAR : Error Receiving Block";
        case errParBindError         : return "PAR : Error Binding";
        case errParDestroying        : return "PAR : Cannot perform (destroying)";
        case errParInvalidParamNumber: return "PAR : Invalid Param Number";
        case errParCannotChangeParam : return "PAR : Cannot change this param now";
        case errParBufferTooSmall    : return "PAR : The buffer supplied is too small to accomplish the operation";
        default : return "PAR : Unknown error (0x"+NumToString(Error,16,8)+")";
    }

}
예제 #15
0
// Set the value of a table's field.
static void BuildFieldOfTable(const StructDef &struct_def,
                              const FieldDef &field,
                              const size_t offset,
                              std::string *code_ptr) {
  std::string &code = *code_ptr;
  code += "func " + struct_def.name + "Add" + MakeCamel(field.name);
  code += "(builder *flatbuffers.Builder, ";
  code += MakeCamel(field.name, false) + " ";
  if (!IsScalar(field.value.type.base_type) && (!struct_def.fixed)) {
    code += "flatbuffers.UOffsetT";
  } else {
    code += GenTypeBasic(field.value.type);
  }
  code += ") {\n";
  code += "\tbuilder.Prepend";
  code += GenMethod(field) + "Slot(";
  code += NumToString(offset) + ", ";
  if (!IsScalar(field.value.type.base_type) && (!struct_def.fixed)) {
    code += "flatbuffers.UOffsetT";
    code += "(";
    code += MakeCamel(field.name, false) + ")";
  } else {
    code += MakeCamel(field.name, false);
  }
  code += ", " + field.value.constant;
  code += ")\n}\n";
}
void drawPixelImageData()
{
	int				row, col;
	Rect			rect;
	unsigned char	value;
	char			*image;
	int				index = 0;
	Str255			string;
	RGBColor		color = { 32000, 32000, 32000 };
	//Byte			mode;
	Rect			tempRect1;
	
	ForeColor( blackColor );
	
	SetRect( &rect, 0, 0, 20, 20 );
	
	/* For this example, let's just use only the upper left corner of the image. */
	
	// Draw the offscreen image to the screen to see what it looks like.
	//CopyBits( (BitMap *)*gPixmap, &gWindow->portBits, &rect,
	//		&gWindow->portRect, srcCopy, 0 );
	//(**gPixmap).rowBytes ^= 0x8000;
	CopyBits( (BitMap *)*gPixmap, GetPortBitMapForCopyBits(GetWindowPort(gWindow)), &rect,
			GetPortBounds(GetWindowPort(gWindow), &tempRect1), srcCopy, 0 );
	//(**gPixmap).rowBytes ^= 0x8000;
	
	RGBForeColor( &color );
	
	// Again, set the pointer to the beginning of the pixel image.
	image = GetPixBaseAddr( gPixmap );
	
	/***************************************************************/
	/* Finally let's display the pixel values on top of the image. */
	/***************************************************************/
	
	/* Loop through the first 20 rows of the pixel image. */
	for (row = 0; row < rect.bottom; row++)
	{
		// Loop through the first 20 columns of the pixel image. 
		for (index = 0, col = 0; col < rect.right; col++)
		{
			// Get the value at this index into the pixel image. 
			value = (unsigned char)*(image + index);
			
			MoveTo( col * 30, row * 20 );
			LineTo( col * 30, (row + 1) * 20 );
			LineTo( (col + 1) * 30, (row + 1) * 20 );
			
			MoveTo( (col * 30) + 6, (row * 20) + 14 );
			NumToString( (long)value, string );
			DrawString( string );
			
			index++;
		}
		
		// Increment the pointer to the next row of the pixel image. 
		image += ((**gPixmap).rowBytes & 0x7fff);
	}
}
예제 #17
0
//---------------------------------------------------------------------------
static BaseString ReadSZLText(TSrvEvent &Event)
{
    BaseString Result="Read SZL request, ID:0x"+NumToString(Event.EvtParam1,16,4)+" INDEX:0x"+NumToString(Event.EvtParam2,16,4);
    if (Event.EvtRetCode == evrNoError)
        return Result+" --> OK";
    else
        return Result+" --> NOT AVAILABLE";
}
예제 #18
0
// Get the value of a table's starting offset.
static void GetStartOfTable(const StructDef &struct_def,
                            std::string *code_ptr) {
  std::string &code = *code_ptr;
  code += "func " + struct_def.name + "Start";
  code += "(builder *flatbuffers.Builder) {\n";
  code += "\tbuilder.StartObject(";
  code += NumToString(struct_def.fields.vec.size());
  code += ")\n}\n";
}
예제 #19
0
// Get the value of a table's starting offset.
static void GetStartOfTable(const StructDef &struct_def,
                            std::string *code_ptr) {
  std::string &code = *code_ptr;
  code += "def " + struct_def.name + "Start";
  code += "(builder): ";
  code += "builder.StartObject(";
  code += NumToString(struct_def.fields.vec.size());
  code += ")\n";
}
예제 #20
0
// A single enum member.
static void EnumMember(const EnumDef &enum_def, const EnumVal ev,
                       std::string *code_ptr) {
  std::string &code = *code_ptr;
  code += "\t";
  code += enum_def.name;
  code += ev.name;
  code += " = ";
  code += NumToString(ev.value) + "\n";
}
예제 #21
0
// Parses exactly nibbles worth of hex digits into a number, or error.
int64_t Parser::ParseHexNum(int nibbles) {
  for (int i = 0; i < nibbles; i++)
    if (!isxdigit(cursor_[i]))
      Error("escape code must be followed by " + NumToString(nibbles) +
            " hex digits");
  auto val = StringToInt(cursor_, 16);
  cursor_ += nibbles;
  return val;
}
예제 #22
0
// Recusively generate struct construction statements of the form:
// builder.putType(name);
// and insert manual padding.
static void GenStructBody(const StructDef &struct_def, std::string *code_ptr,
                          const char *nameprefix) {
  std::string &code = *code_ptr;
  code += "    builder.prep(" + NumToString(struct_def.minalign) + ", 0);\n";
  for (auto it = struct_def.fields.vec.rbegin();
       it != struct_def.fields.vec.rend();
       ++it) {
    auto &field = **it;
    if (field.padding)
      code += "    builder.pad(" + NumToString(field.padding) + ");\n";
    if (IsStruct(field.value.type)) {
      GenStructBody(*field.value.type.struct_def, code_ptr,
                    (field.value.type.struct_def->name + "_").c_str());
    } else {
      code += "    builder.put" + GenMethod(field) + "(";
      code += nameprefix + MakeCamel(field.name, false) + ");\n";
    }
  }
}
OSErr QTUtils_SetMovieTargetID (Movie theMovie, long theTargetID)
{
	UserData		myUserData = NULL;
	long			myID = 0;
	char 			*myString = NULL;
	Str255	 		myPString;
	char 			*myCString = NULL;
	Handle			myHandle = NULL;
	OSErr			myErr = noErr;

	// make sure we've got a movie
	if (theMovie == NULL)
		return(paramErr);
		
	// get the movie's user data list
	myUserData = GetMovieUserData(theMovie);
	if (myUserData == NULL)
		return(paramErr);

	// remove any existing movie target ID
	while (QTUtils_FindUserDataItemWithPrefix(myUserData, FOUR_CHAR_CODE('plug'), kMovieIDPrefix) != 0)
		RemoveUserData(myUserData, FOUR_CHAR_CODE('plug'), QTUtils_FindUserDataItemWithPrefix(myUserData, FOUR_CHAR_CODE('plug'), kMovieIDPrefix));

	// convert the ID into a string
	NumToString(theTargetID, myPString);
	myCString = QTUtils_ConvertPascalToCString(myPString);
	if (myCString == NULL)
		return(paramErr);
	
	// create the user data item data
	myString = malloc(strlen(kMovieIDPrefix) + strlen(myCString) + 2 + 1);	// 2 + 1 == '\"' + '\"' + '\0'
	if (myString != NULL) {
		myString[0] = '\0';
		strcat(myString, kMovieIDPrefix);
		strcat(myString, "\"");
		strcat(myString, myCString);
		strcat(myString, "\"");

		// add in a new user data item
		PtrToHand(myString, &myHandle, strlen(myString));
		if (myHandle != NULL)
			myErr = AddUserData(myUserData, myHandle, FOUR_CHAR_CODE('plug'));

	} else {
		myErr = memFullErr;
	}
	
	free(myString);
	free(myCString);
	
	if (myHandle != NULL)
		DisposeHandle(myHandle);
	
	return(myErr);
}
예제 #24
0
// Generate a flatbuffer schema from the Parser's internal representation.
std::string GenerateFBS(const Parser &parser, const std::string &file_name,
                        const GeneratorOptions &opts) {
  std::string schema;
  schema += "// Generated from " + file_name + ".proto\n\n";
  if (opts.include_dependence_headers) {
    int num_includes = 0;
    for (auto it = parser.included_files_.begin();
         it != parser.included_files_.end(); ++it) {
      auto basename = flatbuffers::StripPath(
                        flatbuffers::StripExtension(it->first));
      if (basename != file_name) {
        schema += "include \"" + basename + ".fbs\";\n";
        num_includes++;
      }
    }
    if (num_includes) schema += "\n";
  }
  schema += "namespace ";
  auto name_space = parser.namespaces_.back();
  for (auto it = name_space->components.begin();
           it != name_space->components.end(); ++it) {
    if (it != name_space->components.begin()) schema += ".";
    schema += *it;
  }
  schema += ";\n\n";
  // Generate code for all the enum declarations.
  for (auto it = parser.enums_.vec.begin();
           it != parser.enums_.vec.end(); ++it) {
    EnumDef &enum_def = **it;
    schema += "enum " + enum_def.name + " : ";
    schema += GenType(enum_def.underlying_type) + " {\n";
    for (auto itTmp = enum_def.vals.vec.begin();
         itTmp != enum_def.vals.vec.end(); ++itTmp) {
      auto &ev = **itTmp;
      schema += "  " + ev.name + " = " + NumToString(ev.value) + ",\n";
    }
    schema += "}\n\n";
  }
  // Generate code for all structs/tables.
  for (auto it = parser.structs_.vec.begin();
           it != parser.structs_.vec.end(); ++it) {
    StructDef &struct_def = **it;
    schema += "table " + struct_def.name + " {\n";
    for (auto itTmp = struct_def.fields.vec.begin();
             itTmp != struct_def.fields.vec.end(); ++itTmp) {
      auto &field = **itTmp;
      schema += "  " + field.name + ":" + GenType(field.value.type);
      if (field.value.constant != "0") schema += " = " + field.value.constant;
      if (field.required) schema += " (required)";
      schema += ";\n";
    }
    schema += "}\n\n";
  }
  return schema;
}
예제 #25
0
// Get the value of a struct's scalar.
static void GetScalarFieldOfStruct(const StructDef &struct_def,
                                   const FieldDef &field,
                                   std::string *code_ptr) {
  std::string &code = *code_ptr;
  std::string getter = GenGetter(field.value.type);
  GenReceiver(struct_def, code_ptr);
  code += MakeCamel(field.name);
  code += "(self): return " + getter;
  code += "self._tab.Pos + flatbuffers.number_types.UOffsetTFlags.py_type(";
  code += NumToString(field.value.offset) + "))\n";
}
예제 #26
0
//////////////////////////////////////////////////
// NAME : MakeLoadNumData
// PARM : void
// RETN : void
// DESC : 로드 수 정보 구성하기 //형식 : Search in 갯수 Urls & 갯수 Posts
// Date : 2006-01-03 coded by lizzy337, origin
//////////////////////////////////////////////////
void CDlg_Search::MakeLoadNumData()
{	
	//Url 수 가져오기
	//int nUrlCount = Url 수 가져오기()
	CString strUserCount;
	strUserCount = _T("");
	NumToString(theApp.m_nnetusercnt, strUserCount);
//	NumToString(100000, strUserCount);


	//Posts 수 가져오기
	//int nPostCount = Posts 수 가져오기();
	CString strPostCount;
	strPostCount = _T("");
	NumToString(theApp.m_nnetpostcnt, strPostCount);
//	NumToString(1000000000, strPostCount);

	m_strLoadCount = _T("");
	m_strLoadCount.Format(STR_DS_SEARCHPOST, strUserCount, strPostCount);
}
예제 #27
0
// Set the value of one of the members of a table's vector.
static void BuildVectorOfTable(const StructDef &struct_def,
                               const FieldDef &field,
                               std::string *code_ptr) {
  std::string &code = *code_ptr;
  code += "func " + struct_def.name + "Start";
  code += MakeCamel(field.name);
  code += "Vector(builder *flatbuffers.Builder, numElems int) ";
  code += "flatbuffers.UOffsetT { return builder.StartVector(";
  code += NumToString(InlineSize(field.value.type.VectorType()));
  code += ", numElems) }\n";
}
예제 #28
0
// Get a struct by initializing an existing struct.
// Specific to Struct.
static void GetStructFieldOfStruct(const StructDef &struct_def,
                                   const FieldDef &field,
                                   std::string *code_ptr) {
  std::string &code = *code_ptr;
  GenReceiver(struct_def, code_ptr);
  code += MakeCamel(field.name);
  code += "(self, obj):\n";
  code += Indent + Indent + "obj.Init(self._tab.Bytes, self._tab.Pos + ";
  code += NumToString(field.value.offset) + ")";
  code += "\n" + Indent + Indent + "return obj\n\n";
}
예제 #29
0
static void RunDialogTheSystem6or7Way(DialogRef theDialog)
{
	SInt16 itemHit;
	DialogItemType itemType;
	Handle itemHandle;
	Rect itemBox;
	
	BringToFront(GetDialogWindow(theDialog));
	
	do {
		ModalDialog(MySystem6or7DialogFilter, &itemHit);
		switch (itemHit)
		{
			case 2:
			{
				// we enable or disable the user item depending on whether the box is checked or not
				GetDialogItem(theDialog, itemHit, &itemType, &itemHandle, &itemBox);
				SInt16 enable = GetControlValue((ControlHandle)itemHandle);
				SetControlValue((ControlHandle)itemHandle, 1 - enable);
				GetDialogItem(theDialog, 13, &itemType, &itemHandle, &itemBox);
				SetDialogItem(theDialog, 13, enable?userItem+itemDisable:userItem, itemHandle, &itemBox);
				HideDialogItem(theDialog, 13);
				ShowDialogItem(theDialog, 13);
			}
				break;
			case 3: case 4: case 5: case 6: case 7:
			{
				// one radio button was chosen, let's adjust them all (we could also remember the last one...)
				int i;
				for (i = 3; i <= 7; i++)
				{
					GetDialogItem(theDialog, i, &itemType, &itemHandle, &itemBox);
					SetControlValue((ControlHandle)itemHandle, (i == itemHit)?1:0);
				}
			}
				break;
			case 14:
			{
				// the indicator of the scroll bar was moved so let's display the value in the first edit box
				// this is System 6 or 7 style so the controls can only handle 16 bits value (hence a max of 32767)
				GetDialogItem(theDialog, itemHit, &itemType, &itemHandle, &itemBox);
				SInt16 newValue = GetControlValue((ControlHandle)itemHandle);
				Str255 theStr;
				NumToString(newValue, theStr);
				GetDialogItem(theDialog, 9, &itemType, &itemHandle, &itemBox);
				SetDialogItemText(itemHandle, theStr);
				SelectDialogItemText(theDialog, 9, 0, 32767);
			}
				break;
		}
	} while (!(itemHit == ok));
	
	DisposeDialog(theDialog);
}
예제 #30
0
// Get the value of a struct's scalar.
static void GetScalarFieldOfStruct(const StructDef &struct_def,
                                   const FieldDef &field,
                                   std::string *code_ptr) {
  std::string &code = *code_ptr;
  std::string getter = GenGetter(field.value.type);
  GenReceiver(struct_def, code_ptr);
  code += " " + MakeCamel(field.name);
  code += "() " + TypeName(field) + " { return " + getter;
  code += "(rcv._tab.Pos + flatbuffers.UOffsetT(";
  code += NumToString(field.value.offset) + ")) }\n";
}