Preferences Panel : Check if the font, size or color was indeed changed before setting it as modified, avoiding unneeded "Save/Cancel" dialog.

This fixes ticket #3348.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32421 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Philippe Saint-Pierre 2009-08-15 18:37:07 +00:00
parent e4ea54bdb7
commit a3c4ce8b7d

View File

@ -176,21 +176,36 @@ AppearancePrefView::MessageReceived(BMessage *msg)
switch (msg->what) {
case MSG_HALF_FONT_CHANGED:
PrefHandler::Default()->setString(PREF_HALF_FONT_FAMILY,
fFont->Menu()->FindMarked()->Label());
modified = true;
if (strcmp(
PrefHandler::Default()->getString(PREF_HALF_FONT_FAMILY),
fFont->Menu()->FindMarked()->Label())) {
PrefHandler::Default()->setString(PREF_HALF_FONT_FAMILY,
fFont->Menu()->FindMarked()->Label());
modified = true;
}
break;
case MSG_HALF_SIZE_CHANGED:
PrefHandler::Default()->setString(PREF_HALF_FONT_SIZE,
fFontSize->Menu()->FindMarked()->Label());
modified = true;
if (strcmp(PrefHandler::Default()->getString(PREF_HALF_FONT_SIZE),
fFontSize->Menu()->FindMarked()->Label())) {
PrefHandler::Default()->setString(PREF_HALF_FONT_SIZE,
fFontSize->Menu()->FindMarked()->Label());
modified = true;
}
break;
case MSG_COLOR_CHANGED:
PrefHandler::Default()->setRGB(fColorField->Menu()->FindMarked()->Label(),
fColorControl->ValueAsColor());
modified = true;
case MSG_COLOR_CHANGED: {
rgb_color oldColor = PrefHandler::Default()->getRGB(
fColorField->Menu()->FindMarked()->Label());
if (oldColor != fColorControl->ValueAsColor()) {
PrefHandler::Default()->setRGB(
fColorField->Menu()->FindMarked()->Label(),
fColorControl->ValueAsColor());
modified = true;
}
}
break;
case MSG_COLOR_FIELD_CHANGED: