Skip to content

Commit

Permalink
M#0821, M#0011
Browse files Browse the repository at this point in the history
  • Loading branch information
w17 committed Jun 27, 2012
1 parent 5fa3820 commit 6904f9f
Show file tree
Hide file tree
Showing 10 changed files with 86 additions and 37 deletions.
11 changes: 11 additions & 0 deletions far/changelog
@@ -1,3 +1,14 @@
w17 27.06.2012 15:43:12 +0400 - build 2748

1. �������� �������� "Use case sensitive sort"
������ �������� �������������� ��������������.

2. M#0821: ��������� "��������� ������� �����" ������ �� ����������� ���������
����� ��������� ��������� � �� ��������� (������ �� ���������������) �������, �������� ����������.

3. M#0011: ���������� wrar/wwrap/unwrap � �������
� ���������� ������� 2 ����� ����� ��� ���������� ��������� � ������ ��������.

drkns 24.06.2012 16:21:55 +0200 - build 2747

1. ��������� 2738.
Expand Down
6 changes: 6 additions & 0 deletions far/config.cpp
Expand Up @@ -720,13 +720,15 @@ void ViewerConfig(ViewerOptions &ViOpt,bool Local)
Builder.StartColumns();
Builder.AddCheckbox(MViewConfigPersistentSelection, ViOpt.PersistentBlocks);
DialogItemEx *SavePos = Builder.AddCheckbox(MViewConfigSavePos, Opt.ViOpt.SavePos); // can't be local
Builder.AddCheckbox(MViewConfigSaveCodepage, ViOpt.SaveCodepage);
Builder.AddCheckbox(MViewConfigEditAutofocus, ViOpt.SearchEditFocus);
DialogItemEx *TabSize = Builder.AddIntEditField(ViOpt.TabSize, 3);
Builder.AddTextAfter(TabSize, MViewConfigTabSize);
Builder.ColumnBreak();
Builder.AddCheckbox(MViewConfigArrows, ViOpt.ShowArrows);
DialogItemEx *SaveShortPos = Builder.AddCheckbox(MViewConfigSaveShortPos, Opt.ViOpt.SaveShortPos); // can't be local
Builder.LinkFlags(SavePos, SaveShortPos, DIF_DISABLE);
Builder.AddCheckbox(MViewConfigSaveWrapMode, ViOpt.SaveWrapMode);
Builder.AddCheckbox(MViewConfigVisible0x00, ViOpt.Visible0x00);
Builder.AddCheckbox(MViewConfigScrollbar, ViOpt.ShowScrollbar);
Builder.EndColumns();
Expand All @@ -742,6 +744,8 @@ void ViewerConfig(ViewerOptions &ViOpt,bool Local)
Builder.AddOKCancel();
if (Builder.ShowDialog())
{
if (Opt.ViOpt.SavePos)
ViOpt.SaveCodepage = true; // codepage is part of saved position
if (ViOpt.TabSize<1 || ViOpt.TabSize>512)
ViOpt.TabSize = DefaultTabSize;
if (!Opt.ViOpt.MaxLineSize)
Expand Down Expand Up @@ -1172,6 +1176,8 @@ static struct FARConfig
{FSSF_PRIVATE, NKeyViewer,L"PersistentBlocks", AddressAndType(Opt.ViOpt.PersistentBlocks), Default(0)},
{FSSF_PRIVATE, NKeyViewer,L"SaveViewerPos", AddressAndType(Opt.ViOpt.SavePos), Default(1)},
{FSSF_PRIVATE, NKeyViewer,L"SaveViewerShortPos", AddressAndType(Opt.ViOpt.SaveShortPos), Default(1)},
{FSSF_PRIVATE, NKeyViewer,L"SaveViewerCodepage", AddressAndType(Opt.ViOpt.SaveCodepage), Default(1)},
{FSSF_PRIVATE, NKeyViewer,L"SaveViewerWrapMode", AddressAndType(Opt.ViOpt.SaveWrapMode), Default(0)},
{FSSF_PRIVATE, NKeyViewer,L"SearchEditFocus", AddressAndType(Opt.ViOpt.SearchEditFocus), Default(0)},
{FSSF_PRIVATE, NKeyViewer,L"SearchRegexp", AddressAndType(Opt.ViOpt.SearchRegexp), Default(0)},
{FSSF_PRIVATE, NKeyViewer,L"ShowArrows", AddressAndType(Opt.ViOpt.ShowArrows), Default(1)},
Expand Down
2 changes: 2 additions & 0 deletions far/config.hpp
Expand Up @@ -376,6 +376,8 @@ struct ViewerOptions
BoolOption ViewerIsWrap; // (Wrap|WordWarp)=1 | UnWrap=0
BoolOption ViewerWrap; // Wrap=0|WordWarp=1
BoolOption SavePos;
BoolOption SaveCodepage;
BoolOption SaveWrapMode;
BoolOption SaveShortPos;
BoolOption UseExternalViewer;
BoolOption ShowKeyBar; // $ 15.07.2000 tran + ShowKeyBar
Expand Down
4 changes: 2 additions & 2 deletions far/configdb.cpp
Expand Up @@ -2452,9 +2452,9 @@ class HistoryConfigCustom: public HistoryConfig, public SQLiteDb {
return b;
}

unsigned __int64 SetViewerPos(const wchar_t *Name, __int64 FilePos, __int64 LeftPos, int Hex, UINT CodePage)
unsigned __int64 SetViewerPos(const wchar_t *Name, __int64 FilePos, __int64 LeftPos, int Hex_Wrap, UINT CodePage)
{
if (stmtSetViewerPos.Bind(Name).Bind(GetCurrentUTCTimeInUI64()).Bind(FilePos).Bind(LeftPos).Bind(Hex).Bind((int)CodePage).StepAndReset())
if (stmtSetViewerPos.Bind(Name).Bind(GetCurrentUTCTimeInUI64()).Bind(FilePos).Bind(LeftPos).Bind(Hex_Wrap).Bind((int)CodePage).StepAndReset())
return LastInsertRowID();
return 0;
}
Expand Down
2 changes: 1 addition & 1 deletion far/configdb.hpp
Expand Up @@ -229,7 +229,7 @@ class HistoryConfig: public Transactional {
virtual unsigned __int64 GetEditorPos(const wchar_t *Name, int *Line, int *LinePos, int *ScreenLine, int *LeftPos, UINT *CodePage) = 0;
virtual bool SetEditorBookmark(unsigned __int64 id, int i, int Line, int LinePos, int ScreenLine, int LeftPos) = 0;
virtual bool GetEditorBookmark(unsigned __int64 id, int i, int *Line, int *LinePos, int *ScreenLine, int *LeftPos) = 0;
virtual unsigned __int64 SetViewerPos(const wchar_t *Name, __int64 FilePos, __int64 LeftPos, int Hex, UINT CodePage) = 0;
virtual unsigned __int64 SetViewerPos(const wchar_t *Name, __int64 FilePos, __int64 LeftPos, int Hex_Wrap, UINT CodePage) = 0;
virtual unsigned __int64 GetViewerPos(const wchar_t *Name, __int64 *FilePos, __int64 *LeftPos, int *Hex, UINT *CodePage) = 0;
virtual bool SetViewerBookmark(unsigned __int64 id, int i, __int64 FilePos, __int64 LeftPos) = 0;
virtual bool GetViewerBookmark(unsigned __int64 id, int i, __int64 *FilePos, __int64 *LeftPos) = 0;
Expand Down
36 changes: 28 additions & 8 deletions far/farlang.templ.m4
Expand Up @@ -2668,6 +2668,26 @@ MViewConfigSaveShortPos
"Guardar &marcadores"
"Ukladať &záložky"

MViewConfigSaveCodepage
"Сохранять ко&довую страницу"
"Save file &codepage"
upd:"Save file &codepage"
upd:"Save file &codepage"
upd:"Save file &codepage"
upd:"Save file &codepage"
upd:"Save file &codepage"
upd:"Save file &codepage"

MViewConfigSaveWrapMode
"Сохранять &режим переноса"
"Save w&rap mode"
upd:"Save w&rap mode"
upd:"Save w&rap mode"
upd:"Save w&rap mode"
upd:"Save w&rap mode"
upd:"Save w&rap mode"
upd:"Save w&rap mode"

MViewAutoDetectCodePage
"&Автоопределение кодовой страницы"
"&Autodetect code page"
Expand Down Expand Up @@ -12947,14 +12967,14 @@ MMenuSortUseNumeric
"Použiť čí&selné triedenie"

MMenuSortUseCaseSensitive
"Сортировка с учётом регистра"
"Use case sensitive sort"
"Použít řazení citlivé na velikost písmen"
"Sortierung abhängig von Groß-/Kleinschreibung"
"Nagy/kisbetű érzékeny rendezés"
"Sortuj uwzględniając wielkość liter"
"Usar orden sensible min/mayúsc."
"Triediť podľa malých a VEĽKÝCH písmen"
"Прописные буквы раньше строчных" #"Верхний регистр раньше нижнего"
"Uppercase before lowercase"
upd:"Použít řazení citlivé na velikost písmen"
upd:"Sortierung abhängig von Groß-/Kleinschreibung"
upd:"Nagy/kisbetű érzékeny rendezés"
upd:"Sortuj uwzględniając wielkość liter"
upd:"Usar orden sensible min/mayúsc."
upd:"Triediť podľa malých a VEĽKÝCH písmen"

MMaskGroupBottom
"Редактирование: Ins, Del, F4, F7, Ctrl-R"
Expand Down
12 changes: 6 additions & 6 deletions far/poscache.cpp
Expand Up @@ -116,7 +116,7 @@ bool FilePositionCache::GetPosition(const wchar_t *Name, EditorPosCache& poscach

bool FilePositionCache::AddPosition(const wchar_t *Name, const ViewerPosCache& poscache)
{
if (!Opt.ViOpt.SavePos)
if (!Opt.ViOpt.SavePos && !Opt.ViOpt.SaveCodepage && !Opt.ViOpt.SaveWrapMode)
return false;

string strFullName;
Expand All @@ -125,11 +125,11 @@ bool FilePositionCache::AddPosition(const wchar_t *Name, const ViewerPosCache& p
HistoryCfg->BeginTransaction();

bool ret = false;
unsigned __int64 id = HistoryCfg->SetViewerPos(strFullName, poscache.FilePos, poscache.LeftPos, poscache.Hex, poscache.CodePage);
unsigned __int64 id = HistoryCfg->SetViewerPos(strFullName, poscache.FilePos, poscache.LeftPos, poscache.Hex_Wrap, poscache.CodePage);

if (id)
{
if (Opt.ViOpt.SaveShortPos)
if (Opt.ViOpt.SavePos && Opt.ViOpt.SaveShortPos)
{
for (int i=0; i<BOOKMARK_COUNT; i++)
{
Expand All @@ -149,17 +149,17 @@ bool FilePositionCache::GetPosition(const wchar_t *Name, ViewerPosCache& poscach
{
poscache.Clear();

if (!Opt.ViOpt.SavePos)
if (!Opt.ViOpt.SavePos && !Opt.ViOpt.SaveCodepage && !Opt.ViOpt.SaveWrapMode)
return false;

string strFullName;
GetFullName(Name,strFullName);

unsigned __int64 id = HistoryCfg->GetViewerPos(strFullName, &poscache.FilePos, &poscache.LeftPos, &poscache.Hex, &poscache.CodePage);
unsigned __int64 id = HistoryCfg->GetViewerPos(strFullName, &poscache.FilePos, &poscache.LeftPos, &poscache.Hex_Wrap, &poscache.CodePage);

if (id)
{
if (!Opt.ViOpt.SaveShortPos)
if (!Opt.ViOpt.SavePos || !Opt.ViOpt.SaveShortPos)
return true;

for (int i=0; i<BOOKMARK_COUNT; i++)
Expand Down
4 changes: 2 additions & 2 deletions far/poscache.hpp
Expand Up @@ -73,12 +73,12 @@ struct ViewerPosCache
{
__int64 FilePos;
__int64 LeftPos;
int Hex;
int Hex_Wrap;
UINT CodePage;

ViewerBookmark bm;

void Clear() { FilePos=LeftPos=0; Hex=0; CodePage=0; bm.Clear(); }
void Clear() { FilePos=LeftPos=0; Hex_Wrap=0; CodePage=0; bm.Clear(); }
};

class FilePositionCache
Expand Down
2 changes: 1 addition & 1 deletion far/vbuild.m4
@@ -1 +1 @@
m4_define(BUILD,2747)m4_dnl
m4_define(BUILD,2748)m4_dnl
44 changes: 27 additions & 17 deletions far/viewer.cpp
Expand Up @@ -180,7 +180,7 @@ Viewer::~Viewer()
ViewerPosCache poscache;
poscache.FilePos=FilePos;
poscache.LeftPos=LeftPos;
poscache.Hex=VM.Hex;
poscache.Hex_Wrap=(VM.Hex & 0x03) | 0x10 | (VM.Wrap ? 0x20 : 0x00) | (VM.WordWrap ? 0x40 : 0x00);
poscache.CodePage=CodePage;
poscache.bm=BMSavePos;

Expand Down Expand Up @@ -311,28 +311,38 @@ int Viewer::OpenFile(const wchar_t *Name,int warning)
apiGetFindDataEx(strFileName, ViewFindData);
UINT CachedCodePage=0;

if (Opt.ViOpt.SavePos && !ReadStdin)
if ((Opt.ViOpt.SavePos || Opt.ViOpt.SaveCodepage || Opt.ViOpt.SaveWrapMode) && !ReadStdin)
{
__int64 NewLeftPos,NewFilePos;
string strCacheName=strPluginData.IsEmpty()?strFileName:strPluginData+PointToName(strFileName);
ViewerPosCache poscache;

bool found = FilePositionCache::GetPosition(strCacheName,poscache);
NewFilePos=poscache.FilePos;
NewLeftPos=poscache.LeftPos;
if ( found && VM.Hex == -1 ) // keep VM.Hex if file listed (Grey+ / Gray-)
if (Opt.ViOpt.SavePos)
{
if ( 1 != (VM.Hex = poscache.Hex) )
dump_text_mode = VM.Hex;
}
CachedCodePage=poscache.CodePage;
BMSavePos=poscache.bm;
NewFilePos=poscache.FilePos;
NewLeftPos=poscache.LeftPos;
if ( found && VM.Hex == -1 ) // keep VM.Hex if file listed (Grey+ / Gray-)
{
if ( 1 != (VM.Hex = (poscache.Hex_Wrap & 0x03)) )
dump_text_mode = VM.Hex;
}
BMSavePos=poscache.bm;

// Ïðîâåðÿåì ïîääåðæèâàåòñÿ èëè íåò çàãðóæåííàÿ èç êýøà êîäîâàÿ ñòðàíèöà
if (CachedCodePage && !IsCodePageSupported(CachedCodePage))
CachedCodePage = 0;
LastSelectPos=FilePos=NewFilePos;
LeftPos=NewLeftPos;
LastSelectPos=FilePos=NewFilePos;
LeftPos=NewLeftPos;
}
if (Opt.ViOpt.SaveCodepage || Opt.ViOpt.SavePos)
{
CachedCodePage=poscache.CodePage;
if (CachedCodePage && !IsCodePageSupported(CachedCodePage))
CachedCodePage = 0;
}
if (Opt.ViOpt.SaveWrapMode && 0 != (poscache.Hex_Wrap & 0x10))
{
VM.Wrap = (poscache.Hex_Wrap & 0x20 ? 1 : 0);
VM.WordWrap = (poscache.Hex_Wrap & 0x40 ? 1 : 0);
}
}
else
{
Expand Down Expand Up @@ -1538,7 +1548,7 @@ int Viewer::ProcessKey(int Key)

if (NextFileFound)
{
if (Opt.ViOpt.SavePos)
if (Opt.ViOpt.SavePos || Opt.ViOpt.SaveCodepage || Opt.ViOpt.SaveWrapMode)
{
string strCacheName=strPluginData.IsEmpty()?strFileName:strPluginData+PointToName(strFileName);
UINT CodePage=0;
Expand All @@ -1550,7 +1560,7 @@ int Viewer::ProcessKey(int Key)
ViewerPosCache poscache;
poscache.FilePos=FilePos;
poscache.LeftPos=LeftPos;
poscache.Hex=VM.Hex;
poscache.Hex_Wrap=(VM.Hex & 0x03) | 0x10 | (VM.Wrap ? 0x20 : 0x00) | (VM.WordWrap ? 0x40 : 0x00);
poscache.CodePage=CodePage;
poscache.bm=BMSavePos;

Expand Down

0 comments on commit 6904f9f

Please sign in to comment.