Ejemplo n.º 1
0
WaveHeader::WaveHeader( int sampleRate,
					    int numSamples,
						int bytesPerSample,
						int bitsPerSample,
						int numChannels )
: _headerSize( HEADER_SIZE ),
  _sampleRate( sampleRate ),
  _numSamples( numSamples ),
  _bytesPerSample( bytesPerSample ),
  _bitsPerSample( bitsPerSample ),
  _numChannels( numChannels )
{
	memset( &_header, 0, sizeof(_header) );

	// Chunk id is four characters: "RIFF"
	SetStr4( CHUNK_ID_IDX, "RIFF" );
	
	// Chunk size is a 32 bit integer that stores size of the entire chunk of wave
	// data, i.e., the header plus samples.
	SetInt32(CHUNK_SIZE_IDX, CHUNK1_SIZE +
				   CHUNK_PREFIX_SIZE +
				   GetAudioDataSizeInBytes() );

    // Format contains the letters "WAVE"
	SetStr4( FORMAT_IDX, "WAVE" );

	// SubchunkID1 contains the letters "fmt ";
	SetStr4( SUB_CHUNK1_ID_IDX, "fmt " );

	// Subchunk size is a 32 bit integer that stores the number of
	// bytes following this number for this sub chunk.  (16 for PCM)
	SetInt16( SUB_CHUNK1_SIZE_IDX, 16 );

	// AudioFormat is PCM - indicated by the value 1
	SetInt16( AUDIO_FORMAT_IDX, 1 );

	// Set num channels as a 16 bit value;
	SetInt16( NUM_CHANNELS_IDX, _numChannels );

	// Sample rate
	SetInt32( SAMPLE_RATE_IDX, _sampleRate );

	// Byte rate
	SetInt32( BYTE_RATE_IDX, _sampleRate * _bytesPerSample * _numChannels );

	// Block alignment i.e. size of a frame of audio data.
	SetInt16( BLOCK_ALIGN_IDX, _numChannels * _bytesPerSample );

	// Bits per sample
	SetInt16( BITS_PER_SAMPLE, _bitsPerSample );

	// SUB_CHUNK2_ID_IDX - The letters "data".
	SetStr4( SUB_CHUNK2_ID_IDX, "data" );

	// SUB_CHUNK2_ID_SIZE_ID - Size, in bytes, of the audio data.
	SetInt32( SUB_CHUNK2_ID_SIZE_IDX, GetAudioDataSizeInBytes() );
}
Ejemplo n.º 2
0
Bool SmplMatrixDialog::InitValues(void)
{
	SetInt32(GADGET_SMPL_MATRIX_DOCUMENT_PREVIEW, document_preview);
	SetInt32(GADGET_SMPL_MATRIX_TEXTURE_MODE, settings->tile_flags == TILE_REPEAT_BORDER ? 0 : 1);

	SetPercent(GADGET_SMPL_MATRIX_SLIDER_MIX, settings->matrix_opacity, 0.0, 100.0, 0.1);
	SetFloat(GADGET_SMPL_MATRIX_SLIDER_ANGLE, Rad(settings->angle), Rad(MIN_ANGLE), Rad(MAX_ANGLE), Rad(STEP_ANGLE), FORMAT_DEGREE);
	SetInt32(GADGET_SMPL_MATRIX_TYPE_POPUP, settings->type);

	return true;
}
Ejemplo n.º 3
0
/*********************************************************************\
	Function name    : CCustomSubDialog::InitValues
	Description      :
	Created at       : 27.03.02, @ 12:07:33
	Created by       : Thomas Kunert
	Modified by      :
\*********************************************************************/
Bool CCustomSubDialog::InitValues(void)
{
    Int32 lID = FIRST_CUSTOM_ELEMENT_ID;
    Int32 i;

    CCustomElements* pElement = g_pCustomElements->GetItem(m_pElement->m_lElement);
    if (!pElement) return true;

    if (!m_pElement->m_pbcGUI) return true;
    BaseContainer* pBC = &m_pElement->m_pbcGUI[m_pElement->m_lElement];

    SetBool(IDC_CUSTOM_OPEN_CLOSE, pElement->m_bIsOpen);

    for (i = 0; m_pProp && m_pProp[i].type != CUSTOMTYPE_END; i++, lID++)
    {
        CustomProperty* pProp = &pElement->m_pProp[i];

        if (pProp->type == CUSTOMTYPE_FLAG) SetBool(lID, pBC, pProp->id);
        else if (pProp->type == CUSTOMTYPE_LONG) SetInt32(lID, pBC, pProp->id);
        else if (pProp->type == CUSTOMTYPE_REAL) SetFloat(lID, pBC, pProp->id);
        else if (pProp->type == CUSTOMTYPE_STRING) SetString(lID, pBC, pProp->id);
        else if (pProp->type == CUSTOMTYPE_VECTOR)
        {
            Vector v = pBC->GetVector(pProp->id);
            SetFloat(lID++,v.x);
            SetFloat(lID++,v.y);
            SetFloat(lID,v.z);
        }
    }

    return true;
}
Ejemplo n.º 4
0
void
PageSetupWindow::UpdateSetupMessage()
{
    SetInt32(fSetupMsg, "xres", 300);
    SetInt32(fSetupMsg, "yres", 300);
    SetInt32(fSetupMsg, "orientation", fCurrentOrientation);

    // Save scaling factor
    float scale = atoi(fScaleControl->Text());
    if (scale <= 0.0) scale = 100.0;
    if (scale > 1000.0) scale = 1000.0;
    SetFloat(fSetupMsg, "scale", scale);

    float scaleR = 100.0 / scale;
    BMenuItem *item = fPageSizeMenu->Menu()->FindMarked();
    if (item) {
        float w, h;
        BMessage *msg = item->Message();
        msg->FindFloat("width", &w);
        msg->FindFloat("height", &h);
        BRect r(0, 0, w, h);
        if (fCurrentOrientation == PrinterDriver::LANDSCAPE_ORIENTATION)
            r.Set(0, 0, h, w);

        SetRect(fSetupMsg, "preview:paper_rect", r);
        SetRect(fSetupMsg, "paper_rect", ScaleRect(r, scaleR));
        SetString(fSetupMsg, "preview:paper_size", item->Label());

        // Save the printable_rect
        BRect margin = fMarginView->Margin();
        if (fCurrentOrientation == PrinterDriver::PORTRAIT_ORIENTATION) {
            margin.right = w - margin.right;
            margin.bottom = h - margin.bottom;
        } else {
            margin.right = h - margin.right;
            margin.bottom = w - margin.bottom;
        }
        SetRect(fSetupMsg, "preview:printable_rect", margin);
        SetRect(fSetupMsg, "printable_rect", ScaleRect(margin, scaleR));

        SetInt32(fSetupMsg, "units", fMarginView->Unit());
    }
}
Ejemplo n.º 5
0
  Bool InitValues()
  {
    // Initialize the force items.
    FreeChildren(CMB_FORCE);
    AddForceCycleElement(ID_SPRING);
    AddForceCycleElement(ID_CONNECTOR);
    AddForceCycleElement(ID_MOTOR);
    SetInt32(CMB_FORCE, ID_CONNECTOR);

    SetInt32(CMB_TYPE, -1);
    SetInt32(CMB_MODE, CMB_MODE_ALL);
    SetInt32(EDT_MAXCONN, 0, 0, 20, 1, false, 0, LIMIT<Int32>::MAX);
    SetFloat(EDT_RADIUS, (Float) 0, 0, 500, 1.0, FORMAT_METER, 0, MAXVALUE_FLOAT, false, false);

    SetBool(CHK_ADDDYNAMICS, false);
    SetBool(CHK_COMPOUND, false);
    SetBool(CHK_CLOSED, false);

    UpdateGadgets(true);
    return super::InitValues();
  }
