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';
|
54 | 54 | const uint32 kMsgIconChanged = 'icch'; |
55 | 55 | const uint32 kMsgTypeIconsChanged = 'tich'; |
56 | 56 | |
| 57 | const uint32 kMsgVersionInfoChanged = 'tvch'; |
| 58 | |
57 | 59 | const uint32 kMsgTypeSelected = 'tpsl'; |
58 | 60 | const uint32 kMsgAddType = 'adtp'; |
59 | 61 | const uint32 kMsgTypeAdded = 'tpad'; |
… |
… |
public:
|
67 | 69 | TabFilteringTextView(const char* name); |
68 | 70 | virtual ~TabFilteringTextView(); |
69 | 71 | |
| 72 | virtual void InsertText(const char* text, int32 length, |
| 73 | int32 offset, const text_run_array* runs); |
70 | 74 | virtual void KeyDown(const char* bytes, int32 count); |
71 | 75 | virtual void TargetedByScrollView(BScrollView* scroller); |
72 | 76 | virtual void MakeFocus(bool focused = true); |
… |
… |
TabFilteringTextView::~TabFilteringTextView()
|
124 | 128 | { |
125 | 129 | } |
126 | 130 | |
| 131 | void |
| 132 | TabFilteringTextView::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 | } |
127 | 140 | |
128 | 141 | void |
129 | 142 | TabFilteringTextView::KeyDown(const char* bytes, int32 count) |
… |
… |
ApplicationTypeWindow::ApplicationTypeWindow(BPoint position,
|
397 | 410 | versionBox->SetLabel(B_TRANSLATE("Version info")); |
398 | 411 | |
399 | 412 | fMajorVersionControl = new BTextControl(B_TRANSLATE("Version:"), |
400 | | NULL, NULL); |
| 413 | NULL, NULL, new BMessage(kMsgVersionInfoChanged)); |
401 | 414 | _MakeNumberTextControl(fMajorVersionControl); |
402 | 415 | |
403 | | fMiddleVersionControl = new BTextControl(".", NULL, NULL); |
| 416 | fMiddleVersionControl = new BTextControl(".", NULL, NULL, |
| 417 | new BMessage(kMsgVersionInfoChanged)); |
404 | 418 | _MakeNumberTextControl(fMiddleVersionControl); |
405 | 419 | |
406 | | fMinorVersionControl = new BTextControl(".", NULL, NULL); |
| 420 | fMinorVersionControl = new BTextControl(".", NULL, NULL, |
| 421 | new BMessage(kMsgVersionInfoChanged)); |
407 | 422 | _MakeNumberTextControl(fMinorVersionControl); |
408 | 423 | |
409 | 424 | 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)); |
415 | 435 | fVarietyMenu->AddItem(item); |
416 | 436 | item->SetMarked(true); |
417 | | fVarietyMenu->AddItem(new BMenuItem(B_TRANSLATE("Final"), NULL)); |
| 437 | fVarietyMenu->AddItem(new BMenuItem(B_TRANSLATE("Final"), |
| 438 | new BMessage(kMsgVersionInfoChanged))); |
418 | 439 | |
419 | 440 | BMenuField* varietyField = new BMenuField("", fVarietyMenu); |
420 | | fInternalVersionControl = new BTextControl("/", NULL, NULL); |
| 441 | fInternalVersionControl = new BTextControl("/", NULL, NULL, |
| 442 | new BMessage(kMsgVersionInfoChanged)); |
421 | 443 | fShortDescriptionControl = |
422 | | new BTextControl(B_TRANSLATE("Short description:"), NULL, NULL); |
| 444 | new BTextControl(B_TRANSLATE("Short description:"), NULL, NULL, |
| 445 | new BMessage(kMsgVersionInfoChanged)); |
423 | 446 | |
424 | 447 | // TODO: workaround for a GCC 4.1.0 bug? Or is that really what the standard says? |
425 | 448 | version_info versionInfo; |
… |
… |
ApplicationTypeWindow::MessageReceived(BMessage* message)
|
900 | 923 | _CheckSaveMenuItem(CHECK_TYPE_ICONS); |
901 | 924 | break; |
902 | 925 | |
| 926 | case kMsgVersionInfoChanged: |
| 927 | _CheckSaveMenuItem(CHECK_VERSION); |
| 928 | break; |
| 929 | |
903 | 930 | case kMsgSave: |
904 | 931 | _Save(); |
905 | 932 | break; |