Ejemplo n.º 1
0
void Dialog::ReadRC(RCFile &rcFile)
{
    if (extended)
    {
        italics = 256;
    }
    resInfo.SetFlags(resInfo.GetFlags() | ResourceInfo::Pure);
    resInfo.ReadRC(rcFile,false);
    pos.x = rcFile.GetNumber();
    rcFile.SkipComma();
    pos.y = rcFile.GetNumber();
    rcFile.SkipComma();
    size.x = rcFile.GetNumber();
    rcFile.SkipComma();
    size.y = rcFile.GetNumber();
    rcFile.SkipComma();
    rcFile.NeedEol();
    ReadSettings(rcFile);
    rcFile.NeedBegin();
    while (Control::ValidType(rcFile))
    {	
        Control *c = new Control;
        controls.push_back(c);
        c->ReadRC(rcFile, extended);
    }
    rcFile.NeedEnd();
}
Ejemplo n.º 2
0
void MessageTable::ReadRC(RCFile &rcFile)
{
    resInfo.SetFlags(resInfo.GetFlags() | ResourceInfo::Pure);
    resInfo.ReadRC(rcFile, false);
    ResourceData *rd = new ResourceData;
    rd->ReadRC(rcFile);
    data = rd;
    rcFile.NeedEol();
}
Ejemplo n.º 3
0
void Font::ReadRC(RCFile &rcFile)
{
    resInfo.SetFlags(resInfo.GetFlags() | ResourceInfo::Pure);
    resInfo.ReadRC(rcFile, false);
    ResourceData *rd = new ResourceData;
    rd->ReadRC(rcFile);
    rcFile.NeedEol();
    int n = rd->GetWord();
    int s = rd->GetWord();
    // check version and size
/*
    if *n != 0x200 && n != 0x300 || s != rd->GetLen() || s < 0x180)
    {
        delete rd;
        throw new std::runtime_error("Invalid font file");
    }
*/
    data = rd;
}
Ejemplo n.º 4
0
void GroupCursor::ReadRC(RCFile &rcFile)
{
    resInfo.ReadRC(rcFile, false);
    ResourceData *rd = new ResourceData;
    rd->ReadRC(rcFile);
    rcFile.NeedEol();
    rd->GetWord();
    if (rd->GetWord() != 2)
    {
        throw new std::runtime_error("file does not contain cursor data");
    }
    int count = rd->GetWord();
    for (int i=0; i < count; i++)
    {
        Cursor *c = new Cursor(resInfo);
        rcFile.GetResFile().Add(c);
        cursors.push_back(c);
        c->ReadBin(rd);
    }
    resInfo.SetFlags(resInfo.GetFlags() | ResourceInfo::Pure);
    delete rd;
}
Ejemplo n.º 5
0
void ResourceInfo::ReadRC(RCFile &rcFile, bool secondary)
{
    bool done = false;
    while (!done)
    {
        switch (rcFile.GetToken()->GetKeyword())
        {
            case Lexer::DISCARDABLE:
                memoryFlags |= Discardable;
                break;
            case Lexer::PURE:
                memoryFlags |= Pure;
                break;
            case Lexer::PRELOAD:
                memoryFlags |= Preload;
                break;
            case Lexer::MOVEABLE:
                memoryFlags |= Moveable;
                break;
            case Lexer::LOADONCALL:
                memoryFlags |= LoadOnCall;
                break;			
            case Lexer::NONDISCARDABLE:
                memoryFlags &= ~Discardable;
                break;
            case Lexer::IMPURE:
                memoryFlags &= ~Pure;
                break;
            case Lexer::FIXED:
                memoryFlags &= ~Moveable;
                break;
            default:
                done = true;
                break;
        }
        if (!done)
            rcFile.NextToken();
    }
    if (secondary)
    {
        done = false;
        language = rcFile.GetLanguage();
        while (!done)
        {
            switch (rcFile.GetToken()->GetKeyword())
            {
                case Lexer::LANGUAGE:
                    rcFile.NextToken();
                    language = rcFile.GetNumber();
                    rcFile.GetNumber();
                    rcFile.NeedEol();
                    break;
                case Lexer::VERSION:
                    rcFile.NextToken();
                    version = rcFile.GetNumber();
                    rcFile.NeedEol();
                    break;
                case Lexer::CHARACTERISTICS:
                    rcFile.NextToken();
                    characteristics = rcFile.GetNumber();
                    rcFile.NeedEol();
                    break;
                default:
                    done = true;
                    break;
            }
        }
    }
}
Ejemplo n.º 6
0
void Accelerators::Key::ReadRC(RCFile &rcFile)
{
    if (rcFile.IsString())
    {
        std::wstring str = rcFile.GetString();
        if (str[0] == '^')
        {
            if (str.size() != 2)
                throw new std::runtime_error("Invalid key sequence");
            if (str[1] == '^')
                key = '^';
            else
                key = str[1] & 0x1f;
        }
        else
        {
            if (str.size() != 1)
                throw new std::runtime_error("Invalid key sequence");
            key = str[0];
        }
    }
    else
    {
        key = rcFile.GetNumber();
    }
    rcFile.SkipComma();
    id = rcFile.GetNumber();
    rcFile.SkipComma();
    bool done = false;
    while (rcFile.IsKeyword() && !done)
    {
        switch (rcFile.GetToken()->GetKeyword())
        {
            case Lexer::ASCII:
                flags &= ~Virtkey;
                break;
            case Lexer::VIRTKEY:
                flags |= Virtkey;
                break;
            case Lexer::NOINVERT:
                flags |= NoInvert;
                break;
            case Lexer::SHIFT:
                flags |= Shift;
                break;
            case Lexer::CONTROL:
                flags |= Control;
                break;
            case Lexer::ALT:
                flags |= Alt;
                break;
            default:
                done = true;
                break;
        }
        if (!done)
        {
            rcFile.NextToken();
            rcFile.SkipComma();
        }
    }
    rcFile.NeedEol();
}
Ejemplo n.º 7
0
void Dialog::ReadSettings(RCFile &rcFile)
{
    bool hascaption = false, hasstyle = false, hasfont = false;
    resInfo.SetLanguage(rcFile.GetLanguage());
    bool done = FALSE;
    while (!done && rcFile.IsKeyword())
    {
        switch (rcFile.GetToken()->GetKeyword())
        {
            case Lexer::LANGUAGE:
            {
                rcFile.NextToken();
                int n = rcFile.GetNumber() ;
                rcFile.SkipComma();
                n += rcFile.GetNumber() * 1024;
                resInfo.SetLanguage(n);
            }
                break;
            case Lexer::VERSION:
                rcFile.NextToken();
                resInfo.SetVersion(rcFile.GetNumber());
                break;
            case Lexer::CHARACTERISTICS:
                rcFile.NextToken();
                resInfo.SetCharacteristics(rcFile.GetNumber());
                break;
            case Lexer::STYLE:
                hasstyle = true;
                rcFile.NextToken();
                style = rcFile.GetNumber();
                break;
            case Lexer::EXSTYLE:
                rcFile.NextToken();
                exStyle |= rcFile.GetNumber();
                break;
            case Lexer::MENU:
                rcFile.NextToken();
                menu.ReadRC(rcFile);
                break;
            case Lexer::FONT:
                hasfont = true;
                rcFile.NextToken();
                pointSize = rcFile.GetNumber();
                rcFile.SkipComma();
                font = rcFile.GetString();
                break;
            case Lexer::CAPTION:
                hascaption = true;
                rcFile.NextToken();
                caption = rcFile.GetString();
                break;
            case Lexer::CLASS:
                rcFile.NextToken();
                cls.ReadRC(rcFile, true);
                break;
            case Lexer::HELP:
                rcFile.NextToken();
                if (!extended)
                    throw new std::runtime_error("Need DialogEx");
                helpIndex = rcFile.GetNumber();
                break;
            case Lexer::WEIGHT:
                rcFile.NextToken();
                if (!extended)
                    throw new std::runtime_error("Need DialogEx");
                weight = rcFile.GetNumber();
                break;
            case Lexer::ITALIC:
                rcFile.NextToken();
                if (!extended)
                    throw new std::runtime_error("Need DialogEx");
                italics = rcFile.GetNumber();
                break;
            default:
                done = TRUE;
                break;
        }
        if (!done)
        {
            rcFile.NeedEol();
        }
    }
    if (hascaption)
        style |= WS_CAPTION;
    if (!hasstyle)
        style |= WS_POPUPWINDOW;
    if (hasfont)
        style |= DS_SETFONT;
}
Ejemplo n.º 8
0
void Control::ReadRC(RCFile &rcFile, bool extended)
{
    switch (rcFile.GetTokenId())
    {
        case Lexer::AUTO3STATE:
            ReadStandard(rcFile, Button, BS_AUTO3STATE | WS_TABSTOP, extended, 1);
            break;
        case Lexer::AUTOCHECKBOX:
            ReadStandard(rcFile, Button, BS_AUTOCHECKBOX | WS_TABSTOP, extended, 1);
            break;
        case Lexer::AUTORADIOBUTTON:
            ReadStandard(rcFile, Button, BS_AUTORADIOBUTTON, extended, 1);
            break;
        case Lexer::CHECKBOX:
            ReadStandard(rcFile, Button, BS_CHECKBOX | WS_TABSTOP, extended, 1);
            break;
        case Lexer::COMBOBOX:
            ReadStandard(rcFile, Combobox, 0, extended, 0);
            if (!(style &3))
                style |= CBS_SIMPLE;
            break;
        case Lexer::CTEXT:
            ReadStandard(rcFile, Static, SS_CENTER | WS_GROUP, extended, 1);
            break;
        case Lexer::DEFPUSHBUTTON:
            ReadStandard(rcFile, Button, BS_DEFPUSHBUTTON | WS_TABSTOP, extended, 1);
            break;
        case Lexer::EDITTEXT:
            ReadStandard(rcFile, Edit, ES_LEFT | WS_BORDER | WS_TABSTOP, extended, 0);
            break;
        case Lexer::GROUPBOX:
            ReadStandard(rcFile, Button, BS_GROUPBOX, extended, 1);
            break;
        case Lexer::ICON:
            ReadStandard(rcFile, Static, SS_ICON, extended, 1);
            break;
        case Lexer::LISTBOX:
            ReadStandard(rcFile, Listbox, LBS_NOTIFY | WS_BORDER, extended, 0);
            break;
        case Lexer::LTEXT:
            ReadStandard(rcFile, Static, SS_LEFT | WS_GROUP, extended, 1);
            break;
        case Lexer::PUSHBUTTON:
            ReadStandard(rcFile, Button, BS_PUSHBUTTON | WS_TABSTOP, extended, 1);
            break;
        case Lexer::RADIOBUTTON:
            ReadStandard(rcFile, Button, BS_RADIOBUTTON, extended, 1);
            break;
        case Lexer::RTEXT:
            ReadStandard(rcFile, Static, SS_RIGHT | WS_GROUP, extended, 1);
            break;
        case Lexer::SCROLLBAR:
            ReadStandard(rcFile, Scrollbar, SBS_HORZ, extended, 0);
            break;
        case Lexer::STATE3:
            ReadStandard(rcFile, Button, BS_3STATE | WS_TABSTOP, extended, 1);
            break;
        case Lexer::CONTROL:
            ReadGeneric(rcFile, extended);
            break;
        default:
            // shouldn't get here
            break;
    }
    rcFile.NeedEol();
}