コード例 #1
0
void CHelpContainer::ConstructL(const TRect& aRect)
	{
	CreateWindowL();

	ReadTextL();

	iRtEd = new (ELeave) CEikRichTextEditor;

	Prepare();

	iRtEd->ConstructL(this, 0, 0, EEikEdwinAvkonDisableCursor|EEikEdwinReadOnly);
	iRtEd->SetFocus(ETrue);

	SetRect(aRect);

	TRgb color;
	AknsUtils::GetCachedColor(AknsUtils::SkinInstance(), color,
			KAknsIIDQsnTextColors, EAknsCIQsnTextColorsCG1/*EAknsCIQsnLineColorsCG1 */);

//	SetColor(color);
	const CFont* font = OKCUI()->GetFont();
	SetFontAndColor(font,color);
	IntroL();
	ActivateL();
	SetupL();

	iBgContext = CAknsBasicBackgroundControlContext::NewL(
			KAknsIIDQsnBgAreaMain, aRect, ETrue);
	}
コード例 #2
0
// ------------------------------------------------------------------------- RHTML_text_view - RHTMLtextview -
RHTMLtextview::RHTMLtextview(BRect fRect, RHTMLtext *target, uint ft): BTextView(fRect,"fTextView",BRect(3,3,fRect.right-32,fRect.bottom-fRect.top),B_FOLLOW_ALL,B_WILL_DRAW)
{
 SetWordWrap(fOptions->WordWrap);
 fFont=new BFont(fOptions->DefaultFont);
 fTarget=target;
 fUpdateTimer = new RTimer("TextViewTimer", this, new BMessage('TIMR'));
 
 fFileTypes = new RHTMLFileTypes(ft,this);
 
 MakeFocus(true);
 SetDoesUndo(true);
 SetStylable(true);

 rgb_color fekete={0,0,0};

 SetFontAndColor(fFont,B_FONT_ALL,&fekete);

 fTagMenu= new RHTMLTagMenu(this);
 fTagMenu->Show();
 fTagMenu->Activate(false);
// fTagMenu->Hide();
 Window()->Activate(true);
 MakeFocus(true);

 fTimer = new RTimer("PopUpTimer", this, new BMessage('PPOP'));
 }
コード例 #3
0
ファイル: HTMLView.cpp プロジェクト: HaikuArchives/BeAIM
void HTMLView::ResetFontToBase() {	
	insertstyle.font = baseFont;
	insertstyle.color = baseColor;
	insertstyle.offset = 0;
	Select( 0, 0 );
	SetFontAndColor( &baseFont, B_FONT_ALL, &baseColor );
	styleChanged = true;
}
コード例 #4
0
ファイル: URLInputGroup.cpp プロジェクト: MaddTheSane/haiku
void
URLInputGroup::URLTextView::InsertText(const char* inText, int32 inLength,
	int32 inOffset, const text_run_array* inRuns)
{
	// Filter all line breaks, note that inText is not terminated.
	if (inLength == 1) {
		if (*inText == '\n' || *inText == '\r')
			BTextView::InsertText(" ", 1, inOffset, inRuns);
		else
			BTextView::InsertText(inText, 1, inOffset, inRuns);
	} else {
		BString filteredText(inText, inLength);
		filteredText.ReplaceAll('\n', ' ');
		filteredText.ReplaceAll('\r', ' ');
		BTextView::InsertText(filteredText.String(), inLength, inOffset,
			inRuns);
	}

	// Make the base URL part bold.
	BString text(Text(), TextLength());
	int32 baseUrlStart = text.FindFirst("://");
	if (baseUrlStart >= 0)
		baseUrlStart += 3;
	else
		baseUrlStart = 0;
	int32 baseUrlEnd = text.FindFirst("/", baseUrlStart);
	if (baseUrlEnd < 0)
		baseUrlEnd = TextLength();

	BFont font;
	GetFont(&font);
	const rgb_color black = (rgb_color) { 0, 0, 0, 255 };
	const rgb_color gray = (rgb_color) { 60, 60, 60, 255 };
	if (baseUrlStart > 0)
		SetFontAndColor(0, baseUrlStart, &font, B_FONT_ALL, &gray);
	if (baseUrlEnd > baseUrlStart) {
		font.SetFace(B_BOLD_FACE);
		SetFontAndColor(baseUrlStart, baseUrlEnd, &font, B_FONT_ALL, &black);
	}
	if (baseUrlEnd < TextLength()) {
		font.SetFace(B_REGULAR_FACE);
		SetFontAndColor(baseUrlEnd, TextLength(), &font, B_FONT_ALL, &gray);
	}

	fURLAutoCompleter->TextModified(fUpdateAutoCompleterChoices);
}
コード例 #5
0
ファイル: HTMLView.cpp プロジェクト: HaikuArchives/BeAIM
void HTMLView::SetBaseFontAndColor( BFont& font, rgb_color& color, bool SetNow ) {
	baseFont = font;
	baseColor = color;
	if( SetNow ) {
		insertstyle.font = font;
		insertstyle.color = color;
		SetFontAndColor( &font, B_FONT_ALL, &color );
	}
}
コード例 #6
0
ファイル: TTimeTextView.cpp プロジェクト: ModeenF/UltraDV
void TTimeTextView::Init()
{		
	m_IsLocked = false;
	
	SetTextRect(Bounds());
	SetAlignment(B_ALIGN_CENTER);
	
	// Set up max number of character
	SetMaxBytes(11);
	
	// Set font and color	
	BFont theFont(be_plain_font);
	theFont.SetSize(10);
	SetViewColor(kWhite);
	SetFontAndColor(&theFont, B_FONT_ALL, &kBlack);
	
	// 	Set up time rects.  We divide the area up into four areas
	//	for hour, minutes, seconds and frames
	float 	numberWidth;
	float 	spaceWidth;

	BRect bounds = Bounds();
	
	numberWidth = StringWidth("00");
	spaceWidth = StringWidth(":");
	
	m_HoursRect.left 		= bounds.left;
	m_HoursRect.top 		= bounds.top;
	m_HoursRect.right 		= m_HoursRect.left + numberWidth;
	m_HoursRect.bottom 		= bounds.bottom;
	
	m_MinutesRect.left 		= m_HoursRect.right + spaceWidth;
	m_MinutesRect.top 		= bounds.top;
	m_MinutesRect.right 	= m_MinutesRect.left + numberWidth;
	m_MinutesRect.bottom 	= bounds.bottom;
	
	m_SecondsRect.left 		= m_MinutesRect.right + spaceWidth;
	m_SecondsRect.top 		= bounds.top;
	m_SecondsRect.right 	= m_SecondsRect.left + numberWidth;
	m_SecondsRect.bottom 	= bounds.bottom;
	
	m_FramesRect.left 		= m_SecondsRect.right + spaceWidth;
	m_FramesRect.top 		= bounds.top;
	m_FramesRect.right 		= bounds.right;
	m_FramesRect.bottom 	= bounds.bottom;
	
	// Select first cell
	//Select(0,2);
	//ScrollToSelection();
	m_CurrentCell = 1;

}
コード例 #7
0
ファイル: floatGadget.cpp プロジェクト: HaikuArchives/BeGUI
void 
FloatGadget	::	AttachedToWindow(	void)
{
	BTextView::AttachedToWindow();
	rgb_color tempRgbColor;
	myPrefs->GetPreferredFloatGadgetLowColor(&tempRgbColor);
	SetLowColor(tempRgbColor);
	myPrefs->GetPreferredFloatGadgetViewColor(&tempRgbColor);
	SetViewColor(tempRgbColor);
	myPrefs->GetPreferredFloatGadgetHighColor(&tempRgbColor);
	SetHighColor(tempRgbColor);
	SetFontAndColor(	myPrefs->GetPreferredFont(),
						B_FONT_ALL,
						&tempRgbColor);
	if (mbMakeFocus) 
	{
		MakeFocus();
	}
}//end
コード例 #8
0
		AboutTextView(BRect rect) : BTextView(rect,NULL,rect.OffsetToCopy(B_ORIGIN),B_FOLLOW_NONE,B_WILL_DRAW)
		{
			int32 major = 0,middle = 0,minor = 0,variety = 0,internal = 1;

			// get version information for app

			app_info appInfo;
			if (be_app->GetAppInfo(&appInfo) == B_OK)
			{
				BFile file(&appInfo.ref,B_READ_ONLY);
				if (file.InitCheck() == B_OK)
				{
					BAppFileInfo info(&file);
					if (info.InitCheck() == B_OK)
					{
						version_info versionInfo;
						if (info.GetVersionInfo(&versionInfo,B_APP_VERSION_KIND) == B_OK)
						{
							major = versionInfo.major;
							middle = versionInfo.middle;
							minor = versionInfo.minor;
							variety = versionInfo.variety;
							internal = versionInfo.internal;
						}
					}
				}
			}
			// prepare version variety string
			const char *varietyStrings[] = {"Development","Alpha","Beta","Gamma","Golden master","Final"};
			char varietyString[32];
			strcpy(varietyString,varietyStrings[variety % 6]);
			if (variety < 5)
				sprintf(varietyString + strlen(varietyString),"/%li",internal);

			char s[512];
			sprintf(s,	"Mail Daemon Replacement\n\n"
						"by Dr. Zoidberg Enterprises. All rights reserved.\n\n"
						"Version %ld.%ld.%ld %s\n\n"
						"See LICENSE file included in the installation package for more information.\n\n\n\n"
						"You can contact us at:\n"
						"%s\n\n"
						"Please submit bug reports using the %s\n\n"
						"Project homepage at:\n%s",
						major,middle,minor,varietyString,
						kEMail,kBugsitePretty,kWebsite);

			SetText(s);
			MakeEditable(false);
			MakeSelectable(false);

			SetAlignment(B_ALIGN_CENTER);
			SetStylable(true);

			// aethetical changes
			BFont font;
			GetFont(&font);
			font.SetSize(24);
			SetFontAndColor(0,23,&font,B_FONT_SIZE);

			// center the view vertically
			rect = TextRect();  rect.OffsetTo(0,(Bounds().Height() - TextHeight(0,42)) / 2);
			SetTextRect(rect);

			// set the link regions
			int start = strstr(s,kEMail) - s;
			int finish = start + strlen(kEMail);
			GetTextRegion(start,finish,&fMail);
			SetFontAndColor(start,finish,NULL,0,&kLinkColor);

			start = strstr(s,kBugsitePretty) - s;
			finish = start + strlen(kBugsitePretty);
			GetTextRegion(start,finish,&fBugsite);
			SetFontAndColor(start,finish,NULL,0,&kLinkColor);

			start = strstr(s,kWebsite) - s;
			finish = start + strlen(kWebsite);
			GetTextRegion(start,finish,&fWebsite);
			SetFontAndColor(start,finish,NULL,0,&kLinkColor);
		}
