Patch by mt : localize stylededit. Thanks !
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35656 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -12,52 +12,50 @@
|
|||||||
#include "FindWindow.h"
|
#include "FindWindow.h"
|
||||||
|
|
||||||
#include <Button.h>
|
#include <Button.h>
|
||||||
|
#include <Catalog.h>
|
||||||
#include <CheckBox.h>
|
#include <CheckBox.h>
|
||||||
|
#include <GroupLayoutBuilder.h>
|
||||||
|
#include <GridLayoutBuilder.h>
|
||||||
|
#include <Locale.h>
|
||||||
|
#include <LayoutBuilder.h>
|
||||||
#include <String.h>
|
#include <String.h>
|
||||||
#include <TextControl.h>
|
#include <TextControl.h>
|
||||||
|
|
||||||
|
|
||||||
|
#undef TR_CONTEXT
|
||||||
|
#define TR_CONTEXT "FindandReplaceWindow"
|
||||||
|
|
||||||
FindWindow::FindWindow(BRect frame, BHandler* _handler, BString* searchString,
|
FindWindow::FindWindow(BRect frame, BHandler* _handler, BString* searchString,
|
||||||
bool caseState, bool wrapState, bool backState)
|
bool caseState, bool wrapState, bool backState)
|
||||||
: BWindow(frame, "FindWindow", B_MODAL_WINDOW,
|
: BWindow(frame, "FindWindow", B_MODAL_WINDOW,
|
||||||
B_NOT_RESIZABLE | B_ASYNCHRONOUS_CONTROLS, B_CURRENT_WORKSPACE)
|
B_NOT_RESIZABLE | B_ASYNCHRONOUS_CONTROLS | B_AUTO_UPDATE_SIZE_LIMITS,
|
||||||
|
B_CURRENT_WORKSPACE)
|
||||||
{
|
{
|
||||||
AddShortcut('W', B_COMMAND_KEY, new BMessage(B_QUIT_REQUESTED));
|
AddShortcut('W', B_COMMAND_KEY, new BMessage(B_QUIT_REQUESTED));
|
||||||
|
|
||||||
fFindView = new BView(Bounds(), "FindView", B_FOLLOW_ALL, B_WILL_DRAW);
|
fSearchString = new BTextControl("", TR("Find:"), NULL, NULL);
|
||||||
fFindView->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
|
fCaseSensBox = new BCheckBox("", TR("Case-sensitive"), NULL);
|
||||||
AddChild(fFindView);
|
fWrapBox = new BCheckBox("", TR("Wrap-around search"), NULL);
|
||||||
|
fBackSearchBox = new BCheckBox("", TR("Search backwards"), NULL);
|
||||||
|
fCancelButton = new BButton("", TR("Cancel"), new BMessage(B_QUIT_REQUESTED));
|
||||||
|
fSearchButton = new BButton("", TR("Find"), new BMessage(MSG_SEARCH));
|
||||||
|
|
||||||
font_height height;
|
SetLayout(new BGroupLayout(B_HORIZONTAL));
|
||||||
fFindView->GetFontHeight(&height);
|
AddChild(BGroupLayoutBuilder(B_VERTICAL, 4)
|
||||||
float lineHeight = height.ascent + height.descent + height.leading;
|
.Add(BGridLayoutBuilder(6, 2)
|
||||||
|
.Add(fSearchString->CreateLabelLayoutItem(), 0, 0)
|
||||||
float findWidth = fFindView->StringWidth("Find:") + 6;
|
.Add(fSearchString->CreateTextViewLayoutItem(), 1, 0)
|
||||||
|
.Add(fCaseSensBox, 1, 1)
|
||||||
float searchBottom = 12 + 2 + lineHeight + 2 + 1;
|
.Add(fWrapBox, 1, 2)
|
||||||
float buttonTop = frame.Height() - 19 - lineHeight;
|
.Add(fBackSearchBox, 1, 3)
|
||||||
float wrapBoxTop = (buttonTop + searchBottom - lineHeight) / 2;
|
)
|
||||||
float wrapBoxBottom = (buttonTop + searchBottom + lineHeight) / 2;
|
.AddGroup(B_HORIZONTAL, 10)
|
||||||
float caseBoxTop = (searchBottom + wrapBoxTop - lineHeight) / 2;
|
.AddGlue()
|
||||||
float caseBoxBottom = (searchBottom + wrapBoxTop + lineHeight) / 2;
|
.Add(fCancelButton)
|
||||||
float backBoxTop = (buttonTop + wrapBoxBottom - lineHeight) / 2;
|
.Add(fSearchButton)
|
||||||
float backBoxBottom = (buttonTop + wrapBoxBottom + lineHeight) / 2;
|
.End()
|
||||||
|
.SetInsets(10, 10, 10, 10)
|
||||||
fFindView->AddChild(fSearchString = new BTextControl(BRect(14, 12,
|
);
|
||||||
frame.Width() - 10, searchBottom), "", "Find:", NULL, NULL));
|
|
||||||
fSearchString->SetDivider(findWidth);
|
|
||||||
|
|
||||||
fFindView->AddChild(fCaseSensBox = new BCheckBox(BRect(16 + findWidth, caseBoxTop,
|
|
||||||
frame.Width() - 12, caseBoxBottom), "", "Case-sensitive", NULL));
|
|
||||||
fFindView->AddChild(fWrapBox = new BCheckBox(BRect(16 + findWidth, wrapBoxTop,
|
|
||||||
frame.Width() - 12, wrapBoxBottom), "", "Wrap-around search", NULL));
|
|
||||||
fFindView->AddChild(fBackSearchBox = new BCheckBox(BRect(16 + findWidth,
|
|
||||||
backBoxTop, frame.Width() - 12, backBoxBottom), "", "Search backwards", NULL));
|
|
||||||
|
|
||||||
fFindView->AddChild(fCancelButton = new BButton(BRect(142, buttonTop, 212,
|
|
||||||
frame.Height() - 7), "", "Cancel", new BMessage(B_QUIT_REQUESTED)));
|
|
||||||
fFindView->AddChild(fSearchButton = new BButton(BRect(221, buttonTop, 291,
|
|
||||||
frame.Height() - 7), "", "Find", new BMessage(MSG_SEARCH)));
|
|
||||||
|
|
||||||
fSearchButton->MakeDefault(true);
|
fSearchButton->MakeDefault(true);
|
||||||
fHandler = _handler;
|
fHandler = _handler;
|
||||||
|
|||||||
@@ -16,7 +16,6 @@
|
|||||||
class BButton;
|
class BButton;
|
||||||
class BCheckBox;
|
class BCheckBox;
|
||||||
class BTextControl;
|
class BTextControl;
|
||||||
class BView;
|
|
||||||
|
|
||||||
|
|
||||||
class FindWindow : public BWindow {
|
class FindWindow : public BWindow {
|
||||||
@@ -30,7 +29,6 @@ class FindWindow : public BWindow {
|
|||||||
private:
|
private:
|
||||||
void _SendMessage();
|
void _SendMessage();
|
||||||
|
|
||||||
BView *fFindView;
|
|
||||||
BTextControl *fSearchString;
|
BTextControl *fSearchString;
|
||||||
BCheckBox *fCaseSensBox;
|
BCheckBox *fCaseSensBox;
|
||||||
BCheckBox *fWrapBox;
|
BCheckBox *fWrapBox;
|
||||||
|
|||||||
@@ -16,6 +16,17 @@ Application StyledEdit :
|
|||||||
StyledEditApp.cpp
|
StyledEditApp.cpp
|
||||||
StyledEditView.cpp
|
StyledEditView.cpp
|
||||||
StyledEditWindow.cpp
|
StyledEditWindow.cpp
|
||||||
: be translation tracker libtextencoding.so $(TARGET_LIBSUPC++)
|
: be translation tracker libtextencoding.so liblocale.so $(TARGET_LIBSUPC++)
|
||||||
: $(styled_edit_rsrc)
|
: $(styled_edit_rsrc)
|
||||||
;
|
;
|
||||||
|
|
||||||
|
DoCatalogs StyledEdit :
|
||||||
|
x-vnd.Haiku-StyledEdit
|
||||||
|
:
|
||||||
|
FindWindow.cpp
|
||||||
|
ReplaceWindow.cpp
|
||||||
|
StyledEditApp.cpp
|
||||||
|
StyledEditWindow.cpp
|
||||||
|
: en.catalog
|
||||||
|
:
|
||||||
|
;
|
||||||
|
|||||||
@@ -12,63 +12,66 @@
|
|||||||
#include "ReplaceWindow.h"
|
#include "ReplaceWindow.h"
|
||||||
|
|
||||||
#include <Button.h>
|
#include <Button.h>
|
||||||
|
#include <Catalog.h>
|
||||||
#include <CheckBox.h>
|
#include <CheckBox.h>
|
||||||
|
#include <GroupLayoutBuilder.h>
|
||||||
|
#include <GridLayoutBuilder.h>
|
||||||
#include <Handler.h>
|
#include <Handler.h>
|
||||||
|
#include <Locale.h>
|
||||||
|
#include <LayoutBuilder.h>
|
||||||
#include <Message.h>
|
#include <Message.h>
|
||||||
#include <Messenger.h>
|
#include <Messenger.h>
|
||||||
#include <Rect.h>
|
|
||||||
#include <String.h>
|
#include <String.h>
|
||||||
#include <TextControl.h>
|
#include <TextControl.h>
|
||||||
#include <View.h>
|
|
||||||
|
|
||||||
|
|
||||||
ReplaceWindow::ReplaceWindow(BRect frame, BHandler *_handler, BString *searchString,
|
#undef TR_CONTEXT
|
||||||
BString *replaceString, bool caseState, bool wrapState, bool backState)
|
#define TR_CONTEXT "FindandReplaceWindow"
|
||||||
|
|
||||||
|
ReplaceWindow::ReplaceWindow(BRect frame, BHandler* _handler,
|
||||||
|
BString* searchString, BString *replaceString,
|
||||||
|
bool caseState, bool wrapState, bool backState)
|
||||||
: BWindow(frame, "ReplaceWindow", B_MODAL_WINDOW,
|
: BWindow(frame, "ReplaceWindow", B_MODAL_WINDOW,
|
||||||
B_NOT_RESIZABLE | B_ASYNCHRONOUS_CONTROLS, B_CURRENT_WORKSPACE)
|
B_NOT_RESIZABLE | B_ASYNCHRONOUS_CONTROLS | B_AUTO_UPDATE_SIZE_LIMITS,
|
||||||
|
B_CURRENT_WORKSPACE)
|
||||||
{
|
{
|
||||||
AddShortcut('W', B_COMMAND_KEY, new BMessage(B_QUIT_REQUESTED));
|
AddShortcut('W', B_COMMAND_KEY, new BMessage(B_QUIT_REQUESTED));
|
||||||
|
|
||||||
fReplaceView = new BView(Bounds(), "ReplaceView", B_FOLLOW_ALL, B_WILL_DRAW);
|
fSearchString = new BTextControl("", TR("Find:"), NULL, NULL);
|
||||||
fReplaceView->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
|
fReplaceString = new BTextControl("", TR("Replace with:"), NULL, NULL);
|
||||||
AddChild(fReplaceView);
|
fCaseSensBox = new BCheckBox("", TR("Case-sensitive"), NULL);
|
||||||
|
fWrapBox = new BCheckBox("", TR("Wrap-around search"), NULL);
|
||||||
char* findLabel = "Find:";
|
fBackSearchBox = new BCheckBox("", TR("Search backwards"), NULL);
|
||||||
float findWidth = fReplaceView->StringWidth(findLabel);
|
fAllWindowsBox = new BCheckBox("", TR("Replace in all windows"),
|
||||||
fReplaceView->AddChild(fSearchString = new BTextControl(BRect(5, 10, 290, 50), "",
|
new BMessage(CHANGE_WINDOW));
|
||||||
findLabel, NULL, NULL, B_FOLLOW_LEFT | B_FOLLOW_TOP, B_WILL_DRAW | B_NAVIGABLE));
|
|
||||||
|
|
||||||
char* replaceWithLabel = "Replace with:";
|
|
||||||
float replaceWithWidth = fReplaceView->StringWidth(replaceWithLabel);
|
|
||||||
fReplaceView->AddChild(fReplaceString = new BTextControl(BRect(5, 35, 290, 50), "",
|
|
||||||
replaceWithLabel, NULL, NULL, B_FOLLOW_LEFT | B_FOLLOW_TOP,
|
|
||||||
B_WILL_DRAW | B_NAVIGABLE));
|
|
||||||
float maxWidth = (replaceWithWidth > findWidth ? replaceWithWidth : findWidth) + TEXT_INSET;
|
|
||||||
fSearchString->SetDivider(maxWidth);
|
|
||||||
fReplaceString->SetDivider(maxWidth);
|
|
||||||
|
|
||||||
fReplaceView->AddChild(fCaseSensBox = new BCheckBox(BRect(maxWidth + 8, 60, 290, 52),
|
|
||||||
"", "Case-sensitive", NULL, B_FOLLOW_LEFT | B_FOLLOW_TOP, B_WILL_DRAW | B_NAVIGABLE));
|
|
||||||
fReplaceView->AddChild(fWrapBox = new BCheckBox(BRect(maxWidth + 8, 80, 290, 70),
|
|
||||||
"", "Wrap-around search", NULL, B_FOLLOW_LEFT | B_FOLLOW_TOP,
|
|
||||||
B_WILL_DRAW | B_NAVIGABLE));
|
|
||||||
fReplaceView->AddChild(fBackSearchBox = new BCheckBox(BRect(maxWidth + 8, 100, 290, 95),
|
|
||||||
"", "Search backwards", NULL, B_FOLLOW_LEFT | B_FOLLOW_TOP,
|
|
||||||
B_WILL_DRAW | B_NAVIGABLE));
|
|
||||||
fReplaceView->AddChild(fAllWindowsBox = new BCheckBox(BRect(maxWidth + 8, 120, 290, 95),
|
|
||||||
"", "Replace in all windows", new BMessage(CHANGE_WINDOW),
|
|
||||||
B_FOLLOW_LEFT | B_FOLLOW_TOP, B_WILL_DRAW | B_NAVIGABLE));
|
|
||||||
fUIchange = false;
|
fUIchange = false;
|
||||||
|
|
||||||
fReplaceView->AddChild(fReplaceAllButton = new BButton(BRect(10, 150, 98, 166),
|
fReplaceAllButton = new BButton("", TR("Replace all"),
|
||||||
"", "Replace all", new BMessage(MSG_REPLACE_ALL), B_FOLLOW_LEFT | B_FOLLOW_TOP,
|
new BMessage(MSG_REPLACE_ALL));
|
||||||
B_WILL_DRAW | B_NAVIGABLE));
|
fCancelButton = new BButton("", TR("Cancel"), new BMessage(B_QUIT_REQUESTED));
|
||||||
fReplaceView->AddChild(fCancelButton = new BButton(BRect(141, 150, 211, 166),
|
fReplaceButton = new BButton("", TR("Replace"), new BMessage(MSG_REPLACE));
|
||||||
"", "Cancel", new BMessage(B_QUIT_REQUESTED), B_FOLLOW_LEFT | B_FOLLOW_TOP,
|
|
||||||
B_WILL_DRAW | B_NAVIGABLE));
|
SetLayout(new BGroupLayout(B_HORIZONTAL));
|
||||||
fReplaceView->AddChild(fReplaceButton = new BButton(BRect(221, 150, 291, 166),
|
AddChild(BGroupLayoutBuilder(B_VERTICAL, 4)
|
||||||
"", "Replace", new BMessage(MSG_REPLACE), B_FOLLOW_LEFT | B_FOLLOW_TOP,
|
.Add(BGridLayoutBuilder(6, 2)
|
||||||
B_WILL_DRAW | B_NAVIGABLE));
|
.Add(fSearchString->CreateLabelLayoutItem(), 0, 0)
|
||||||
|
.Add(fSearchString->CreateTextViewLayoutItem(), 1, 0)
|
||||||
|
.Add(fReplaceString->CreateLabelLayoutItem(), 0, 1)
|
||||||
|
.Add(fReplaceString->CreateTextViewLayoutItem(), 1, 1)
|
||||||
|
.Add(fCaseSensBox, 1, 2)
|
||||||
|
.Add(fWrapBox, 1, 3)
|
||||||
|
.Add(fBackSearchBox, 1, 4)
|
||||||
|
.Add(fAllWindowsBox, 1, 5)
|
||||||
|
)
|
||||||
|
.AddGroup(B_HORIZONTAL, 10)
|
||||||
|
.Add(fReplaceAllButton)
|
||||||
|
.AddGlue()
|
||||||
|
.Add(fCancelButton)
|
||||||
|
.Add(fReplaceButton)
|
||||||
|
.End()
|
||||||
|
.SetInsets(10, 10, 10, 10)
|
||||||
|
);
|
||||||
|
|
||||||
fReplaceButton->MakeDefault(true);
|
fReplaceButton->MakeDefault(true);
|
||||||
|
|
||||||
fHandler = _handler;
|
fHandler = _handler;
|
||||||
|
|||||||
@@ -13,7 +13,6 @@
|
|||||||
#include <Window.h>
|
#include <Window.h>
|
||||||
|
|
||||||
|
|
||||||
class BView;
|
|
||||||
class BString;
|
class BString;
|
||||||
class BButton;
|
class BButton;
|
||||||
class BHandler;
|
class BHandler;
|
||||||
@@ -35,7 +34,6 @@ class ReplaceWindow : public BWindow {
|
|||||||
void _SendMessage(uint32 what);
|
void _SendMessage(uint32 what);
|
||||||
void _ChangeUI();
|
void _ChangeUI();
|
||||||
|
|
||||||
BView *fReplaceView;
|
|
||||||
BTextControl *fSearchString;
|
BTextControl *fSearchString;
|
||||||
BTextControl *fReplaceString;
|
BTextControl *fReplaceString;
|
||||||
BCheckBox *fCaseSensBox;
|
BCheckBox *fCaseSensBox;
|
||||||
|
|||||||
@@ -15,6 +15,8 @@
|
|||||||
|
|
||||||
#include <Alert.h>
|
#include <Alert.h>
|
||||||
#include <Autolock.h>
|
#include <Autolock.h>
|
||||||
|
#include <Catalog.h>
|
||||||
|
#include <Locale.h>
|
||||||
#include <MenuBar.h>
|
#include <MenuBar.h>
|
||||||
#include <CharacterSet.h>
|
#include <CharacterSet.h>
|
||||||
#include <CharacterSetRoster.h>
|
#include <CharacterSetRoster.h>
|
||||||
@@ -78,17 +80,21 @@ namespace
|
|||||||
|
|
||||||
// #pragma mark -
|
// #pragma mark -
|
||||||
|
|
||||||
|
#undef TR_CONTEXT
|
||||||
|
#define TR_CONTEXT "Open_and_SaveAsPanel"
|
||||||
|
|
||||||
StyledEditApp::StyledEditApp()
|
StyledEditApp::StyledEditApp()
|
||||||
: BApplication(APP_SIGNATURE),
|
: BApplication(APP_SIGNATURE),
|
||||||
fOpenPanel(NULL)
|
fOpenPanel(NULL)
|
||||||
{
|
{
|
||||||
|
be_locale->GetAppCatalog(&fCatalog);
|
||||||
|
|
||||||
fOpenPanel = new BFilePanel();
|
fOpenPanel = new BFilePanel();
|
||||||
BMenuBar* menuBar =
|
BMenuBar* menuBar =
|
||||||
dynamic_cast<BMenuBar*>(fOpenPanel->Window()->FindView("MenuBar"));
|
dynamic_cast<BMenuBar*>(fOpenPanel->Window()->FindView("MenuBar"));
|
||||||
|
|
||||||
fOpenAsEncoding = 0;
|
fOpenAsEncoding = 0;
|
||||||
fOpenPanelEncodingMenu= new BMenu("Encoding");
|
fOpenPanelEncodingMenu= new BMenu(TR("Encoding"));
|
||||||
menuBar->AddItem(fOpenPanelEncodingMenu);
|
menuBar->AddItem(fOpenPanelEncodingMenu);
|
||||||
fOpenPanelEncodingMenu->SetRadioMode(true);
|
fOpenPanelEncodingMenu->SetRadioMode(true);
|
||||||
|
|
||||||
@@ -97,7 +103,7 @@ StyledEditApp::StyledEditApp()
|
|||||||
while (roster.GetNextCharacterSet(&charset) == B_NO_ERROR) {
|
while (roster.GetNextCharacterSet(&charset) == B_NO_ERROR) {
|
||||||
BString name;
|
BString name;
|
||||||
if (charset.GetFontID() == B_UNICODE_UTF8)
|
if (charset.GetFontID() == B_UNICODE_UTF8)
|
||||||
name = "Default";
|
name = TR("Default");
|
||||||
else
|
else
|
||||||
name = charset.GetPrintName();
|
name = charset.GetPrintName();
|
||||||
|
|
||||||
@@ -107,7 +113,8 @@ StyledEditApp::StyledEditApp()
|
|||||||
name.Append(mime);
|
name.Append(mime);
|
||||||
name.Append(")");
|
name.Append(")");
|
||||||
}
|
}
|
||||||
BMenuItem* item = new BMenuItem(name.String(), new BMessage(OPEN_AS_ENCODING));
|
BMenuItem* item =
|
||||||
|
new BMenuItem(name.String(), new BMessage(OPEN_AS_ENCODING));
|
||||||
item->SetTarget(this);
|
item->SetTarget(this);
|
||||||
fOpenPanelEncodingMenu->AddItem(item);
|
fOpenPanelEncodingMenu->AddItem(item);
|
||||||
if (charset.GetFontID() == fOpenAsEncoding)
|
if (charset.GetFontID() == fOpenAsEncoding)
|
||||||
|
|||||||
@@ -12,6 +12,7 @@
|
|||||||
|
|
||||||
|
|
||||||
#include <Application.h>
|
#include <Application.h>
|
||||||
|
#include <Catalog.h>
|
||||||
|
|
||||||
|
|
||||||
struct entry_ref;
|
struct entry_ref;
|
||||||
@@ -48,6 +49,7 @@ class StyledEditApp : public BApplication {
|
|||||||
int32 fWindowCount;
|
int32 fWindowCount;
|
||||||
int32 fNextUntitledWindow;
|
int32 fNextUntitledWindow;
|
||||||
bool fBadArguments;
|
bool fBadArguments;
|
||||||
|
BCatalog fCatalog;
|
||||||
};
|
};
|
||||||
|
|
||||||
extern StyledEditApp* styled_edit_app;
|
extern StyledEditApp* styled_edit_app;
|
||||||
|
|||||||
@@ -19,12 +19,14 @@
|
|||||||
|
|
||||||
#include <Alert.h>
|
#include <Alert.h>
|
||||||
#include <Autolock.h>
|
#include <Autolock.h>
|
||||||
|
#include <Catalog.h>
|
||||||
#include <CharacterSet.h>
|
#include <CharacterSet.h>
|
||||||
#include <CharacterSetRoster.h>
|
#include <CharacterSetRoster.h>
|
||||||
#include <Clipboard.h>
|
#include <Clipboard.h>
|
||||||
#include <Debug.h>
|
#include <Debug.h>
|
||||||
#include <File.h>
|
#include <File.h>
|
||||||
#include <FilePanel.h>
|
#include <FilePanel.h>
|
||||||
|
#include <Locale.h>
|
||||||
#include <Menu.h>
|
#include <Menu.h>
|
||||||
#include <MenuBar.h>
|
#include <MenuBar.h>
|
||||||
#include <MenuItem.h>
|
#include <MenuItem.h>
|
||||||
@@ -42,12 +44,14 @@ using namespace BPrivate;
|
|||||||
|
|
||||||
const float kLineViewWidth = 30.0;
|
const float kLineViewWidth = 30.0;
|
||||||
|
|
||||||
|
#undef TR_CONTEXT
|
||||||
|
#define TR_CONTEXT "StyledEditWindow"
|
||||||
|
|
||||||
StyledEditWindow::StyledEditWindow(BRect frame, int32 id, uint32 encoding)
|
StyledEditWindow::StyledEditWindow(BRect frame, int32 id, uint32 encoding)
|
||||||
: BWindow(frame, "untitled", B_DOCUMENT_WINDOW, B_ASYNCHRONOUS_CONTROLS)
|
: BWindow(frame, "untitled", B_DOCUMENT_WINDOW, B_ASYNCHRONOUS_CONTROLS)
|
||||||
{
|
{
|
||||||
InitWindow(encoding);
|
InitWindow(encoding);
|
||||||
BString unTitled("Untitled ");
|
BString unTitled(TR("Untitled "));
|
||||||
unTitled << id;
|
unTitled << id;
|
||||||
SetTitle(unTitled.String());
|
SetTitle(unTitled.String());
|
||||||
fSaveItem->SetEnabled(true);
|
fSaveItem->SetEnabled(true);
|
||||||
@@ -73,6 +77,9 @@ StyledEditWindow::~StyledEditWindow()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#undef TR_CONTEXT
|
||||||
|
#define TR_CONTEXT "Menus"
|
||||||
|
|
||||||
void
|
void
|
||||||
StyledEditWindow::InitWindow(uint32 encoding)
|
StyledEditWindow::InitWindow(uint32 encoding)
|
||||||
{
|
{
|
||||||
@@ -124,79 +131,97 @@ StyledEditWindow::InitWindow(uint32 encoding)
|
|||||||
fTextView->MakeFocus(true);
|
fTextView->MakeFocus(true);
|
||||||
|
|
||||||
// Add "File"-menu:
|
// Add "File"-menu:
|
||||||
BMenu* menu = new BMenu("File");
|
BMenu* menu = new BMenu(TR("File"));
|
||||||
fMenuBar->AddItem(menu);
|
fMenuBar->AddItem(menu);
|
||||||
|
|
||||||
BMenuItem* menuItem;
|
BMenuItem* menuItem;
|
||||||
menu->AddItem(menuItem = new BMenuItem("New", new BMessage(MENU_NEW), 'N'));
|
menu->AddItem(menuItem = new BMenuItem(TR("New"),
|
||||||
|
new BMessage(MENU_NEW), 'N'));
|
||||||
menuItem->SetTarget(be_app);
|
menuItem->SetTarget(be_app);
|
||||||
|
|
||||||
menu->AddItem(menuItem = new BMenuItem(fRecentMenu = new BMenu("Open" B_UTF8_ELLIPSIS),
|
menu->AddItem(menuItem = new BMenuItem(fRecentMenu =
|
||||||
new BMessage(MENU_OPEN)));
|
new BMenu(TR("Open" B_UTF8_ELLIPSIS)), new BMessage(MENU_OPEN)));
|
||||||
menuItem->SetShortcut('O', 0);
|
menuItem->SetShortcut('O', 0);
|
||||||
menuItem->SetTarget(be_app);
|
menuItem->SetTarget(be_app);
|
||||||
menu->AddSeparatorItem();
|
menu->AddSeparatorItem();
|
||||||
|
|
||||||
menu->AddItem(fSaveItem = new BMenuItem("Save", new BMessage(MENU_SAVE), 'S'));
|
menu->AddItem(fSaveItem = new BMenuItem(TR("Save"),
|
||||||
|
new BMessage(MENU_SAVE), 'S'));
|
||||||
fSaveItem->SetEnabled(false);
|
fSaveItem->SetEnabled(false);
|
||||||
menu->AddItem(menuItem = new BMenuItem("Save as" B_UTF8_ELLIPSIS, new BMessage(MENU_SAVEAS)));
|
menu->AddItem(menuItem = new BMenuItem(TR("Save as" B_UTF8_ELLIPSIS),
|
||||||
|
new BMessage(MENU_SAVEAS)));
|
||||||
menuItem->SetShortcut('S', B_SHIFT_KEY);
|
menuItem->SetShortcut('S', B_SHIFT_KEY);
|
||||||
menuItem->SetEnabled(true);
|
menuItem->SetEnabled(true);
|
||||||
|
|
||||||
menu->AddItem(fRevertItem = new BMenuItem("Revert to saved" B_UTF8_ELLIPSIS,
|
menu->AddItem(fRevertItem =
|
||||||
|
new BMenuItem(TR("Revert to saved" B_UTF8_ELLIPSIS),
|
||||||
new BMessage(MENU_REVERT)));
|
new BMessage(MENU_REVERT)));
|
||||||
fRevertItem->SetEnabled(false);
|
fRevertItem->SetEnabled(false);
|
||||||
menu->AddItem(menuItem = new BMenuItem("Close", new BMessage(MENU_CLOSE), 'W'));
|
menu->AddItem(menuItem = new BMenuItem(TR("Close"),
|
||||||
|
new BMessage(MENU_CLOSE), 'W'));
|
||||||
|
|
||||||
menu->AddSeparatorItem();
|
menu->AddSeparatorItem();
|
||||||
menu->AddItem(menuItem = new BMenuItem("Page setup" B_UTF8_ELLIPSIS, new BMessage(MENU_PAGESETUP)));
|
menu->AddItem(menuItem = new BMenuItem(TR("Page setup" B_UTF8_ELLIPSIS),
|
||||||
menu->AddItem(menuItem = new BMenuItem("Print" B_UTF8_ELLIPSIS, new BMessage(MENU_PRINT), 'P'));
|
new BMessage(MENU_PAGESETUP)));
|
||||||
|
menu->AddItem(menuItem = new BMenuItem(TR("Print" B_UTF8_ELLIPSIS),
|
||||||
|
new BMessage(MENU_PRINT), 'P'));
|
||||||
|
|
||||||
menu->AddSeparatorItem();
|
menu->AddSeparatorItem();
|
||||||
menu->AddItem(menuItem = new BMenuItem("Quit", new BMessage(MENU_QUIT), 'Q'));
|
menu->AddItem(menuItem = new BMenuItem(TR("Quit"),
|
||||||
|
new BMessage(MENU_QUIT), 'Q'));
|
||||||
|
|
||||||
// Add the "Edit"-menu:
|
// Add the "Edit"-menu:
|
||||||
menu = new BMenu("Edit");
|
menu = new BMenu(TR("Edit"));
|
||||||
fMenuBar->AddItem(menu);
|
fMenuBar->AddItem(menu);
|
||||||
|
|
||||||
menu->AddItem(fUndoItem = new BMenuItem("Can't undo", new BMessage(B_UNDO), 'Z'));
|
menu->AddItem(fUndoItem = new BMenuItem(TR("Can't undo"),
|
||||||
|
new BMessage(B_UNDO), 'Z'));
|
||||||
fUndoItem->SetEnabled(false);
|
fUndoItem->SetEnabled(false);
|
||||||
|
|
||||||
menu->AddSeparatorItem();
|
menu->AddSeparatorItem();
|
||||||
menu->AddItem(fCutItem = new BMenuItem("Cut", new BMessage(B_CUT), 'X'));
|
menu->AddItem(fCutItem = new BMenuItem(TR("Cut"), new BMessage(B_CUT), 'X'));
|
||||||
fCutItem->SetEnabled(false);
|
fCutItem->SetEnabled(false);
|
||||||
fCutItem->SetTarget(fTextView);
|
fCutItem->SetTarget(fTextView);
|
||||||
|
|
||||||
menu->AddItem(fCopyItem = new BMenuItem("Copy", new BMessage(B_COPY), 'C'));
|
menu->AddItem(fCopyItem = new BMenuItem(TR("Copy"),
|
||||||
|
new BMessage(B_COPY), 'C'));
|
||||||
fCopyItem->SetEnabled(false);
|
fCopyItem->SetEnabled(false);
|
||||||
fCopyItem->SetTarget(fTextView);
|
fCopyItem->SetTarget(fTextView);
|
||||||
|
|
||||||
menu->AddItem(menuItem = new BMenuItem("Paste", new BMessage(B_PASTE), 'V'));
|
menu->AddItem(menuItem = new BMenuItem(TR("Paste"),
|
||||||
|
new BMessage(B_PASTE), 'V'));
|
||||||
menuItem->SetTarget(fTextView);
|
menuItem->SetTarget(fTextView);
|
||||||
menu->AddItem(fClearItem = new BMenuItem("Clear", new BMessage(MENU_CLEAR)));
|
menu->AddItem(fClearItem = new BMenuItem(TR("Clear"),
|
||||||
|
new BMessage(MENU_CLEAR)));
|
||||||
fClearItem->SetEnabled(false);
|
fClearItem->SetEnabled(false);
|
||||||
fClearItem->SetTarget(fTextView);
|
fClearItem->SetTarget(fTextView);
|
||||||
|
|
||||||
menu->AddSeparatorItem();
|
menu->AddSeparatorItem();
|
||||||
menu->AddItem(menuItem = new BMenuItem("Select all", new BMessage(B_SELECT_ALL), 'A'));
|
menu->AddItem(menuItem = new BMenuItem(TR("Select all"),
|
||||||
|
new BMessage(B_SELECT_ALL), 'A'));
|
||||||
menuItem->SetTarget(fTextView);
|
menuItem->SetTarget(fTextView);
|
||||||
|
|
||||||
menu->AddSeparatorItem();
|
menu->AddSeparatorItem();
|
||||||
menu->AddItem(menuItem = new BMenuItem("Find" B_UTF8_ELLIPSIS, new BMessage(MENU_FIND),'F'));
|
menu->AddItem(menuItem = new BMenuItem(TR("Find" B_UTF8_ELLIPSIS),
|
||||||
menu->AddItem(fFindAgainItem= new BMenuItem("Find again",new BMessage(MENU_FIND_AGAIN),'G'));
|
new BMessage(MENU_FIND), 'F'));
|
||||||
|
menu->AddItem(fFindAgainItem= new BMenuItem(TR("Find again"),
|
||||||
|
new BMessage(MENU_FIND_AGAIN), 'G'));
|
||||||
fFindAgainItem->SetEnabled(false);
|
fFindAgainItem->SetEnabled(false);
|
||||||
|
|
||||||
menu->AddItem(menuItem = new BMenuItem("Find selection", new BMessage(MENU_FIND_SELECTION),'H'));
|
menu->AddItem(menuItem = new BMenuItem(TR("Find selection"),
|
||||||
menu->AddItem(menuItem = new BMenuItem("Replace" B_UTF8_ELLIPSIS, new BMessage(MENU_REPLACE),'R'));
|
new BMessage(MENU_FIND_SELECTION), 'H'));
|
||||||
menu->AddItem(fReplaceSameItem = new BMenuItem("Replace same", new BMessage(MENU_REPLACE_SAME),'T'));
|
menu->AddItem(menuItem = new BMenuItem(TR("Replace" B_UTF8_ELLIPSIS),
|
||||||
|
new BMessage(MENU_REPLACE), 'R'));
|
||||||
|
menu->AddItem(fReplaceSameItem = new BMenuItem(TR("Replace same"),
|
||||||
|
new BMessage(MENU_REPLACE_SAME), 'T'));
|
||||||
fReplaceSameItem->SetEnabled(false);
|
fReplaceSameItem->SetEnabled(false);
|
||||||
|
|
||||||
// Add the "Font"-menu:
|
// Add the "Font"-menu:
|
||||||
fFontMenu = new BMenu("Font");
|
fFontMenu = new BMenu(TR("Font"));
|
||||||
fMenuBar->AddItem(fFontMenu);
|
fMenuBar->AddItem(fFontMenu);
|
||||||
|
|
||||||
//"Size"-subMenu
|
//"Size"-subMenu
|
||||||
fFontSizeMenu = new BMenu("Size");
|
fFontSizeMenu = new BMenu(TR("Size"));
|
||||||
fFontSizeMenu->SetRadioMode(true);
|
fFontSizeMenu->SetRadioMode(true);
|
||||||
fFontMenu->AddItem(fFontSizeMenu);
|
fFontMenu->AddItem(fFontSizeMenu);
|
||||||
|
|
||||||
@@ -214,18 +239,25 @@ StyledEditWindow::InitWindow(uint32 encoding)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// "Color"-subMenu
|
// "Color"-subMenu
|
||||||
fFontColorMenu = new BMenu("Color");
|
fFontColorMenu = new BMenu(TR("Color"));
|
||||||
fFontColorMenu->SetRadioMode(true);
|
fFontColorMenu->SetRadioMode(true);
|
||||||
fFontMenu->AddItem(fFontColorMenu);
|
fFontMenu->AddItem(fFontColorMenu);
|
||||||
|
|
||||||
fFontColorMenu->AddItem(fBlackItem = new BMenuItem("Black", new BMessage(FONT_COLOR)));
|
fFontColorMenu->AddItem(fBlackItem = new BMenuItem(TR("Black"),
|
||||||
|
new BMessage(FONT_COLOR)));
|
||||||
fBlackItem->SetMarked(true);
|
fBlackItem->SetMarked(true);
|
||||||
fFontColorMenu->AddItem(fRedItem = new ColorMenuItem("Red", RED, new BMessage(FONT_COLOR)));
|
fFontColorMenu->AddItem(fRedItem = new ColorMenuItem(TR("Red"), RED,
|
||||||
fFontColorMenu->AddItem(fGreenItem = new ColorMenuItem("Green", GREEN, new BMessage(FONT_COLOR)));
|
new BMessage(FONT_COLOR)));
|
||||||
fFontColorMenu->AddItem(fBlueItem = new ColorMenuItem("Blue", BLUE, new BMessage(FONT_COLOR)));
|
fFontColorMenu->AddItem(fGreenItem = new ColorMenuItem(TR("Green"), GREEN,
|
||||||
fFontColorMenu->AddItem(fCyanItem = new ColorMenuItem("Cyan", CYAN, new BMessage(FONT_COLOR)));
|
new BMessage(FONT_COLOR)));
|
||||||
fFontColorMenu->AddItem(fMagentaItem = new ColorMenuItem("Magenta", MAGENTA, new BMessage(FONT_COLOR)));
|
fFontColorMenu->AddItem(fBlueItem = new ColorMenuItem(TR("Blue"), BLUE,
|
||||||
fFontColorMenu->AddItem(fYellowItem = new ColorMenuItem("Yellow", YELLOW, new BMessage(FONT_COLOR)));
|
new BMessage(FONT_COLOR)));
|
||||||
|
fFontColorMenu->AddItem(fCyanItem = new ColorMenuItem(TR("Cyan"), CYAN,
|
||||||
|
new BMessage(FONT_COLOR)));
|
||||||
|
fFontColorMenu->AddItem(fMagentaItem = new ColorMenuItem(TR("Magenta"), MAGENTA,
|
||||||
|
new BMessage(FONT_COLOR)));
|
||||||
|
fFontColorMenu->AddItem(fYellowItem = new ColorMenuItem(TR("Yellow"), YELLOW,
|
||||||
|
new BMessage(FONT_COLOR)));
|
||||||
fFontMenu->AddSeparatorItem();
|
fFontMenu->AddSeparatorItem();
|
||||||
|
|
||||||
// Available fonts
|
// Available fonts
|
||||||
@@ -256,20 +288,24 @@ StyledEditWindow::InitWindow(uint32 encoding)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Add the "Document"-menu:
|
// Add the "Document"-menu:
|
||||||
menu = new BMenu("Document");
|
menu = new BMenu(TR("Document"));
|
||||||
fMenuBar->AddItem(menu);
|
fMenuBar->AddItem(menu);
|
||||||
|
|
||||||
// "Align"-subMenu:
|
// "Align"-subMenu:
|
||||||
subMenu = new BMenu("Align");
|
subMenu = new BMenu(TR("Align"));
|
||||||
subMenu->SetRadioMode(true);
|
subMenu->SetRadioMode(true);
|
||||||
|
|
||||||
subMenu->AddItem(fAlignLeft = new BMenuItem("Left", new BMessage(ALIGN_LEFT)));
|
subMenu->AddItem(fAlignLeft = new BMenuItem(TR("Left"),
|
||||||
|
new BMessage(ALIGN_LEFT)));
|
||||||
fAlignLeft->SetMarked(true);
|
fAlignLeft->SetMarked(true);
|
||||||
|
|
||||||
subMenu->AddItem(fAlignCenter = new BMenuItem("Center", new BMessage(ALIGN_CENTER)));
|
subMenu->AddItem(fAlignCenter = new BMenuItem(TR("Center"),
|
||||||
subMenu->AddItem(fAlignRight = new BMenuItem("Right", new BMessage(ALIGN_RIGHT)));
|
new BMessage(ALIGN_CENTER)));
|
||||||
|
subMenu->AddItem(fAlignRight = new BMenuItem(TR("Right"),
|
||||||
|
new BMessage(ALIGN_RIGHT)));
|
||||||
menu->AddItem(subMenu);
|
menu->AddItem(subMenu);
|
||||||
menu->AddItem(fWrapItem = new BMenuItem("Wrap lines", new BMessage(WRAP_LINES)));
|
menu->AddItem(fWrapItem = new BMenuItem(TR("Wrap lines"),
|
||||||
|
new BMessage(WRAP_LINES)));
|
||||||
fWrapItem->SetMarked(true);
|
fWrapItem->SetMarked(true);
|
||||||
|
|
||||||
fSavePanel = NULL;
|
fSavePanel = NULL;
|
||||||
@@ -542,7 +578,7 @@ StyledEditWindow::MessageReceived(BMessage *message)
|
|||||||
// set mode
|
// set mode
|
||||||
fCanUndo = false;
|
fCanUndo = false;
|
||||||
fCanRedo = true;
|
fCanRedo = true;
|
||||||
fUndoItem->SetLabel("Redo typing");
|
fUndoItem->SetLabel(TR("Redo typing"));
|
||||||
fUndoItem->SetEnabled(true);
|
fUndoItem->SetEnabled(true);
|
||||||
fUndoFlag = false;
|
fUndoFlag = false;
|
||||||
} else {
|
} else {
|
||||||
@@ -562,7 +598,7 @@ StyledEditWindow::MessageReceived(BMessage *message)
|
|||||||
// set mode
|
// set mode
|
||||||
fCanUndo = true;
|
fCanUndo = true;
|
||||||
fCanRedo = false;
|
fCanRedo = false;
|
||||||
fUndoItem->SetLabel("Undo typing");
|
fUndoItem->SetLabel(TR("Undo typing"));
|
||||||
fUndoItem->SetEnabled(true);
|
fUndoItem->SetEnabled(true);
|
||||||
fRedoFlag = false;
|
fRedoFlag = false;
|
||||||
}
|
}
|
||||||
@@ -579,7 +615,8 @@ StyledEditWindow::MessageReceived(BMessage *message)
|
|||||||
void* ptr;
|
void* ptr;
|
||||||
if (message->FindPointer("source", &ptr) == B_OK
|
if (message->FindPointer("source", &ptr) == B_OK
|
||||||
&& fSavePanelEncodingMenu != NULL) {
|
&& fSavePanelEncodingMenu != NULL) {
|
||||||
fTextView->SetEncoding((uint32)fSavePanelEncodingMenu->IndexOf((BMenuItem*)ptr));
|
fTextView->SetEncoding(
|
||||||
|
(uint32)fSavePanelEncodingMenu->IndexOf((BMenuItem*)ptr));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -736,15 +773,34 @@ StyledEditWindow::Quit()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// This is temporary solution for building BString with printf like format.
|
||||||
|
// will be removed in the future.
|
||||||
|
static void
|
||||||
|
bs_printf(BString* string, const char* format, ...)
|
||||||
|
{
|
||||||
|
va_list ap;
|
||||||
|
va_start(ap, format);
|
||||||
|
char* buf;
|
||||||
|
vasprintf(&buf, format, ap);
|
||||||
|
string->SetTo(buf);
|
||||||
|
free(buf);
|
||||||
|
va_end(ap);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#undef TR_CONTEXT
|
||||||
|
#define TR_CONTEXT "QuitAlert"
|
||||||
|
|
||||||
bool
|
bool
|
||||||
StyledEditWindow::QuitRequested()
|
StyledEditWindow::QuitRequested()
|
||||||
{
|
{
|
||||||
if (fClean)
|
if (fClean)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
BString alertText("Save changes to the document \"");
|
BString alertText;
|
||||||
alertText<< Title() <<"\"? ";
|
bs_printf(&alertText, TR("Save changes to the document \"%s\"? "), Title());
|
||||||
int32 index = _ShowAlert(alertText, "Cancel", "Don't save", "Save",
|
|
||||||
|
int32 index = _ShowAlert(alertText, TR("Cancel"), TR("Don't save"), TR("Save"),
|
||||||
B_WARNING_ALERT);
|
B_WARNING_ALERT);
|
||||||
|
|
||||||
if (index == 0)
|
if (index == 0)
|
||||||
@@ -762,6 +818,9 @@ StyledEditWindow::QuitRequested()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#undef TR_CONTEXT
|
||||||
|
#define TR_CONTEXT "SaveAlert"
|
||||||
|
|
||||||
status_t
|
status_t
|
||||||
StyledEditWindow::Save(BMessage* message)
|
StyledEditWindow::Save(BMessage* message)
|
||||||
{
|
{
|
||||||
@@ -788,10 +847,10 @@ StyledEditWindow::Save(BMessage *message)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (status != B_OK) {
|
if (status != B_OK) {
|
||||||
BString alertText("Error saving \"");
|
BString alertText;
|
||||||
alertText << name << "\":\n" << strerror(status);
|
bs_printf(&alertText, TR("Error saving \"%s\":\n%s"), name, strerror(status));
|
||||||
|
|
||||||
_ShowAlert(alertText, "OK", "", "", B_STOP_ALERT);
|
_ShowAlert(alertText, TR("OK"), "", "", B_STOP_ALERT);
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -816,6 +875,9 @@ StyledEditWindow::Save(BMessage *message)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#undef TR_CONTEXT
|
||||||
|
#define TR_CONTEXT "Open_and_SaveAsPanel"
|
||||||
|
|
||||||
status_t
|
status_t
|
||||||
StyledEditWindow::SaveAs(BMessage* message)
|
StyledEditWindow::SaveAs(BMessage* message)
|
||||||
{
|
{
|
||||||
@@ -834,7 +896,7 @@ StyledEditWindow::SaveAs(BMessage *message)
|
|||||||
BMenuBar* menuBar = dynamic_cast<BMenuBar*>(
|
BMenuBar* menuBar = dynamic_cast<BMenuBar*>(
|
||||||
fSavePanel->Window()->FindView("MenuBar"));
|
fSavePanel->Window()->FindView("MenuBar"));
|
||||||
|
|
||||||
fSavePanelEncodingMenu= new BMenu("Encoding");
|
fSavePanelEncodingMenu= new BMenu(TR("Encoding"));
|
||||||
menuBar->AddItem(fSavePanelEncodingMenu);
|
menuBar->AddItem(fSavePanelEncodingMenu);
|
||||||
fSavePanelEncodingMenu->SetRadioMode(true);
|
fSavePanelEncodingMenu->SetRadioMode(true);
|
||||||
|
|
||||||
@@ -848,7 +910,8 @@ StyledEditWindow::SaveAs(BMessage *message)
|
|||||||
name.Append(mime);
|
name.Append(mime);
|
||||||
name.Append(")");
|
name.Append(")");
|
||||||
}
|
}
|
||||||
BMenuItem * item = new BMenuItem(name.String(), new BMessage(SAVE_AS_ENCODING));
|
BMenuItem * item = new BMenuItem(name.String(),
|
||||||
|
new BMessage(SAVE_AS_ENCODING));
|
||||||
item->SetTarget(this);
|
item->SetTarget(this);
|
||||||
fSavePanelEncodingMenu->AddItem(item);
|
fSavePanelEncodingMenu->AddItem(item);
|
||||||
if (charset.GetFontID() == fTextView->GetEncoding())
|
if (charset.GetFontID() == fTextView->GetEncoding())
|
||||||
@@ -865,6 +928,9 @@ StyledEditWindow::SaveAs(BMessage *message)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#undef TR_CONTEXT
|
||||||
|
#define TR_CONTEXT "LoadAlert"
|
||||||
|
|
||||||
status_t
|
status_t
|
||||||
StyledEditWindow::_LoadFile(entry_ref* ref)
|
StyledEditWindow::_LoadFile(entry_ref* ref)
|
||||||
{
|
{
|
||||||
@@ -892,16 +958,15 @@ StyledEditWindow::_LoadFile(entry_ref* ref)
|
|||||||
BEntry entry(ref, true);
|
BEntry entry(ref, true);
|
||||||
char name[B_FILE_NAME_LENGTH];
|
char name[B_FILE_NAME_LENGTH];
|
||||||
if (entry.GetName(name) != B_OK)
|
if (entry.GetName(name) != B_OK)
|
||||||
strcpy(name, "???");
|
strcpy(name, TR("???"));
|
||||||
|
|
||||||
BString text("Error loading \"");
|
BString text;
|
||||||
text << name << "\":\n\t";
|
|
||||||
if (status == B_BAD_TYPE)
|
if (status == B_BAD_TYPE)
|
||||||
text << "Unsupported format";
|
bs_printf(&text, TR("Error loading \"%s\":\n\tUnsupported format"), name);
|
||||||
else
|
else
|
||||||
text << strerror(status);
|
bs_printf(&text, TR("Error loading \"%s\":\n\t%s"), name, strerror(status));
|
||||||
|
|
||||||
_ShowAlert(text, "OK", "", "", B_STOP_ALERT);
|
_ShowAlert(text, TR("OK"), "", "", B_STOP_ALERT);
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -953,6 +1018,9 @@ StyledEditWindow::OpenFile(entry_ref* ref)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#undef TR_CONTEXT
|
||||||
|
#define TR_CONTEXT "RevertToSavedAlert"
|
||||||
|
|
||||||
void
|
void
|
||||||
StyledEditWindow::RevertToSaved()
|
StyledEditWindow::RevertToSaved()
|
||||||
{
|
{
|
||||||
@@ -972,23 +1040,26 @@ StyledEditWindow::RevertToSaved()
|
|||||||
status = entry.GetRef(&ref);
|
status = entry.GetRef(&ref);
|
||||||
|
|
||||||
if (status != B_OK || !entry.Exists()) {
|
if (status != B_OK || !entry.Exists()) {
|
||||||
BString alertText("Cannot revert, file not found: \"");
|
BString alertText;
|
||||||
alertText << name << "\".";
|
bs_printf(&alertText, TR("Cannot revert, file not found: \"%s\"."), name);
|
||||||
_ShowAlert(alertText, "OK", "", "", B_STOP_ALERT);
|
_ShowAlert(alertText, TR("OK"), "", "", B_STOP_ALERT);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
BString alertText("Revert to the last version of \"");
|
BString alertText;
|
||||||
alertText << Title() << "\"? ";
|
bs_printf(&alertText, TR("Revert to the last version of \"%s\"? "), Title());
|
||||||
if (_ShowAlert(alertText, "Cancel", "OK", "", B_WARNING_ALERT) != 1)
|
if (_ShowAlert(alertText, TR("Cancel"), TR("OK"), "", B_WARNING_ALERT) != 1)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
fTextView->Reset();
|
fTextView->Reset();
|
||||||
if (_LoadFile(&ref) != B_OK)
|
if (_LoadFile(&ref) != B_OK)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
#undef TR_CONTEXT
|
||||||
|
#define TR_CONTEXT "Menus"
|
||||||
|
|
||||||
// clear undo modes
|
// clear undo modes
|
||||||
fUndoItem->SetLabel("Can't undo");
|
fUndoItem->SetLabel(TR("Can't undo"));
|
||||||
fUndoItem->SetEnabled(false);
|
fUndoItem->SetEnabled(false);
|
||||||
fUndoFlag = false;
|
fUndoFlag = false;
|
||||||
fCanUndo = false;
|
fCanUndo = false;
|
||||||
@@ -1089,7 +1160,8 @@ StyledEditWindow::Print(const char* documentName)
|
|||||||
top = fTextView->TextHeight(0, firstLineOnPage - 1);
|
top = fTextView->TextHeight(0, firstLineOnPage - 1);
|
||||||
|
|
||||||
float bottom = fTextView->TextHeight(0, printLine - 1);
|
float bottom = fTextView->TextHeight(0, printLine - 1);
|
||||||
BRect textRect(0.0, top + TEXT_INSET, printableRect.Width(), bottom + TEXT_INSET);
|
BRect textRect(0.0, top + TEXT_INSET,
|
||||||
|
printableRect.Width(), bottom + TEXT_INSET);
|
||||||
printJob.DrawView(fTextView, textRect, B_ORIGIN);
|
printJob.DrawView(fTextView, textRect, B_ORIGIN);
|
||||||
printJob.SpoolPage();
|
printJob.SpoolPage();
|
||||||
}
|
}
|
||||||
@@ -1311,6 +1383,8 @@ StyledEditWindow::SetFontStyle(const char *fontFamily, const char *fontStyle)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#undef TR_CONTEXT
|
||||||
|
#define TR_CONTEXT "Menus"
|
||||||
void
|
void
|
||||||
StyledEditWindow::_UpdateCleanUndoRedoSaveRevert()
|
StyledEditWindow::_UpdateCleanUndoRedoSaveRevert()
|
||||||
{
|
{
|
||||||
@@ -1319,7 +1393,7 @@ StyledEditWindow::_UpdateCleanUndoRedoSaveRevert()
|
|||||||
fRedoCleans = false;
|
fRedoCleans = false;
|
||||||
fRevertItem->SetEnabled(fSaveMessage != NULL);
|
fRevertItem->SetEnabled(fSaveMessage != NULL);
|
||||||
fSaveItem->SetEnabled(true);
|
fSaveItem->SetEnabled(true);
|
||||||
fUndoItem->SetLabel("Can't Undo");
|
fUndoItem->SetLabel(TR("Can't Undo"));
|
||||||
fUndoItem->SetEnabled(false);
|
fUndoItem->SetEnabled(false);
|
||||||
fCanUndo = false;
|
fCanUndo = false;
|
||||||
fCanRedo = false;
|
fCanRedo = false;
|
||||||
|
|||||||
Reference in New Issue
Block a user