Ejemplo n.º 6
0
/*********************************************************************\
	Function name    : CArrowSettings::SetData
	Description      :
	Created at       : 12.08.01, @ 21:55:29
	Created by       : Thomas Kunert
	Modified by      :
\*********************************************************************/
void CArrowSettings::SetData()
{
	_Init();

	SetBool(IDS_ARROW_SMALL_CHK, m_pArrow->m_lArrowType > 4);
	Int32 l = m_pArrow->m_lArrowType;
	if (l > 4) l -= 4;
	SetInt32(IDS_ARROW_TYPE_COMBO, l - 1);
	SetBool(IDC_IS_POPUP_CHK, m_pArrow->m_bIsPopupButton);
	Enable(IDS_ARROW_SMALL_CHK, !m_pArrow->m_bIsPopupButton);
	Enable(IDS_ARROW_TYPE_COMBO, !m_pArrow->m_bIsPopupButton);
	Enable(IDC_ARROW_CHILD_ITEMS, m_pArrow->m_bIsPopupButton);

	m_pArrow->m_Children.FillEditBox(m_pSettingsDialog, IDC_ARROW_CHILD_ITEMS);
}
Ejemplo n.º 7
0
void PaletteSubDialog::FromContainer(const BaseContainer &bc)
{
    Int32 i=0;
    m_showLabel    = bc.GetBool(++i);
    m_rows         = bc.GetInt32(++i);
    m_layout       = bc.GetInt32(++i);
    m_searchString = bc.GetString(++i);
    m_paletteID    = bc.GetInt32(++i);
    
    if(m_rowArea != NULL){
        SetInt32(m_rowArea, m_rows);
    }
    if(m_layoutArea != NULL){
        SetInt32(m_layoutArea, m_layout);
    }
    if(m_labelCheckArea != NULL){
        SetBool(m_labelCheckArea,m_showLabel);
    }
    if(m_searchText != NULL){
        SetString(m_searchText, m_searchString);
    }
    
    m_controlsShown = !m_showControls;
}
Ejemplo n.º 8
0
	virtual Bool InitValues(void)
	{
		SetInt32(1006, Int32(0), 0, 10);

		BaseContainer shortcut;
		shortcut.SetInt32(0, 0);			// qual
		shortcut.SetInt32(1, KEY_F1);	// key

		BaseContainer m(BFM_VALUECHNG);
		m.SetContainer(BFM_ACTION_VALUE, shortcut);

		SendMessage(1004, m);

		return true;
	}
Ejemplo n.º 9
0
void CMdbPara::SetNumber(register uint32 nFieldNo, register void* pVal, register uint32 nOperator)
{
	switch(GetType(nFieldNo))
	{
	case MDB_INT8_FIELD:
		SetInt8(nFieldNo, *(int8*)pVal, nOperator);
		break;
	case MDB_INT16_FIELD:
		SetInt16(nFieldNo, *(int16*)pVal, nOperator);
		break;
	case MDB_INT32_FIELD:
		SetInt32(nFieldNo, *(int32*)pVal, nOperator);
		break;
	case MDB_INT64_FIELD:
		SetInt64(nFieldNo, *(int64*)pVal, nOperator);
		break;
	case MDB_UINT8_FIELD:
		SetUInt8(nFieldNo, *(uint8*)pVal, nOperator);
		break;
	case MDB_UINT16_FIELD:
		SetUInt16(nFieldNo, *(uint16*)pVal, nOperator);
		break;
	case MDB_UINT32_FIELD:
		SetUInt32(nFieldNo, *(uint32*)pVal, nOperator);
		break;
	case MDB_UINT64_FIELD:
		SetUInt64(nFieldNo, *(uint64*)pVal, nOperator);
		break;
	case MDB_FLOAT_FIELD:
		SetFloat(nFieldNo, *(float*)pVal, nOperator);
		break;
	case MDB_DOUBLE_FIELD:
		SetDouble(nFieldNo, *(double*)pVal, nOperator);
		break;
	case MDB_DATE_FIELD:
		SetDate(nFieldNo, *(CDate*)pVal, nOperator);
		break;
	case MDB_TIME_FIELD:
		SetTime(nFieldNo, *(CTime*)pVal, nOperator);
		break;
	case MDB_DATETIME_FIELD:
		SetDateTime(nFieldNo, *(CDateTime*)pVal, nOperator);
		break;
	}
}
Ejemplo n.º 10
0
Bool ApplinkDialog::InitValues(void)
{
	if (!GeDialog::InitValues()) return false;
    
	filenamePrefs = GeGetPluginPath()+ "preference.ini";
	dirty = false;
	
	AutoAlloc<HyperFile> hyperfilePrefs;
    
	if(!GeFExist(filenamePrefs, false))
	{
		if (!hyperfilePrefs->Open('coat', filenamePrefs.GetString(), FILEOPEN_WRITE, FILEDIALOG_ANY)) return false;
        
		gPreferences.SetString(IDC_TMP_FOLDER, "");
        
        Filename path;
#if defined _WIN32 || defined _WIN64
        path = GeGetC4DPath(C4D_PATH_MYDOCUMENTS);
#elif __APPLE__
        path = GeGetC4DPath(C4D_PATH_HOME);
#endif
		//file magic!
		Filename exFolder = path + "3D-CoatV3" + "Exchange";
		if(GeFExist(exFolder, true))
		{
			gPreferences.SetString(IDC_EXCH_FOLDER, exFolder.GetString());
		}
		else
		{
			exFolder = path + "3D-CoatV4" + "Exchange";
			if (GeFExist(exFolder, true))
			{
				gPreferences.SetString(IDC_EXCH_FOLDER, exFolder.GetString());
			}

			else
			{
				GePrint("Not Find");
#if defined _WIN32 || defined _WIN64
				GePrint(String("Folder ..\\MyDocuments\\3D-CoatV3\\Exchange not found!"));
#elif __APPLE__
				GePrint(String("Folder ../Users/admin/3D-CoatV3/Exchange  not found!"));
#endif
				gPreferences.SetString(IDC_EXCH_FOLDER, "");
			}
		}
        
		gPreferences.SetInt32(IDC_COMBO_MAP_TYPE, 0);
		gPreferences.SetBool(IDC_CHK_EXP_MAT, true);
		gPreferences.SetBool(IDC_CHK_EXP_UV, true);
		gPreferences.SetBool(IDC_CHK_SKIP_IMP_DIALOG, false);
		gPreferences.SetBool(IDC_CHK_SKIP_EXP_DIALOG, false);
        
		gPreferences.SetBool(IDC_CHK_IMP_MAT, true);
		gPreferences.SetInt32(IDC_COMBO_MAP_IMPORT, 0);
		gPreferences.SetBool(IDC_CHK_IMP_UV, true);
		gPreferences.SetBool(IDC_CHK_REPLACE, true);
		gPreferences.SetBool(IDC_CHK_PROMPT, false);
		
		gPreferences.SetString(IDC_COAT_EXE_PATH, "");
		gPreferences.SetBool(IDC_CHK_COAT_START, false);
        
		hyperfilePrefs->WriteContainer(gPreferences);
		hyperfilePrefs->Close();
	}
    
	if(!hyperfilePrefs->Open('coat', filenamePrefs.GetString(), FILEOPEN_READ, FILEDIALOG_ANY)) return false;
    
	hyperfilePrefs->ReadContainer(&gPreferences, true);
	hyperfilePrefs->Close();
    
	SetString(IDC_TMP_FOLDER, gPreferences.GetString(IDC_TMP_FOLDER));
	SetString(IDC_EXCH_FOLDER, gPreferences.GetString(IDC_EXCH_FOLDER));
    
	SetInt32(IDC_COMBO_MAP_TYPE, gPreferences.GetInt32(IDC_COMBO_MAP_TYPE));
	SetBool(IDC_CHK_EXP_MAT, gPreferences.GetBool(IDC_CHK_EXP_MAT));
	SetBool(IDC_CHK_EXP_UV, gPreferences.GetBool(IDC_CHK_EXP_UV));
	SetBool(IDC_CHK_SKIP_IMP_DIALOG, gPreferences.GetBool(IDC_CHK_SKIP_IMP_DIALOG));
	SetBool(IDC_CHK_SKIP_EXP_DIALOG, gPreferences.GetBool(IDC_CHK_SKIP_EXP_DIALOG));
    
	SetBool(IDC_CHK_IMP_MAT, gPreferences.GetBool(IDC_CHK_IMP_MAT));
	SetInt32(IDC_COMBO_MAP_IMPORT, gPreferences.GetInt32(IDC_COMBO_MAP_IMPORT));
	SetBool(IDC_CHK_IMP_UV, gPreferences.GetBool(IDC_CHK_IMP_UV));
	SetBool(IDC_CHK_REPLACE, gPreferences.GetBool(IDC_CHK_REPLACE));
	SetBool(IDC_CHK_PROMPT, gPreferences.GetBool(IDC_CHK_PROMPT));
	
	SetString(IDC_COAT_EXE_PATH, gPreferences.GetString(IDC_COAT_EXE_PATH));
	SetBool(IDC_CHK_COAT_START, gPreferences.GetBool(IDC_CHK_COAT_START));

    
#ifdef __APPLE__
    //------------ temp    
    //Enable(IDC_CHK_COAT_START, false);
    //Enable(IDC_COAT_EXE_PATH, false);    
    //-------------
//    SetString(IDS_STATIC12, "Folder ../Users/user/3D-CoatV3/Exchange  not found!");
#endif
    
	SetTimer(1000);
    
	return true;
}
Ejemplo n.º 11
0
bool Pb2Json::Json2Message(const Json& json, ProtobufMsg& message, bool str2enum) {
    auto descriptor = message.GetDescriptor();
    auto reflection = message.GetReflection();
    if (nullptr == descriptor || nullptr == reflection) return false;

    auto count = descriptor->field_count();
    for (auto i = 0; i < count; ++i) {
        const auto field = descriptor->field(i);
        if (nullptr == field) continue;

        auto& value = json[field->name()];
        if (value.is_null()) continue;

        if (field->is_repeated()) {
            if (!value.is_array()) {
                return false;
            } else {
                Json2RepeatedMessage(value, message, field, reflection, str2enum);
                continue;
            }
        }

        switch (field->type()) {
            case ProtobufFieldDescriptor::TYPE_BOOL: {
                if (value.is_boolean())
                    reflection->SetBool(&message, field, value.get<bool>());
                else if (value.is_number_integer())
                    reflection->SetBool(&message, field, value.get<uint32_t>() != 0);
                else if (value.is_string()) {
                    if (value.get<std::string>() == "true")
                        reflection->SetBool(&message, field, true);
                    else if (value.get<std::string>() == "false")
                        reflection->SetBool(&message, field, false);
                }
            } break;

            case ProtobufFieldDescriptor::TYPE_ENUM: {
                auto const* pedesc = field->enum_type();
                const ::google::protobuf::EnumValueDescriptor* pevdesc = nullptr;

                if (str2enum) {
                    pevdesc = pedesc->FindValueByName(value.get<std::string>());
                } else {
                    pevdesc = pedesc->FindValueByNumber(value.get<int>());
                }

                if (nullptr != pevdesc) {
                    reflection->SetEnum(&message, field, pevdesc);
                }
            } break;

            case ProtobufFieldDescriptor::TYPE_INT32:
            case ProtobufFieldDescriptor::TYPE_SINT32:
            case ProtobufFieldDescriptor::TYPE_SFIXED32: {
                if (value.is_number()) reflection->SetInt32(&message, field, value.get<int32_t>());
            } break;

            case ProtobufFieldDescriptor::TYPE_UINT32:
            case ProtobufFieldDescriptor::TYPE_FIXED32: {
                if (value.is_number()) reflection->SetUInt32(&message, field, value.get<uint32_t>());
            } break;

            case ProtobufFieldDescriptor::TYPE_INT64:
            case ProtobufFieldDescriptor::TYPE_SINT64:
            case ProtobufFieldDescriptor::TYPE_SFIXED64: {
                if (value.is_number()) reflection->SetInt64(&message, field, value.get<int64_t>());
            } break;
            case ProtobufFieldDescriptor::TYPE_UINT64:
            case ProtobufFieldDescriptor::TYPE_FIXED64: {
                if (value.is_number()) reflection->SetUInt64(&message, field, value.get<uint64_t>());
            } break;

            case ProtobufFieldDescriptor::TYPE_FLOAT: {
                if (value.is_number()) reflection->SetFloat(&message, field, value.get<float>());
            } break;

            case ProtobufFieldDescriptor::TYPE_DOUBLE: {
                if (value.is_number()) reflection->SetDouble(&message, field, value.get<double>());
            } break;

            case ProtobufFieldDescriptor::TYPE_STRING:
            case ProtobufFieldDescriptor::TYPE_BYTES: {
                if (value.is_string()) reflection->SetString(&message, field, value.get<std::string>());
            } break;

            case ProtobufFieldDescriptor::TYPE_MESSAGE: {
                if (value.is_object()) Json2Message(value, *reflection->MutableMessage(&message, field));
            } break;

            default:
                break;
        }
    }
    return true;
}
Ejemplo n.º 12
0
  void UpdateGadgets(Bool relevants=false)
  {
    Int32 mode;
    Bool add_dynamics;
    GetBool(CHK_ADDDYNAMICS, add_dynamics);
    GetInt32(CMB_MODE, mode);

    BaseDocument* doc = GetActiveDocument();
    BaseObject* op = doc ? doc->GetActiveObject() : nullptr;

    Enable(EDT_MAXCONN, mode != CMB_MODE_CHAIN);
    Enable(EDT_RADIUS, mode != CMB_MODE_CHAIN);
    Enable(CHK_CLOSED, mode == CMB_MODE_CHAIN);
    Enable(CHK_COMPOUND, add_dynamics);

    // Need at least two child objects on the active object.
    Bool execEnabled = op != nullptr && op->GetDown() != nullptr
        && op->GetDown()->GetNext() != nullptr;
    Enable(BTN_EXECUTE, execEnabled);

    if (relevants)
    {
      FreeChildren(CMB_TYPE);

      Int32 pluginid;
      GetInt32(CMB_FORCE, pluginid);

      do {
        BaseObject* op = BaseObject::Alloc(pluginid);
        if (!op) break;
        AutoFree<BaseObject> free(op);

        AutoAlloc<Description> desc;
        if (!op->GetDescription(desc, DESCFLAGS_DESC_0)) break;

        BaseContainer temp;
        AutoAlloc<AtomArray> arr;
        const BaseContainer* param = desc->GetParameter(FORCE_TYPE, temp, arr);
        if (!param) break;

        const BaseContainer* cycle = param->GetContainerInstance(DESC_CYCLE);
        if (!cycle) break;

        const BaseContainer* icons = param->GetContainerInstance(DESC_CYCLEICONS);

        Int32 i = 0;
        Int32 last_id = -1;
        while (true) {
          Int32 id = cycle->GetIndexId(i++);
          if (id == NOTOK) break;

          Int32 icon = icons ? icons->GetInt32(id) : -1;

          String name = cycle->GetString(id);
          if (name.Content()) {
            if (icon > 0) name += "&i" + String::IntToString(icon);
            if (last_id < 0) last_id = id;
            AddChild(CMB_TYPE, id, name);
          }
        }

        SetInt32(CMB_TYPE, last_id);
      } while (0);

      LayoutChanged(CMB_TYPE);
    }
  }
