bool pawsConfigCamera::CreateTree()
{
    pawsTreeNode * root;

    /*tree = new pawsTree();
    tree->MoveTo(screenFrame.xmin, screenFrame.ymin);
    tree->SetSize(screenFrame.Width(), screenFrame.Height());
    tree->SetScrollBars(false, true);
    tree->SetTreeLayout(new pawsStdTreeLayout(tree, 5, 20));
    tree->SetTreeDecorator(new pawsStdTreeDecorator(tree, graphics2D, 0x0000ff, 0x00ffff, 13));
    AddChild(tree);
    */
    if (!LoadFromFile("configcamera.xml"))
        return false;

    tree = dynamic_cast<pawsTree *>(children[0]);
    tree->SetRelativeFrameSize(parent->ScreenFrame().Width()-20, parent->ScreenFrame().Height()-20);

    root = tree->GetRoot();
    if (root != NULL)
        CreateTreeWidgets(root);

    tree->SetScrollBars(false,true);

    return true;
}
Exemplo n.º 2
0
bool pawsConfigKeys::CreateTree()
{
    pawsTreeNode * root;

    /****************
    CS_ASSERT(tree == NULL);
    tree = new pawsTree();
    tree->SetRelativeFrame(0, 0,parent->GetDefaultFrame().Width(),parent->GetDefaultFrame().Height());
    tree->SetScrollBars(false, true);
    tree->SetTreeLayout(new pawsStdTreeLayout(tree, 5, 20));
    tree->SetTreeDecorator(new pawsStdTreeDecorator(tree, graphics2D, 0x0000ff, 0x00ffff, 13));
    AddChild(tree);

    if ( !tree->LoadFromFile("configkeys.xml") )
        return false;
    *********************/

    if (!LoadFromFile("configkeys.xml") )
		return false;

    tree = dynamic_cast<pawsTree *>(children[0]);
    tree->SetRelativeFrameSize(parent->GetScreenFrame().Width()-20, parent->GetScreenFrame().Height()-20);

    root = tree->GetRoot();
    if (root != NULL)
        CreateTreeWidgets(root);

    tree->SetScrollBars(false,true);
    return true;
}
Exemplo n.º 3
0
void pawsConfigKeys::CreateTreeWidgets(pawsTreeNode * subtreeRoot)
{
    pawsTextBox * label, * key;
    pawsButton * button;
    pawsSeqTreeNode * rootAsSeq;
    pawsTreeNode * child;


    rootAsSeq = dynamic_cast<pawsSeqTreeNode*> (subtreeRoot);
    if (rootAsSeq != NULL   &&   rootAsSeq != tree->GetRoot())
    {
        label = new pawsTextBox();
        label->SetRelativeFrameSize(GetActualWidth(COMMAND_WIDTH), 20);
        label->SetColour(0xffffff);
        label->Show();
        label->SetParent( this );
        label->SetRelativeFrame( 0, 0, GetActualWidth(COMMAND_WIDTH), 20 );
        label->VertAdjust(pawsTextBox::vertCENTRE);
        rootAsSeq->AddSeqWidget(label, GetActualWidth(COMMAND_WIDTH) + GetActualWidth(COLUMN_SPACING));

        key = new pawsTextBox();        
        key->SetRelativeFrameSize(GetActualWidth(TRIGGER_WIDTH), 20);
        key->SetColour(0xffffff);
        key->Show();
        key->SetParent( this );
        key->SetRelativeFrame( GetActualWidth(COMMAND_WIDTH)+5, 0, GetActualWidth(TRIGGER_WIDTH), 20 );
        key->VertAdjust(pawsTextBox::vertCENTRE);
        rootAsSeq->AddSeqWidget(key, GetActualWidth(TRIGGER_WIDTH) + GetActualWidth(COLUMN_SPACING));

        button = new pawsButton();
        button->SetParent( this );
        button->SetNotify(this);
        button->SetRelativeFrameSize(30, 20);
        button->SetUpImage("Standard Button");
        button->SetDownImage("Standard Button Down");
        button->SetText("Set");
        button->SetToggle(false);
        button->Show();
        button->SetRelativeFrame( GetActualWidth(COMMAND_WIDTH)+GetActualWidth(TRIGGER_WIDTH)+5, 0, 30, 20 );
        rootAsSeq->AddSeqWidget(button);
    }
    
    child = subtreeRoot->GetFirstChild();
    while (child != NULL)
    {
        CreateTreeWidgets(child);
        child = child->GetNextSibling();
    }
}
void pawsConfigCamera::CreateTreeWidgets(pawsTreeNode * subtreeRoot)
{
    pawsTextBox * label;
    pawsButton * button;
    pawsSeqTreeNode * rootAsSeq;
    pawsTreeNode * child;

    rootAsSeq = dynamic_cast<pawsSeqTreeNode*> (subtreeRoot);
    if (rootAsSeq != NULL)
    {
        csString cammode = subtreeRoot->GetAttr("cammode");
        int currCamMode = -1;
        if (cammode == "First Person")
            currCamMode = psCamera::CAMERA_FIRST_PERSON;
        else if (cammode == "Third Person Follow")
            currCamMode = psCamera::CAMERA_THIRD_PERSON;
        else if (cammode == "Third Person M64")
            currCamMode = psCamera::CAMERA_M64_THIRD_PERSON;
        else if (cammode == "Third Person Lara")
            currCamMode = psCamera::CAMERA_LARA_THIRD_PERSON;
        else if (cammode == "Free Rotation")
            currCamMode = psCamera::CAMERA_FREE;

        if (!strcmp(subtreeRoot->GetAttr("type"), "onoff"))
        {
            label = new pawsTextBox();
            label->SetText(subtreeRoot->GetName());
            label->SetColour(0xffffff);
            label->Show();
            label->SetRelativeFrame( 0, 0, (int)labelWidth, 20 );
            rootAsSeq->AddSeqWidget(label, (int)labelWidth + 5);

            button = new pawsButton();
            button->SetNotify(this);
            button->SetUpImage("Checkbox Off");
            button->SetDownImage("Checkbox On");
            button->SetToggle(true);
            button->Show();
            button->SetState(GetCameraSetting(subtreeRoot->GetName(), currCamMode) > 0.0f);
            button->SetRelativeFrame( (int)labelWidth+5, 0, 16, 16 );
            rootAsSeq->AddSeqWidget(button);
        }
        else if (!strcmp(subtreeRoot->GetAttr("type"), "real"))
        {
            label = new pawsTextBox();
            label->SetText(subtreeRoot->GetName());
            label->SetColour(0xffffff);
            label->Show();
            label->SetRelativeFrame( 0, 0, (int)labelWidth, 20 );
            rootAsSeq->AddSeqWidget(label, (int)labelWidth + 5);

            pawsSpinBox* spin = new pawsSpinBox();
            spin->SetRelativeFrame( (int)labelWidth+5, 0, (int)inputWidth, 20 );
            csString val("");
            val += GetCameraSetting(subtreeRoot->GetName(), currCamMode);
            csString pos("right");
            spin->ManualSetup(val, atof(subtreeRoot->GetAttr("min")), atof(subtreeRoot->GetAttr("max")), atof(subtreeRoot->GetAttr("inc")), pos);
            spin->Show();
            rootAsSeq->AddSeqWidget(spin, (int)inputWidth);
        }
    }

    child = subtreeRoot->GetFirstChild();
    while (child != NULL)
    {
        CreateTreeWidgets(child);
        child = child->GetNextSibling();
    }
}