Removal of LGA* stuff in prefs.

This commit is contained in:
pinkerton 1998-05-27 17:29:01 +00:00
parent 4dd63195fc
commit bd784db14a
13 changed files with 210 additions and 433 deletions

View File

@ -54,6 +54,13 @@
#include <LAMPushButtonImp.h>
#include <LBevelButton.h>
#include <LCmdBevelButton.h>
#include <LCheckbox.h>
#include <LRadioButton.h>
#include <LTextGroupBox.h>
#include <LEditText.h>
#include <LAMEditTextImp.h>
#include <LPopupButton.h>
#include <LAMPopupButtonImp.h>
// ¥¥¥ Things that will go away after appearance conversion complete
#include "CProgressBar.h"
@ -239,7 +246,17 @@ void RegisterAllBrowserClasses(void)
// RegisterClassID_(LAMControlImp, LBevelButton::imp_class_ID);
RegisterClass_(LCmdBevelButton);
RegisterClassID_(LAMControlImp, LCmdBevelButton::imp_class_ID);
RegisterClass_(LCheckBox);
RegisterClassID_(LAMControlImp, LCheckBox::imp_class_ID);
RegisterClass_(LRadioButton);
RegisterClassID_(LAMControlImp, LRadioButton::imp_class_ID);
RegisterClass_(LTextGroupBox);
RegisterClassID_(LAMControlImp, LTextGroupBox::imp_class_ID);
RegisterClass_(LPopupButton);
RegisterClassID_(LAMPopupButtonImp, LPopupButton::imp_class_ID);
// RegisterClass_(LEditText);
// RegisterClassID_(LAMEditTextImp, LEditText::imp_class_ID);
// ¥¥¥ Things that will go away after appearance port complete
RegisterClass_(CProgressBar);
RegisterClass_(CPatternBevelView);

View File