Ejemplo n.º 13
0
void
PageSetupWindow::_UpdateSetupMessage()
{
	SetInt32(fSetupMsg, "orientation", fCurrentOrientation);

	BMenuItem *item = fPDFCompatibilityMenu->Menu()->FindMarked();
	if (item)
		SetString(fSetupMsg, "pdf_compatibility", item->Label());

	SetInt32(fSetupMsg, "pdf_compression", fPDFCompressionSlider->Value());

	item = fPageSizeMenu->Menu()->FindMarked();
	if (item) {
		float w, h;
		BMessage *msg = item->Message();
		msg->FindFloat("width", &w);
		msg->FindFloat("height", &h);
		BRect r(0, 0, w, h);
		if (fCurrentOrientation == PrinterDriver::LANDSCAPE_ORIENTATION)
			r.Set(0, 0, h, w);

		// Save the printable_rect
		BRect margin = fMarginView->Margin();
		if (fCurrentOrientation == PrinterDriver::PORTRAIT_ORIENTATION) {
			margin.right = w - margin.right;
			margin.bottom = h - margin.bottom;
		} else {
			margin.right = h - margin.right;
			margin.bottom = w - margin.bottom;
		}

		SetRect(fSetupMsg, "paper_rect", r);
		SetRect(fSetupMsg, "printable_rect", margin);
		SetInt32(fSetupMsg, "units", fMarginView->Unit());
		SetString(fSetupMsg, "pdf_paper_size", item->Label());
	}

	BMessage fonts;
	if (fFonts->Archive(&fonts) == B_OK) {
		fSetupMsg->RemoveName("fonts");
		fSetupMsg->AddMessage("fonts", &fonts);
	}

	// advanced settings
	BString value;
	if (fAdvancedSettings.FindString("pdflib_license_key", &value) == B_OK)
		SetString(fSetupMsg, "pdflib_license_key", value);

	bool webLinks;
	if (fAdvancedSettings.FindBool("create_web_links", &webLinks) == B_OK)
		SetBool(fSetupMsg, "create_web_links", webLinks);

	float linkBorder;
	if (fAdvancedSettings.FindFloat("link_border_width", &linkBorder) == B_OK)
		SetFloat(fSetupMsg, "link_border_width", linkBorder);

	bool createBookmarks;
	if (fAdvancedSettings.FindBool("create_bookmarks", &createBookmarks) == B_OK)
		SetBool(fSetupMsg, "create_bookmarks", createBookmarks);

	if (fAdvancedSettings.FindString("bookmark_definition_file", &value) == B_OK)
		SetString(fSetupMsg, "bookmark_definition_file", value);

	bool createXrefs;
	if (fAdvancedSettings.FindBool("create_xrefs", &createXrefs) == B_OK)
		SetBool(fSetupMsg, "create_xrefs", createXrefs);

	if (fAdvancedSettings.FindString("xrefs_file", &value) == B_OK)
		SetString(fSetupMsg, "xrefs_file", value.String());

	int32 closeOption;
	if (fAdvancedSettings.FindInt32("close_option", &closeOption) == B_OK)
		SetInt32(fSetupMsg, "close_option", closeOption);
}
Ejemplo n.º 14
0
	virtual Bool InitValues(void)
	{
		SetInt32(1006, Int32(0), 0, 10);
		return true;
	}
