Ticket #12780: 0001-12780-FileTypes-enable-save-menu-item-when-changing-.patch

File 0001-12780-FileTypes-enable-save-menu-item-when-changing-.patch, 4.4 KB (added by markh, 8 years ago)
  • src/preferences/filetypes/ApplicationTypeWindow.cpp

    From b8c1ddadfc0f73687cff67b78825076ebcfc597d Mon Sep 17 00:00:00 2001
    From: Mark Hellegers <mark@firedisk.net>
    Date: Sat, 14 May 2016 18:16:38 +0200
    Subject: [PATCH] #12780: FileTypes, enable save menu item when changing
     version information of a resource
    
    ---
     .../filetypes/ApplicationTypeWindow.cpp            | 49 +++++++++++++++++-----
     1 file changed, 38 insertions(+), 11 deletions(-)
    
    diff --git a/src/preferences/filetypes/ApplicationTypeWindow.cpp b/src/preferences/filetypes/ApplicationTypeWindow.cpp
    index f4e1c8f..0d1020e 100644
    a b const uint32 kMsgAppFlagsChanged = 'afch';  
    5454const uint32 kMsgIconChanged = 'icch';
    5555const uint32 kMsgTypeIconsChanged = 'tich';
    5656
     57const uint32 kMsgVersionInfoChanged = 'tvch';
     58
    5759const uint32 kMsgTypeSelected = 'tpsl';
    5860const uint32 kMsgAddType = 'adtp';
    5961const uint32 kMsgTypeAdded = 'tpad';
    public:  
    6769                                TabFilteringTextView(const char* name);
    6870    virtual                     ~TabFilteringTextView();
    6971
     72    virtual void                InsertText(const char* text, int32 length,
     73                                    int32 offset, const text_run_array* runs);
    7074    virtual void                KeyDown(const char* bytes, int32 count);
    7175    virtual void                TargetedByScrollView(BScrollView* scroller);
    7276    virtual void                MakeFocus(bool focused = true);
    TabFilteringTextView::~TabFilteringTextView()  
    124128{
    125129}
    126130
     131void
     132TabFilteringTextView::InsertText(const char* text, int32 length, int32 offset,
     133    const text_run_array* runs)
     134{
     135    BTextView::InsertText(text, length, offset, runs);
     136   
     137    Window()->PostMessage(kMsgVersionInfoChanged);
     138   
     139}
    127140
    128141void
    129142TabFilteringTextView::KeyDown(const char* bytes, int32 count)
    ApplicationTypeWindow::ApplicationTypeWindow(BPoint position,  
    397410    versionBox->SetLabel(B_TRANSLATE("Version info"));
    398411
    399412    fMajorVersionControl = new BTextControl(B_TRANSLATE("Version:"),
    400         NULL, NULL);
     413        NULL, NULL, new BMessage(kMsgVersionInfoChanged));
    401414    _MakeNumberTextControl(fMajorVersionControl);
    402415
    403     fMiddleVersionControl = new BTextControl(".", NULL, NULL);
     416    fMiddleVersionControl = new BTextControl(".", NULL, NULL,
     417        new BMessage(kMsgVersionInfoChanged));
    404418    _MakeNumberTextControl(fMiddleVersionControl);
    405419
    406     fMinorVersionControl = new BTextControl(".", NULL, NULL);
     420    fMinorVersionControl = new BTextControl(".", NULL, NULL,
     421        new BMessage(kMsgVersionInfoChanged));
    407422    _MakeNumberTextControl(fMinorVersionControl);
    408423
    409424    fVarietyMenu = new BPopUpMenu("variety", true, true);
    410     fVarietyMenu->AddItem(new BMenuItem(B_TRANSLATE("Development"), NULL));
    411     fVarietyMenu->AddItem(new BMenuItem(B_TRANSLATE("Alpha"), NULL));
    412     fVarietyMenu->AddItem(new BMenuItem(B_TRANSLATE("Beta"), NULL));
    413     fVarietyMenu->AddItem(new BMenuItem(B_TRANSLATE("Gamma"), NULL));
    414     item = new BMenuItem(B_TRANSLATE("Golden master"), NULL);
     425    fVarietyMenu->AddItem(new BMenuItem(B_TRANSLATE("Development"),
     426        new BMessage(kMsgVersionInfoChanged)));
     427    fVarietyMenu->AddItem(new BMenuItem(B_TRANSLATE("Alpha"),
     428        new BMessage(kMsgVersionInfoChanged)));
     429    fVarietyMenu->AddItem(new BMenuItem(B_TRANSLATE("Beta"),
     430        new BMessage(kMsgVersionInfoChanged)));
     431    fVarietyMenu->AddItem(new BMenuItem(B_TRANSLATE("Gamma"),
     432        new BMessage(kMsgVersionInfoChanged)));
     433    item = new BMenuItem(B_TRANSLATE("Golden master"),
     434        new BMessage(kMsgVersionInfoChanged));
    415435    fVarietyMenu->AddItem(item);
    416436    item->SetMarked(true);
    417     fVarietyMenu->AddItem(new BMenuItem(B_TRANSLATE("Final"), NULL));
     437    fVarietyMenu->AddItem(new BMenuItem(B_TRANSLATE("Final"),
     438        new BMessage(kMsgVersionInfoChanged)));
    418439
    419440    BMenuField* varietyField = new BMenuField("", fVarietyMenu);
    420     fInternalVersionControl = new BTextControl("/", NULL, NULL);
     441    fInternalVersionControl = new BTextControl("/", NULL, NULL,
     442        new BMessage(kMsgVersionInfoChanged));
    421443    fShortDescriptionControl =
    422         new BTextControl(B_TRANSLATE("Short description:"), NULL, NULL);
     444        new BTextControl(B_TRANSLATE("Short description:"), NULL, NULL,
     445            new BMessage(kMsgVersionInfoChanged));
    423446
    424447    // TODO: workaround for a GCC 4.1.0 bug? Or is that really what the standard says?
    425448    version_info versionInfo;
    ApplicationTypeWindow::MessageReceived(BMessage* message)  
    900923            _CheckSaveMenuItem(CHECK_TYPE_ICONS);
    901924            break;
    902925
     926        case kMsgVersionInfoChanged:
     927            _CheckSaveMenuItem(CHECK_VERSION);
     928            break;
     929
    903930        case kMsgSave:
    904931            _Save();
    905932            break;