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())
|
if (Window())
|
||||||
Window()->AddCommonFilter(fFilter);
|
Window()->AddCommonFilter(fFilter);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -75,3 +75,4 @@ private:
|
|||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -85,3 +85,4 @@ private:
|
|||||||
};
|
};
|
||||||
|
|
||||||
#endif // #ifndef _BMAP_BUTTON_H
|
#endif // #ifndef _BMAP_BUTTON_H
|
||||||
|
|
||||||
|
|||||||
@@ -234,3 +234,4 @@ ButtonBar::ShowLabels(bool show)
|
|||||||
}
|
}
|
||||||
fShowLabels = show;
|
fShowLabels = show;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -80,3 +80,4 @@ protected:
|
|||||||
};
|
};
|
||||||
|
|
||||||
#endif // #ifndef _BUTTON_BAR_H
|
#endif // #ifndef _BUTTON_BAR_H
|
||||||
|
|
||||||
|
|||||||
@@ -229,3 +229,4 @@ private:
|
|||||||
};
|
};
|
||||||
|
|
||||||
#endif // #ifndef _COMBOBOX_H
|
#endif // #ifndef _COMBOBOX_H
|
||||||
|
|
||||||
|
|||||||
@@ -303,3 +303,4 @@ extern void FillInQuoteTextRuns(BTextView* view, quote_context* context,
|
|||||||
int32 maxStyles = 5);
|
int32 maxStyles = 5);
|
||||||
|
|
||||||
#endif /* #ifndef _CONTENT_H */
|
#endif /* #ifndef _CONTENT_H */
|
||||||
|
|
||||||
|
|||||||
@@ -127,3 +127,4 @@ class TListItem : public BListItem
|
|||||||
};
|
};
|
||||||
|
|
||||||
#endif // #ifndef _ENCLOSURES_H
|
#endif // #ifndef _ENCLOSURES_H
|
||||||
|
|
||||||
|
|||||||
@@ -48,3 +48,4 @@ enum {
|
|||||||
};
|
};
|
||||||
|
|
||||||
#endif // #ifndef _FIELD_MSG_H
|
#endif // #ifndef _FIELD_MSG_H
|
||||||
|
|
||||||
|
|||||||
@@ -59,9 +59,7 @@ enum {
|
|||||||
M_FIND_STRING_CHANGED = 'fsch'
|
M_FIND_STRING_CHANGED = 'fsch'
|
||||||
};
|
};
|
||||||
|
|
||||||
void TextBevel(BView& view, BRect r);
|
|
||||||
|
|
||||||
// ============================================================================
|
|
||||||
void TextBevel(BView& view, BRect r)
|
void TextBevel(BView& view, BRect r)
|
||||||
{
|
{
|
||||||
r.InsetBy(-1,-1);
|
r.InsetBy(-1,-1);
|
||||||
@@ -96,7 +94,8 @@ void FindWindow::DoFind(BWindow *window, const char *text)
|
|||||||
{
|
{
|
||||||
if (window == NULL) {
|
if (window == NULL) {
|
||||||
long i=0;
|
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 (window != mFindWindow)
|
||||||
if (dynamic_cast<TMailWindow *>(window) != NULL)
|
if (dynamic_cast<TMailWindow *>(window) != NULL)
|
||||||
break; // Found a window
|
break; // Found a window
|
||||||
@@ -129,9 +128,10 @@ FindPanel::FindPanel(BRect rect)
|
|||||||
{
|
{
|
||||||
BRect r = Bounds().InsetByCopy(10,10);
|
BRect r = Bounds().InsetByCopy(10,10);
|
||||||
|
|
||||||
mBTextControl = new AutoTextControl(r,"BTextControl",NULL,sPreviousFind.String(),
|
mBTextControl = new AutoTextControl(r,"BTextControl",NULL,
|
||||||
new BMessage(M_FIND_STRING_CHANGED),
|
sPreviousFind.String(), new BMessage(M_FIND_STRING_CHANGED),
|
||||||
B_FOLLOW_LEFT_RIGHT | B_FOLLOW_TOP);
|
B_FOLLOW_LEFT_RIGHT | B_FOLLOW_TOP);
|
||||||
|
|
||||||
mBTextControl->SetText(sPreviousFind.String());
|
mBTextControl->SetText(sPreviousFind.String());
|
||||||
mBTextControl->MakeFocus();
|
mBTextControl->MakeFocus();
|
||||||
mBTextControl->SetEscapeCancel(true);
|
mBTextControl->SetEscapeCancel(true);
|
||||||
@@ -163,7 +163,8 @@ void FindPanel::AttachedToWindow()
|
|||||||
|
|
||||||
mBTextControl->SetTarget(this);
|
mBTextControl->SetTarget(this);
|
||||||
mBTextControl->ResizeToPreferred();
|
mBTextControl->ResizeToPreferred();
|
||||||
mBTextControl->ResizeTo(Bounds().Width() - 20, mBTextControl->Frame().Height());
|
mBTextControl->ResizeTo(Bounds().Width() - 20,
|
||||||
|
mBTextControl->Frame().Height());
|
||||||
|
|
||||||
mBTextControl->MakeFocus(true);
|
mBTextControl->MakeFocus(true);
|
||||||
mBTextControl->TextView()->SelectAll();
|
mBTextControl->TextView()->SelectAll();
|
||||||
@@ -211,6 +212,7 @@ void FindPanel::MessageReceived(BMessage *msg)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void FindPanel::Find()
|
void FindPanel::Find()
|
||||||
{
|
{
|
||||||
mBTextControl->TextView()->SelectAll();
|
mBTextControl->TextView()->SelectAll();
|
||||||
@@ -219,7 +221,8 @@ void FindPanel::Find()
|
|||||||
|
|
||||||
BWindow *window = NULL;
|
BWindow *window = NULL;
|
||||||
long i=0;
|
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)
|
if (window != FindWindow::mFindWindow)
|
||||||
break; // Found a window
|
break; // Found a window
|
||||||
}
|
}
|
||||||
@@ -228,8 +231,6 @@ void FindPanel::Find()
|
|||||||
FindWindow::DoFind(window, text);
|
FindWindow::DoFind(window, text);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ============================================================================
|
|
||||||
|
|
||||||
|
|
||||||
FindWindow::FindWindow()
|
FindWindow::FindWindow()
|
||||||
: BWindow(FindWindow::mLastPosition,
|
: BWindow(FindWindow::mLastPosition,
|
||||||
@@ -243,12 +244,14 @@ FindWindow::FindWindow()
|
|||||||
Show();
|
Show();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
FindWindow::~FindWindow()
|
FindWindow::~FindWindow()
|
||||||
{
|
{
|
||||||
FindWindow::mLastPosition = Frame();
|
FindWindow::mLastPosition = Frame();
|
||||||
mFindWindow = NULL;
|
mFindWindow = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void FindWindow::Find(BWindow *window)
|
void FindWindow::Find(BWindow *window)
|
||||||
{
|
{
|
||||||
// eliminate unused parameter warning
|
// eliminate unused parameter warning
|
||||||
@@ -260,6 +263,7 @@ void FindWindow::Find(BWindow *window)
|
|||||||
mFindWindow->Activate();
|
mFindWindow->Activate();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void FindWindow::FindAgain(BWindow *window)
|
void FindWindow::FindAgain(BWindow *window)
|
||||||
{
|
{
|
||||||
if (mFindWindow) {
|
if (mFindWindow) {
|
||||||
@@ -272,12 +276,15 @@ void FindWindow::FindAgain(BWindow *window)
|
|||||||
Find(window);
|
Find(window);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void FindWindow::SetFindString(const char *string)
|
void FindWindow::SetFindString(const char *string)
|
||||||
{
|
{
|
||||||
sPreviousFind = string;
|
sPreviousFind = string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const char *FindWindow::GetFindString()
|
const char *FindWindow::GetFindString()
|
||||||
{
|
{
|
||||||
return sPreviousFind.String();
|
return sPreviousFind.String();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -47,8 +47,6 @@ All rights reserved.
|
|||||||
class FindPanel;
|
class FindPanel;
|
||||||
class AutoTextControl;
|
class AutoTextControl;
|
||||||
|
|
||||||
// ============================================================================
|
|
||||||
// Floating find window, just one of them.....
|
|
||||||
|
|
||||||
class FindWindow : public BWindow {
|
class FindWindow : public BWindow {
|
||||||
friend class FindPanel;
|
friend class FindPanel;
|
||||||
@@ -89,6 +87,5 @@ protected:
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
// ============================================================================
|
|
||||||
|
|
||||||
#endif // #ifndef _FINDWINDOW_H
|
#endif // #ifndef _FINDWINDOW_H
|
||||||
|
|
||||||
|
|||||||
@@ -76,6 +76,7 @@ All rights reserved.
|
|||||||
using namespace BPrivate;
|
using namespace BPrivate;
|
||||||
using std::map;
|
using std::map;
|
||||||
|
|
||||||
|
|
||||||
const char* kDateLabel = "Date:";
|
const char* kDateLabel = "Date:";
|
||||||
const uint32 kMsgFrom = 'hFrm';
|
const uint32 kMsgFrom = 'hFrm';
|
||||||
const uint32 kMsgEncoding = 'encd';
|
const uint32 kMsgEncoding = 'encd';
|
||||||
@@ -84,6 +85,7 @@ const uint32 kMsgAddressChosen = 'acsn';
|
|||||||
static const float kTextControlDividerOffset = 0;
|
static const float kTextControlDividerOffset = 0;
|
||||||
static const float kMenuFieldDividerOffset = 6;
|
static const float kMenuFieldDividerOffset = 6;
|
||||||
|
|
||||||
|
|
||||||
class QPopupMenu : public QueryMenu {
|
class QPopupMenu : public QueryMenu {
|
||||||
public:
|
public:
|
||||||
QPopupMenu(const char *title);
|
QPopupMenu(const char *title);
|
||||||
@@ -100,6 +102,7 @@ class QPopupMenu : public QueryMenu {
|
|||||||
int32 fGroups; // Current number of "group" submenus. Includes All People if present.
|
int32 fGroups; // Current number of "group" submenus. Includes All People if present.
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
struct CompareBStrings {
|
struct CompareBStrings {
|
||||||
bool
|
bool
|
||||||
operator()(const BString *s1, const BString *s2) const
|
operator()(const BString *s1, const BString *s2) const
|
||||||
|
|||||||
@@ -81,11 +81,13 @@ class TTextControl;
|
|||||||
|
|
||||||
class THeaderView : public BBox {
|
class THeaderView : public BBox {
|
||||||
public:
|
public:
|
||||||
THeaderView(BRect, BRect, bool incoming, BEmailMessage *mail,
|
THeaderView(BRect, BRect, bool incoming,
|
||||||
bool resending, uint32 defaultCharacterSet, uint32 defaultChain);
|
BEmailMessage *mail, bool resending,
|
||||||
|
uint32 defaultCharacterSet,
|
||||||
|
uint32 defaultChain);
|
||||||
|
|
||||||
virtual void MessageReceived(BMessage*);
|
virtual void MessageReceived(BMessage*);
|
||||||
virtual void AttachedToWindow(void);
|
virtual void AttachedToWindow();
|
||||||
status_t LoadMessage(BEmailMessage*);
|
status_t LoadMessage(BEmailMessage*);
|
||||||
|
|
||||||
BPopUpMenu* fAccountMenu;
|
BPopUpMenu* fAccountMenu;
|
||||||
@@ -113,15 +115,15 @@ class THeaderView : public BBox {
|
|||||||
BDefaultChoiceList fEmailList;
|
BDefaultChoiceList fEmailList;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
class TTextControl : public BComboBox {
|
class TTextControl : public BComboBox {
|
||||||
public:
|
public:
|
||||||
TTextControl(BRect, const char*, BMessage*, bool, bool,
|
TTextControl(BRect, const char*, BMessage*, bool,
|
||||||
int32 resizingMode = B_FOLLOW_NONE);
|
bool, int32 resizingMode = B_FOLLOW_NONE);
|
||||||
|
|
||||||
virtual void AttachedToWindow();
|
virtual void AttachedToWindow();
|
||||||
virtual void MessageReceived(BMessage*);
|
virtual void MessageReceived(BMessage*);
|
||||||
|
|
||||||
// returns focus for the text view
|
|
||||||
bool HasFocus();
|
bool HasFocus();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|||||||
@@ -4,11 +4,6 @@
|
|||||||
#include "KUndoBuffer.h"
|
#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 length,
|
||||||
int32 offset,
|
int32 offset,
|
||||||
@@ -24,9 +19,9 @@ KUndoItem::KUndoItem(const char *redo_text,
|
|||||||
RedoText = (char*)malloc(length);
|
RedoText = (char*)malloc(length);
|
||||||
memcpy(RedoText, redo_text, length);
|
memcpy(RedoText, redo_text, length);
|
||||||
if (RedoText!=NULL) {
|
if (RedoText!=NULL) {
|
||||||
Status = B_OK;
|
fStatus = B_OK;
|
||||||
} else {
|
} else {
|
||||||
Status = B_ERROR;
|
fStatus = B_ERROR;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -39,7 +34,7 @@ KUndoItem::~KUndoItem()
|
|||||||
status_t
|
status_t
|
||||||
KUndoItem::InitCheck()
|
KUndoItem::InitCheck()
|
||||||
{
|
{
|
||||||
return Status;
|
return fStatus;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@@ -51,20 +46,11 @@ KUndoItem::Merge(const char *text, int32 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)
|
KUndoBuffer::KUndoBuffer():BList(1024)
|
||||||
{
|
{
|
||||||
FIndex = 0;
|
fIndex = 0;
|
||||||
Off();
|
Off();
|
||||||
FNewItem = true;
|
fNewItem = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
KUndoBuffer::~KUndoBuffer()
|
KUndoBuffer::~KUndoBuffer()
|
||||||
@@ -72,14 +58,7 @@ KUndoBuffer::~KUndoBuffer()
|
|||||||
MakeEmpty();
|
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
|
bool
|
||||||
KUndoBuffer::AddItem(KUndoItem* item, int32 index)
|
KUndoBuffer::AddItem(KUndoItem* item, int32 index)
|
||||||
{
|
{
|
||||||
@@ -106,7 +85,7 @@ KUndoBuffer::MakeEmpty(void)
|
|||||||
KUndoItem*
|
KUndoItem*
|
||||||
KUndoBuffer::RemoveItem(int32 index)
|
KUndoBuffer::RemoveItem(int32 index)
|
||||||
{
|
{
|
||||||
if (FIndex>=CountItems()) FIndex--;
|
if (fIndex>=CountItems()) fIndex--;
|
||||||
delete this->ItemAt(index);
|
delete this->ItemAt(index);
|
||||||
return (KUndoItem*)BList::RemoveItem(index);
|
return (KUndoItem*)BList::RemoveItem(index);
|
||||||
}
|
}
|
||||||
@@ -117,62 +96,51 @@ 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
|
void
|
||||||
KUndoBuffer::On()
|
KUndoBuffer::On()
|
||||||
{
|
{
|
||||||
FNoTouch = false;
|
fNoTouch = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
KUndoBuffer::Off()
|
KUndoBuffer::Off()
|
||||||
{
|
{
|
||||||
FNoTouch = true;
|
fNoTouch = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
status_t
|
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();
|
status_t status = NewUndoItem->InitCheck();
|
||||||
if ( status != B_OK) {
|
if ( status != B_OK) {
|
||||||
delete NewUndoItem;
|
delete NewUndoItem;
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
AddItem(NewUndoItem, FIndex);
|
AddItem(NewUndoItem, fIndex);
|
||||||
FIndex++;
|
fIndex++;
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
Undo情報をリストに追加する。
|
|
||||||
(Undo information is added to the list.)
|
|
||||||
*/
|
|
||||||
status_t
|
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;
|
status_t status;
|
||||||
|
|
||||||
// 新たな追加予約がある(FNewItem)か、現在位置(FIndex)が最後尾でないか、Undoリストが空であれば
|
if (fNewItem || (fIndex < CountItems()) || (CountItems()==0)) {
|
||||||
// 新たに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)) {
|
|
||||||
status = NewUndo(text, length, offset, history, cursor_pos);
|
status = NewUndo(text, length, offset, history, cursor_pos);
|
||||||
FNewItem = false;
|
fNewItem = false;
|
||||||
} else {
|
} else {
|
||||||
KUndoItem* CurrentUndoItem;
|
KUndoItem* CurrentUndoItem;
|
||||||
CurrentUndoItem = ItemAt(FIndex-1);
|
CurrentUndoItem = ItemAt(fIndex-1);
|
||||||
if (CurrentUndoItem!=NULL) {
|
if (CurrentUndoItem!=NULL) {
|
||||||
int32 c_length = CurrentUndoItem->Length;
|
int32 c_length = CurrentUndoItem->Length;
|
||||||
int32 c_offset = CurrentUndoItem->Offset;
|
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) {
|
if ((c_offset + c_length) == offset) {
|
||||||
CurrentUndoItem->Merge(text, length);
|
CurrentUndoItem->Merge(text, length);
|
||||||
} else {
|
} else {
|
||||||
status = NewUndo(text, length, offset, history, cursor_pos);
|
status = NewUndo(text, length, offset, history,
|
||||||
|
cursor_pos);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case K_DELETED:
|
case K_DELETED:
|
||||||
status = NewUndo(text, length, offset, history, cursor_pos);
|
status = NewUndo(text, length, offset, history,
|
||||||
|
cursor_pos);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@@ -200,25 +170,18 @@ KUndoBuffer::AddUndo(const char *text, int32 length, int32 offset, undo_type his
|
|||||||
return B_OK;
|
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
|
status_t
|
||||||
KUndoBuffer::MakeNewUndoItem()
|
KUndoBuffer::MakeNewUndoItem()
|
||||||
{
|
{
|
||||||
if (FIndex >= CountItems()) {
|
if (fIndex >= CountItems()) {
|
||||||
FNewItem = true;
|
fNewItem = true;
|
||||||
return B_OK;
|
return B_OK;
|
||||||
}
|
}
|
||||||
return B_ERROR;
|
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
|
status_t
|
||||||
KUndoBuffer::Undo(char** text,
|
KUndoBuffer::Undo(char** text,
|
||||||
int32* length,
|
int32* length,
|
||||||
@@ -229,8 +192,8 @@ KUndoBuffer::Undo(char **text,
|
|||||||
KUndoItem* undoItem;
|
KUndoItem* undoItem;
|
||||||
status_t status;
|
status_t status;
|
||||||
|
|
||||||
if (FIndex>0) {
|
if (fIndex>0) {
|
||||||
undoItem = ItemAt(FIndex-1);
|
undoItem = ItemAt(fIndex-1);
|
||||||
if (undoItem!=NULL) {
|
if (undoItem!=NULL) {
|
||||||
*text = undoItem->RedoText;
|
*text = undoItem->RedoText;
|
||||||
*length = undoItem->Length;
|
*length = undoItem->Length;
|
||||||
@@ -241,7 +204,7 @@ KUndoBuffer::Undo(char **text,
|
|||||||
} else {
|
} else {
|
||||||
status = B_ERROR;
|
status = B_ERROR;
|
||||||
}
|
}
|
||||||
FIndex--;
|
fIndex--;
|
||||||
} else {
|
} else {
|
||||||
status = B_ERROR;
|
status = B_ERROR;
|
||||||
}
|
}
|
||||||
@@ -259,16 +222,16 @@ KUndoBuffer::Redo(char **text,
|
|||||||
KUndoItem* undoItem;
|
KUndoItem* undoItem;
|
||||||
status_t status;
|
status_t status;
|
||||||
|
|
||||||
if (FIndex < CountItems()) {
|
if (fIndex < CountItems()) {
|
||||||
undoItem = ItemAt(FIndex);
|
undoItem = ItemAt(fIndex);
|
||||||
if (undoItem!=NULL) {
|
if (undoItem!=NULL) {
|
||||||
*text = undoItem->RedoText;
|
*text = undoItem->RedoText;
|
||||||
*length = undoItem->Length;
|
*length = undoItem->Length;
|
||||||
*offset = undoItem->Offset;
|
*offset = undoItem->Offset;
|
||||||
*history = undoItem->History;
|
*history = undoItem->History;
|
||||||
*cursor_pos = undoItem->CursorPos;
|
*cursor_pos = undoItem->CursorPos;
|
||||||
if ((FIndex+1) < CountItems()) {
|
if ((fIndex+1) < CountItems()) {
|
||||||
*replaced = ItemAt(FIndex+1)->History==K_REPLACED;
|
*replaced = ItemAt(fIndex+1)->History==K_REPLACED;
|
||||||
} else {
|
} else {
|
||||||
*replaced = false;
|
*replaced = false;
|
||||||
}
|
}
|
||||||
@@ -276,17 +239,14 @@ KUndoBuffer::Redo(char **text,
|
|||||||
} else {
|
} else {
|
||||||
status = B_ERROR;
|
status = B_ERROR;
|
||||||
}
|
}
|
||||||
FIndex++;
|
fIndex++;
|
||||||
} else {
|
} else {
|
||||||
status = B_ERROR;
|
status = B_ERROR;
|
||||||
}
|
}
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Undo/Redo 情報を標準出力に書きだす。
|
|
||||||
// (It starts writing Undo/Redo information on standard output.)
|
|
||||||
// デバッグ時のみ。
|
|
||||||
// (Only when debugging.)
|
|
||||||
void
|
void
|
||||||
KUndoBuffer::PrintToStream()
|
KUndoBuffer::PrintToStream()
|
||||||
{
|
{
|
||||||
@@ -319,3 +279,4 @@ KUndoBuffer::PrintToStream()
|
|||||||
printf("'\n");
|
printf("'\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+37
-36
@@ -1,33 +1,39 @@
|
|||||||
|
#ifndef _K_UNDOBUFFER_H
|
||||||
|
#define _K_UNDOBUFFER_H
|
||||||
|
|
||||||
|
|
||||||
#include <List.h>
|
#include <List.h>
|
||||||
|
|
||||||
|
|
||||||
enum undo_type{
|
enum undo_type{
|
||||||
K_INSERTED, // 文字挿入時 (At the time of character insertion)
|
K_INSERTED,
|
||||||
K_DELETED, // 削除時 (When deleting)
|
K_DELETED,
|
||||||
K_REPLACED // 置換、つまり削除→挿入の連続動作時 (Substitution, in other words deletion -> at the time of continuous action of insertion)
|
K_REPLACED
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
class KUndoItem
|
class KUndoItem
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
KUndoItem(const char *text,
|
KUndoItem(const char* text, int32 length,
|
||||||
int32 length,
|
int32 offset, undo_type history,
|
||||||
int32 offset,
|
|
||||||
undo_type history,
|
|
||||||
int32 cursor_pos);
|
int32 cursor_pos);
|
||||||
~KUndoItem();
|
~KUndoItem();
|
||||||
|
|
||||||
void Merge(const char* text, int32 length);
|
void Merge(const char* text, int32 length);
|
||||||
status_t InitCheck();
|
status_t InitCheck();
|
||||||
|
|
||||||
int32 Offset; // 開始位置 (Start position)
|
int32 Offset;
|
||||||
int32 Length; // 文字長 (Letter length)
|
int32 Length;
|
||||||
char *RedoText; // 復元すべきテキスト (The text which it should reconstruct)
|
char* RedoText;
|
||||||
undo_type History; // 操作区分 (Operation division)
|
undo_type History;
|
||||||
int32 CursorPos; // カーソル位置 (Cursor position)
|
int32 CursorPos;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
status_t Status;
|
status_t fStatus;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
class KUndoBuffer : public BList
|
class KUndoBuffer : public BList
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@@ -40,38 +46,33 @@ public:
|
|||||||
KUndoItem* RemoveItem(int32 index);
|
KUndoItem* RemoveItem(int32 index);
|
||||||
KUndoItem* ItemAt(int32 index) const;
|
KUndoItem* ItemAt(int32 index) const;
|
||||||
|
|
||||||
|
status_t AddUndo(const char* redo_text, int32 length,
|
||||||
status_t AddUndo(const char *redo_text,
|
int32 offset, undo_type history,
|
||||||
int32 length,
|
|
||||||
int32 offset,
|
|
||||||
undo_type history,
|
|
||||||
int32 cursor_pos);
|
int32 cursor_pos);
|
||||||
|
|
||||||
status_t MakeNewUndoItem();
|
status_t MakeNewUndoItem();
|
||||||
status_t Undo(char **text,
|
|
||||||
int32 *length,
|
status_t Undo(char** text, int32* length, int32* offset,
|
||||||
int32 *offset,
|
undo_type* history, int32* cursor_pos);
|
||||||
undo_type *history,
|
|
||||||
int32 *cursor_pos);
|
status_t Redo(char** text, int32* length, int32* offset,
|
||||||
status_t Redo(char **text,
|
undo_type* history, int32* cursor_pos,
|
||||||
int32 *length,
|
|
||||||
int32 *offset,
|
|
||||||
undo_type *history,
|
|
||||||
int32 *cursor_pos,
|
|
||||||
bool* replaced);
|
bool* replaced);
|
||||||
|
|
||||||
void PrintToStream();
|
void PrintToStream();
|
||||||
|
|
||||||
void On();
|
void On();
|
||||||
void Off();
|
void Off();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
int32 FIndex;
|
int32 fIndex;
|
||||||
bool FNewItem;
|
bool fNewItem;
|
||||||
bool FNoTouch;
|
bool fNoTouch;
|
||||||
|
|
||||||
status_t NewUndo(const char *text,
|
status_t NewUndo(const char* text, int32 length,
|
||||||
int32 length,
|
int32 offset, undo_type history,
|
||||||
int32 offset,
|
|
||||||
undo_type history,
|
|
||||||
int32 cursor_pos);
|
int32 cursor_pos);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
#endif // _K_UNDOBUFFER_H
|
||||||
|
|
||||||
|
|||||||
@@ -58,3 +58,4 @@ class TMenu: public BPopUpMenu {
|
|||||||
};
|
};
|
||||||
|
|
||||||
#endif // _MAIL_POPUPMENU_H
|
#endif // _MAIL_POPUPMENU_H
|
||||||
|
|
||||||
|
|||||||
@@ -3120,3 +3120,4 @@ TMailWindow::_UpdateReadButton()
|
|||||||
}
|
}
|
||||||
UpdateViews();
|
UpdateViews();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -204,3 +204,4 @@ class TMailWindow : public BWindow {
|
|||||||
};
|
};
|
||||||
|
|
||||||
#endif // _MAIL_WINDOW_H
|
#endif // _MAIL_WINDOW_H
|
||||||
|
|
||||||
|
|||||||
@@ -128,3 +128,4 @@ enum MENUS {
|
|||||||
};
|
};
|
||||||
|
|
||||||
#endif // _MESSAGES_H
|
#endif // _MESSAGES_H
|
||||||
|
|
||||||
|
|||||||
@@ -86,3 +86,4 @@ class QueryMenu : public BPopUpMenu {
|
|||||||
};
|
};
|
||||||
|
|
||||||
#endif // #ifndef _QUERY_MENU
|
#endif // #ifndef _QUERY_MENU
|
||||||
|
|
||||||
|
|||||||
@@ -63,3 +63,4 @@ class TStatusWindow : public BWindow {
|
|||||||
};
|
};
|
||||||
|
|
||||||
#endif // #ifndef _STATUS_H
|
#endif // #ifndef _STATUS_H
|
||||||
|
|
||||||
|
|||||||
@@ -67,3 +67,4 @@ int32 linelen(char*, int32, bool);
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif // #ifndef _UTILITIES_H
|
#endif // #ifndef _UTILITIES_H
|
||||||
|
|
||||||
|
|||||||
@@ -104,3 +104,4 @@ protected:
|
|||||||
};
|
};
|
||||||
|
|
||||||
#endif // #ifndef _WORD_INDEX_H
|
#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 );
|
matches->SortItems( (int (*)(const void *, const void *))word_cmp );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -67,3 +67,4 @@ protected:
|
|||||||
};
|
};
|
||||||
|
|
||||||
#endif // #ifndef _WORDS_H
|
#endif // #ifndef _WORDS_H
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user