Ejemplo n.º 15
0
void PaletteSubDialog::PaletteLayout()
{
    if(m_rowArea != NULL){
        GetInt32(m_rowArea, m_rows);
    }
    if(m_layoutArea != NULL){
        GetInt32(m_layoutArea, m_layout);
    }
    if(m_labelCheckArea != NULL){
        GetBool(m_labelCheckArea,m_showLabel);
    }
    if(m_searchText != NULL){
        GetString(m_searchText, m_searchString);
    }
    if(m_showControls && !m_controlsShown){
        LayoutFlushGroup(1);
        GroupBegin(51, BFV_SCALEFIT, 1, 0, String(), 0);
            m_nameArea = AddEditText(IDC_NAME, BFH_SCALEFIT);
            SetString(IDC_NAME, m_palette.m_name);
            
            GroupBegin(123,BFH_SCALEFIT,0,1,String(),0);
            String rowText("Rows");
            if(m_layout == 1){
                rowText = String("Columns");
            }
            AddStaticText(9, BFH_LEFT, 0, 0, rowText, 0);
            
            m_rowArea = AddEditNumberArrows(IDC_ROWS, BFH_RIGHT);
            GroupEnd();
            SetInt32(m_rowArea, m_rows,1,99);
            
            m_layoutArea = AddComboBox(IDC_LAYOUT_DIRECTION,BFH_LEFT);
            AddChild(m_layoutArea, 0, String("Horizontal"));
            AddChild(m_layoutArea, 1, String("Vertical"));
            SetInt32(m_layoutArea, m_layout);
            
            m_labelCheckArea = AddCheckbox(IDC_LABELCHECKBOX,BFH_LEFT,0,0,String("Show Labels"));
            SetBool(m_labelCheckArea, m_showLabel);
        
            AddStaticText(IDC_FILTERLABEL, BFH_CENTER, 0, 0, String("Filter:"), 0);
            m_searchText = AddEditText(IDC_SEARCHTEXT, BFH_SCALEFIT);
            SetString(m_searchText, m_searchString);
        
            m_controlsShown = TRUE;
        
			GroupBegin(142,BFV_SCALEFIT,1,0,String(),0);
				GroupBorderNoTitle(BORDER_THIN_IN);
				AddButton(IDC_CREATEMATERIAL, BFH_CENTER, 0, 0, String("Create Materials"));
				m_linkColor = AddCheckbox(IDC_LINKMATERIALS,BFH_LEFT,0,0,String("Link colors"));
			GroupEnd();
        
            AddButton(IDC_HIDE, BFH_CENTER, 0, 0, String("Hide Controls"));
        GroupEnd();
        
        GroupBegin(3,BFV_SCALEFIT,1,0,String(),0);
            m_actionPopup = AddPopupButton(3,BFH_LEFT);
            m_trashArea = AddUserArea(4, BFH_CENTER);
            AttachUserArea(m_trash, m_trashArea);
        GroupEnd();
        LayoutChanged(1);
    }
    if(!m_showControls && m_controlsShown){
        LayoutFlushGroup(1);
            GroupBegin(3,BFV_SCALEFIT,1,0,String(),0);
                m_actionPopup = AddPopupButton(3,BFH_LEFT);
                m_trashArea = AddUserArea(4, BFH_CENTER);
                AttachUserArea(m_trash, m_trashArea);
            GroupEnd();
        LayoutChanged(1);
        m_rowArea = NULL;
        m_layoutArea = NULL;
        m_labelCheckArea = NULL;
        m_searchText = NULL;
        m_controlsShown = FALSE;
    }
    
	LayoutFlushGroup(6);
    LayoutPalette();
	LayoutChanged(6);
}
Ejemplo n.º 16
0
//============================================================================
//		NNumber::SetValue : Set the value.
//----------------------------------------------------------------------------
bool NNumber::SetValue(const NVariant &theValue)
{	uint8_t					valueUInt8;
	uint16_t				valueUInt16;
	uint32_t				valueUInt32;
	uint64_t				valueUInt64;
	int8_t					valueSInt8;
	int16_t					valueSInt16;
	int32_t					valueSInt32;
	int64_t					valueSInt64;
	float32_t				valueFloat32;
	float64_t				valueFloat64;
	int						valueInt;
	long					valueLong;
	NString					valueString;



	// Set the value
	//
	// NVariant treats some unsized types as numeric, to support literal constants.
	if (theValue.GetValue(*this))
		; // Assigned to this

	else if (theValue.GetValue(valueUInt8))
		SetUInt8(valueUInt8);

	else if (theValue.GetValue(valueUInt16))
		SetUInt16(valueUInt16);
	
	else if (theValue.GetValue(valueUInt32))
		SetUInt32(valueUInt32);
	
	else if (theValue.GetValue(valueUInt64))
		SetUInt64(valueUInt64);
	
	else if (theValue.GetValue(valueSInt8))
		SetInt8(valueSInt8);
	
	else if (theValue.GetValue(valueSInt16))
		SetInt16(valueSInt16);
	
	else if (theValue.GetValue(valueSInt32))
		SetInt32(valueSInt32);
	
	else if (theValue.GetValue(valueSInt64))
		SetInt64(valueSInt64);
	
	else if (theValue.GetValue(valueFloat32))
		SetFloat32(valueFloat32);
	
	else if (theValue.GetValue(valueFloat64))
		SetFloat64(valueFloat64);
	
	else if (theValue.GetValue(valueInt))
		SetInt64(valueInt);
	
	else if (theValue.GetValue(valueLong))
		SetInt64(valueLong);
	
	else if (theValue.GetValue(valueString))
		return(SetValue(valueString));

	else
		return(false);

	return(true);
}
Ejemplo n.º 17
0
/*********************************************************************\
	Function name    : CGroupSettings::Command
	Description      :
	Created at       : 12.08.01, @ 09:31:10
	Created by       : Thomas Kunert
	Modified by      :
\*********************************************************************/
Bool CGroupSettings::Command(Int32 lID, const BaseContainer &msg)
{
	switch (lID)
	{
	case IDC_GROUP_TYPE_TAB:
		GetInt32(IDC_GROUP_TYPE_TAB, m_pGroup->m_lGroupType);
		((CItemSettingsDialog*)m_pSettingsDialog)->SetSelItem(m_pGroup);
		//SetInt32(IDC_BORDER_TAB, IDC_BORDER_SETTINGS1);

		Enable(IDC_SIMPLE_GROUP_BORDER_CHK, m_pGroup->m_lGroupType != 1);
		Enable(IDC_SIMPLE_GROUP_BORDER_COMBO, m_pGroup->m_lGroupType != 1);
		Enable(IDC_SIMPLE_GROUP_BORDER_NO_TITLE_CHK, (m_pGroup->m_lGroupType == 0) && m_pGroup->m_bHasBorder);
		Enable(IDC_HAS_BORDER_CHECKBOX, (m_pGroup->m_lGroupType == 0) && m_pGroup->m_bHasBorder && !m_pGroup->m_bBorderNoTitle);
		m_pGroup->ItemChanged();
		break;

	case IDC_GROUP_ROWS_EDIT:
		GetInt32(IDC_GROUP_ROWS_EDIT, m_pGroup->m_lRows);
		m_pGroup->m_lCols = 0;
		SetInt32(IDC_GROUP_COLS_EDIT, m_pGroup->m_lCols);
		SetInt32(IDC_GROUP_COLS_EDIT1, m_pGroup->m_lCols);
		m_pGroup->ItemChanged();
		break;
	case IDC_GROUP_COLS_EDIT:
		GetInt32(IDC_GROUP_COLS_EDIT, m_pGroup->m_lCols);
		m_pGroup->m_lRows = 0;
		SetInt32(IDC_GROUP_ROWS_EDIT, m_pGroup->m_lRows);
		SetInt32(IDC_GROUP_ROWS_EDIT1, m_pGroup->m_lRows);
		m_pGroup->ItemChanged();
		break;
	case IDC_GROUP_ROWS_EDIT1:
		GetInt32(IDC_GROUP_ROWS_EDIT1, m_pGroup->m_lRows);
		m_pGroup->m_lCols = 0;
		SetInt32(IDC_GROUP_ROWS_EDIT, m_pGroup->m_lRows);
		SetInt32(IDC_GROUP_COLS_EDIT, m_pGroup->m_lCols);
		SetInt32(IDC_GROUP_COLS_EDIT1, m_pGroup->m_lCols);
		m_pGroup->ItemChanged();
		break;
	case IDC_GROUP_COLS_EDIT1:
		GetInt32(IDC_GROUP_COLS_EDIT1, m_pGroup->m_lCols);
		m_pGroup->m_lRows = 0;
		SetInt32(IDC_GROUP_COLS_EDIT, m_pGroup->m_lCols);
		SetInt32(IDC_GROUP_ROWS_EDIT, m_pGroup->m_lRows);
		SetInt32(IDC_GROUP_ROWS_EDIT1, m_pGroup->m_lRows);
		m_pGroup->ItemChanged();
		break;
	case IDC_GROUP_EQUALCOLS_CHK:
	case IDC_GROUP_EQUALROWS_CHK:
	case IDC_GROUP_ALLOW_WEIGHTS_CHK:
		{
		Bool b;
		m_pGroup->m_lGroupFlags = 0;
		GetBool(IDC_GROUP_EQUALCOLS_CHK, b); if (b) m_pGroup->m_lGroupFlags |= BFV_GRIDGROUP_EQUALCOLS;
		GetBool(IDC_GROUP_EQUALROWS_CHK, b); if (b) m_pGroup->m_lGroupFlags |= BFV_GRIDGROUP_EQUALROWS;
		GetBool(IDC_GROUP_ALLOW_WEIGHTS_CHK, b); if (b) m_pGroup->m_lGroupFlags |= BFV_GRIDGROUP_ALLOW_WEIGHTS;
		m_pGroup->ItemChanged();
		break;
																}
	case IDC_TAB_GROUP_TYPE_COMBO:
		GetInt32(IDC_TAB_GROUP_TYPE_COMBO, m_pGroup->m_lTabType);
		m_pGroup->ItemChanged();
		break;

	case IDC_SCROLL_GROUP_VERT_CHK:
	case IDC_SCROLL_GROUP_HORZ_CHK:
	case IDC_SCROLL_GROUP_NOBLIT_CHK:
	case IDC_SCROLL_GROUP_LEFT_CHK:
	case IDC_SCROLL_GROUP_BORDERIN_CHK:
	case IDC_SCROLL_GROUP_STATUSBAR_CHK:
	case IDC_SCROLL_GROUP_AUTOHORIZ_CHK:
	case IDC_SCROLL_GROUP_AUTOVERT_CHK: {
		Bool b;
		m_pGroup->m_lScrollType = 0;
		GetBool(IDC_SCROLL_GROUP_VERT_CHK, b); if (b) m_pGroup->m_lScrollType |= SCROLLGROUP_VERT;
		GetBool(IDC_SCROLL_GROUP_HORZ_CHK, b); if (b) m_pGroup->m_lScrollType |= SCROLLGROUP_HORIZ;
		GetBool(IDC_SCROLL_GROUP_NOBLIT_CHK, b); if (b) m_pGroup->m_lScrollType |= SCROLLGROUP_NOBLIT;
		GetBool(IDC_SCROLL_GROUP_LEFT_CHK, b); if (b) m_pGroup->m_lScrollType |= SCROLLGROUP_LEFT;
		GetBool(IDC_SCROLL_GROUP_BORDERIN_CHK, b); if (b) m_pGroup->m_lScrollType |= SCROLLGROUP_BORDERIN;
		GetBool(IDC_SCROLL_GROUP_STATUSBAR_CHK, b); if (b) m_pGroup->m_lScrollType |= SCROLLGROUP_STATUSBAR;
		GetBool(IDC_SCROLL_GROUP_AUTOHORIZ_CHK, b); if (b) m_pGroup->m_lScrollType |= SCROLLGROUP_AUTOHORIZ;
		GetBool(IDC_SCROLL_GROUP_AUTOVERT_CHK, b); if (b) m_pGroup->m_lScrollType |= SCROLLGROUP_AUTOVERT;
		m_pGroup->ItemChanged();
		break;
																			}
	case IDC_SIMPLE_GROUP_BORDER_CHK:
		GetBool(IDC_SIMPLE_GROUP_BORDER_CHK, m_pGroup->m_bHasBorder);
		Enable(IDC_SIMPLE_GROUP_BORDER_COMBO, m_pGroup->m_bHasBorder);
		Enable(IDC_SIMPLE_GROUP_BORDER_NO_TITLE_CHK, (m_pGroup->m_lGroupType == 0) && m_pGroup->m_bHasBorder);
		Enable(IDC_HAS_BORDER_CHECKBOX, (m_pGroup->m_lGroupType == 0) && m_pGroup->m_bHasBorder && !m_pGroup->m_bBorderNoTitle);
		m_pGroup->ItemChanged();
		break;
	case IDC_SIMPLE_GROUP_BORDER_COMBO:
		GetInt32(IDC_SIMPLE_GROUP_BORDER_COMBO, m_pGroup->m_lBorderStyle);
		if (m_pGroup->m_lLeftBorder == 0 && m_pGroup->m_lRightBorder == 0 && m_pGroup->m_lTopBorder == 0 && m_pGroup->m_lBottomBorder == 0 &&
				m_pGroup->m_lBorderStyle != BORDER_NONE)
		{
			m_pGroup->m_lLeftBorder = m_pGroup->m_lRightBorder = m_pGroup->m_lTopBorder = m_pGroup->m_lBottomBorder = 4;
			SetInt32(IDC_BW_LEFT_EDIT, m_pGroup->m_lLeftBorder);
			SetInt32(IDC_BW_RIGHT_EDIT, m_pGroup->m_lRightBorder);
			SetInt32(IDC_BW_TOP_EDIT, m_pGroup->m_lTopBorder);
			SetInt32(IDC_BW_BOTTOM_EDIT, m_pGroup->m_lBottomBorder);
		}
		// lint -fallthrough
	case IDC_SIMPLE_GROUP_BORDER_NO_TITLE_CHK:
		GetBool(IDC_SIMPLE_GROUP_BORDER_NO_TITLE_CHK, m_pGroup->m_bBorderNoTitle);
		Enable(IDC_HAS_BORDER_CHECKBOX, (m_pGroup->m_lGroupType == 0) && m_pGroup->m_bHasBorder && !m_pGroup->m_bBorderNoTitle);
		m_pGroup->ItemChanged();
		break;

	case IDC_BW_LEFT_EDIT:
	case IDC_BW_RIGHT_EDIT:
	case IDC_BW_TOP_EDIT:
	case IDC_BW_BOTTOM_EDIT:
		GetInt32(IDC_BW_LEFT_EDIT, m_pGroup->m_lLeftBorder);
		GetInt32(IDC_BW_RIGHT_EDIT, m_pGroup->m_lRightBorder);
		GetInt32(IDC_BW_TOP_EDIT, m_pGroup->m_lTopBorder);
		GetInt32(IDC_BW_BOTTOM_EDIT, m_pGroup->m_lBottomBorder);
		m_pGroup->ItemChanged();
		break;
	case IDC_SPACE_X_EDIT:
	case IDC_SPACE_Y_EDIT:
		GetInt32(IDC_SPACE_X_EDIT, m_pGroup->m_lSpaceX);
		GetInt32(IDC_SPACE_Y_EDIT, m_pGroup->m_lSpaceY);
		m_pGroup->ItemChanged();
		break;
	case IDC_HAS_BORDER_CHECKBOX:
		GetBool(IDC_HAS_BORDER_CHECKBOX, m_pGroup->m_bHasTitleCheckbox);
		m_pGroup->ItemChanged();
		break;
	}
	return true;
}
Ejemplo n.º 18
0
/*********************************************************************\
	Function name    : CGroupSettings::SetData
	Description      :
	Created at       : 12.08.01, @ 09:24:31
	Created by       : Thomas Kunert
	Modified by      :
\*********************************************************************/
void CGroupSettings::SetData()
{
	_Init();

	SetInt32(IDC_GROUP_TYPE_TAB, m_pGroup->m_lGroupType);

	SetInt32(IDC_GROUP_ROWS_EDIT, m_pGroup->m_lRows, 0);
	SetInt32(IDC_GROUP_COLS_EDIT, m_pGroup->m_lCols, 0);
	SetInt32(IDC_GROUP_ROWS_EDIT1, m_pGroup->m_lRows, 0);
	SetInt32(IDC_GROUP_COLS_EDIT1, m_pGroup->m_lCols, 0);
	SetBool(IDC_GROUP_EQUALCOLS_CHK, m_pGroup->m_lGroupFlags & BFV_GRIDGROUP_EQUALCOLS);
	SetBool(IDC_GROUP_EQUALROWS_CHK, m_pGroup->m_lGroupFlags & BFV_GRIDGROUP_EQUALROWS);
	SetInt32(IDC_SIMPLE_GROUP_BORDER_COMBO, m_pGroup->m_lBorderStyle);
	SetBool(IDC_SIMPLE_GROUP_BORDER_CHK, m_pGroup->m_bHasBorder);
	SetBool(IDC_SIMPLE_GROUP_BORDER_NO_TITLE_CHK, m_pGroup->m_bBorderNoTitle);
	Enable(IDC_SIMPLE_GROUP_BORDER_COMBO, m_pGroup->m_bHasBorder);
	Enable(IDC_SIMPLE_GROUP_BORDER_NO_TITLE_CHK, (m_pGroup->m_lGroupType == 0) && m_pGroup->m_bHasBorder);
	SetInt32(IDC_BW_LEFT_EDIT, m_pGroup->m_lLeftBorder);
	SetInt32(IDC_BW_RIGHT_EDIT, m_pGroup->m_lRightBorder);
	SetInt32(IDC_BW_TOP_EDIT, m_pGroup->m_lTopBorder);
	SetInt32(IDC_BW_BOTTOM_EDIT, m_pGroup->m_lBottomBorder);
	SetInt32(IDC_SPACE_X_EDIT, m_pGroup->m_lSpaceX, -1);
	SetInt32(IDC_SPACE_Y_EDIT, m_pGroup->m_lSpaceY, -1);
	SetBool(IDC_GROUP_ALLOW_WEIGHTS_CHK, m_pGroup->m_lGroupFlags & BFV_GRIDGROUP_ALLOW_WEIGHTS);

	SetInt32(IDC_TAB_GROUP_TYPE_COMBO, m_pGroup->m_lTabType);

	SetBool(IDC_SCROLL_GROUP_VERT_CHK, m_pGroup->m_lScrollType & SCROLLGROUP_VERT);
	SetBool(IDC_SCROLL_GROUP_HORZ_CHK, m_pGroup->m_lScrollType & SCROLLGROUP_HORIZ);
	SetBool(IDC_SCROLL_GROUP_NOBLIT_CHK, m_pGroup->m_lScrollType & SCROLLGROUP_NOBLIT);
	SetBool(IDC_SCROLL_GROUP_LEFT_CHK, m_pGroup->m_lScrollType & SCROLLGROUP_LEFT);
	SetBool(IDC_SCROLL_GROUP_BORDERIN_CHK, m_pGroup->m_lScrollType & SCROLLGROUP_BORDERIN);
	SetBool(IDC_SCROLL_GROUP_STATUSBAR_CHK, m_pGroup->m_lScrollType & SCROLLGROUP_STATUSBAR);
	SetBool(IDC_SCROLL_GROUP_AUTOHORIZ_CHK, m_pGroup->m_lScrollType & SCROLLGROUP_AUTOHORIZ);
	SetBool(IDC_SCROLL_GROUP_AUTOVERT_CHK, m_pGroup->m_lScrollType & SCROLLGROUP_AUTOVERT);

	SetBool(IDC_HAS_BORDER_CHECKBOX, m_pGroup->m_bHasTitleCheckbox);
	Enable(IDC_HAS_BORDER_CHECKBOX, (m_pGroup->m_lGroupType == 0) && m_pGroup->m_bHasBorder && !m_pGroup->m_bBorderNoTitle);
}