StyledEditApp::StyledEditApp() : BApplication(APP_SIGNATURE), fOpenPanel(NULL) { B_TRANSLATE_MARK_SYSTEM_NAME_VOID("StyledEdit"); fOpenPanel = new BFilePanel(); fOpenAsEncoding = 0; BMenuBar* menuBar = dynamic_cast<BMenuBar*>(fOpenPanel->Window()->FindView("MenuBar")); if (menuBar != NULL) { fOpenPanelEncodingMenu = new BMenu(B_TRANSLATE("Encoding")); fOpenPanelEncodingMenu->SetRadioMode(true); menuBar->AddItem(fOpenPanelEncodingMenu); BCharacterSetRoster roster; BCharacterSet charset; while (roster.GetNextCharacterSet(&charset) == B_NO_ERROR) { BString name; if (charset.GetFontID() == B_UNICODE_UTF8) name = B_TRANSLATE("Default"); else name = charset.GetPrintName(); const char* mime = charset.GetMIMEName(); if (mime != NULL) { name.Append(" ("); name.Append(mime); name.Append(")"); } BMenuItem* item = new BMenuItem(name.String(), new BMessage(OPEN_AS_ENCODING)); item->SetTarget(this); fOpenPanelEncodingMenu->AddItem(item); if (charset.GetFontID() == fOpenAsEncoding) item->SetMarked(true); } } else fOpenPanelEncodingMenu = NULL; fWindowCount = 0; fNextUntitledWindow = 1; fBadArguments = false; float factor = be_plain_font->Size() / 12.0f; sCascadeOffset *= factor; sTopLeft.x *= factor; sTopLeft.y *= factor; sWindowRect.left *= factor; sWindowRect.top *= factor; sWindowRect.right *= factor; sWindowRect.bottom *= factor; sWindowRect.PrintToStream(); }
StyledEditApp::StyledEditApp() : BApplication(APP_SIGNATURE), fOpenPanel(NULL) { be_locale->GetAppCatalog(&fCatalog); fOpenPanel = new BFilePanel(); BMenuBar* menuBar = dynamic_cast<BMenuBar*>(fOpenPanel->Window()->FindView("MenuBar")); fOpenAsEncoding = 0; fOpenPanelEncodingMenu= new BMenu(TR("Encoding")); menuBar->AddItem(fOpenPanelEncodingMenu); fOpenPanelEncodingMenu->SetRadioMode(true); BCharacterSetRoster roster; BCharacterSet charset; while (roster.GetNextCharacterSet(&charset) == B_NO_ERROR) { BString name; if (charset.GetFontID() == B_UNICODE_UTF8) name = TR("Default"); else name = charset.GetPrintName(); const char* mime = charset.GetMIMEName(); if (mime) { name.Append(" ("); name.Append(mime); name.Append(")"); } BMenuItem* item = new BMenuItem(name.String(), new BMessage(OPEN_AS_ENCODING)); item->SetTarget(this); fOpenPanelEncodingMenu->AddItem(item); if (charset.GetFontID() == fOpenAsEncoding) item->SetMarked(true); } fWindowCount = 0; fNextUntitledWindow = 1; fBadArguments = false; styled_edit_app = this; }