Clean-up.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@33576 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -24,7 +24,7 @@
|
|||||||
#define TR_CONTEXT "Locale Preflet"
|
#define TR_CONTEXT "Locale Preflet"
|
||||||
|
|
||||||
|
|
||||||
const char *kSignature = "application/x-vnd.Haiku-Locale";
|
const char* kSignature = "application/x-vnd.Haiku-Locale";
|
||||||
|
|
||||||
static const uint32 kMsgLocaleSettings = 'LCst';
|
static const uint32 kMsgLocaleSettings = 'LCst';
|
||||||
|
|
||||||
@@ -35,10 +35,10 @@ public:
|
|||||||
~Settings();
|
~Settings();
|
||||||
|
|
||||||
const BMessage& Message() const { return fMessage; }
|
const BMessage& Message() const { return fMessage; }
|
||||||
void UpdateFrom(BMessage *message);
|
void UpdateFrom(BMessage* message);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
status_t Open(BFile *file, int32 mode);
|
status_t _Open(BFile* file, int32 mode);
|
||||||
|
|
||||||
BMessage fMessage;
|
BMessage fMessage;
|
||||||
bool fUpdated;
|
bool fUpdated;
|
||||||
@@ -50,7 +50,7 @@ public:
|
|||||||
LocalePreflet();
|
LocalePreflet();
|
||||||
virtual ~LocalePreflet();
|
virtual ~LocalePreflet();
|
||||||
|
|
||||||
virtual void MessageReceived(BMessage *message);
|
virtual void MessageReceived(BMessage* message);
|
||||||
virtual void AboutRequested();
|
virtual void AboutRequested();
|
||||||
virtual bool QuitRequested();
|
virtual bool QuitRequested();
|
||||||
|
|
||||||
@@ -70,7 +70,7 @@ Settings::Settings()
|
|||||||
fUpdated(false)
|
fUpdated(false)
|
||||||
{
|
{
|
||||||
BFile file;
|
BFile file;
|
||||||
if (Open(&file, B_READ_ONLY) != B_OK
|
if (_Open(&file, B_READ_ONLY) != B_OK
|
||||||
|| fMessage.Unflatten(&file) != B_OK) {
|
|| fMessage.Unflatten(&file) != B_OK) {
|
||||||
// set default prefs
|
// set default prefs
|
||||||
fMessage.AddString("language", "en");
|
fMessage.AddString("language", "en");
|
||||||
@@ -86,7 +86,7 @@ Settings::~Settings()
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
BFile file;
|
BFile file;
|
||||||
if (Open(&file, B_CREATE_FILE | B_ERASE_FILE | B_WRITE_ONLY) != B_OK)
|
if (_Open(&file, B_CREATE_FILE | B_ERASE_FILE | B_WRITE_ONLY) != B_OK)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
fMessage.Flatten(&file);
|
fMessage.Flatten(&file);
|
||||||
@@ -94,7 +94,7 @@ Settings::~Settings()
|
|||||||
|
|
||||||
|
|
||||||
status_t
|
status_t
|
||||||
Settings::Open(BFile *file, int32 mode)
|
Settings::_Open(BFile* file, int32 mode)
|
||||||
{
|
{
|
||||||
BPath path;
|
BPath path;
|
||||||
if (find_directory(B_USER_SETTINGS_DIRECTORY, &path) != B_OK)
|
if (find_directory(B_USER_SETTINGS_DIRECTORY, &path) != B_OK)
|
||||||
@@ -107,7 +107,7 @@ Settings::Open(BFile *file, int32 mode)
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
Settings::UpdateFrom(BMessage *message)
|
Settings::UpdateFrom(BMessage* message)
|
||||||
{
|
{
|
||||||
BPoint point;
|
BPoint point;
|
||||||
if (message->FindPoint("window_location", &point) == B_OK) {
|
if (message->FindPoint("window_location", &point) == B_OK) {
|
||||||
@@ -162,7 +162,7 @@ LocalePreflet::~LocalePreflet()
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
LocalePreflet::MessageReceived(BMessage *message)
|
LocalePreflet::MessageReceived(BMessage* message)
|
||||||
{
|
{
|
||||||
switch (message->what) {
|
switch (message->what) {
|
||||||
case kMsgSettingsChanged:
|
case kMsgSettingsChanged:
|
||||||
@@ -198,7 +198,7 @@ LocalePreflet::QuitRequested()
|
|||||||
|
|
||||||
|
|
||||||
int
|
int
|
||||||
main(int argc, char **argv)
|
main(int argc, char** argv)
|
||||||
{
|
{
|
||||||
LocalePreflet app;
|
LocalePreflet app;
|
||||||
app.Run();
|
app.Run();
|
||||||
|
|||||||
@@ -11,9 +11,11 @@
|
|||||||
|
|
||||||
extern const char* kSignature;
|
extern const char* kSignature;
|
||||||
|
|
||||||
|
static const uint32 kMsgCountrySelection = 'csel';
|
||||||
static const uint32 kMsgSettingsChanged = 'SeCh';
|
static const uint32 kMsgSettingsChanged = 'SeCh';
|
||||||
static const uint32 kMsgSelectLanguage = 'slng';
|
static const uint32 kMsgSelectLanguage = 'slng';
|
||||||
static const uint32 kMsgDefaults = 'dflt';
|
static const uint32 kMsgDefaults = 'dflt';
|
||||||
static const uint32 kMsgRevert = 'revt';
|
static const uint32 kMsgRevert = 'revt';
|
||||||
|
|
||||||
#endif /* LOCALE_H */
|
#endif /* LOCALE_H */
|
||||||
|
|
||||||
|
|||||||
@@ -62,7 +62,7 @@ class LanguageListView: public BListView
|
|||||||
{}
|
{}
|
||||||
|
|
||||||
bool InitiateDrag(BPoint point, int32 index, bool wasSelected);
|
bool InitiateDrag(BPoint point, int32 index, bool wasSelected);
|
||||||
void MouseMoved(BPoint where, uint32 transit, const BMessage *msg);
|
void MouseMoved(BPoint where, uint32 transit, const BMessage* msg);
|
||||||
void MoveItems(BList& items, int32 index);
|
void MoveItems(BList& items, int32 index);
|
||||||
void AttachedToWindow()
|
void AttachedToWindow()
|
||||||
{
|
{
|
||||||
@@ -73,8 +73,8 @@ class LanguageListView: public BListView
|
|||||||
void MessageReceived (BMessage* message)
|
void MessageReceived (BMessage* message)
|
||||||
{
|
{
|
||||||
if (message->what == 'DRAG') {
|
if (message->what == 'DRAG') {
|
||||||
LanguageListView *list = NULL;
|
LanguageListView* list = NULL;
|
||||||
if (message->FindPointer("list", (void **)&list) == B_OK) {
|
if (message->FindPointer("list", (void**)&list) == B_OK) {
|
||||||
if (list == this) {
|
if (list == this) {
|
||||||
int32 count = CountItems();
|
int32 count = CountItems();
|
||||||
if (fDropIndex < 0 || fDropIndex > count)
|
if (fDropIndex < 0 || fDropIndex > count)
|
||||||
@@ -180,7 +180,7 @@ LanguageListView::InitiateDrag(BPoint point, int32 index, bool)
|
|||||||
}
|
}
|
||||||
BBitmap* dragBitmap = new BBitmap(dragRect, B_RGB32, true);
|
BBitmap* dragBitmap = new BBitmap(dragRect, B_RGB32, true);
|
||||||
if (dragBitmap && dragBitmap->IsValid()) {
|
if (dragBitmap && dragBitmap->IsValid()) {
|
||||||
if (BView *v = new BView(dragBitmap->Bounds(), "helper",
|
if (BView* v = new BView(dragBitmap->Bounds(), "helper",
|
||||||
B_FOLLOW_NONE, B_WILL_DRAW)) {
|
B_FOLLOW_NONE, B_WILL_DRAW)) {
|
||||||
dragBitmap->AddChild(v);
|
dragBitmap->AddChild(v);
|
||||||
dragBitmap->Lock();
|
dragBitmap->Lock();
|
||||||
@@ -202,7 +202,7 @@ LanguageListView::InitiateDrag(BPoint point, int32 index, bool)
|
|||||||
v->StrokeRect(v->Bounds());
|
v->StrokeRect(v->Bounds());
|
||||||
v->Sync();
|
v->Sync();
|
||||||
|
|
||||||
uint8 *bits = (uint8 *)dragBitmap->Bits();
|
uint8* bits = (uint8*)dragBitmap->Bits();
|
||||||
int32 height = (int32)dragBitmap->Bounds().Height() + 1;
|
int32 height = (int32)dragBitmap->Bounds().Height() + 1;
|
||||||
int32 width = (int32)dragBitmap->Bounds().Width() + 1;
|
int32 width = (int32)dragBitmap->Bounds().Width() + 1;
|
||||||
int32 bpr = dragBitmap->BytesPerRow();
|
int32 bpr = dragBitmap->BytesPerRow();
|
||||||
@@ -210,22 +210,22 @@ LanguageListView::InitiateDrag(BPoint point, int32 index, bool)
|
|||||||
if (fade) {
|
if (fade) {
|
||||||
for (int32 y = 0; y < height - ALPHA / 2;
|
for (int32 y = 0; y < height - ALPHA / 2;
|
||||||
y++, bits += bpr) {
|
y++, bits += bpr) {
|
||||||
uint8 *line = bits + 3;
|
uint8* line = bits + 3;
|
||||||
for (uint8 *end = line + 4 * width; line < end;
|
for (uint8* end = line + 4 * width; line < end;
|
||||||
line += 4)
|
line += 4)
|
||||||
*line = ALPHA;
|
*line = ALPHA;
|
||||||
}
|
}
|
||||||
for (int32 y = height - ALPHA / 2; y < height;
|
for (int32 y = height - ALPHA / 2; y < height;
|
||||||
y++, bits += bpr) {
|
y++, bits += bpr) {
|
||||||
uint8 *line = bits + 3;
|
uint8* line = bits + 3;
|
||||||
for (uint8 *end = line + 4 * width; line < end;
|
for (uint8* end = line + 4 * width; line < end;
|
||||||
line += 4)
|
line += 4)
|
||||||
*line = (height - y) << 1;
|
*line = (height - y) << 1;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
for (int32 y = 0; y < height; y++, bits += bpr) {
|
for (int32 y = 0; y < height; y++, bits += bpr) {
|
||||||
uint8 *line = bits + 3;
|
uint8* line = bits + 3;
|
||||||
for (uint8 *end = line + 4 * width; line < end;
|
for (uint8* end = line + 4 * width; line < end;
|
||||||
line += 4)
|
line += 4)
|
||||||
*line = ALPHA;
|
*line = ALPHA;
|
||||||
}
|
}
|
||||||
@@ -248,7 +248,7 @@ LanguageListView::InitiateDrag(BPoint point, int32 index, bool)
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
LanguageListView::MouseMoved(BPoint where, uint32 transit, const BMessage *msg)
|
LanguageListView::MouseMoved(BPoint where, uint32 transit, const BMessage* msg)
|
||||||
{
|
{
|
||||||
if (msg && (msg->what == 'DRAG')) {
|
if (msg && (msg->what == 'DRAG')) {
|
||||||
switch (transit) {
|
switch (transit) {
|
||||||
@@ -315,9 +315,9 @@ LocaleWindow::LocaleWindow()
|
|||||||
|
|
||||||
{
|
{
|
||||||
// first list: available languages
|
// first list: available languages
|
||||||
LanguageListView *listView = new LanguageListView("available",
|
LanguageListView* listView = new LanguageListView("available",
|
||||||
B_MULTIPLE_SELECTION_LIST);
|
B_MULTIPLE_SELECTION_LIST);
|
||||||
BScrollView *scrollView = new BScrollView("scroller", listView,
|
BScrollView* scrollView = new BScrollView("scroller", listView,
|
||||||
B_WILL_DRAW | B_FRAME_EVENTS, false, true);
|
B_WILL_DRAW | B_FRAME_EVENTS, false, true);
|
||||||
|
|
||||||
// Fill the language list from the LocaleRoster data
|
// Fill the language list from the LocaleRoster data
|
||||||
@@ -355,7 +355,7 @@ LocaleWindow::LocaleWindow()
|
|||||||
// Second list: active languages
|
// Second list: active languages
|
||||||
fPreferredListView = new LanguageListView("preferred",
|
fPreferredListView = new LanguageListView("preferred",
|
||||||
B_MULTIPLE_SELECTION_LIST);
|
B_MULTIPLE_SELECTION_LIST);
|
||||||
BScrollView *scrollViewEnabled = new BScrollView("scroller",
|
BScrollView* scrollViewEnabled = new BScrollView("scroller",
|
||||||
fPreferredListView, B_WILL_DRAW | B_FRAME_EVENTS, false, true);
|
fPreferredListView, B_WILL_DRAW | B_FRAME_EVENTS, false, true);
|
||||||
|
|
||||||
// get the preferred languages from the Settings. Move them here from
|
// get the preferred languages from the Settings. Move them here from
|
||||||
@@ -393,10 +393,9 @@ LocaleWindow::LocaleWindow()
|
|||||||
|
|
||||||
{
|
{
|
||||||
BListView* listView = new BListView("country", B_SINGLE_SELECTION_LIST);
|
BListView* listView = new BListView("country", B_SINGLE_SELECTION_LIST);
|
||||||
BScrollView *scrollView = new BScrollView("scroller",
|
BScrollView* scrollView = new BScrollView("scroller",
|
||||||
listView, B_WILL_DRAW | B_FRAME_EVENTS, false, true);
|
listView, B_WILL_DRAW | B_FRAME_EVENTS, false, true);
|
||||||
BMessage* msg = new BMessage('csel');
|
listView->SetSelectionMessage(new BMessage(kMsgCountrySelection));
|
||||||
listView->SetSelectionMessage(msg);
|
|
||||||
|
|
||||||
// get all available countries from ICU
|
// get all available countries from ICU
|
||||||
// Use DateFormat::getAvailableLocale so we get only the one we can
|
// Use DateFormat::getAvailableLocale so we get only the one we can
|
||||||
@@ -423,13 +422,13 @@ LocaleWindow::LocaleWindow()
|
|||||||
// TODO: find a real solution intead of this hack
|
// TODO: find a real solution intead of this hack
|
||||||
listView->SetExplicitMinSize(BSize(300, B_SIZE_UNSET));
|
listView->SetExplicitMinSize(BSize(300, B_SIZE_UNSET));
|
||||||
|
|
||||||
fTimeFormatSettings = new TimeFormatSettingsView(defaultCountry);
|
fFormatView = new FormatView(defaultCountry);
|
||||||
|
|
||||||
countryTab->AddChild(BLayoutBuilder::Group<>(B_HORIZONTAL, 5)
|
countryTab->AddChild(BLayoutBuilder::Group<>(B_HORIZONTAL, 5)
|
||||||
.AddGroup(B_VERTICAL, 3)
|
.AddGroup(B_VERTICAL, 3)
|
||||||
.Add(scrollView)
|
.Add(scrollView)
|
||||||
.End()
|
.End()
|
||||||
.Add(fTimeFormatSettings)
|
.Add(fFormatView)
|
||||||
.View()
|
.View()
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -474,18 +473,18 @@ LocaleWindow::QuitRequested()
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
LocaleWindow::MessageReceived(BMessage *message)
|
LocaleWindow::MessageReceived(BMessage* message)
|
||||||
{
|
{
|
||||||
switch (message->what) {
|
switch (message->what) {
|
||||||
case kMsgDefaults:
|
case kMsgDefaults:
|
||||||
// reset default settings
|
// TODO
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case kMsgRevert:
|
case kMsgRevert:
|
||||||
// revert to last settings
|
// TODO
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'csel':
|
case kMsgCountrySelection:
|
||||||
{
|
{
|
||||||
// Country selection changed.
|
// Country selection changed.
|
||||||
// Get the new selected country from the ListView and send it to the
|
// Get the new selected country from the ListView and send it to the
|
||||||
@@ -500,7 +499,7 @@ LocaleWindow::MessageReceived(BMessage *message)
|
|||||||
be_app_messenger.SendMessage(newMessage);
|
be_app_messenger.SendMessage(newMessage);
|
||||||
|
|
||||||
BCountry* country = new BCountry(lli->LanguageCode());
|
BCountry* country = new BCountry(lli->LanguageCode());
|
||||||
fTimeFormatSettings->SetCountry(country);
|
fFormatView->SetCountry(country);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2005, Axel Dörfler, [email protected]. All rights reserved.
|
* Copyright 2005-2009, Axel Dörfler, [email protected].
|
||||||
* Distributed under the terms of the MIT License.
|
* All rights reserved. Distributed under the terms of the MIT License.
|
||||||
*/
|
*/
|
||||||
#ifndef LOCALE_WINDOW_H
|
#ifndef LOCALE_WINDOW_H
|
||||||
#define LOCALE_WINDOW_H
|
#define LOCALE_WINDOW_H
|
||||||
@@ -10,20 +10,21 @@
|
|||||||
|
|
||||||
class BButton;
|
class BButton;
|
||||||
class BListView;
|
class BListView;
|
||||||
class TimeFormatSettingsView;
|
class FormatView;
|
||||||
|
|
||||||
|
|
||||||
class LocaleWindow : public BWindow {
|
class LocaleWindow : public BWindow {
|
||||||
public:
|
public:
|
||||||
LocaleWindow();
|
LocaleWindow();
|
||||||
|
|
||||||
virtual bool QuitRequested();
|
virtual bool QuitRequested();
|
||||||
virtual void MessageReceived(BMessage *message);
|
virtual void MessageReceived(BMessage* message);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
BButton* fRevertButton;
|
BButton* fRevertButton;
|
||||||
BListView* fPreferredListView;
|
BListView* fPreferredListView;
|
||||||
TimeFormatSettingsView* fTimeFormatSettings;
|
FormatView* fFormatView;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* LOCALE_WINDOW_H */
|
#endif // LOCALE_WINDOW_H
|
||||||
|
|
||||||
|
|||||||
@@ -38,7 +38,7 @@
|
|||||||
BMessage*
|
BMessage*
|
||||||
MenuMessage(const char* format, BMenuField* field)
|
MenuMessage(const char* format, BMenuField* field)
|
||||||
{
|
{
|
||||||
BMessage* msg = new BMessage('FRMT');
|
BMessage* msg = new BMessage(kMenuMessage);
|
||||||
msg->AddPointer("dest", field);
|
msg->AddPointer("dest", field);
|
||||||
msg->AddString("format", format);
|
msg->AddString("format", format);
|
||||||
|
|
||||||
@@ -47,22 +47,23 @@ MenuMessage(const char* format, BMenuField* field)
|
|||||||
|
|
||||||
|
|
||||||
class DateMenuItem: public BMenuItem {
|
class DateMenuItem: public BMenuItem {
|
||||||
public:
|
public:
|
||||||
DateMenuItem(const char* label, const char* code, BMenuField* field)
|
DateMenuItem(const char* label, const char* code,
|
||||||
:
|
BMenuField* field)
|
||||||
BMenuItem(label, MenuMessage(code, field))
|
:
|
||||||
{
|
BMenuItem(label, MenuMessage(code, field))
|
||||||
icuCode = code;
|
{
|
||||||
}
|
fIcuCode = code;
|
||||||
|
}
|
||||||
|
|
||||||
BString icuCode;
|
BString fIcuCode;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
CreateDateMenu(BMenuField** field, bool longFormat = true)
|
CreateDateMenu(BMenuField** field, bool longFormat = true)
|
||||||
{
|
{
|
||||||
BMenu *menu = new BMenu("");
|
BMenu* menu = new BMenu("");
|
||||||
*field = new BMenuField("", menu);
|
*field = new BMenuField("", menu);
|
||||||
|
|
||||||
BPopUpMenu* dayMenu = new BPopUpMenu(TR("Day"));
|
BPopUpMenu* dayMenu = new BPopUpMenu(TR("Day"));
|
||||||
@@ -115,7 +116,7 @@ CreateDateMenu(BMenuField** field, bool longFormat = true)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
TimeFormatSettingsView::TimeFormatSettingsView(BCountry* country)
|
FormatView::FormatView(BCountry* country)
|
||||||
:
|
:
|
||||||
BView("WindowsSettingsView", B_FRAME_EVENTS),
|
BView("WindowsSettingsView", B_FRAME_EVENTS),
|
||||||
fCountry(country)
|
fCountry(country)
|
||||||
@@ -150,7 +151,7 @@ TimeFormatSettingsView::TimeFormatSettingsView(BCountry* country)
|
|||||||
|
|
||||||
fSeparatorMenuField = new BMenuField(TR("Separator:"), menu);
|
fSeparatorMenuField = new BMenuField(TR("Separator:"), menu);
|
||||||
|
|
||||||
BBox *clockBox = new BBox("Clock");
|
BBox* clockBox = new BBox("Clock");
|
||||||
clockBox->SetLabel(TR("Clock"));
|
clockBox->SetLabel(TR("Clock"));
|
||||||
|
|
||||||
{
|
{
|
||||||
@@ -196,7 +197,7 @@ TimeFormatSettingsView::TimeFormatSettingsView(BCountry* country)
|
|||||||
BCheckBox* currencyLeadingZero = new BCheckBox("", TR("Leading 0"),
|
BCheckBox* currencyLeadingZero = new BCheckBox("", TR("Leading 0"),
|
||||||
new BMessage(kSettingsContentsModified));
|
new BMessage(kSettingsContentsModified));
|
||||||
|
|
||||||
BBox *formatBox = new BBox("Symbol position");
|
BBox* formatBox = new BBox("Symbol position");
|
||||||
formatBox->SetLabel(TR("Symbol position"));
|
formatBox->SetLabel(TR("Symbol position"));
|
||||||
|
|
||||||
{
|
{
|
||||||
@@ -346,7 +347,7 @@ bool IsSpecialDateChar(char charToTest)
|
|||||||
|
|
||||||
// Get the date format from ICU and set the date fields accordingly
|
// Get the date format from ICU and set the date fields accordingly
|
||||||
void
|
void
|
||||||
TimeFormatSettingsView::_ParseDateFormat()
|
FormatView::_ParseDateFormat()
|
||||||
{
|
{
|
||||||
// TODO parse the short date too
|
// TODO parse the short date too
|
||||||
BString dateFormatString;
|
BString dateFormatString;
|
||||||
@@ -374,7 +375,7 @@ TimeFormatSettingsView::_ParseDateFormat()
|
|||||||
BMenuItem* item;
|
BMenuItem* item;
|
||||||
for (int itemIndex = 0; (item = subMenu->ItemAt(itemIndex)) != NULL;
|
for (int itemIndex = 0; (item = subMenu->ItemAt(itemIndex)) != NULL;
|
||||||
itemIndex++) {
|
itemIndex++) {
|
||||||
if (static_cast<DateMenuItem*>(item)->icuCode == str) {
|
if (static_cast<DateMenuItem*>(item)->fIcuCode == str) {
|
||||||
item->SetMarked(true);
|
item->SetMarked(true);
|
||||||
fLongDateMenu[i]->MenuItem()->SetLabel(item->Label());
|
fLongDateMenu[i]->MenuItem()->SetLabel(item->Label());
|
||||||
isFound = true;
|
isFound = true;
|
||||||
@@ -426,7 +427,7 @@ TimeFormatSettingsView::_ParseDateFormat()
|
|||||||
BMenuItem* item;
|
BMenuItem* item;
|
||||||
for (int itemIndex = 0; (item = subMenu->ItemAt(itemIndex)) != NULL;
|
for (int itemIndex = 0; (item = subMenu->ItemAt(itemIndex)) != NULL;
|
||||||
itemIndex++) {
|
itemIndex++) {
|
||||||
if (static_cast<DateMenuItem*>(item)->icuCode == str) {
|
if (static_cast<DateMenuItem*>(item)->fIcuCode == str) {
|
||||||
item->SetMarked(true);
|
item->SetMarked(true);
|
||||||
fDateMenu[i]->MenuItem()->SetLabel(item->Label());
|
fDateMenu[i]->MenuItem()->SetLabel(item->Label());
|
||||||
isFound = true;
|
isFound = true;
|
||||||
@@ -459,7 +460,7 @@ TimeFormatSettingsView::_ParseDateFormat()
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
TimeFormatSettingsView::AttachedToWindow()
|
FormatView::AttachedToWindow()
|
||||||
{
|
{
|
||||||
f24HrRadioButton->SetTarget(this);
|
f24HrRadioButton->SetTarget(this);
|
||||||
f12HrRadioButton->SetTarget(this);
|
f12HrRadioButton->SetTarget(this);
|
||||||
@@ -480,7 +481,7 @@ TimeFormatSettingsView::AttachedToWindow()
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
TimeFormatSettingsView::_UpdateLongDateFormatString()
|
FormatView::_UpdateLongDateFormatString()
|
||||||
{
|
{
|
||||||
BString newDateFormat;
|
BString newDateFormat;
|
||||||
|
|
||||||
@@ -506,10 +507,10 @@ TimeFormatSettingsView::_UpdateLongDateFormatString()
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
TimeFormatSettingsView::MessageReceived(BMessage *message)
|
FormatView::MessageReceived(BMessage* message)
|
||||||
{
|
{
|
||||||
switch (message->what) {
|
switch (message->what) {
|
||||||
case 'FRMT':
|
case kMenuMessage:
|
||||||
{
|
{
|
||||||
// Update one of the dropdown menus
|
// Update one of the dropdown menus
|
||||||
void* pointerFromMessage;
|
void* pointerFromMessage;
|
||||||
@@ -544,7 +545,7 @@ TimeFormatSettingsView::MessageReceived(BMessage *message)
|
|||||||
case kSettingsContentsModified:
|
case kSettingsContentsModified:
|
||||||
{
|
{
|
||||||
int32 separator = 0;
|
int32 separator = 0;
|
||||||
BMenuItem *item = fSeparatorMenuField->Menu()->FindMarked();
|
BMenuItem* item = fSeparatorMenuField->Menu()->FindMarked();
|
||||||
if (item) {
|
if (item) {
|
||||||
separator = fSeparatorMenuField->Menu()->IndexOf(item);
|
separator = fSeparatorMenuField->Menu()->IndexOf(item);
|
||||||
if (separator >= 0)
|
if (separator >= 0)
|
||||||
@@ -570,13 +571,13 @@ TimeFormatSettingsView::MessageReceived(BMessage *message)
|
|||||||
}
|
}
|
||||||
|
|
||||||
default:
|
default:
|
||||||
_inherited::MessageReceived(message);
|
BView::MessageReceived(message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
TimeFormatSettingsView::SetDefaults()
|
FormatView::SetDefaults()
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
TrackerSettings settings;
|
TrackerSettings settings;
|
||||||
@@ -594,7 +595,7 @@ TimeFormatSettingsView::SetDefaults()
|
|||||||
|
|
||||||
|
|
||||||
bool
|
bool
|
||||||
TimeFormatSettingsView::IsDefaultable() const
|
FormatView::IsDefaultable() const
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
TrackerSettings settings;
|
TrackerSettings settings;
|
||||||
@@ -608,7 +609,7 @@ TimeFormatSettingsView::IsDefaultable() const
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
TimeFormatSettingsView::Revert()
|
FormatView::Revert()
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
TrackerSettings settings;
|
TrackerSettings settings;
|
||||||
@@ -624,7 +625,7 @@ TimeFormatSettingsView::Revert()
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
TimeFormatSettingsView::_SendNotices()
|
FormatView::_SendNotices()
|
||||||
{
|
{
|
||||||
// Make the notification message and send it to the tracker:
|
// Make the notification message and send it to the tracker:
|
||||||
/*
|
/*
|
||||||
@@ -638,7 +639,7 @@ TimeFormatSettingsView::_SendNotices()
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
TimeFormatSettingsView::SetCountry(BCountry* country)
|
FormatView::SetCountry(BCountry* country)
|
||||||
{
|
{
|
||||||
delete fCountry;
|
delete fCountry;
|
||||||
fCountry = country;
|
fCountry = country;
|
||||||
@@ -658,7 +659,7 @@ TimeFormatSettingsView::SetCountry(BCountry* country)
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
TimeFormatSettingsView::RecordRevertSettings()
|
FormatView::RecordRevertSettings()
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
f24HrClock = settings.ClockIs24Hr();
|
f24HrClock = settings.ClockIs24Hr();
|
||||||
@@ -671,11 +672,11 @@ TimeFormatSettingsView::RecordRevertSettings()
|
|||||||
// Return true if the Revert button should be enabled (ie some setting was
|
// Return true if the Revert button should be enabled (ie some setting was
|
||||||
// changed)
|
// changed)
|
||||||
bool
|
bool
|
||||||
TimeFormatSettingsView::IsRevertable() const
|
FormatView::IsRevertable() const
|
||||||
{
|
{
|
||||||
FormatSeparator separator;
|
FormatSeparator separator;
|
||||||
|
|
||||||
BMenuItem *item = fSeparatorMenuField->Menu()->FindMarked();
|
BMenuItem* item = fSeparatorMenuField->Menu()->FindMarked();
|
||||||
if (item) {
|
if (item) {
|
||||||
int32 index = fSeparatorMenuField->Menu()->IndexOf(item);
|
int32 index = fSeparatorMenuField->Menu()->IndexOf(item);
|
||||||
if (index >= 0)
|
if (index >= 0)
|
||||||
@@ -697,7 +698,7 @@ TimeFormatSettingsView::IsRevertable() const
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
TimeFormatSettingsView::_UpdateExamples()
|
FormatView::_UpdateExamples()
|
||||||
{
|
{
|
||||||
time_t timeValue = (time_t)time(NULL);
|
time_t timeValue = (time_t)time(NULL);
|
||||||
BString timeFormat;
|
BString timeFormat;
|
||||||
|
|||||||
@@ -30,13 +30,14 @@ enum FormatSeparator {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const uint32 kSettingsContentsModified = 'Scmo';
|
const uint32 kSettingsContentsModified = 'Scmo';
|
||||||
|
const uint32 kMenuMessage = 'FRMT';
|
||||||
|
|
||||||
|
|
||||||
class TimeFormatSettingsView : public BView {
|
class FormatView : public BView {
|
||||||
public:
|
public:
|
||||||
TimeFormatSettingsView(BCountry* country);
|
FormatView(BCountry* country);
|
||||||
|
|
||||||
virtual void MessageReceived(BMessage *message);
|
virtual void MessageReceived(BMessage* message);
|
||||||
virtual void AttachedToWindow();
|
virtual void AttachedToWindow();
|
||||||
|
|
||||||
virtual void SetDefaults();
|
virtual void SetDefaults();
|
||||||
@@ -80,8 +81,6 @@ private:
|
|||||||
BBox* fTimeBox;
|
BBox* fTimeBox;
|
||||||
BBox* fNumbersBox;
|
BBox* fNumbersBox;
|
||||||
BBox* fCurrencyBox;
|
BBox* fCurrencyBox;
|
||||||
|
|
||||||
typedef BView _inherited;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user