Humble beginnings of a code style correction.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34976 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -245,3 +245,4 @@ AutoTextControl::SetFilter(AutoTextControlFilter *filter)
|
||||
if (Window())
|
||||
Window()->AddCommonFilter(fFilter);
|
||||
}
|
||||
|
||||
|
||||
@@ -75,3 +75,4 @@ private:
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -85,3 +85,4 @@ private:
|
||||
};
|
||||
|
||||
#endif // #ifndef _BMAP_BUTTON_H
|
||||
|
||||
|
||||
@@ -234,3 +234,4 @@ ButtonBar::ShowLabels(bool show)
|
||||
}
|
||||
fShowLabels = show;
|
||||
}
|
||||
|
||||
|
||||
@@ -80,3 +80,4 @@ protected:
|
||||
};
|
||||
|
||||
#endif // #ifndef _BUTTON_BAR_H
|
||||
|
||||
|
||||
@@ -229,3 +229,4 @@ private:
|
||||
};
|
||||
|
||||
#endif // #ifndef _COMBOBOX_H
|
||||
|
||||
|
||||
@@ -303,3 +303,4 @@ extern void FillInQuoteTextRuns(BTextView* view, quote_context* context,
|
||||
int32 maxStyles = 5);
|
||||
|
||||
#endif /* #ifndef _CONTENT_H */
|
||||
|
||||
|
||||
@@ -127,3 +127,4 @@ class TListItem : public BListItem
|
||||
};
|
||||
|
||||
#endif // #ifndef _ENCLOSURES_H
|
||||
|
||||
|
||||
@@ -48,3 +48,4 @@ enum {
|
||||
};
|
||||
|
||||
#endif // #ifndef _FIELD_MSG_H
|
||||
|
||||
|
||||
@@ -59,9 +59,7 @@ enum {
|
||||
M_FIND_STRING_CHANGED = 'fsch'
|
||||
};
|
||||
|
||||
void TextBevel(BView& view, BRect r);
|
||||
|
||||
// ============================================================================
|
||||
void TextBevel(BView& view, BRect r)
|
||||
{
|
||||
r.InsetBy(-1,-1);
|
||||
@@ -96,7 +94,8 @@ void FindWindow::DoFind(BWindow *window, const char *text)
|
||||
{
|
||||
if (window == NULL) {
|
||||
long i=0;
|
||||
while ((bool)(window = be_app->WindowAt(i++))) { // Send the text to a waiting window
|
||||
while ((bool)(window = be_app->WindowAt(i++))) {
|
||||
// Send the text to a waiting window
|
||||
if (window != mFindWindow)
|
||||
if (dynamic_cast<TMailWindow *>(window) != NULL)
|
||||
break; // Found a window
|
||||
@@ -129,9 +128,10 @@ FindPanel::FindPanel(BRect rect)
|
||||
{
|
||||
BRect r = Bounds().InsetByCopy(10,10);
|
||||
|
||||
mBTextControl = new AutoTextControl(r,"BTextControl",NULL,sPreviousFind.String(),
|
||||
new BMessage(M_FIND_STRING_CHANGED),
|
||||
B_FOLLOW_LEFT_RIGHT | B_FOLLOW_TOP);
|
||||
mBTextControl = new AutoTextControl(r,"BTextControl",NULL,
|
||||
sPreviousFind.String(), new BMessage(M_FIND_STRING_CHANGED),
|
||||
B_FOLLOW_LEFT_RIGHT | B_FOLLOW_TOP);
|
||||
|
||||
mBTextControl->SetText(sPreviousFind.String());
|
||||
mBTextControl->MakeFocus();
|
||||
mBTextControl->SetEscapeCancel(true);
|
||||
@@ -163,7 +163,8 @@ void FindPanel::AttachedToWindow()
|
||||
|
||||
mBTextControl->SetTarget(this);
|
||||
mBTextControl->ResizeToPreferred();
|
||||
mBTextControl->ResizeTo(Bounds().Width() - 20, mBTextControl->Frame().Height());
|
||||
mBTextControl->ResizeTo(Bounds().Width() - 20,
|
||||
mBTextControl->Frame().Height());
|
||||
|
||||
mBTextControl->MakeFocus(true);
|
||||
mBTextControl->TextView()->SelectAll();
|
||||
@@ -211,6 +212,7 @@ void FindPanel::MessageReceived(BMessage *msg)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void FindPanel::Find()
|
||||
{
|
||||
mBTextControl->TextView()->SelectAll();
|
||||
@@ -219,7 +221,8 @@ void FindPanel::Find()
|
||||
|
||||
BWindow *window = NULL;
|
||||
long i=0;
|
||||
while ((bool)(window = be_app->WindowAt(i++))) { // Send the text to a waiting window
|
||||
while ((bool)(window = be_app->WindowAt(i++))) {
|
||||
// Send the text to a waiting window
|
||||
if (window != FindWindow::mFindWindow)
|
||||
break; // Found a window
|
||||
}
|
||||
@@ -228,8 +231,6 @@ void FindPanel::Find()
|
||||
FindWindow::DoFind(window, text);
|
||||
}
|
||||
|
||||
// ============================================================================
|
||||
|
||||
|
||||
FindWindow::FindWindow()
|
||||
: BWindow(FindWindow::mLastPosition,
|
||||
@@ -243,12 +244,14 @@ FindWindow::FindWindow()
|
||||
Show();
|
||||
}
|
||||
|
||||
|
||||
FindWindow::~FindWindow()
|
||||
{
|
||||
FindWindow::mLastPosition = Frame();
|
||||
mFindWindow = NULL;
|
||||
}
|
||||
|
||||
|
||||
void FindWindow::Find(BWindow *window)
|
||||
{
|
||||
// eliminate unused parameter warning
|
||||
@@ -260,6 +263,7 @@ void FindWindow::Find(BWindow *window)
|
||||
mFindWindow->Activate();
|
||||
}
|
||||
|
||||
|
||||
void FindWindow::FindAgain(BWindow *window)
|
||||
{
|
||||
if (mFindWindow) {
|
||||
@@ -272,12 +276,15 @@ void FindWindow::FindAgain(BWindow *window)
|
||||
Find(window);
|
||||
}
|
||||
|
||||
|
||||
void FindWindow::SetFindString(const char *string)
|
||||
{
|
||||
sPreviousFind = string;
|
||||
}
|
||||
|
||||
|
||||
const char *FindWindow::GetFindString()
|
||||
{
|
||||
return sPreviousFind.String();
|
||||
}
|
||||
|
||||
|
||||
@@ -47,8 +47,6 @@ All rights reserved.
|
||||
class FindPanel;
|
||||
class AutoTextControl;
|
||||
|
||||
// ============================================================================
|
||||
// Floating find window, just one of them.....
|
||||
|
||||
class FindWindow : public BWindow {
|
||||
friend class FindPanel;
|
||||
@@ -89,6 +87,5 @@ protected:
|
||||
};
|
||||
|
||||
|
||||
// ============================================================================
|
||||
|
||||
#endif // #ifndef _FINDWINDOW_H
|
||||
|
||||
|
||||
@@ -76,6 +76,7 @@ All rights reserved.
|
||||
using namespace BPrivate;
|
||||
using std::map;
|
||||
|
||||
|
||||
const char* kDateLabel = "Date:";
|
||||
const uint32 kMsgFrom = 'hFrm';
|
||||
const uint32 kMsgEncoding = 'encd';
|
||||
@@ -84,6 +85,7 @@ const uint32 kMsgAddressChosen = 'acsn';
|
||||
static const float kTextControlDividerOffset = 0;
|
||||
static const float kMenuFieldDividerOffset = 6;
|
||||
|
||||
|
||||
class QPopupMenu : public QueryMenu {
|
||||
public:
|
||||
QPopupMenu(const char *title);
|
||||
@@ -100,6 +102,7 @@ class QPopupMenu : public QueryMenu {
|
||||
int32 fGroups; // Current number of "group" submenus. Includes All People if present.
|
||||
};
|
||||
|
||||
|
||||
struct CompareBStrings {
|
||||
bool
|
||||
operator()(const BString *s1, const BString *s2) const
|
||||
|
||||
+42
-40
@@ -80,56 +80,58 @@ class TTextControl;
|
||||
|
||||
|
||||
class THeaderView : public BBox {
|
||||
public:
|
||||
THeaderView(BRect, BRect, bool incoming, BEmailMessage *mail,
|
||||
bool resending, uint32 defaultCharacterSet, uint32 defaultChain);
|
||||
public:
|
||||
THeaderView(BRect, BRect, bool incoming,
|
||||
BEmailMessage *mail, bool resending,
|
||||
uint32 defaultCharacterSet,
|
||||
uint32 defaultChain);
|
||||
|
||||
virtual void MessageReceived(BMessage *);
|
||||
virtual void AttachedToWindow(void);
|
||||
status_t LoadMessage(BEmailMessage *);
|
||||
virtual void MessageReceived(BMessage*);
|
||||
virtual void AttachedToWindow();
|
||||
status_t LoadMessage(BEmailMessage*);
|
||||
|
||||
BPopUpMenu *fAccountMenu;
|
||||
BPopUpMenu *fEncodingMenu;
|
||||
int32 fChain;
|
||||
TTextControl *fAccountTo;
|
||||
TTextControl *fAccount;
|
||||
TTextControl *fBcc;
|
||||
TTextControl *fCc;
|
||||
TTextControl *fSubject;
|
||||
TTextControl *fTo;
|
||||
BStringView *fDateLabel;
|
||||
BStringView *fDate;
|
||||
bool fIncoming;
|
||||
uint32 fCharacterSetUserSees;
|
||||
BPopUpMenu* fAccountMenu;
|
||||
BPopUpMenu* fEncodingMenu;
|
||||
int32 fChain;
|
||||
TTextControl* fAccountTo;
|
||||
TTextControl* fAccount;
|
||||
TTextControl* fBcc;
|
||||
TTextControl* fCc;
|
||||
TTextControl* fSubject;
|
||||
TTextControl* fTo;
|
||||
BStringView* fDateLabel;
|
||||
BStringView* fDate;
|
||||
bool fIncoming;
|
||||
uint32 fCharacterSetUserSees;
|
||||
|
||||
private:
|
||||
void InitEmailCompletion();
|
||||
void InitGroupCompletion();
|
||||
private:
|
||||
void InitEmailCompletion();
|
||||
void InitGroupCompletion();
|
||||
|
||||
bool fResending;
|
||||
QPopupMenu *fBccMenu;
|
||||
QPopupMenu *fCcMenu;
|
||||
QPopupMenu *fToMenu;
|
||||
BDefaultChoiceList fEmailList;
|
||||
bool fResending;
|
||||
QPopupMenu* fBccMenu;
|
||||
QPopupMenu* fCcMenu;
|
||||
QPopupMenu* fToMenu;
|
||||
BDefaultChoiceList fEmailList;
|
||||
};
|
||||
|
||||
|
||||
class TTextControl : public BComboBox {
|
||||
public:
|
||||
TTextControl(BRect, const char*, BMessage*, bool, bool,
|
||||
int32 resizingMode = B_FOLLOW_NONE);
|
||||
public:
|
||||
TTextControl(BRect, const char*, BMessage*, bool,
|
||||
bool, int32 resizingMode = B_FOLLOW_NONE);
|
||||
|
||||
virtual void AttachedToWindow();
|
||||
virtual void MessageReceived(BMessage*);
|
||||
virtual void AttachedToWindow();
|
||||
virtual void MessageReceived(BMessage*);
|
||||
|
||||
// returns focus for the text view
|
||||
bool HasFocus();
|
||||
bool HasFocus();
|
||||
|
||||
private:
|
||||
bool fIncoming;
|
||||
bool fResending;
|
||||
char fLabel[100];
|
||||
BPopUpMenu *fRefDropMenu;
|
||||
int32 fCommand;
|
||||
private:
|
||||
bool fIncoming;
|
||||
bool fResending;
|
||||
char fLabel[100];
|
||||
BPopUpMenu* fRefDropMenu;
|
||||
int32 fCommand;
|
||||
};
|
||||
|
||||
#endif /* _HEADER_H */
|
||||
|
||||
+67
-106
@@ -4,12 +4,7 @@
|
||||
#include "KUndoBuffer.h"
|
||||
|
||||
|
||||
/*
|
||||
KUndoItem
|
||||
KUndoBuffer に格納される Undo/Redo 情報を記憶するクラス
|
||||
(The class which remembers the Undo/Redo information which is housed in the KUndoBuffer)
|
||||
*/
|
||||
KUndoItem::KUndoItem(const char *redo_text,
|
||||
KUndoItem::KUndoItem(const char* redo_text,
|
||||
int32 length,
|
||||
int32 offset,
|
||||
undo_type history,
|
||||
@@ -21,12 +16,12 @@ KUndoItem::KUndoItem(const char *redo_text,
|
||||
CursorPos = cursor_pos;
|
||||
|
||||
if (redo_text!=NULL) {
|
||||
RedoText = (char *)malloc(length);
|
||||
RedoText = (char*)malloc(length);
|
||||
memcpy(RedoText, redo_text, length);
|
||||
if (RedoText!=NULL) {
|
||||
Status = B_OK;
|
||||
fStatus = B_OK;
|
||||
} else {
|
||||
Status = B_ERROR;
|
||||
fStatus = B_ERROR;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -39,32 +34,23 @@ KUndoItem::~KUndoItem()
|
||||
status_t
|
||||
KUndoItem::InitCheck()
|
||||
{
|
||||
return Status;
|
||||
return fStatus;
|
||||
}
|
||||
|
||||
void
|
||||
KUndoItem::Merge(const char *text, int32 length)
|
||||
KUndoItem::Merge(const char* text, int32 length)
|
||||
{
|
||||
RedoText = (char *)realloc(RedoText, Length + length);
|
||||
RedoText = (char*)realloc(RedoText, Length + length);
|
||||
memcpy(&RedoText[Length], text, length);
|
||||
Length += length;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
KUndoBuffer
|
||||
Undo/Redo情報リストを管理するクラス。
|
||||
(The class which manages the Undo/Redo information list.)
|
||||
このクラス自体は、BTextViewに影響を及ぼすものではない。
|
||||
(This class itself is not something which exerts influence on the BTextView.)
|
||||
あくまで、アプリケーションがUndo/Redoを実装するための補助にすぎない。
|
||||
(To the last, it is no more than an assistance because application mounts the Undo/Redo.)
|
||||
*/
|
||||
KUndoBuffer::KUndoBuffer():BList(1024)
|
||||
{
|
||||
FIndex = 0;
|
||||
fIndex = 0;
|
||||
Off();
|
||||
FNewItem = true;
|
||||
fNewItem = true;
|
||||
}
|
||||
|
||||
KUndoBuffer::~KUndoBuffer()
|
||||
@@ -72,16 +58,9 @@ KUndoBuffer::~KUndoBuffer()
|
||||
MakeEmpty();
|
||||
}
|
||||
|
||||
/*
|
||||
Undo情報を追加する。
|
||||
(Undo information is added.)
|
||||
リスト途中に追加したら、以降はRedoの必要がなくなるため、
|
||||
追加位置以降のUndo情報があれば削除する。
|
||||
(When it adds on the list middle, if later because necessity of the Redo is
|
||||
gone, there is Undo information after the additional position, it deletes.)
|
||||
*/
|
||||
|
||||
bool
|
||||
KUndoBuffer::AddItem(KUndoItem *item, int32 index)
|
||||
KUndoBuffer::AddItem(KUndoItem* item, int32 index)
|
||||
{
|
||||
for (int32 i=CountItems()-1; i>=index; i--) {
|
||||
RemoveItem(i);
|
||||
@@ -90,7 +69,7 @@ KUndoBuffer::AddItem(KUndoItem *item, int32 index)
|
||||
}
|
||||
|
||||
bool
|
||||
KUndoBuffer::AddItem(KUndoItem *item)
|
||||
KUndoBuffer::AddItem(KUndoItem* item)
|
||||
{
|
||||
return BList::AddItem(item);
|
||||
}
|
||||
@@ -103,76 +82,65 @@ KUndoBuffer::MakeEmpty(void)
|
||||
}
|
||||
}
|
||||
|
||||
KUndoItem *
|
||||
KUndoItem*
|
||||
KUndoBuffer::RemoveItem(int32 index)
|
||||
{
|
||||
if (FIndex>=CountItems()) FIndex--;
|
||||
if (fIndex>=CountItems()) fIndex--;
|
||||
delete this->ItemAt(index);
|
||||
return (KUndoItem *)BList::RemoveItem(index);
|
||||
return (KUndoItem*)BList::RemoveItem(index);
|
||||
}
|
||||
|
||||
KUndoItem *
|
||||
KUndoItem*
|
||||
KUndoBuffer::ItemAt(int32 index) const
|
||||
{
|
||||
return (KUndoItem *)BList::ItemAt(index);
|
||||
return (KUndoItem*)BList::ItemAt(index);
|
||||
}
|
||||
|
||||
/*
|
||||
Off() 呼び出し後は、On()を実行しないとUndo情報追加を行わない。
|
||||
(Unless OFF () it calls after, ON () executes, Undo information addition is not done.)
|
||||
*/
|
||||
|
||||
void
|
||||
KUndoBuffer::On()
|
||||
{
|
||||
FNoTouch = false;
|
||||
fNoTouch = false;
|
||||
}
|
||||
|
||||
void
|
||||
KUndoBuffer::Off()
|
||||
{
|
||||
FNoTouch = true;
|
||||
fNoTouch = true;
|
||||
}
|
||||
|
||||
status_t
|
||||
KUndoBuffer::NewUndo(const char *text, int32 length, int32 offset, undo_type history, int32 cursor_pos)
|
||||
KUndoBuffer::NewUndo(const char* text, int32 length, int32 offset,
|
||||
undo_type history, int32 cursor_pos)
|
||||
{
|
||||
KUndoItem *NewUndoItem = new KUndoItem(text, length, offset, history, cursor_pos);
|
||||
KUndoItem* NewUndoItem = new KUndoItem(text, length, offset, history,
|
||||
cursor_pos);
|
||||
|
||||
status_t status = NewUndoItem->InitCheck();
|
||||
if ( status != B_OK) {
|
||||
delete NewUndoItem;
|
||||
return status;
|
||||
}
|
||||
AddItem(NewUndoItem, FIndex);
|
||||
FIndex++;
|
||||
AddItem(NewUndoItem, fIndex);
|
||||
fIndex++;
|
||||
return status;
|
||||
}
|
||||
|
||||
/*
|
||||
Undo情報をリストに追加する。
|
||||
(Undo information is added to the list.)
|
||||
*/
|
||||
|
||||
status_t
|
||||
KUndoBuffer::AddUndo(const char *text, int32 length, int32 offset, undo_type history, int32 cursor_pos)
|
||||
KUndoBuffer::AddUndo(const char* text, int32 length, int32 offset,
|
||||
undo_type history, int32 cursor_pos)
|
||||
{
|
||||
if (FNoTouch) return B_OK;
|
||||
if (fNoTouch) return B_OK;
|
||||
|
||||
status_t status;
|
||||
|
||||
// 新たな追加予約がある(FNewItem)か、現在位置(FIndex)が最後尾でないか、Undoリストが空であれば
|
||||
// 新たにUndo情報を追加する。
|
||||
// (There is new additional reservation, if (the FNewItem), 現在位置 (the
|
||||
// FIndex) is not the last tail or and the Undo list is the sky, Undo
|
||||
// information is added anew.)
|
||||
// さもなくば、最後尾Undo情報に結合すべきなら結合し、そうでなければ
|
||||
// やはり新たにUndo情報を追加する。
|
||||
// (Without, if it should connect to last tail Undo information, if it
|
||||
// connects and so is not Undo information is added after all anew.)
|
||||
if (FNewItem || (FIndex < CountItems()) || (CountItems()==0)) {
|
||||
if (fNewItem || (fIndex < CountItems()) || (CountItems()==0)) {
|
||||
status = NewUndo(text, length, offset, history, cursor_pos);
|
||||
FNewItem = false;
|
||||
fNewItem = false;
|
||||
} else {
|
||||
KUndoItem *CurrentUndoItem;
|
||||
CurrentUndoItem = ItemAt(FIndex-1);
|
||||
KUndoItem* CurrentUndoItem;
|
||||
CurrentUndoItem = ItemAt(fIndex-1);
|
||||
if (CurrentUndoItem!=NULL) {
|
||||
int32 c_length = CurrentUndoItem->Length;
|
||||
int32 c_offset = CurrentUndoItem->Offset;
|
||||
@@ -184,11 +152,13 @@ KUndoBuffer::AddUndo(const char *text, int32 length, int32 offset, undo_type his
|
||||
if ((c_offset + c_length) == offset) {
|
||||
CurrentUndoItem->Merge(text, length);
|
||||
} else {
|
||||
status = NewUndo(text, length, offset, history, cursor_pos);
|
||||
status = NewUndo(text, length, offset, history,
|
||||
cursor_pos);
|
||||
}
|
||||
break;
|
||||
case K_DELETED:
|
||||
status = NewUndo(text, length, offset, history, cursor_pos);
|
||||
status = NewUndo(text, length, offset, history,
|
||||
cursor_pos);
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
@@ -200,37 +170,30 @@ KUndoBuffer::AddUndo(const char *text, int32 length, int32 offset, undo_type his
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
// Enterを押した、矢印キーを押した等、Undoを一区切り起きたい場合に
|
||||
// MakeNewUndoItem()を呼び出す。
|
||||
// (The Enter was pushed, one you divide the Undo and the MakeNewUndoItem ()
|
||||
// you call when we would like to occur e.g., the arrow key was pushed.)
|
||||
|
||||
status_t
|
||||
KUndoBuffer::MakeNewUndoItem()
|
||||
{
|
||||
if (FIndex >= CountItems()) {
|
||||
FNewItem = true;
|
||||
if (fIndex >= CountItems()) {
|
||||
fNewItem = true;
|
||||
return B_OK;
|
||||
}
|
||||
return B_ERROR;
|
||||
}
|
||||
|
||||
// Undo() Redo() は、FIndexをいったりきたりしながら
|
||||
// 挿入位置、文字長、復元テキスト等の情報を返す。
|
||||
// (The Undo () the Redo (), the FIndex, while going back and forth, it
|
||||
// returns the information of insertion position, letter length and the
|
||||
// restoration text et cetera.)
|
||||
|
||||
status_t
|
||||
KUndoBuffer::Undo(char **text,
|
||||
int32 *length,
|
||||
int32 *offset,
|
||||
undo_type *history,
|
||||
int32 *cursor_pos)
|
||||
KUndoBuffer::Undo(char** text,
|
||||
int32* length,
|
||||
int32* offset,
|
||||
undo_type* history,
|
||||
int32* cursor_pos)
|
||||
{
|
||||
KUndoItem *undoItem;
|
||||
KUndoItem* undoItem;
|
||||
status_t status;
|
||||
|
||||
if (FIndex>0) {
|
||||
undoItem = ItemAt(FIndex-1);
|
||||
if (fIndex>0) {
|
||||
undoItem = ItemAt(fIndex-1);
|
||||
if (undoItem!=NULL) {
|
||||
*text = undoItem->RedoText;
|
||||
*length = undoItem->Length;
|
||||
@@ -241,7 +204,7 @@ KUndoBuffer::Undo(char **text,
|
||||
} else {
|
||||
status = B_ERROR;
|
||||
}
|
||||
FIndex--;
|
||||
fIndex--;
|
||||
} else {
|
||||
status = B_ERROR;
|
||||
}
|
||||
@@ -249,26 +212,26 @@ KUndoBuffer::Undo(char **text,
|
||||
}
|
||||
|
||||
status_t
|
||||
KUndoBuffer::Redo(char **text,
|
||||
int32 *length,
|
||||
int32 *offset,
|
||||
undo_type *history,
|
||||
int32 *cursor_pos,
|
||||
bool *replaced)
|
||||
KUndoBuffer::Redo(char** text,
|
||||
int32* length,
|
||||
int32* offset,
|
||||
undo_type* history,
|
||||
int32* cursor_pos,
|
||||
bool* replaced)
|
||||
{
|
||||
KUndoItem *undoItem;
|
||||
KUndoItem* undoItem;
|
||||
status_t status;
|
||||
|
||||
if (FIndex < CountItems()) {
|
||||
undoItem = ItemAt(FIndex);
|
||||
if (fIndex < CountItems()) {
|
||||
undoItem = ItemAt(fIndex);
|
||||
if (undoItem!=NULL) {
|
||||
*text = undoItem->RedoText;
|
||||
*length = undoItem->Length;
|
||||
*offset = undoItem->Offset;
|
||||
*history = undoItem->History;
|
||||
*cursor_pos = undoItem->CursorPos;
|
||||
if ((FIndex+1) < CountItems()) {
|
||||
*replaced = ItemAt(FIndex+1)->History==K_REPLACED;
|
||||
if ((fIndex+1) < CountItems()) {
|
||||
*replaced = ItemAt(fIndex+1)->History==K_REPLACED;
|
||||
} else {
|
||||
*replaced = false;
|
||||
}
|
||||
@@ -276,22 +239,19 @@ KUndoBuffer::Redo(char **text,
|
||||
} else {
|
||||
status = B_ERROR;
|
||||
}
|
||||
FIndex++;
|
||||
fIndex++;
|
||||
} else {
|
||||
status = B_ERROR;
|
||||
}
|
||||
return status;
|
||||
}
|
||||
|
||||
// Undo/Redo 情報を標準出力に書きだす。
|
||||
// (It starts writing Undo/Redo information on standard output.)
|
||||
// デバッグ時のみ。
|
||||
// (Only when debugging.)
|
||||
|
||||
void
|
||||
KUndoBuffer::PrintToStream()
|
||||
{
|
||||
for(int32 i=0; i<CountItems(); i++) {
|
||||
KUndoItem *item = ItemAt(i);
|
||||
KUndoItem* item = ItemAt(i);
|
||||
printf("%3.3d ", (int)i);
|
||||
switch(item->History) {
|
||||
case K_INSERTED:
|
||||
@@ -319,3 +279,4 @@ KUndoBuffer::PrintToStream()
|
||||
printf("'\n");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+54
-53
@@ -1,77 +1,78 @@
|
||||
#ifndef _K_UNDOBUFFER_H
|
||||
#define _K_UNDOBUFFER_H
|
||||
|
||||
|
||||
#include <List.h>
|
||||
|
||||
|
||||
enum undo_type{
|
||||
K_INSERTED, // 文字挿入時 (At the time of character insertion)
|
||||
K_DELETED, // 削除時 (When deleting)
|
||||
K_REPLACED // 置換、つまり削除→挿入の連続動作時 (Substitution, in other words deletion -> at the time of continuous action of insertion)
|
||||
K_INSERTED,
|
||||
K_DELETED,
|
||||
K_REPLACED
|
||||
};
|
||||
|
||||
|
||||
class KUndoItem
|
||||
{
|
||||
public:
|
||||
KUndoItem(const char *text,
|
||||
int32 length,
|
||||
int32 offset,
|
||||
undo_type history,
|
||||
int32 cursor_pos);
|
||||
~KUndoItem();
|
||||
void Merge(const char *text, int32 length);
|
||||
status_t InitCheck();
|
||||
KUndoItem(const char* text, int32 length,
|
||||
int32 offset, undo_type history,
|
||||
int32 cursor_pos);
|
||||
~KUndoItem();
|
||||
|
||||
int32 Offset; // 開始位置 (Start position)
|
||||
int32 Length; // 文字長 (Letter length)
|
||||
char *RedoText; // 復元すべきテキスト (The text which it should reconstruct)
|
||||
undo_type History; // 操作区分 (Operation division)
|
||||
int32 CursorPos; // カーソル位置 (Cursor position)
|
||||
void Merge(const char* text, int32 length);
|
||||
status_t InitCheck();
|
||||
|
||||
int32 Offset;
|
||||
int32 Length;
|
||||
char* RedoText;
|
||||
undo_type History;
|
||||
int32 CursorPos;
|
||||
|
||||
private:
|
||||
status_t Status;
|
||||
status_t fStatus;
|
||||
};
|
||||
|
||||
class KUndoBuffer:public BList
|
||||
|
||||
class KUndoBuffer : public BList
|
||||
{
|
||||
public:
|
||||
KUndoBuffer();
|
||||
~KUndoBuffer();
|
||||
KUndoBuffer();
|
||||
~KUndoBuffer();
|
||||
|
||||
bool AddItem(KUndoItem *item, int32 index);
|
||||
bool AddItem(KUndoItem *item);
|
||||
void MakeEmpty(void);
|
||||
KUndoItem *RemoveItem(int32 index);
|
||||
KUndoItem *ItemAt(int32 index) const;
|
||||
bool AddItem(KUndoItem* item, int32 index);
|
||||
bool AddItem(KUndoItem* item);
|
||||
void MakeEmpty(void);
|
||||
KUndoItem* RemoveItem(int32 index);
|
||||
KUndoItem* ItemAt(int32 index) const;
|
||||
|
||||
status_t AddUndo(const char* redo_text, int32 length,
|
||||
int32 offset, undo_type history,
|
||||
int32 cursor_pos);
|
||||
|
||||
status_t AddUndo(const char *redo_text,
|
||||
int32 length,
|
||||
int32 offset,
|
||||
undo_type history,
|
||||
int32 cursor_pos);
|
||||
status_t MakeNewUndoItem();
|
||||
status_t Undo(char **text,
|
||||
int32 *length,
|
||||
int32 *offset,
|
||||
undo_type *history,
|
||||
int32 *cursor_pos);
|
||||
status_t Redo(char **text,
|
||||
int32 *length,
|
||||
int32 *offset,
|
||||
undo_type *history,
|
||||
int32 *cursor_pos,
|
||||
bool *replaced);
|
||||
status_t MakeNewUndoItem();
|
||||
|
||||
void PrintToStream();
|
||||
status_t Undo(char** text, int32* length, int32* offset,
|
||||
undo_type* history, int32* cursor_pos);
|
||||
|
||||
void On();
|
||||
void Off();
|
||||
status_t Redo(char** text, int32* length, int32* offset,
|
||||
undo_type* history, int32* cursor_pos,
|
||||
bool* replaced);
|
||||
|
||||
void PrintToStream();
|
||||
void On();
|
||||
void Off();
|
||||
|
||||
private:
|
||||
int32 FIndex;
|
||||
bool FNewItem;
|
||||
bool FNoTouch;
|
||||
int32 fIndex;
|
||||
bool fNewItem;
|
||||
bool fNoTouch;
|
||||
|
||||
status_t NewUndo(const char *text,
|
||||
int32 length,
|
||||
int32 offset,
|
||||
undo_type history,
|
||||
int32 cursor_pos);
|
||||
status_t NewUndo(const char* text, int32 length,
|
||||
int32 offset, undo_type history,
|
||||
int32 cursor_pos);
|
||||
};
|
||||
|
||||
|
||||
#endif // _K_UNDOBUFFER_H
|
||||
|
||||
|
||||
@@ -39,22 +39,23 @@ All rights reserved.
|
||||
|
||||
|
||||
class TMenu: public BPopUpMenu {
|
||||
public:
|
||||
TMenu(const char* name, const char* attribute,
|
||||
int32 message, bool popup = false,
|
||||
bool addRandom = true);
|
||||
virtual ~TMenu();
|
||||
public:
|
||||
TMenu(const char* name, const char* attribute,
|
||||
int32 message, bool popup = false,
|
||||
bool addRandom = true);
|
||||
virtual ~TMenu();
|
||||
|
||||
virtual BPoint ScreenLocation(void);
|
||||
virtual void AttachedToWindow();
|
||||
virtual BPoint ScreenLocation(void);
|
||||
virtual void AttachedToWindow();
|
||||
|
||||
void BuildMenu();
|
||||
void BuildMenu();
|
||||
|
||||
private:
|
||||
char* fAttribute;
|
||||
bool fPopup;
|
||||
bool fAddRandom;
|
||||
int32 fMessage;
|
||||
private:
|
||||
char* fAttribute;
|
||||
bool fPopup;
|
||||
bool fAddRandom;
|
||||
int32 fMessage;
|
||||
};
|
||||
|
||||
#endif // _MAIL_POPUPMENU_H
|
||||
|
||||
|
||||
@@ -3120,3 +3120,4 @@ TMailWindow::_UpdateReadButton()
|
||||
}
|
||||
UpdateViews();
|
||||
}
|
||||
|
||||
|
||||
@@ -204,3 +204,4 @@ class TMailWindow : public BWindow {
|
||||
};
|
||||
|
||||
#endif // _MAIL_WINDOW_H
|
||||
|
||||
|
||||
@@ -128,3 +128,4 @@ enum MENUS {
|
||||
};
|
||||
|
||||
#endif // _MESSAGES_H
|
||||
|
||||
|
||||
@@ -919,4 +919,4 @@ TPrefsWindow::_BuildButtonBarMenu(uint8 show)
|
||||
|
||||
return menu;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -86,3 +86,4 @@ class QueryMenu : public BPopUpMenu {
|
||||
};
|
||||
|
||||
#endif // #ifndef _QUERY_MENU
|
||||
|
||||
|
||||
@@ -63,3 +63,4 @@ class TStatusWindow : public BWindow {
|
||||
};
|
||||
|
||||
#endif // #ifndef _STATUS_H
|
||||
|
||||
|
||||
@@ -67,3 +67,4 @@ int32 linelen(char*, int32, bool);
|
||||
#endif
|
||||
|
||||
#endif // #ifndef _UTILITIES_H
|
||||
|
||||
|
||||
@@ -104,3 +104,4 @@ protected:
|
||||
};
|
||||
|
||||
#endif // #ifndef _WORD_INDEX_H
|
||||
|
||||
|
||||
@@ -862,3 +862,4 @@ void sort_word_list( BList *matches, const char *reference )
|
||||
matches->SortItems( (int (*)(const void *, const void *))word_cmp );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -67,3 +67,4 @@ protected:
|
||||
};
|
||||
|
||||
#endif // #ifndef _WORDS_H
|
||||
|
||||
|
||||
Reference in New Issue
Block a user