예제 #1
0
void LLPanel::initFromParams(const LLPanel::Params& p)
{
    //setting these here since panel constructor not called with params
    //and LLView::initFromParams will use them to set visible and enabled  
	setVisible(p.visible);
	setEnabled(p.enabled);
	setFocusRoot(p.focus_root);
	setSoundFlags(p.sound_flags);

	 // control_name, tab_stop, focus_lost_callback, initial_value, rect, enabled, visible
	LLUICtrl::initFromParams(p);
	
	// visible callback 
	if (p.visible_callback.isProvided())
	{
		setVisibleCallback(initCommitCallback(p.visible_callback));
	}
	
	for (LLInitParam::ParamIterator<LocalizedString>::const_iterator it = p.strings.begin();
		it != p.strings.end();
		++it)
	{
		mUIStrings[it->name] = it->value;
	}

	setLabel(p.label());
	setHelpTopic(p.help_topic);
	setShape(p.rect);
	parseFollowsFlags(p);

	setToolTip(p.tool_tip());
	setFromXUI(p.from_xui);
	
	mHoverCursor = getCursorFromString(p.hover_cursor);
	
	if (p.has_border)
	{
		addBorder(p.border);
	}
	// let constructors set this value if not provided
	if (p.use_bounding_rect.isProvided())
	{
		setUseBoundingRect(p.use_bounding_rect);
	}
	setDefaultTabGroup(p.default_tab_group);
	setMouseOpaque(p.mouse_opaque);
	
	setBackgroundVisible(p.background_visible);
	setBackgroundOpaque(p.background_opaque);
	setBackgroundColor(p.bg_opaque_color().get());
	setTransparentColor(p.bg_alpha_color().get());
	mBgOpaqueImage = p.bg_opaque_image();
	mBgAlphaImage = p.bg_alpha_image();
	mBgOpaqueImageOverlay = p.bg_opaque_image_overlay;
	mBgAlphaImageOverlay = p.bg_alpha_image_overlay;

	mAcceptsBadge = p.accepts_badge;
}
예제 #2
0
BOOL	LLFloaterTools::postBuild()
{

    // Hide until tool selected
    setVisible(FALSE);

    // Since we constantly show and hide this during drags, don't
    // make sounds on visibility changes.
    setSoundFlags(LLView::SILENT);

    getDragHandle()->setEnabled( !gSavedSettings.getBOOL("ToolboxAutoMove") );

    LLRect rect;
    mBtnFocus = getChild<LLButton>("button focus");//btn;
    childSetAction("button focus",LLFloaterTools::setEditTool, (void*)LLToolCamera::getInstance());
    mBtnMove = getChild<LLButton>("button move");
    childSetAction("button move",LLFloaterTools::setEditTool, (void*)LLToolGrab::getInstance());
    mBtnEdit = getChild<LLButton>("button edit");
    childSetAction("button edit",LLFloaterTools::setEditTool, (void*)LLToolCompTranslate::getInstance());
    mBtnCreate = getChild<LLButton>("button create");
    childSetAction("button create",LLFloaterTools::setEditTool, (void*)LLToolCompCreate::getInstance());
    mBtnLand = getChild<LLButton>("button land" );
    childSetAction("button land",LLFloaterTools::setEditTool, (void*)LLToolSelectLand::getInstance());
    mTextStatus = getChild<LLTextBox>("text status");

    childSetCommitCallback("slider zoom",commit_slider_zoom,this);

    mRadioZoom = getChild<LLCheckBoxCtrl>("radio zoom");
    childSetCommitCallback("radio zoom",commit_radio_zoom,this);
    mRadioOrbit = getChild<LLCheckBoxCtrl>("radio orbit");
    childSetCommitCallback("radio orbit",commit_radio_orbit,this);
    mRadioPan = getChild<LLCheckBoxCtrl>("radio pan");
    childSetCommitCallback("radio pan",commit_radio_pan,this);

    mRadioMove = getChild<LLCheckBoxCtrl>("radio move");
    childSetCommitCallback("radio move",click_popup_grab_drag,this);
    mRadioLift = getChild<LLCheckBoxCtrl>("radio lift");
    childSetCommitCallback("radio lift",click_popup_grab_lift,this);
    mRadioSpin = getChild<LLCheckBoxCtrl>("radio spin");
    childSetCommitCallback("radio spin",click_popup_grab_spin,NULL);
    mRadioPosition = getChild<LLCheckBoxCtrl>("radio position");
    childSetCommitCallback("radio position",commit_select_tool,LLToolCompTranslate::getInstance());
    mRadioRotate = getChild<LLCheckBoxCtrl>("radio rotate");
    childSetCommitCallback("radio rotate",commit_select_tool,LLToolCompRotate::getInstance());
    mRadioStretch = getChild<LLCheckBoxCtrl>("radio stretch");
    childSetCommitCallback("radio stretch",commit_select_tool,LLToolCompScale::getInstance());
    mRadioSelectFace = getChild<LLCheckBoxCtrl>("radio select face");
    childSetCommitCallback("radio select face",commit_select_tool,LLToolFace::getInstance());
    mCheckSelectIndividual = getChild<LLCheckBoxCtrl>("checkbox edit linked parts");
    childSetValue("checkbox edit linked parts",(BOOL)gSavedSettings.getBOOL("EditLinkedParts"));
    childSetCommitCallback("checkbox edit linked parts",commit_select_component,this);
    mCheckSnapToGrid = getChild<LLCheckBoxCtrl>("checkbox snap to grid");
    childSetValue("checkbox snap to grid",(BOOL)gSavedSettings.getBOOL("SnapEnabled"));
    mBtnGridOptions = getChild<LLButton>("Options...");
    childSetAction("Options...",onClickGridOptions, this);
    mCheckStretchUniform = getChild<LLCheckBoxCtrl>("checkbox uniform");
    childSetValue("checkbox uniform",(BOOL)gSavedSettings.getBOOL("ScaleUniform"));
    mCheckStretchTexture = getChild<LLCheckBoxCtrl>("checkbox stretch textures");
    childSetValue("checkbox stretch textures",(BOOL)gSavedSettings.getBOOL("ScaleStretchTextures"));
    mTextGridMode = getChild<LLTextBox>("text ruler mode");
    mComboGridMode = getChild<LLComboBox>("combobox grid mode");
    childSetCommitCallback("combobox grid mode",commit_grid_mode, this);
    //
    // Create Buttons
    //

    static	const std::string	toolNames[]= {
        "ToolCube",
        "ToolPrism",
        "ToolPyramid",
        "ToolTetrahedron",
        "ToolCylinder",
        "ToolHemiCylinder",
        "ToolCone",
        "ToolHemiCone",
        "ToolSphere",
        "ToolHemiSphere",
        "ToolTorus",
        "ToolTube",
        "ToolRing",
        "ToolTree",
        "ToolGrass"
    };
    void*	toolData[]= {
        &LLToolPlacerPanel::sCube,
        &LLToolPlacerPanel::sPrism,
        &LLToolPlacerPanel::sPyramid,
        &LLToolPlacerPanel::sTetrahedron,
        &LLToolPlacerPanel::sCylinder,
        &LLToolPlacerPanel::sCylinderHemi,
        &LLToolPlacerPanel::sCone,
        &LLToolPlacerPanel::sConeHemi,
        &LLToolPlacerPanel::sSphere,
        &LLToolPlacerPanel::sSphereHemi,
        &LLToolPlacerPanel::sTorus,
        &LLToolPlacerPanel::sSquareTorus,
        &LLToolPlacerPanel::sTriangleTorus,
        &LLToolPlacerPanel::sTree,
        &LLToolPlacerPanel::sGrass
    };
    for(size_t t=0; t<LL_ARRAY_SIZE(toolNames); ++t)
    {
        LLButton *found = getChild<LLButton>(toolNames[t]);
        if(found)
        {
            found->setClickedCallback(setObjectType,toolData[t]);
            mButtons.push_back( found );
        } else {
            llwarns << "Tool button not found! DOA Pending." << llendl;
        }
    }
    mCheckCopySelection = getChild<LLCheckBoxCtrl>("checkbox copy selection");
    childSetValue("checkbox copy selection",(BOOL)gSavedSettings.getBOOL("CreateToolCopySelection"));
    mCheckSticky = getChild<LLCheckBoxCtrl>("checkbox sticky");
    childSetValue("checkbox sticky",(BOOL)gSavedSettings.getBOOL("CreateToolKeepSelected"));
    mCheckCopyCenters = getChild<LLCheckBoxCtrl>("checkbox copy centers");
    childSetValue("checkbox copy centers",(BOOL)gSavedSettings.getBOOL("CreateToolCopyCenters"));
    mCheckCopyRotates = getChild<LLCheckBoxCtrl>("checkbox copy rotates");
    childSetValue("checkbox copy rotates",(BOOL)gSavedSettings.getBOOL("CreateToolCopyRotates"));
    mRadioSelectLand = getChild<LLCheckBoxCtrl>("radio select land");
    childSetCommitCallback("radio select land",commit_select_tool, LLToolSelectLand::getInstance());
    mRadioDozerFlatten = getChild<LLCheckBoxCtrl>("radio flatten");
    childSetCommitCallback("radio flatten",click_popup_dozer_mode,  (void*)0);
    mRadioDozerRaise = getChild<LLCheckBoxCtrl>("radio raise");
    childSetCommitCallback("radio raise",click_popup_dozer_mode,  (void*)1);
    mRadioDozerLower = getChild<LLCheckBoxCtrl>("radio lower");
    childSetCommitCallback("radio lower",click_popup_dozer_mode,  (void*)2);
    mRadioDozerSmooth = getChild<LLCheckBoxCtrl>("radio smooth");
    childSetCommitCallback("radio smooth",click_popup_dozer_mode,  (void*)3);
    mRadioDozerNoise = getChild<LLCheckBoxCtrl>("radio noise");
    childSetCommitCallback("radio noise",click_popup_dozer_mode,  (void*)4);
    mRadioDozerRevert = getChild<LLCheckBoxCtrl>("radio revert");
    childSetCommitCallback("radio revert",click_popup_dozer_mode,  (void*)5);
    mBtnApplyToSelection = getChild<LLButton>("button apply to selection");
    childSetAction("button apply to selection",click_apply_to_selection,  (void*)0);

    mSliderDozerSize = getChild<LLSlider>("slider brush size");
    childSetCommitCallback("slider brush size", commit_slider_dozer_size,  (void*)0);
    childSetValue( "slider brush size", gSavedSettings.getF32("LandBrushSize"));

    mSliderDozerForce = getChild<LLSlider>("slider force");
    childSetCommitCallback("slider force",commit_slider_dozer_force,  (void*)0);
    // the setting stores the actual force multiplier, but the slider is logarithmic, so we convert here
    childSetValue( "slider force", log10(gSavedSettings.getF32("LandBrushForce")));

    mTab = getChild<LLTabContainer>("Object Info Tabs");
    if(mTab)
    {
        mTab->setFollows(FOLLOWS_TOP | FOLLOWS_LEFT);
        mTab->setBorderVisible(FALSE);
        mTab->selectFirstTab();
    }

    mStatusText["rotate"] = getString("status_rotate");
    mStatusText["scale"] = getString("status_scale");
    mStatusText["move"] = getString("status_move");
    mStatusText["modifyland"] = getString("status_modifyland");
    mStatusText["camera"] = getString("status_camera");
    mStatusText["grab"] = getString("status_grab");
    mStatusText["place"] = getString("status_place");
    mStatusText["selectland"] = getString("status_selectland");

    return TRUE;
}