@ -37,8 +37,6 @@
//#include "shist.h"
//#include <QAP_Assist.h>
#include <LGARadioButton.h>
#include <LGACheckbox.h>
// macfe
#include "earlmgr.h"
@ -1336,12 +1334,12 @@ void CFrontApp::ProperStartup( FSSpec* file, short fileType )
};
StDialogHandler handler(eAskMeDialog, nil);
LWindow *dialog = handler.GetDialog();
LGARadioButton *onRButton =
(LGARadioButton *)dialog->FindPaneByID(eWorkOnline);
LWindow* dialog = handler.GetDialog();
LControl* onRButton = dynamic_cast<LControl*>(
dialog->FindPaneByID(eWorkOnline));
XP_ASSERT(onRButton);
LGARadioButton *offRButton =
(LGARadioButton *)dialog->FindPaneByID(eWorkOffline);
LControl *offRButton = dynamic_cast<LControl*>(
dialog->FindPaneByID(eWorkOffline));
XP_ASSERT(offRButton);
if (onlineLastTime)
{
@ -1351,8 +1349,8 @@ void CFrontApp::ProperStartup( FSSpec* file, short fileType )
{
offRButton->SetValue(true);
}
LGACheckbox *setPrefBox =
(LGACheckbox *)dialog->FindPaneByID(eSetPref);
LControl *setPrefBox = dynamic_cast<LControl*>(
dialog->FindPaneByID(eSetPref));
XP_ASSERT(setPrefBox);
if (locked)
{

View File

@ -34,7 +34,6 @@ extern "C"
#ifdef MOZ_MAIL_NEWS
#include "CMessageFolder.h"
#endif
#include "UGraphicGizmos.h"
#include "CToolTipAttachment.h"
#include "CValidEditField.h"
@ -64,14 +63,9 @@ extern "C"
#include <UModalDialogs.h>
#include <UNewTextDrawing.h>
#include <LTextColumn.h>
#include <UDrawingUtils.h>
#include <UGAColorRamp.h>
#include <LControl.h>
#include <LGADialogBox.h>
#include <LGACheckbox.h>
#include <LGARadioButton.h>
#include <LPopupButton.h>
#include <LDialogBox.h>
//#include <QAP_Assist.h>
@ -87,6 +81,41 @@ extern "C"
#endif
#endif // MOZ_MAIL_NEWS
#pragma mark ---CBroadcasterEditField---
//
// CBroadcasterEditField
//
// Differs from LBroadcasterEditField in that it broadcasts a change with every keystroke,
// unlike its L* bretheren which only broadcasts when focus leaves the textbox.
//
// NOTE: This used to be called CEditFieldControl, but that was too misleading for my tastes.
//
class CBroadcasterEditField : public LEditField, public LBroadcaster
{
public:
enum
{
class_ID = 'BrEd',
msg_TextChanged = 'TxtC'
};
CBroadcasterEditField(LStream *inStream) :
LEditField(inStream)
{}
virtual ~CBroadcasterEditField() {}
protected:
virtual void UserChangedText();
}; // class CBroadcasterEditField
void CBroadcasterEditField::UserChangedText()
{
BroadcastMessage(msg_TextChanged, this);
}
#pragma mark ---CMIMEListPane---
//======================================
class CMIMEListPane : public LTable, public LCommander, public LBroadcaster
@ -685,7 +714,7 @@ CMIMEListPane::PrefCellInfo::PrefCellInfo()
#pragma mark ---CEditMIMEWindow---
//======================================
class CEditMIMEWindow : public LGADialogBox
class CEditMIMEWindow : public LDialogBox
//======================================
{
public:
@ -725,16 +754,16 @@ private:
char** mPluginList; // Null-terminated array of plug-in names
uint32 mPluginCount; // Number of plug-ins in array
LGAPopup *mFileTypePopup;
LGAPopup *mPluginPopup;
CGAEditBroadcaster *mDescriptionEditField;
CGAEditBroadcaster *mTypeEditField;
CGAEditBroadcaster *mExtensionEditField;
LGARadioButton *mRadioSave;
LGARadioButton *mRadioLaunch;
LGARadioButton *mRadioInternal;
LGARadioButton *mRadioUnknown;
LGARadioButton *mRadioPlugin;
LPopupButton *mFileTypePopup;
LPopupButton *mPluginPopup;
LEditField *mDescriptionEditField;
LEditField *mTypeEditField;
LEditField *mExtensionEditField;
LControl *mRadioSave;
LControl *mRadioLaunch;
LControl *mRadioInternal;
LControl *mRadioUnknown;
LControl *mRadioPlugin;
// CFilePicker *mAppPicker;
LCaption *mAppName;
LButton *mAppButton;
@ -761,7 +790,7 @@ enum
//-----------------------------------
CEditMIMEWindow::CEditMIMEWindow(LStream* inStream):
//-----------------------------------
LGADialogBox(inStream),
LDialogBox(inStream),
mMIMETable(nil),
mModified(false),
mInitialized(false),
@ -786,34 +815,35 @@ CEditMIMEWindow::~CEditMIMEWindow()
void CEditMIMEWindow::FinishCreateSelf()
{
// Cache pointers to all the controls
mFileTypePopup = (LGAPopup *)FindPaneByID(eFileTypePopupMenu);
mFileTypePopup = dynamic_cast<LPopupButton*>(FindPaneByID(eFileTypePopupMenu));
XP_ASSERT(mFileTypePopup);
mPluginPopup = (LGAPopup *)FindPaneByID(ePluginPopupMenu);
mPluginPopup = dynamic_cast<LPopupButton*>(FindPaneByID(ePluginPopupMenu));
XP_ASSERT(mPluginPopup);
mDescriptionEditField = (CGAEditBroadcaster *)FindPaneByID(eDescriptionField);
mDescriptionEditField = dynamic_cast<LEditField*>(FindPaneByID(eDescriptionField));
XP_ASSERT(mDescriptionEditField);
mTypeEditField = (CGAEditBroadcaster *)FindPaneByID(eMIMETypeField);
mTypeEditField = dynamic_cast<LEditField*>(FindPaneByID(eMIMETypeField));
XP_ASSERT(mTypeEditField);
mExtensionEditField = (CGAEditBroadcaster *)FindPaneByID(eSuffixes);
mExtensionEditField = dynamic_cast<LEditField*>(FindPaneByID(eSuffixes));
XP_ASSERT(mExtensionEditField);
mRadioSave = (LGARadioButton *)FindPaneByID(eSaveRButton);
mRadioSave = dynamic_cast<LControl*>(FindPaneByID(eSaveRButton));
XP_ASSERT(mRadioSave);
mRadioLaunch = (LGARadioButton *)FindPaneByID(eApplicationRButton);
mRadioLaunch = dynamic_cast<LControl*>(FindPaneByID(eApplicationRButton));
XP_ASSERT(mRadioLaunch);
mRadioInternal = (LGARadioButton *)FindPaneByID(eCommunicatorRButton);
mRadioInternal = dynamic_cast<LControl*>(FindPaneByID(eCommunicatorRButton));
XP_ASSERT(mRadioInternal);
mRadioUnknown = (LGARadioButton *)FindPaneByID(eUnknownRButton);
mRadioUnknown = dynamic_cast<LControl*>(FindPaneByID(eUnknownRButton));
XP_ASSERT(mRadioUnknown);
mRadioPlugin = (LGARadioButton *)FindPaneByID(ePluginRButton);
mRadioPlugin = dynamic_cast<LControl*>(FindPaneByID(ePluginRButton));
XP_ASSERT(mRadioPlugin);
// mAppPicker = (CFilePicker *)FindPaneByID(eApplicationFilePicker);
@ -830,12 +860,18 @@ void CEditMIMEWindow::FinishCreateSelf()
// Text fields cannot become broadcasters automatically because
// LinkListenerToControls expects fields to be descendants of LControl
// C++ vtable gets messed up
mDescriptionEditField->AddListener(this);
mTypeEditField->AddListener(this);
mExtensionEditField->AddListener(this);
// C++ vtable gets messed up. Luckily, these text fields are also LBroadcasters!
LBroadcaster* field = dynamic_cast<LBroadcaster*>(FindPaneByID(eDescriptionField));
XP_ASSERT(field != NULL);
field->AddListener(this);
field = dynamic_cast<LBroadcaster*>(FindPaneByID(eMIMETypeField));
XP_ASSERT(field != NULL);
field->AddListener(this);
field = dynamic_cast<LBroadcaster*>(FindPaneByID(eSuffixes));
XP_ASSERT(field != NULL);
field->AddListener(this);
LGADialogBox::FinishCreateSelf();
LDialogBox::FinishCreateSelf();
}
@ -911,7 +947,7 @@ void CEditMIMEWindow::BuildPluginMenu()
if (oldCount || mPluginCount)
{
SetMenuSizeForLGAPopup(mPluginPopup, mPluginCount);
SetMenuSize(mPluginPopup, mPluginCount);
MenuHandle menuH = mPluginPopup->GetMacMenuH();
uint32 index = 0;
@ -943,6 +979,8 @@ void CEditMIMEWindow::BuildPluginMenu()
mPluginPopup->Refresh();
}
}
else
mPluginPopup->SetValue(1);
}
@ -957,7 +995,7 @@ void CEditMIMEWindow::BuildFileTypeMenu()
if (count)
{
SetMenuSizeForLGAPopup(mFileTypePopup, count);
SetMenuSize(mFileTypePopup, count);
MenuHandle menuH = mFileTypePopup->GetMacMenuH();
uint32 index;
@ -1326,8 +1364,8 @@ void CEditMIMEWindow::ListenToMessage(MessageT inMessage, void */*ioParam*/)
break;
}
// Edit some text
case msg_EditField:
// User edited some text. Update controls to match.
case CBroadcasterEditField::msg_TextChanged:
{
CStr255 newText;
@ -1361,33 +1399,6 @@ void CEditMIMEWindow::ListenToMessage(MessageT inMessage, void */*ioParam*/)
}
}
#pragma mark ---CEditFieldControl---
//======================================
class CEditFieldControl : public LGAEditField
//======================================
{
// Note: This is not derived from LControl! It has control in the
// name because it broadcasts when the user changes its contents.
public:
enum
{
class_ID = 'edtC',
msg_ChangedText = 'TxtC'
};
virtual ~CEditFieldControl() {}
CEditFieldControl(LStream *inStream) :
LGAEditField(inStream)
{}
virtual void UserChangedText();
}; // class CEditFieldControl
//-----------------------------------
void CEditFieldControl::UserChangedText()
//-----------------------------------
{
BroadcastMessage(msg_ChangedText, this);
}
//======================================
#pragma mark --CAppearanceMainMediator---
@ -1399,14 +1410,13 @@ enum
eMailBox,
eNewsBox,
eEditorBox,
eConferenceBox,
eConferenceBox, // unused
eCalendarBox,
eNetcasterBox,
eNetcasterBox, // unused
ePicturesAndTextRButton,
eShowToolTipsBox,
ePicturesOnlyRButton,
eTextOnlyRButton,
eDesktopPatternBox
};
//-----------------------------------
@ -1420,42 +1430,25 @@ CAppearanceMainMediator::CAppearanceMainMediator(LStream*)
void CAppearanceMainMediator::LoadPrefs()
//-----------------------------------
{
const OSType kConferenceAppSig = 'Ncq¹';
// netcaster/conference are gone in 5.0
FSSpec fspec;
if (CFileMgr::FindApplication(kConferenceAppSig, fspec) != noErr)
{
LGACheckbox* checkbox = (LGACheckbox *)FindPaneByID(eConferenceBox);
XP_ASSERT(checkbox);
checkbox->SetValue(false);
// disable the control
checkbox->Disable();
}
const OSType kCalendarAppSig = 'NScl';
if (CFileMgr::FindApplication(kCalendarAppSig, fspec) != noErr)
{
LGACheckbox* checkbox = (LGACheckbox *)FindPaneByID(eCalendarBox);
LControl* checkbox = dynamic_cast<LControl*>(FindPaneByID(eCalendarBox));
XP_ASSERT(checkbox);
checkbox->SetValue(false);
// disable the control
checkbox->Disable();
}
if (!FE_IsNetcasterInstalled())
{
LGACheckbox* checkbox = (LGACheckbox *)FindPaneByID(eNetcasterBox);
XP_ASSERT(checkbox);
checkbox->SetValue(false);
// disable the control
checkbox->Disable();
}
}
void CAppearanceMainMediator::WritePrefs()
{
// this pref will not take effect immediately unless we tell the CToolTipAttachment
// class to make it so
LGACheckbox *theBox = (LGACheckbox *)FindPaneByID(eShowToolTipsBox);
LControl *theBox = dynamic_cast<LControl*>(FindPaneByID(eShowToolTipsBox));
XP_ASSERT(theBox);
CToolTipAttachment::Enable(theBox->GetValue());
}
@ -1484,7 +1477,7 @@ CAppearanceFontsMediator::CAppearanceFontsMediator(LStream*)
int
CAppearanceFontsMediator::GetSelectEncMenuItem()
{
LGAPopup *encMenu = (LGAPopup *)FindPaneByID(eCharSetMenu);
LPopupButton* encMenu = dynamic_cast<LPopupButton*>(FindPaneByID(eCharSetMenu));
XP_ASSERT(encMenu);
return encMenu->GetValue();
}
@ -1497,7 +1490,7 @@ CAppearanceFontsMediator::UpdateEncoding(PaneIDT changedMenuID)
if (changedMenuID == ePropFontMenu || changedMenuID == eFixedFontMenu)
{
LGAPopup *changedMenu = (LGAPopup *)FindPaneByID(changedMenuID);
LPopupButton *changedMenu = dynamic_cast<LPopupButton*>(FindPaneByID(changedMenuID));
XP_ASSERT(changedMenu);
int changedMenuValue = changedMenu->GetValue();
CStr255 itemString;
@ -1513,7 +1506,7 @@ CAppearanceFontsMediator::UpdateEncoding(PaneIDT changedMenuID)
}
else if (changedMenuID == ePropSizeMenu || changedMenuID == eFixedSizeMenu)
{
CSizePopup *sizeMenu = (CSizePopup *)FindPaneByID(changedMenuID);
CSizePopup *sizeMenu = dynamic_cast<CSizePopup*>(FindPaneByID(changedMenuID));
XP_ASSERT(sizeMenu);
if (changedMenuID == ePropSizeMenu)
{
@ -1533,7 +1526,7 @@ CAppearanceFontsMediator::UpdateMenus()
Int32 selectedEncMenuItem = GetSelectEncMenuItem();
XP_ASSERT(selectedEncMenuItem <= mEncodingsCount);
CSizePopup *propSizeMenu = (CSizePopup *)FindPaneByID(ePropSizeMenu);
CSizePopup *propSizeMenu = dynamic_cast<CSizePopup*>(FindPaneByID(ePropSizeMenu));
XP_ASSERT(propSizeMenu);
propSizeMenu->SetFontSize(mEncodings[selectedEncMenuItem - 1].mPropFontSize);
if (mEncodings[selectedEncMenuItem - 1].mPropFontSizeLocked)
@ -1544,7 +1537,7 @@ CAppearanceFontsMediator::UpdateMenus()
{
propSizeMenu->Enable();
}
CSizePopup *fixedSizeMenu = (CSizePopup *)FindPaneByID(eFixedSizeMenu);
CSizePopup *fixedSizeMenu = dynamic_cast<CSizePopup*>(FindPaneByID(eFixedSizeMenu));
XP_ASSERT(fixedSizeMenu);
fixedSizeMenu->SetFontSize(mEncodings[selectedEncMenuItem - 1].mFixedFontSize);
if (mEncodings[selectedEncMenuItem - 1].mFixedFontSizeLocked)
@ -1557,7 +1550,7 @@ CAppearanceFontsMediator::UpdateMenus()
}
Str255 fontName;
LGAPopup *propFontMenu = (LGAPopup *)FindPaneByID(ePropFontMenu);
LPopupButton *propFontMenu = dynamic_cast<LPopupButton*>(FindPaneByID(ePropFontMenu));
XP_ASSERT(propFontMenu);
if (!SetMenuToNamedItem(propFontMenu, propFontMenu->GetMacMenuH(), mEncodings[selectedEncMenuItem - 1].mPropFont))
{
@ -1577,7 +1570,7 @@ CAppearanceFontsMediator::UpdateMenus()
propFontMenu->Enable();
}
LGAPopup *fixedFontMenu = (LGAPopup *)FindPaneByID(eFixedFontMenu);
LPopupButton *fixedFontMenu = dynamic_cast<LPopupButton*>(FindPaneByID(eFixedFontMenu));
XP_ASSERT(fixedFontMenu);
if (!SetMenuToNamedItem(fixedFontMenu, fixedFontMenu->GetMacMenuH(), mEncodings[selectedEncMenuItem - 1].mFixedFont))
{
@ -1708,7 +1701,7 @@ CAppearanceFontsMediator::PopulateEncodingsMenus(PaneIDT menuID)
{
LoadEncodings();
}
LGAPopup *theMenu = (LGAPopup *)FindPaneByID(menuID);
LPopupButton *theMenu = dynamic_cast<LPopupButton*>(FindPaneByID(menuID));
XP_ASSERT(theMenu);
for (int i = 0; i < mEncodingsCount; ++i)
{
@ -1765,7 +1758,7 @@ CAppearanceFontsMediator::WriteEncodingPrefs()
Int16
CAppearanceFontsMediator::GetFontSize(LGAPopup* whichPopup)
CAppearanceFontsMediator::GetFontSize(LPopupButton* whichPopup)
{
Str255 sizeString;
Int32 fontSize = 12;
@ -1786,12 +1779,11 @@ CAppearanceFontsMediator::GetFontSize(LGAPopup* whichPopup)
void
CAppearanceFontsMediator::FontMenuChanged(PaneIDT changedMenuID)
{
CSizePopup *sizePopup =
(CSizePopup *)FindPaneByID(ePropFontMenu == changedMenuID ?
CSizePopup *sizePopup = dynamic_cast<CSizePopup*>(FindPaneByID(ePropFontMenu == changedMenuID ?
ePropSizeMenu :
eFixedSizeMenu);
eFixedSizeMenu));
XP_ASSERT(sizePopup);
LGAPopup *fontPopup = (LGAPopup *)FindPaneByID(changedMenuID);
LPopupButton* fontPopup = dynamic_cast<LPopupButton*>(FindPaneByID(changedMenuID));
XP_ASSERT(fontPopup);
sizePopup->MarkRealFontSizes(fontPopup);
UpdateEncoding(changedMenuID);
@ -2299,8 +2291,7 @@ CBrowserLanguagesMediator::GetNewLanguage(char *&newLanguage)
mAddLanguageList =
(LTextColumn *)dialog->FindPaneByID(eAddLanguageList);
XP_ASSERT(mAddLanguageList);
CEditFieldControl *theField =
(CEditFieldControl *)dialog->FindPaneByID(eAddLanguageOtherEditField);
CBroadcasterEditField* theField = dynamic_cast<CBroadcasterEditField*>(dialog->FindPaneByID(eAddLanguageOtherEditField));
XP_ASSERT(theField);
mOtherTextEmpty = true;
@ -2406,9 +2397,9 @@ CBrowserLanguagesMediator::ListenToMessage(MessageT inMessage, void *ioParam)
{
switch (inMessage)
{
case CEditFieldControl::msg_ChangedText:
case CBroadcasterEditField::msg_TextChanged:
Str255 languageStr;
((CEditFieldControl *)ioParam)->GetDescriptor(languageStr);
(reinterpret_cast<LEditField*>(ioParam))->GetDescriptor(languageStr);
if ((mOtherTextEmpty && languageStr[0]) || // The value of mOtherTextEmpty
(!mOtherTextEmpty && !languageStr[0])) // needs to change.
{
@ -2825,8 +2816,7 @@ CEditorMainMediator::ListenToMessage(MessageT inMessage, void *ioParam)
// If mNeedsPrefs, then we are setting up the pane. If the picker
// is not set (can happen if the app file was physically deleted),
// then we need to unset the "use" check box.
LGACheckbox *checkbox =
(LGACheckbox *)FindPaneByID(inMessage);
LControl *checkbox = dynamic_cast<LControl*>(FindPaneByID(inMessage));
XP_ASSERT(checkbox);
checkbox->SetValue(false);
}
@ -2836,8 +2826,7 @@ CEditorMainMediator::ListenToMessage(MessageT inMessage, void *ioParam)
if (!fPicker->WasSet())
{ // If the file picker is still unset, that means that the user
// cancelled the file browse so we don't want the checkbox set.
LGACheckbox *checkbox =
(LGACheckbox *)FindPaneByID(inMessage);
LControl *checkbox = dynamic_cast<LControl*>(FindPaneByID(inMessage));
XP_ASSERT(checkbox);
checkbox->SetValue(false);
}
@ -2855,8 +2844,7 @@ CEditorMainMediator::ListenToMessage(MessageT inMessage, void *ioParam)
// If mNeedsPrefs, then we are setting up the pane. If the picker
// is not set (can happen if the app file was physically deleted),
// then we need to unset the "use" check box.
LGACheckbox *checkbox =
(LGACheckbox *)FindPaneByID(inMessage);
LControl *checkbox = dynamic_cast<LControl*>(FindPaneByID(inMessage));
XP_ASSERT(checkbox);
checkbox->SetValue(false);
}
@ -2866,8 +2854,7 @@ CEditorMainMediator::ListenToMessage(MessageT inMessage, void *ioParam)
if (!fPicker->WasSet())
{ // If the file picker is still unset, that means that the user
// cancelled the file browse so we don't want the checkbox set.
LGACheckbox *checkbox =
(LGACheckbox *)FindPaneByID(inMessage);
LControl *checkbox = dynamic_cast<LControl*>(FindPaneByID(inMessage));
XP_ASSERT(checkbox);
checkbox->SetValue(false);
}
@ -2885,7 +2872,7 @@ CEditorMainMediator::ListenToMessage(MessageT inMessage, void *ioParam)
checkBoxID = eUseImageEditorBox;
break;
}
LGACheckbox *checkbox = (LGACheckbox *)FindPaneByID(checkBoxID);
LControl *checkbox = dynamic_cast<LControl*>(FindPaneByID(inMessage));
XP_ASSERT(checkbox);
checkbox->SetValue(true);
break;
@ -2932,8 +2919,7 @@ CEditorMainMediator::SaveIntervalValidationFunc(CValidEditField *saveInterval)
// We are assuming that the checkbox is a sub of the field's superview.
LView *superView = saveInterval->GetSuperView();
XP_ASSERT(superView);
LGACheckbox *checkbox =
(LGACheckbox *)superView->FindPaneByID(eAutoSaveCheckBox);
LControl *checkbox = dynamic_cast<LControl*>(superView->FindPaneByID(eAutoSaveCheckBox));
XP_ASSERT(checkbox);
if (checkbox->GetValue())
{
@ -3357,7 +3343,7 @@ CAdvancedProxiesMediator::ListenToMessage(MessageT inMessage, void *ioParam)
case msg_ControlClicked:
break;
case eViewProxyConfigButton:
LGARadioButton *theButton = (LGARadioButton *)FindPaneByID(eManualRButton);
LControl* theButton = dynamic_cast<LControl*>(FindPaneByID(eManualRButton));
XP_ASSERT(theButton);
if (!theButton->GetValue())
{
@ -3515,8 +3501,8 @@ void CAdvancedDiskSpaceMediator::LoadMainPane()
void UAssortedPrefMediators::RegisterViewClasses()
//-----------------------------------
{
RegisterClass_(CEditFieldControl);
RegisterClass_(CBroadcasterEditField);
RegisterClass_( CEditMIMEWindow);
RegisterClass_( CMIMEListPane);
RegisterClass_(CColorButton);
@ -3525,10 +3511,10 @@ void UAssortedPrefMediators::RegisterViewClasses()
RegisterClass_(COtherSizeDialog);
RegisterClass_(CSizePopup);
RegisterClass_( CGAEditBroadcaster);
RegisterClass_(CValidEditField);
RegisterClass_( LCicnButton);
// RegisterClass_( 'sbox', (ClassCreatorFunc)OneClickLListBox::CreateOneClickLListBox );
RegisterClass_(OneRowLListBox); // added by ftang
UPrefControls::RegisterPrefControlViews();
} // CPrefsDialog::RegisterViewClasses

View File

@ -32,6 +32,7 @@ public:
class LTextColumn;
class CMIMEListPane;
class CDragOrderTextList;
class LPopupButton;
//======================================
#pragma mark
@ -100,7 +101,7 @@ class CAppearanceFontsMediator : public CPrefsMediator
void UpdateEncoding(PaneIDT changedMenuID);
void PopulateEncodingsMenus(PaneIDT menuID);
void WriteEncodingPrefs();
Int16 GetFontSize(LGAPopup* whichPopup);
Int16 GetFontSize(LPopupButton* whichPopup);
int GetSelectEncMenuItem();
void FontMenuChanged(PaneIDT changedMenuID);
void SizeMenuChanged(PaneIDT changedMenuID);
@ -159,6 +160,7 @@ class CBrowserLanguagesMediator : public CPrefsMediator
public:
enum { class_ID = PrefPaneID::eBrowser_Languages };
CBrowserLanguagesMediator(LStream*);
virtual ~CBrowserLanguagesMediator();

View File

@ -16,8 +16,6 @@
* Reserved.
*/
/* Portions copyright Metrowerks Corporation. */
#include "CSizePopup.h"
#include "PascalString.h"
@ -25,23 +23,13 @@
#include "resgui.h"
#include "macutil.h"
#include "UModalDialogs.h"
#include "UGraphicGizmos.h"
#include <UNewTextDrawing.h>
#include <UGAColorRamp.h>
#include <UGraphicsUtilities.h>
static const Char16 gsPopup_SmallMark = '¥'; // Mark used for small font popups
static const Int16 gsPopup_ArrowButtonWidth = 22; // Width used in drawing the arrow only
static const Int16 gsPopup_ArrowButtonHeight = 16; // Height used for drawing arrow only
static const Int16 gsPopup_ArrowHeight = 5; // Actual height of the arrow
static const Int16 gsPopup_ArrowWidth = 9; // Actual width of the arrow at widest
//-----------------------------------
CSizePopup::CSizePopup(LStream* inStream)
//-----------------------------------
: mFontNumber(0)
, LGAPopup(inStream)
, LPopupButton(inStream)
{
}
@ -100,8 +88,7 @@ void CSizePopup::SetUpCurrentMenuItem(MenuHandle inMenuH, Int16 inCurrentItem )
::SetItemMark(inMenuH, oldItem, 0);
// ¥ Always make sure item is marked
Char16 mark = GetMenuFontSize() < 12 ? gsPopup_SmallMark : checkMark;
::SetItemMark(inMenuH, inCurrentItem, mark);
::SetItemMark(inMenuH, inCurrentItem, checkMark);
}
}
@ -148,6 +135,7 @@ void CSizePopup::SetFontSize(Int32 inFontSize)
}
}
//-----------------------------------
void CSizePopup::SetValue(Int32 inValue)
//-----------------------------------
@ -155,20 +143,40 @@ void CSizePopup::SetValue(Int32 inValue)
// ¥ We intentionally do not guard against setting the value to the
// same value the popup current has. This is so that the other
// size stuff works correctly.
// ¥ Get the current item setup in the menu
MenuHandle menuH = GetMacMenuH();
if ( menuH )
{
SetUpCurrentMenuItem( menuH, inValue );
}
if (inValue < mMinValue) { // Enforce min/max range
inValue = mMinValue;
} else if (inValue > mMaxValue) {
inValue = mMaxValue;
}
// handle the "other" command if the user picked the last element of the menu
if ( inValue == ::CountMItems( menuH ))
{
StDialogHandler handler(Wind_OtherSizeDialog, nil);
LWindow* dialog = handler.GetDialog();
LEditField *sizeField = dynamic_cast<LEditField*>(dialog->FindPaneByID('SIZE'));
Assert_(sizeField);
sizeField->SetValue(GetFontSize());
sizeField->SelectAll();
// Run the dialog
MessageT message = msg_Nothing;
do
{
message = handler.DoDialog();
} while (message == msg_Nothing);
if (message == 1501)
mFontSize = sizeField->GetValue();
}
else
mFontSize = GetFontSizeFromMenuItem(inValue);
// ¥ Get the current item setup in the menu
if ( menuH )
SetUpCurrentMenuItem( menuH, inValue );
mValue = inValue; // Store new value
BroadcastValueMessage(); // Inform Listeners of value change
@ -176,80 +184,11 @@ void CSizePopup::SetValue(Int32 inValue)
// will be seen
Draw( nil );
} // LGAPopup::SetValue
} // CSizePopup::SetValue
//-----------------------------------
Boolean CSizePopup::TrackHotSpot(Int16 inHotSpot, Point inPoint, Int16 inModifiers)
//-----------------------------------
{
// Portions of this function are from LGAPopup.cp in PowerPlant
// ¥ We only want the popup menu to appear if the mouse went down
// in the our hot spot which is the popup portion of the control
// not the label area
if ( PointInHotSpot( inPoint, inHotSpot ))
{
// ¥ Get things started off on the right foot
Boolean currInside = true;
Boolean prevInside = false;
HotSpotAction( inHotSpot, currInside, prevInside );
// ¥ We skip the normal tracking that is done in the control as
// the call to PopupMenuSelect will take control of the tracking
// once the menu is up
// ¥ Now we need to handle the display of the actual popup menu
// we start by setting up some values that we will need
Int16 menuID = 0;
Int16 menuItem = GetValue();
Int16 currItem = IsPulldownMenu() ? 1 : GetValue();
Point popLoc;
GetPopupMenuPosition( popLoc );
// ¥ Call our utility function which handles the display of the menu
// menu is disposed of inside this function
HandlePopupMenuSelect( popLoc, currItem, menuID, menuItem );
if ( menuItem > 0)
{
if ( menuItem == ::CountMItems( GetMacMenuH() ))
{
StDialogHandler handler(Wind_OtherSizeDialog, nil);
LWindow* dialog = handler.GetDialog();
LEditField *sizeField = (LEditField *)dialog->FindPaneByID(1504);
Assert_(sizeField);
sizeField->SetValue(GetFontSize());
sizeField->SelectAll();
// Run the dialog
MessageT message = msg_Nothing;
do
{
message = handler.DoDialog();
} while (message == msg_Nothing);
if (msg_ChangeFontSize == message)
{
SetFontSize(sizeField->GetValue());
}
}
else
{
SetFontSize(GetFontSizeFromMenuItem(menuItem));
}
}
// ¥ Make sure that we get the HotSpotAction called one last time
HotSpotAction( inHotSpot, false, true );
return menuItem > 0;
}
else
return false;
}
//-----------------------------------
void CSizePopup::MarkRealFontSizes(LGAPopup *fontPopup)
void CSizePopup::MarkRealFontSizes(LPopupButton *fontPopup)
//-----------------------------------
{
CStr255 fontName;
@ -293,159 +232,3 @@ void CSizePopup::MarkRealFontSizes(short fontNum)
theSyle);
}
}
//-----------------------------------
void CSizePopup::DrawPopupTitle()
// DrawPopupTitle is overridden to draw in the outline style
// as needed
//-----------------------------------
{
StColorPenState theColorPenState;
StTextState theTextState;
// ¥ Get some loal variables setup including the rect for the title
ResIDT textTID = GetTextTraitsID();
Rect titleRect;
Str255 title;
GetCurrentItemTitle( title );
// ¥ Figure out what the justification is from the text trait and
// get the port setup with the text traits
UTextTraits::SetPortTextTraits( textTID );
// ¥ Set outline style if it's an outline size
if (GetMacMenuH() && GetValue() != ::CountMItems(GetMacMenuH()))
{
Int32 fontSize;
CStr255 itemString;
::GetMenuItemText(GetMacMenuH(), GetValue(), itemString);
fontSize = 0;
myStringToNum(itemString, &fontSize);
Style theSyle;
if (fontSize && ::RealFont(mFontNumber, fontSize))
{
theSyle = outline;
}
else
{
theSyle = normal;
}
::TextFace(theSyle);
}
// ¥ Set up the title justification which is always left justified
Int16 titleJust = teFlushLeft;
// ¥ Get the current item's title
Str255 currentItemTitle;
GetCurrentItemTitle( currentItemTitle );
// ¥ Calculate the title rect
CalcTitleRect( titleRect );
// ¥ Kludge for drawing (correctly) in outline style left-justified
Rect actualRect;
UNewTextDrawing::MeasureWithJustification(
(char*) &currentItemTitle[1],
currentItemTitle[0],
titleRect,
titleJust,
actualRect);
actualRect.right += 2;
titleRect = actualRect;
titleJust = teJustRight;
// ¥ Set up the text color which by default is black
RGBColor textColor;
::GetForeColor( &textColor );
// ¥ Loop over any devices we might be spanning and handle the drawing
// appropriately for each devices screen depth
StDeviceLoop theLoop( titleRect );
Int16 depth;
while ( theLoop.NextDepth( depth ))
{
if ( depth < 4 ) // ¥ BLACK & WHITE
{
// ¥ If the control is dimmed then we use the grayishTextOr
// transfer mode to draw the text
if ( !IsEnabled())
{
::RGBForeColor( &UGAColorRamp::GetBlackColor() );
::TextMode( grayishTextOr );
}
else if ( IsEnabled() && IsHilited() )
{
// ¥ When we are hilited we simply draw the title in white
::RGBForeColor( &UGAColorRamp::GetWhiteColor() );
}
// ¥ Now get the actual title drawn with all the appropriate settings
UTextDrawing::DrawWithJustification(
(char*) &currentItemTitle[1],
currentItemTitle[0],
titleRect,
titleJust);
}
else // ¥ COLOR
{
// ¥ If control is selected we always draw the text in the title
// hilite color, if requested
if ( IsHilited())
::RGBForeColor( &UGAColorRamp::GetWhiteColor() );
// ¥ If the box is dimmed then we have to do our own version of the
// grayishTextOr as it does not appear to work correctly across
// multiple devices
if ( !IsEnabled() || !IsActive())
{
textColor = UGraphicsUtilities::Lighten( &textColor );
::TextMode( srcOr );
::RGBForeColor( &textColor );
}
// ¥ Now get the actual title drawn with all the appropriate settings
UTextDrawing::DrawWithJustification(
(char*) &currentItemTitle[1],
currentItemTitle[0],
titleRect,
titleJust);
}
}
} // CSizePopup::DrawPopupTitle
//-----------------------------------
void CSizePopup::DrawPopupArrow()
//-----------------------------------
{
StColorPenState theColorPenState;
// ¥ Get the local popup frame rect
Rect popupFrame;
CalcLocalPopupFrameRect( popupFrame );
// ¥ Set up some variables used in the drawing loop
Int16 start = (( UGraphicsUtilities::RectHeight( popupFrame ) - gsPopup_ArrowHeight) / 2) + 1;
// ¥ Figure out the left and right edges based on whether we are drawing
// only the arrow portion or the entire popup
Int16 leftEdge = gsPopup_ArrowButtonWidth - 6;
Int16 rightEdge = leftEdge - (gsPopup_ArrowWidth - 1);
popupFrame.top = popupFrame.top + start;
popupFrame.bottom = popupFrame.top + gsPopup_ArrowHeight - 1;
popupFrame.left = popupFrame.right - leftEdge;
popupFrame.right = popupFrame.right - rightEdge;
UGraphicGizmos::DrawPopupArrow(
popupFrame,
IsEnabled(),
IsActive(),
IsHilited());
} // CSizePopup::DrawPopupArrow

