Ticket #8107: stump.patch

File stump.patch, 3.2 KB (added by SF/doren, 22 years ago)
  • dialogs.cpp

    diff -Naur scumm/dialogs.cpp scumm/new/dialogs.cpp
    old new  
    642642
    643643#pragma mark -
    644644
     645InfoDialog::InfoDialog(NewGui *gui, Scumm *scumm, int res,
     646                int x, int y, int w, int h)
     647        : ScummDialog(gui, scumm, x, y, w, h)
     648{
     649        setInfoText (queryResString (res));
     650}
     651
     652InfoDialog::InfoDialog(NewGui *gui, Scumm *scumm, const String& message,
     653                int x, int y, int w, int h)
     654        : ScummDialog(gui, scumm, x, y, w, h)
     655{
     656        setInfoText (message);
     657}
     658
     659void InfoDialog::setInfoText(const String& message)
     660{
     661        new StaticTextWidget(this, 4, 4, _w-8, _h, message, kTextAlignCenter);
     662}
     663
     664#pragma mark -
     665
    645666PauseDialog::PauseDialog(NewGui *gui, Scumm *scumm)
    646         : ScummDialog(gui, scumm, 35, 80, 250, 16)
     667        : InfoDialog(gui, scumm, 10, 35, 80, 250, 16)
     668        //: InfoDialog(gui, scumm, queryResString (10), 35, 80, 250, 16)
    647669{
    648         addResText(4, 4, 250-8, 16, 10);
     670        // cannot call queryResString from the initializer list, since _scumm
     671        // is not initialized yet..
    649672}
    650673
    651674#ifdef _WIN32_WCE
  • dialogs.h

    diff -Naur scumm/dialogs.h scumm/new/dialogs.h
    old new  
    109109        CheckboxWidget *amigaPalCheckbox;
    110110};
    111111
    112 class PauseDialog : public ScummDialog {
     112class InfoDialog : public ScummDialog {
    113113public:
    114         PauseDialog(NewGui *gui, Scumm *scumm);
     114        // arbitrary message
     115        InfoDialog(NewGui *gui, Scumm *scumm, const String& message, int x, int y,
     116                        int w, int h);
     117        // from resources
     118        InfoDialog(NewGui *gui, Scumm *scumm, int res, int x, int y, int w, int h);
    115119
    116120        virtual void handleMouseDown(int x, int y, int button, int clickCount)
    117121                { close(); }
     
    122126                        else
    123127                                ScummDialog::handleKeyDown(key, modifiers);
    124128                }
     129protected:
     130        void setInfoText (const String& message);
     131};
     132
     133class PauseDialog : public InfoDialog {
     134public:
     135        PauseDialog(NewGui *gui, Scumm *scumm);
    125136};
    126137
    127138#ifdef _WIN32_WCE
  • string.cpp

    diff -Naur scumm/string.cpp scumm/new/string.cpp
    old new  
    2323#include "stdafx.h"
    2424#include "scumm.h"
    2525#include "actor.h"
     26#include "dialogs.h"
    2627#include "scumm/sound.h"
    2728
    2829int CharsetRenderer::getStringWidth(int arg, byte *text, int pos)
     
    170171        if (_string[3].color == 0)
    171172                _string[3].color = 4;
    172173
    173         // TODO - it appears the this function should display the given message graphically
    174         // to the user in a "dialog" looking like the pause dialog, i.e. a single line.
    175         warning("unkMessage2(\"%s\")", buf);
     174        // Unfortunately, calculating string width will require including newgui.h
     175        // OUCH
     176        // Will used fixed width for now...
     177
     178        //int width = _newgui -> getStringWidth ((char*) buf);
     179        //InfoDialog* dialog = new InfoDialog (_newgui, this, (char*) buf,
     180        //      (_realWidth - (width + 10)) >> 1, 80, width + 10, 16);
     181                       
     182        InfoDialog* dialog = new InfoDialog (_newgui, this, (char*) buf,
     183                        10, 80, 300, 16);
     184        runDialog (dialog);
     185        delete dialog;
     186
    176187        _messagePtr = tmp;
    177188}
    178189