コード例 #9
0
/*****************************************************************************
 * MessagesView::Pulse
 *****************************************************************************/
void MessagesView::Pulse()
{
    bool isScrolling = false;
    if( fScrollBar->LockLooper() )
    {
        float min, max;
        fScrollBar->GetRange( &min, &max );
        if( fScrollBar->Value() != max )
            isScrolling = true;
        fScrollBar->UnlockLooper();

    }

    int i_start, oldLength;
    char * psz_module_type = NULL;
    rgb_color red = { 200, 0, 0 };
    rgb_color gray = { 150, 150, 150 };
    rgb_color green = { 0, 150, 0 };
    rgb_color orange = { 230, 180, 00 };
    rgb_color color;

    vlc_mutex_lock( p_sub->p_lock );
    int i_stop = *p_sub->pi_stop;
    vlc_mutex_unlock( p_sub->p_lock );

    if( p_sub->i_start != i_stop )
    {
        for( i_start = p_sub->i_start;
             i_start != i_stop;
                 i_start = (i_start+1) % VLC_MSG_QSIZE )
        {
            /* Add message */
            switch( p_sub->p_msg[i_start].i_type )
            {
                case VLC_MSG_INFO: color = green; break;
                case VLC_MSG_WARN: color = orange; break;
                case VLC_MSG_ERR: color = red; break;
                case VLC_MSG_DBG: color = gray; break;
            }

            switch( p_sub->p_msg[i_start].i_object_type )
            {
                case VLC_OBJECT_ROOT: psz_module_type = "root"; break;
                case VLC_OBJECT_VLC: psz_module_type = "vlc"; break;
                case VLC_OBJECT_MODULE: psz_module_type = "module"; break;
                case VLC_OBJECT_INTF: psz_module_type = "interface"; break;
                case VLC_OBJECT_PLAYLIST: psz_module_type = "playlist"; break;
                case VLC_OBJECT_ITEM: psz_module_type = "item"; break;
                case VLC_OBJECT_INPUT: psz_module_type = "input"; break;
                case VLC_OBJECT_DECODER: psz_module_type = "decoder"; break;
                case VLC_OBJECT_VOUT: psz_module_type = "video output"; break;
                case VLC_OBJECT_AOUT: psz_module_type = "audio output"; break;
                case VLC_OBJECT_SOUT: psz_module_type = "stream output"; break;
            }

            if( LockLooper() )
            {
                oldLength = TextLength();
                BString string;
                string << p_sub->p_msg[i_start].psz_module
                    << " " << psz_module_type << " : "
                    << p_sub->p_msg[i_start].psz_msg << "\n";
                Insert( TextLength(), string.String(), strlen( string.String() ) );
                SetFontAndColor( oldLength, TextLength(), NULL, 0, &color );
                Draw( Bounds() );
                UnlockLooper();
            }
        }

        vlc_mutex_lock( p_sub->p_lock );
        p_sub->i_start = i_start;
        vlc_mutex_unlock( p_sub->p_lock );
    }

    /* Scroll at the end unless the is user is scrolling or selecting something */
    int32 start, end;
    GetSelection( &start, &end );
    if( !isScrolling && start == end && fScrollBar->LockLooper() )
    {
        float min, max;
        fScrollBar->GetRange( &min, &max );
        fScrollBar->SetValue( max );
        fScrollBar->UnlockLooper();
    }

    BTextView::Pulse();
}
コード例 #10
0
ファイル: TexView.cpp プロジェクト: HaikuArchives/BeTeX
TexView::TexView(BRect frame, BRect textRect, Prefs* p) 
			:	BTextView(frame,"texview",textRect,B_FOLLOW_ALL_SIDES, B_WILL_DRAW|B_PULSE_NEEDED/*|B_NAVIGABLE*/)
{
	prefs = p;
	IsColSel = false;
	DontSel = false;
	BFont fontie(be_fixed_font);
	f = fontie;
	f.SetSize(prefs->FontSize);
	SetFontAndColor(0,1,&f,B_FONT_ALL,&prefs->fg_color);
	SetStylable(prefs->IsSyntax);
	SetAlignment(B_ALIGN_LEFT);
	SetDoesUndo(true);
	SetAutoindent(prefs->AutoIndent);
	//IsUndo = false;
	
	IsNormalFocus = false;
	HasAttachedFocus = false;
	//TextStyles
	green_matches.push_back("textbf");
	green_matches.push_back("textit");
	green_matches.push_back("textmd");
	green_matches.push_back("textrm");
	green_matches.push_back("textsc");
	green_matches.push_back("textsf");
	green_matches.push_back("textsl");
	green_matches.push_back("texttt");
	green_matches.push_back("textup");
	green_matches.push_back("emph");

	green_matches.push_back("bf");
	green_matches.push_back("it");
	green_matches.push_back("em");
	green_matches.push_back("rm");
	green_matches.push_back("sc");
	green_matches.push_back("sf");
	green_matches.push_back("sl");
	green_matches.push_back("tt");
	green_matches.push_back("up");	

	//TextSizes
	green_matches.push_back("tiny");
	green_matches.push_back("scriptsize");
	green_matches.push_back("footnotesize");
	green_matches.push_back("small");
	green_matches.push_back("normalsize");
	green_matches.push_back("large");
	green_matches.push_back("Large");
	green_matches.push_back("LARGE");
	green_matches.push_back("huge");
	green_matches.push_back("Huge");

    green_matches.push_back("mathbb");
    green_matches.push_back("mathbf");
    green_matches.push_back("mathcal");
    green_matches.push_back("mathfrak");
    green_matches.push_back("mathit");
    green_matches.push_back("mathnormal");
    green_matches.push_back("mathrm");
    green_matches.push_back("mathsf");
    green_matches.push_back("mathtt");

    green_matches.push_back("rmfamily");
    green_matches.push_back("sffamily");
    green_matches.push_back("ttfamily");

    green_matches.push_back("itshape");
    green_matches.push_back("scshape");
    green_matches.push_back("slshape");
    green_matches.push_back("upshape");

    green_matches.push_back("bfseries");
    green_matches.push_back("mdseries");
 	
	purple_matches.push_back("author");
	purple_matches.push_back("title");
	purple_matches.push_back("section");
	purple_matches.push_back("subsection");
	purple_matches.push_back("subsubsection");
	purple_matches.push_back("subsubsubsection");
	purple_matches.push_back("verb");
	
	IsShifting = false;
}
コード例 #11
0
ファイル: TexView.cpp プロジェクト: HaikuArchives/BeTeX
void TexView::IParseLine(int sol,int eol)
{
		int size = eol-sol+1;
		vector<rgb_color> colorVec(size,prefs->fg_color);
		
		for(int k=0;k<size;k++)
		{
			colorVec[k] = prefs->fg_color;
		}
	
		int i;
		int offset = sol;
		int pos;
		int text_length = TextLength();
		//Setup some defaults....
		ITwoColorPlateau('\'',sol,eol,prefs->comma_color,colorVec);
		ITwoColorPlateau('`',sol,eol,prefs->comma_color,colorVec);
		ITwoColorPlateau('\\',sol,eol,prefs->punc_symbol_color,colorVec);

		for(i=sol;i<eol;i++)
		{
			if(ByteAt(i) == '[' || ByteAt(i) == ']')
			{
				if(i-1 >= 0 && ByteAt(i-1) == '\\')
				{
					colorVec[i-1-sol] = prefs->punc_symbol_color;
				}
					
				colorVec[i-sol] = prefs->punc_symbol_color;			
				
			}
			else if(ByteAt(i) == '&' || ByteAt(i) == '{' || ByteAt(i) == '}')//
			{
				if(i-1 >= 0 && ByteAt(i-1) == '\\')
				{
					colorVec[i-1-sol] = prefs->punc_symbol_color;
				}
					
				colorVec[i-sol] = prefs->punc_symbol_color;			
				
			}
			else if(ByteAt(i) == '$')
			{
				if(i-1 >= 0 && ByteAt(i-1) == '\\')
				{
					colorVec[i-1-sol] = prefs->fg_color;
					colorVec[i-sol] = prefs->fg_color;
				}
			}
			else if(ByteAt(i) == '\\' && i+1 < eol)
			{
				if(ByteAt(i+1) == '#')
				{	
					colorVec[i-sol] = prefs->punc_symbol_color;
					colorVec[i+1-sol] = prefs->punc_symbol_color;
				}else if(ByteAt(i+1) == '\'' || ByteAt(i+1) == '`')
				{
					colorVec[i-sol] = prefs->fg_color;
					colorVec[i+1-sol] = prefs->fg_color;
				}
			}			
		}
		offset = sol;
		
		while((pos = FindFirstOnLine('%',offset,eol))>= 0 && offset < eol)
		{			
			if(pos - 1 >= 0 && ByteAt(pos-1) == '\\')
			{
				colorVec[pos-1-sol] = prefs->punc_symbol_color;
				colorVec[pos-sol] = prefs->punc_symbol_color;
			}
			else 
			{
				for(i=pos;i<eol;i++)
					colorVec[i-sol] = prefs->comment_color;
				break;
			}
			offset= pos+1;
		}	
		
		//START COLOURING***********************************
			
		BFont default_font(be_fixed_font);
		default_font.SetSize(prefs->FontSize);

		int plLength=0;
		int plStart=0;
		for(i=sol;i<eol;i++)
		{
			if(i == sol)
			{
				plLength = 1;
				plStart = i;
			}
			else if(colorVec[i-sol] != colorVec[i-sol-1])
			{
				//if(colorVec[i-sol-1] != old_colors[i-sol])
					SetFontAndColor(plStart,plStart+plLength,&default_font,B_FONT_ALL,&colorVec[i-sol-1]);		
				
				plLength = 1;
				plStart = i;
			}
			else
			{
				plLength++;
			}	
		}
				
		if(plLength > 0)
			SetFontAndColor(plStart,plStart+plLength,&default_font,B_FONT_ALL,&colorVec[i-sol-1]);	
}
コード例 #12
0
ファイル: TexView.cpp プロジェクト: HaikuArchives/BeTeX
void TexView::UpdateFontSize()
{
	f.SetSize(prefs->FontSize);
	SetFontAndColor(0,TextLength(),&f,B_FONT_ALL,&prefs->fg_color);
	ParseAll(0,TextLength()-1,true);	
}
コード例 #13
0
ファイル: TexView.cpp プロジェクト: HaikuArchives/BeTeX
void TexView::UpdateColors()
{
	SetFontAndColor(0,TextLength(),&f,B_FONT_ALL,&prefs->fg_color);
	ParseAll(0,TextLength()-1,true);	
}