View File

@ -16,10 +16,10 @@
* Reserved.
*/
#include <LGAPopup.h>
#include <LPopupButton.h>
//======================================
class CSizePopup: public LGAPopup
class CSizePopup: public LPopupButton
//======================================
{
public:
@ -39,17 +39,15 @@ public:
virtual void SetValue(Int32 inValue);
void MarkRealFontSizes(short fontNum);
void MarkRealFontSizes(LGAPopup *fontPopup);
void MarkRealFontSizes(LPopupButton *fontPopup);
virtual void SetUpCurrentMenuItem(MenuHandle inMenuH, Int16 inCurrentItem);
protected:
virtual Boolean TrackHotSpot(Int16 inHotSpot, Point inPoint, Int16 inModifiers);
virtual Int32 GetFontSizeFromMenuItem(Int32 inMenuItem) const;
virtual void DrawPopupTitle();
virtual void DrawPopupArrow();
Int32 mFontSize;
short mFontNumber;
}; // class CSizePopup

View File

@ -21,7 +21,7 @@
//-----------------------------------
CValidEditField::CValidEditField( LStream* s )
//-----------------------------------
: LGAEditField( s )
: LEditField( s )
, mValidationFunc( nil )
{
}

View File

@ -18,10 +18,10 @@
#pragma once
#include <LGAEditField.h>
#include <LEditField.h>
//======================================
class CValidEditField: public LGAEditField
class CValidEditField: public LEditField
//======================================
{
public:

View File

@ -52,10 +52,7 @@ extern "C"
//PP
#include <LTextColumn.h>
#include <LGAPushButton.h>
#include <UModalDialogs.h>
#include <LGARadioButton.h>
#include <LGACheckbox.h>
#ifndef MOZ_LITE
#pragma mark ---CLDAPServerPropDialog---
@ -97,12 +94,12 @@ void CLDAPServerPropDialog::FinishCreateSelf( )
XP_ASSERT(mPortNumber);
mMaxHits = (CValidEditField *) FindPaneByID(eMaxHitsEditField);
XP_ASSERT(mMaxHits);
mSecureBox = (LGACheckbox *) FindPaneByID(eSecureBox);
mSecureBox = dynamic_cast<LControl*>(FindPaneByID(eSecureBox));
XP_ASSERT(mSecureBox);
mSavePasswordBox = dynamic_cast<LGACheckbox *>(FindPaneByID ( eSaveLDAPServerPasswordBox) );
mSavePasswordBox = dynamic_cast<LControl*>(FindPaneByID ( eSaveLDAPServerPasswordBox) );
Assert_( mSavePasswordBox );
mDownloadCheckBox = dynamic_cast<LGACheckbox* >( FindPaneByID ( eDownloadCheckBox ) );
mDownloadCheckBox = dynamic_cast<LControl*>( FindPaneByID ( eDownloadCheckBox ) );
Assert_( mDownloadCheckBox );
UReanimator::LinkListenerToControls( this, this, eLDAPServerPropertiesDialogResID );
@ -268,7 +265,7 @@ void CLDAPServerPropDialog::SetUpDialog(
mMaxHits->Disable();
mSecureBox->Disable();
// pwBox->Disable();
LGAPushButton *okButton = (LGAPushButton *) FindPaneByID(CPrefsDialog::eOKButtonID);
LControl *okButton = dynamic_cast<LControl*>(FindPaneByID(CPrefsDialog::eOKButtonID));
XP_ASSERT(okButton);
okButton->Disable();
}
@ -295,8 +292,7 @@ Boolean CLDAPServerPropDialog::PortNumberValidationFunc(CValidEditField *portNum
// LDAP secure (SSL) standard port = 636
LView *superView = portNumber->GetSuperView();
XP_ASSERT(superView);
LGACheckbox *checkbox =
(LGACheckbox *)superView->FindPaneByID(eSecureBox);
LControl* checkbox = dynamic_cast<LControl*>(superView->FindPaneByID(eSecureBox));
XP_ASSERT(checkbox);
portNumber->SetValue(checkbox->GetValue() ? eLDAPSecurePort : eLDAPStandardPort);
portNumber->SelectAll();
@ -392,8 +388,7 @@ void CMailNewsIdentityMediator::ListenToMessage(MessageT inMessage, void *ioPara
// If mNeedsPrefs, then we are setting up the pane. If the picker
// is not set (can happen if the sig file was physically deleted),
// then we need to unset the "use" check box.
LGACheckbox *checkbox =
(LGACheckbox *)FindPaneByID(inMessage);
LControl* checkbox = dynamic_cast<LControl*>(FindPaneByID(inMessage));
XP_ASSERT(checkbox);
checkbox->SetValue(false);
}
@ -403,8 +398,7 @@ void CMailNewsIdentityMediator::ListenToMessage(MessageT inMessage, void *ioPara
if (!fPicker->WasSet())
{ // If the file picker is still unset, that means that the user
// cancelled the file browse so we don't want the checkbox set.
LGACheckbox *checkbox =
(LGACheckbox *)FindPaneByID(inMessage);
LControl *checkbox = dynamic_cast<LControl*>(FindPaneByID(inMessage));
XP_ASSERT(checkbox);
checkbox->SetValue(false);
}
@ -412,8 +406,7 @@ void CMailNewsIdentityMediator::ListenToMessage(MessageT inMessage, void *ioPara
}
break;
case msg_FolderChanged:
LGACheckbox *checkbox =
(LGACheckbox *)FindPaneByID(eUseSigFileBox);
LControl *checkbox = dynamic_cast<LControl*>(FindPaneByID(eUseSigFileBox));
XP_ASSERT(checkbox);
checkbox->SetValue(true);
break;
@ -626,7 +619,8 @@ void CMailNewsOutgoingMediator::ListenToMessage(MessageT inMessage, void* ioPara
ckID = 'Tmpl';
break;
}
LGACheckbox* checkbox = dynamic_cast<LGACheckbox*>(FindPaneByID(ckID));
LControl* checkbox = dynamic_cast<LControl*>(FindPaneByID(ckID));
XP_ASSERT(checkbox);
UPrefControls::NoteSpecialFolderChanged(checkbox, kind, folder);
}
}
@ -976,11 +970,11 @@ void CMailNewsMailServerMediator::AddButton()
MPreferenceBase::StWriteOnDestroy setter2(false);
StDialogHandler handler(12011, nil);
LWindow* dialog = handler.GetDialog();
LGAEditField* nameField = (LGAEditField*)dialog->FindPaneByID('NAME');
LEditField* nameField = dynamic_cast<LEditField*>(dialog->FindPaneByID('NAME'));
SignalIf_(!nameField);
if (!nameField)
return;
LGARadioButton* popButton = (LGARadioButton*)dialog->FindPaneByID('POP3');
LControl* popButton = dynamic_cast<LControl*>(dialog->FindPaneByID('POP3'));
SignalIf_(!popButton);
if (!popButton)
return;
@ -1201,8 +1195,7 @@ Boolean CMailNewsNewsServerMediator::PortNumberValidationFunc(CValidEditField *p
// NNTP secure (SSL) standard port = 563
LView *superView = portNumber->GetSuperView();
XP_ASSERT(superView);
LGACheckbox *checkbox =
(LGACheckbox *)superView->FindPaneByID(eNewsServerSecureBox);
LControl *checkbox = dynamic_cast<LControl*>(superView->FindPaneByID(eNewsServerSecureBox));
XP_ASSERT(checkbox);
portNumber->SetValue(checkbox->GetValue() ? eNNTPSecurePort : eNNTPStandardPort);
portNumber->SelectAll();
@ -1702,11 +1695,9 @@ Boolean COfflineNewsMediator::SinceDaysValidationFunc(CValidEditField *sinceDays
// field's superview.
LView *superView = sinceDays->GetSuperView();
XP_ASSERT(superView);
LGACheckbox *checkbox =
(LGACheckbox *)superView->FindPaneByID(eByDateBox);
LControl *checkbox = dynamic_cast<LControl*>(superView->FindPaneByID(eByDateBox));
XP_ASSERT(checkbox);
LGARadioButton *radioButton =
(LGARadioButton *)superView->FindPaneByID(eDaysRButton);
LControl *radioButton = dynamic_cast<LControl*>(superView->FindPaneByID(eDaysRButton));
XP_ASSERT(radioButton);
if (checkbox->GetValue() && radioButton->GetValue())
{

View File

@ -28,10 +28,12 @@
#include "xp_mcom.h"
#include <LGACheckbox.h>
#include <LGARadioButton.h>
#include <LCheckbox.h>
#include <LRadioButton.h>
//#include <LPopupButton.h>
#include <LGAPopup.h>
// Note. We can do java-style 'inline' virtual functions here, because these classes
// all have file scope. If you ever move these declarations to a header, you
// should non-inline 'em.
@ -40,12 +42,12 @@
//======================================
class CPrefCheckbox
//======================================
: public LGACheckbox
: public LCheckBox
, public MPreference<LControl,XP_Bool>
{
public:
CPrefCheckbox(LStream* inStream)
: LGACheckbox(inStream)
: LCheckBox(inStream)
, MPreference<LControl,XP_Bool>(this, inStream)
{
}
@ -55,10 +57,10 @@ public:
// checkbox always writes its pane value ^ its ordinal.
// Thus: if mOrdinal == 1, the checkbox reverses the sense of the pref.
}
enum { class_ID = 'Pchk' };
enum { class_ID = 'PCHK' };
virtual void FinishCreateSelf()
{
LGACheckbox::FinishCreateSelf();
LCheckBox::FinishCreateSelf();
MPreferenceBase::FinishCreate();
}
}; // class CPrefCheckbox
@ -67,14 +69,14 @@ public:
//======================================
class CBoolPrefRadio
// Actually, because of the writing-out policy, only the zero-ordinal radio button
// needs to be a CBoolPrefRadio. The other one can be just a LGARadioButton.
// needs to be a CBoolPrefRadio. The other one can be just a LRadioButton.
//======================================
: public LGARadioButton
: public LRadioButton
, public MPreference<LControl,XP_Bool>
{
public:
CBoolPrefRadio(LStream* inStream)
: LGARadioButton(inStream)
: LRadioButton(inStream)
, MPreference<LControl,XP_Bool>(this, inStream)
{
}
@ -85,10 +87,10 @@ public:
if (mOrdinal == 0)
WriteSelf();
}
enum { class_ID = 'Brad' };
enum { class_ID = 'BRAD' };
virtual void FinishCreateSelf()
{
LGARadioButton::FinishCreateSelf();
LRadioButton::FinishCreateSelf();
MPreferenceBase::FinishCreate();
}
}; // class CBoolPrefRadio
@ -97,12 +99,12 @@ public:
//======================================
class CIntPrefRadio
//======================================
: public LGARadioButton
: public LRadioButton
, public MPreference<LControl,int32>
{
public:
CIntPrefRadio(LStream* inStream)
: LGARadioButton(inStream)
: LRadioButton(inStream)
, MPreference<LControl,int32>(this, inStream)
{
}
@ -113,10 +115,10 @@ public:
if (mPaneSelf->GetValue() != 0)
WriteSelf();
}
enum { class_ID = 'Irad' };
enum { class_ID = 'IRAD' };
virtual void FinishCreateSelf()
{
LGARadioButton::FinishCreateSelf();
LRadioButton::FinishCreateSelf();
MPreferenceBase::FinishCreate();
}
}; // class CIntPrefRadio
@ -252,7 +254,7 @@ public:
// A textedit field always writes its value out.
WriteSelf();
}
enum { class_ID = 'Pedt' };
enum { class_ID = 'PEDT' };
virtual void FinishCreateSelf()
{
CValidEditField::FinishCreateSelf();
@ -272,7 +274,7 @@ class CIntPrefTextEdit
, public MPreference<LTextEdit,int32>
{
public:
enum { class_ID = 'Iedt' };
enum { class_ID = 'IEDT' };
CIntPrefTextEdit(LStream* inStream)
: CValidEditField(inStream)
, MPreference<LTextEdit,int32>((LTextEdit*)this, inStream)