本文整理汇总了C++中Prefs函数的典型用法代码示例。如果您正苦于以下问题:C++ Prefs函数的具体用法?C++ Prefs怎么用?C++ Prefs使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了Prefs函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ControlBounds
void ArpIntControl::DrawOn(BRect updateRect, BView* view)
{
BRect cb = ControlBounds();
float textY = cb.top + Prefs().GetInt32(ARP_FULLFONT_Y);
if (mDivider > 0) {
view->SetHighColor(mViewColor);
view->FillRect( BRect(0, cb.top, cb.left, cb.bottom) );
if (mLabel.Length() > 0) {
if ( IsFocus() ) view->SetHighColor( Prefs().GetColor(ARP_INT_FGF_C));
else if ( !IsEnabled() ) view->SetHighColor( tint_color(Prefs().GetColor(ARP_INT_FG_C), B_LIGHTEN_1_TINT) );
else view->SetHighColor( Prefs().GetColor(ARP_INT_FG_C) );
view->SetLowColor(mViewColor);
view->DrawString( mLabel.String(), BPoint(0, textY) );
}
}
DrawControlBackgroundOn(cb, view);
BPoint drawPt(cb.left + 3, textY);
if (IsEnabled() == false) {
drawPt.x++;
drawPt.y++;
}
BString16 str;
GetValueLabel(Value(), str);
SetValueColor(view);
view->DrawString( str.String(), drawPt );
}
示例2: StopEdit
void ArpIntControl::StartEdit()
{
// If I've lost the active state while waiting, don't start editing.
if ( !Window() || !Window()->IsActive() ) return;
StopEdit(false);
StopTimer();
BRect b = ControlBounds();
float borderL = b.left;
float bottomIndent = 0;
float stringIndent = 3;
BPoint origin( borderL + 3, b.bottom - bottomIndent - stringIndent );
if (!mTextCtrl) {
BFont font;
GetFont(&font);
mTextCtrl = new ArpInlineTextView(BMessenger(this),
"text:edit", &font,
origin.x, b.right-2, origin.y);
}
if (!mTextCtrl) return;
SetEventMask(B_POINTER_EVENTS, B_NO_POINTER_HISTORY);
mTextCtrl->MoveOver(origin.x, b.right-2, origin.y);
mTextCtrl->SetViewColor( Prefs().GetColor(ARP_INT_BGF_C));
mTextCtrl->SetHighColor( Prefs().GetColor(ARP_INT_FGF_C));
BString16 str;
GetValueLabel(Value(), str);
mTextCtrl->SetText( str.String() );
AddChild(mTextCtrl);
}
示例3: Prefs
void SeqSignatureMeasureControl::DrawCenterOn(BRect bounds, BView* view)
{
view->SetHighColor( Prefs().Color(AM_MEASURE_FG_C) );
view->SetLowColor( Prefs().Color(AM_MEASURE_BOTTOM_BG_C) );
AmSignatureMeasureBackground bg(mSignatures, mMtc);
bg.SetScrollX(mScrollX);
bg.SetLeftIndent(mLeftIndent);
bg.SetFlag(bg.DRAW_SIGNATURES_FLAG, true);
bg.SetFlag(bg.DRAW_MEASURE_FLAG, true);
/* This looks like a hack I did for drawing the measure in
* the track window. However, as of now, I have no plans to
* allow tracks to have their own signatures, so this is
* currently a waste of time. Probably, if I do want to reinstate
* this, I should do it a better way, like another subclass. This
* is just gross.
*/
#if 0
if (mTrackWinProps) {
AmTrackRef trackRef = mTrackWinProps->OrderedTrackAt(0);
if (trackRef.IsValid() ) bg.SetTrackRef(trackRef);
}
#endif
bg.DrawAllOn(view, bounds);
}
示例4: left
void SeqMeasureControl::DrawCenterBgOn(BRect cBounds, BView* view, AmTime songEndTime)
{
BPoint left(cBounds.left, cBounds.top + 1);
BPoint right(cBounds.right, cBounds.top + 1);
rgb_color c = Prefs().Color( AM_MEASURE_TOP_BG_C );
rgb_color bc = Prefs().Color( AM_MEASURE_BOTTOM_BG_C );
float r_delta = 0, g_delta = 0, b_delta = 0;
float height = cBounds.bottom - left.y;
if( c.red != bc.red ) r_delta = ((float)bc.red - (float)c.red) / height;
if( c.green != bc.green ) g_delta = ((float)bc.green - (float)c.green) / height;
if( c.blue != bc.blue ) b_delta = ((float)bc.blue - (float)c.blue) / height;
float i = 1;
rgb_color o = c;
while (left.y < cBounds.bottom) {
view->SetHighColor( c );
view->StrokeLine( left, right );
c.red = (uint8)(o.red + (i * r_delta));
c.green = (uint8)(o.green + (i * g_delta));
c.blue = (uint8)(o.blue + (i * b_delta));
left.y++;
right.y++;
i++;
}
}
示例5: BView
BView* SeqPrefWin::NewEditView(BRect bounds, const BMessage& prefs)
{
BView* v = new BView(bounds, EDIT_STR, B_FOLLOW_ALL, 0);
if (!v) return v;
v->SetViewColor( Prefs().Color(AM_AUX_WINDOW_BG_C) );
const char* label = "Undo history:";
float top = INDENT;
float fh = view_font_height(v);
float ih = Prefs().Size(INT_CTRL_Y);
float max = (fh > ih) ? fh : ih;
BRect r(INDENT, top, INDENT + v->StringWidth(label), top + max);
BStringView* sv = new BStringView(r, "undolevellabel", label);
if (sv) v->AddChild(sv);
r.left = r.right + LABEL_PAD;
r.right = r.left + v->StringWidth("999") + 5;
mUndoLevelCtrl = new ArpIntControl( r, UNDO_LEVEL_INT, NULL, new BMessage(CHANGE_UNDO_HISTORY_MSG) );
if (mUndoLevelCtrl) {
mUndoLevelCtrl->SetLimits(0, UNDO_HISTORY_MAX);
int32 level;
if (prefs.FindInt32(UNDO_HISTORY_PREF, &level) != B_OK) level = AM_DEFAULT_UNDO_HISTORY;
if (level < 0 || level > UNDO_HISTORY_MAX) level = AM_DEFAULT_UNDO_HISTORY;
mUndoLevelCtrl->SetValue(level);
v->AddChild(mUndoLevelCtrl);
}
return v;
}
示例6: TestPrefsDataReadOld
void TestPrefsDataReadOld( void )
{
OldPreferences oldPref;
Int16 version;
UInt16 prefSize;
/* Add known old preference structure */
MemSet( &oldPref, sizeof( OldPreferences ), 0 );
oldPref.rotate = true;
oldPref.controlMode = MODE2;
oldPref.useDateTime = true;
PrefSetAppPreferences( (UInt32) ViewerAppID, (UInt16) ViewerOldPrefID,
(Int16) ViewerVersion, &oldPref, sizeof( OldPreferences ), true );
/* When the old preference structure is found it should be converted
to the new format and then the old structure should be removed */
ReadPrefs();
ASSERT( Prefs()->rotate );
ASSERT( Prefs()->controlMode == MODE2 );
ASSERT( Prefs()->useDateTime );
/* Check that the old preference structure is removed */
prefSize = 0;
version = PrefGetAppPreferences( (UInt32) ViewerAppID,
(UInt16) ViewerOldPrefID, NULL, &prefSize, true);
ASSERT( version == noPreferenceFound );
}
示例7: LoadColorPrefs
/* Load the general section into memory */
static void LoadColorPrefs( void )
{
CtlSetValue( GetObjectPtr( frmPrefsColorStrikethrough ),
Prefs()->strikethrough );
CtlSetValue( GetObjectPtr( frmPrefsColorForceDefaultColors ),
Prefs()->forceDefaultColors );
}
示例8: ShowSelectWordTapIcon
/* Indicate that the next tap looks things up in the selected word */
static void ShowSelectWordTapIcon( void )
{
FormType* mainForm;
UInt16 prevCoordSys;
if ( Prefs()->toolbar == TOOLBAR_NONE )
return;
mainForm = FrmGetFormPtr( GetMainFormId() );
prevCoordSys = PalmSetCoordinateSystem( STANDARD );
if ( Prefs()->toolbar == TOOLBAR_SILK ) {
/* FIXME: figure this out */
}
else {
FrmHideObject( mainForm, FrmGetObjectIndex( mainForm, bmpWait ) );
if ( isSelectWordTapMode ) {
FrmHideObject( mainForm, FrmGetObjectIndex( mainForm, bmpHome ) );
FrmShowObject( mainForm, FrmGetObjectIndex( mainForm, bmpLookup ) );
}
else {
FrmHideObject( mainForm, FrmGetObjectIndex( mainForm, bmpLookup ) );
FrmShowObject( mainForm, FrmGetObjectIndex( mainForm, bmpHome ) );
}
}
PalmSetCoordinateSystem( prevCoordSys );
}
示例9: inherited
/*************************************************************************
* SEQ-STUDIO-WINDOW
*************************************************************************/
SeqStudioWindow::SeqStudioWindow( BRect frame,
const BMessage* config = NULL)
: inherited(frame,
"Studio",
B_DOCUMENT_WINDOW_LOOK,
B_NORMAL_WINDOW_FEEL,
B_ASYNCHRONOUS_CONTROLS),
mBg(NULL), mPortMenu(NULL),
mLabelCtrl(NULL), mDeviceCtrl(NULL)
{
BRect b(Bounds() );
BRect r(b);
r.bottom = Prefs().Size(MAINMENU_Y);
AddMainMenu(r);
r.top = r.bottom + 1;
/* This accounts for the document window tab. That tab does
* not play nicely with a background that goes completely behind
* it -- it leaves trails -- so we have to chunk the background
* into two parts.
*/
r.bottom = b.bottom - B_H_SCROLL_BAR_HEIGHT;
AddViews(r);
r.top = r.bottom + 1;
r.bottom = b.bottom;
r.right = b.right - B_V_SCROLL_BAR_WIDTH;
BView* v = new BView(r, "filler", B_FOLLOW_LEFT_RIGHT | B_FOLLOW_BOTTOM, 0);
if (v) {
v->SetViewColor( Prefs().Color(AM_AUX_WINDOW_BG_C) );
AddChild(v);
}
if (config) SetConfiguration(config);
}
示例10: DoSelectTypeAction
/* Perform action for specified screen region */
static void DoScreenAction
(
RegionType region /* screen region */
)
{
DoSelectTypeAction( Prefs()->select[ Prefs()->controlMode ][ region ] );
}
示例11: ArpVALIDATE
void SeqPrefWin::FactoryRowSelected()
{
if (mFactoryInspector) {
if (mFactoryInspector->RemoveSelf()) delete mFactoryInspector;
mFactoryInspector = 0;
}
if (!mFactoryView) return;
ArpVALIDATE(mFactoryList, return);
float sx = Prefs().Size(SPACE_X), sy = Prefs().Size(SPACE_Y);
BPoint at = BPoint(sx, mFactoryList->Frame().bottom + sy);
BString fac, key;
if (mFactoryList->GetCurrentKeys(fac, key) != B_OK
|| fac.Length() < 1 || key.Length() < 1)
return;
AmViewFactory* factory = AmGlobals().FactoryNamed(fac);
if (!factory) return;
BRect f(mFactoryView->Bounds());
f.left = at.x;
f.top = at.y;
mFactoryInspector = factory->NewPrefView(f, &mPreferences, key);
if (mFactoryInspector) mFactoryView->AddChild(mFactoryInspector);
}
示例12: Prefs
GlImage* GlNode1dAddOn::NewImage() const
{
int32 w = Prefs().GetInt32(GL_NODE_IMAGE_X),
h = Prefs().GetInt32(GL_NODE_IMAGE_Y);
if (w < 1 || h < 1) return 0;
GlImage* img = new GlImage(w, h);
if (!img || img->InitCheck() != B_OK) {
delete img;
return 0;
}
img->SetColor(0, 0, 0, 0);
GlNode* node = NewInstance(0);
if (!node) return img;
node->IncRefs();
gl_generate_args args;
args.flags = GL_NODE_ICON_F;
GlAlgo* a = node->Generate(args);
node->MakeEmpty();
node->DecRefs();
GlAlgo1d* a1d = (a) ? a->As1d() : 0;
if (a1d) {
GlCache1d cache;
cache.Render(a1d, img, GlRect(0, 0, w, h), GlRect(0, 0, w, h));
}
delete a;
return img;
}
示例13: ArpVALIDATE
BView* GlNode1d::NewView(gl_new_view_params& params) const
{
if (params.viewType != GL_INSPECTOR_VIEW) return inherited::NewView(params);
ArpVALIDATE(Parent(), return 0);
GlStrainedParamList list;
status_t err = GetParams(list);
if (err != B_OK) return 0;
// if (GetParams(params) != B_OK) return 0;
GlParamView* v = new GlParamView(params, Parent()->Id(), Id());
if (!v) return 0;
float sx = float(Prefs().GetInt32(ARP_PADX)),
sy = float(Prefs().GetInt32(ARP_PADY));
float fh = v->ViewFontHeight();
// float div = get_divider(params, this);
v->mRect.Set(sx, sy, 152, sy + fh);
v->AddLabel(v->mRect, "label", AddOn()->Label());
v->mRect.Set(v->mRect.left, v->mRect.bottom + sy, v->mRect.right, v->mRect.bottom + sy + 50);
v->AddVisualView(v->mRect, "bm", NewVisual(params.ref), 0);
v->AddParamControls(list);
return v;
}
示例14: BView
void SeqPhrasePropertyWindow::AddViews(BRect frame)
{
mBg = new BView(frame, "bg", B_FOLLOW_ALL, B_WILL_DRAW);
if (!mBg) return;
mBg->SetViewColor( Prefs().Color(AM_AUX_WINDOW_BG_C) );
AddChild(mBg);
float fh = arp_get_font_height(mBg);
float borderX = Prefs().Size(BORDER_X), borderY = Prefs().Size(BORDER_Y);
float spaceX = Prefs().Size(SPACE_X), spaceY = Prefs().Size(SPACE_Y);
float divider = mBg->StringWidth("Color:") + 10;
/* The Name field.
*/
BRect f(borderX, borderY, frame.Width() - borderX, borderY + fh);
mNameCtrl = new BTextControl(f, "name_ctrl", "Name:", NULL, new BMessage(NAME_MSG), B_FOLLOW_LEFT_RIGHT | B_FOLLOW_TOP);
if (mNameCtrl) {
f.top = mNameCtrl->Frame().bottom;
mNameCtrl->SetDivider(divider);
mNameCtrl->MakeFocus(true);
mNameCtrl->SetModificationMessage(new BMessage(NAME_MSG) );
mBg->AddChild(mNameCtrl);
}
/* The Time field.
*/
f.top += spaceY;
const char* timeStr = "Time:";
f.right = divider;
f.bottom = f.top + fh;
mTimeLabel = new BStringView(f, "time_label", timeStr, B_FOLLOW_LEFT | B_FOLLOW_TOP);
if (mTimeLabel) mBg->AddChild(mTimeLabel);
mTimeCtrl = new AmTimeView(mSongRef);
if (mTimeCtrl) {
mTimeCtrl->MoveTo(f.right + 5, f.top);
mTimeCtrl->SetEnabled(false);
mBg->AddChild(mTimeCtrl);
mTimeCtrl->StartWatching(this, ARPMSG_TIME_VIEW_CHANGED);
f.top = mTimeCtrl->Frame().bottom;
}
/* The color controls.
*/
f.top += spaceY;
f.bottom = f.top + fh;
f.right = frame.Width() - spaceX;
mColorField = new_color_field(f);
if (mColorField) {
mColorField->SetDivider(divider);
mBg->AddChild(mColorField);
f.top = f.bottom;
}
mColorCtrl = new BColorControl( BPoint(spaceX, f.top + spaceY + spaceY),
B_CELLS_32x8, 2, "color_control",
new BMessage(COLOR_CHANGED_MSG) );
if (mColorCtrl) {
mBg->AddChild(mColorCtrl);
}
}
示例15: LoadLookupPrefs
/* Load the Lookup section into memory */
static void LoadLookupPrefs( void )
{
CtlSetValue( GetObjectPtr( frmPrefsLookupAlwaysActive ),
( Prefs()->selectWordTap != SELECT_WORD_TAP_NONE ) );
lookupAction = Prefs()->selectedWordAction;
SetListToSelection( frmPrefsLookupActionList,
frmPrefsLookupActionPopup, lookupAction );
}