Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make #2452 feature with adjust column width to text more customizable #2586

Merged
merged 4 commits into from
Dec 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
116 changes: 80 additions & 36 deletions far2l/bootstrap/scripts/farlang.templ.m4
Original file line number Diff line number Diff line change
Expand Up @@ -2444,37 +2444,70 @@ upd:"Use Ctrl-Alt-D to quick open from panel"
upd:"Use Ctrl-Alt-D to quick open from panel"

DirSettingsCenter
"Выравнивать по центру"
"Center align"
"Zarovnat do středu"
"Zentrieren"
"Középre igazítani"
"Wyśrodkować"
"Alinear al centro"
"Вирівняти по центру"
"Выраўнаваць па цэнтры"
"Выравнивать по &центру"
"&Center align"
"&Zarovnat do středu"
"&Zentrieren"
"&Középre igazítani"
"&Wyśrodkować"
"Alinear al &centro"
"Вирівняти по &центру"
"Выраўнаваць па &цэнтры"

DirSettingsSurround
"Символы вокруг"
"Symbols around"
"Symboly kolem"
"Symbole um"
"Szimbólumok körül"
"Symbole wokół"
"Símbolos alrededor"
"Символи навколо"
"Сімвалы вакол"
"&Символы вокруг"
"&Symbols around"
"&Symboly kolem"
"&Symbole um"
"&Szimbólumok körül"
"&Symbole wokół"
"&Símbolos alrededor"
"&Символи навколо"
"&Сімвалы вакол"

DirSettingsShowAs
"Показывать директорию как:"
"Show directory as:"
"Zobrazit adresář jako:"
"Verzeichnis anzeigen als:"
"Könyvtár megjelenítéseként:"
"Pokaż katalog jako:"
"Mostrar directorio como:"
"Показувати каталог як:"
"Паказваць каталог як:"
"Показывать &директорию как:"
"Show &directory as:"
"Zobrazit &adresář jako:"
"&Verzeichnis anzeigen als:"
"Könyvtár &megjelenítéseként:"
"Pokaż &katalog jako:"
"Mostrar &directorio como:"
"Показувати &каталог як:"
"Паказваць &каталог як:"

DirSettingsWidthText
"Подстройка &ширины колонки "Размер" под текст:"
"Adjust "Size" column &width to text:"
upd:"Adjust "Size" column &width to text:"
upd:"Adjust "Size" column &width to text:"
upd:"Adjust "Size" column &width to text:"
upd:"Adjust "Size" column &width to text:"
upd:"Adjust "Size" column &width to text:"
"Відрегулюйте &ширину колонки "Розмір" до тексту:"
"Адрэгулюйце &шырыню слупка "Памер" да тэксту:"

DirSettingsWidthCombo0
"когда в режимах панели ширина колонки 0"
"when in file panel mode it width is 0"
upd:"when in file panel mode it width is 0"
upd:"when in file panel mode it width is 0"
upd:"when in file panel mode it width is 0"
upd:"when in file panel mode it width is 0"
upd:"when in file panel mode it width is 0"
"коли в режимі панелі файлів ширина 0"
"калі ў рэжыме панэлі файла шырыня 0"

DirSettingsWidthCombo1
"всегда"
"always"
upd:"always"
upd:"always"
upd:"always"
upd:"always"
upd:"always"
"завжди"
"заўсёды"

DirSettingsSymlinkText
"Для симлинка на файл показывать:"
Expand All @@ -2487,16 +2520,27 @@ upd:"For symlink to file show:"
upd:"For symlink to file show:"
upd:"For symlink to file show:"

DirSettingsSymlinkRadio1
"&текст"
"&text"
upd:"&text"
upd:"&text"
upd:"&text"
upd:"&text"
upd:"&text"
upd:"&text"
upd:"&text"

DirSettingsSymlinkRadio2
"размер целевого файла"
"size of target file"
upd:"size of target file"
upd:"size of target file"
upd:"size of target file"
upd:"size of target file"
upd:"size of target file"
upd:"size of target file"
upd:"size of target file"
"размер целевого &файла"
"size of target &file"
upd:"size of target &file"
upd:"size of target &file"
upd:"size of target &file"
upd:"size of target &file"
upd:"size of target &file"
upd:"size of target &file"
upd:"size of target &file"

DirSettingsApply
"&Применить"
Expand Down
1 change: 1 addition & 0 deletions far2l/src/cfg/ConfigOpt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -395,6 +395,7 @@ const ConfigOpt g_cfg_opts[] {
{true, NSecPanel, "MinFilenameIndentation", &Opt.MinFilenameIndentation, 0},
{true, NSecPanel, "MaxFilenameIndentation", &Opt.MaxFilenameIndentation, HIGHLIGHT_MAX_MARK_LENGTH},
{true, NSecPanel, "DirNameStyle", &Opt.DirNameStyle, 0 },
{true, NSecPanel, "DirNameStyleColumnWidthAlways", &Opt.DirNameStyleColumnWidthAlways, 0 },
{true, NSecPanel, "ShowSymlinkSize", &Opt.ShowSymlinkSize, 0},

{true, NSecPanelLeft, "Type", &Opt.LeftPanel.Type, 0},
Expand Down
60 changes: 41 additions & 19 deletions far2l/src/cfg/config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,9 @@ enum enumDirCfgDialog
ID_DIRCFG_CHECKBOX_SURR,
ID_DIRCFG_SURR_COMBO,

ID_DIRCFG_WIDTH_TEXT,
ID_DIRCFG_WIDTH_COMBO,

ID_DIRCFG_SEPARATOR,
ID_DIRCFG_SYMLINK_TEXT,
ID_DIRCFG_SYMLINK_RADIO1_TEXT,
Expand Down Expand Up @@ -387,7 +390,8 @@ static LONG_PTR WINAPI DirCfgDlgProc(HANDLE hDlg, int Msg, int Param1, LONG_PTR
// SendDlgMessage(hDlg, DM_LISTSETCURPOS, dircfg_data->DirNameStyleComboID, (LONG_PTR)&flpos);
update_surrcombo( );

swprintf(tmp, ARRAYSIZE(tmp), L"\"%ls\"", SymLinkNames[dircfg_data->DirNameStyle].CPtr());
swprintf(tmp, ARRAYSIZE(tmp), L"%ls \"%ls\"",
Msg::DirSettingsSymlinkRadio1.CPtr(), SymLinkNames[dircfg_data->DirNameStyle].CPtr());
SendDlgMessage(hDlg, DM_SETTEXTPTR, ID_DIRCFG_SYMLINK_RADIO1_TEXT, (LONG_PTR)tmp);
}
break;
Expand All @@ -397,7 +401,8 @@ static LONG_PTR WINAPI DirCfgDlgProc(HANDLE hDlg, int Msg, int Param1, LONG_PTR

dircfg_data->DirNameStyle = SendDlgMessage(hDlg, DM_LISTGETCURPOS, ID_DIRCFG_STYLE_COMBO, (LONG_PTR)0);
update_surrcombo( );
swprintf(tmp, ARRAYSIZE(tmp), L"\"%ls\"", SymLinkNames[dircfg_data->DirNameStyle].CPtr());
swprintf(tmp, ARRAYSIZE(tmp), L"%ls \"%ls\"",
Msg::DirSettingsSymlinkRadio1.CPtr(), SymLinkNames[dircfg_data->DirNameStyle].CPtr());
SendDlgMessage(hDlg, DM_SETTEXTPTR, ID_DIRCFG_SYMLINK_RADIO1_TEXT, (LONG_PTR)tmp);
SendDlgMessage(hDlg, DM_REDRAW, 0, 0);
}
Expand All @@ -420,6 +425,8 @@ static LONG_PTR WINAPI DirCfgDlgProc(HANDLE hDlg, int Msg, int Param1, LONG_PTR
Opt.DirNameStyle |= DIRNAME_STYLE_CENTERED * dircfg_data->bCentered;
Opt.DirNameStyle |= DIRNAME_STYLE_SURR_CH * dircfg_data->bSurr;

Opt.DirNameStyleColumnWidthAlways = SendDlgMessage(hDlg, DM_LISTGETCURPOS, ID_DIRCFG_WIDTH_COMBO, 0);

if (BSTATE_CHECKED == SendDlgMessage(hDlg, DM_GETCHECK, ID_DIRCFG_SYMLINK_RADIO1_TEXT, 0))
Opt.ShowSymlinkSize = 0;
else if (BSTATE_CHECKED == SendDlgMessage(hDlg, DM_GETCHECK, ID_DIRCFG_SYMLINK_RADIO2_SIZE, 0))
Expand All @@ -445,29 +452,32 @@ void DirectoryNameSettings()
{
dircfg_data_t dircfg_data;
DialogDataEx DirCfgDlgData[] = {
{DI_DOUBLEBOX, 3, 1, 48, 15, {}, 0, Msg::DirSettingsTitle},
{DI_TEXT, 5, 2, 46, 2, {}, DIF_DISABLE, Msg::DirSettingsHint},
{DI_TEXT, 5, 3, 46, 3, {}, 0, Msg::DirSettingsShowAs},
{DI_COMBOBOX, 5, 4, 5+40, 4, {}, DIF_DROPDOWNLIST | DIF_LISTNOAMPERSAND | DIF_LISTWRAPMODE, L""},
{DI_DOUBLEBOX, 3, 1, 52, 17, {}, 0, Msg::DirSettingsTitle},
{DI_TEXT, 5, 2, 50, 2, {}, DIF_DISABLE, Msg::DirSettingsHint},
{DI_TEXT, 5, 3, 50, 3, {}, 0, Msg::DirSettingsShowAs},
{DI_COMBOBOX, 6, 4, 6+40, 4, {}, DIF_DROPDOWNLIST | DIF_LISTNOAMPERSAND | DIF_LISTWRAPMODE, L""},

{DI_CHECKBOX, 5, 5, 46, 5, {}, DIF_AUTOMATION, Msg::DirSettingsCenter},
{DI_CHECKBOX, 5, 6, 46, 6, {}, DIF_AUTOMATION, Msg::DirSettingsSurround},
{DI_CHECKBOX, 5, 5, 50, 5, {}, DIF_AUTOMATION, Msg::DirSettingsCenter},
{DI_CHECKBOX, 5, 6, 50, 6, {}, DIF_AUTOMATION, Msg::DirSettingsSurround},
{DI_COMBOBOX, 9, 7, 26, 7, {}, DIF_DROPDOWNLIST | DIF_LISTNOAMPERSAND | DIF_LISTWRAPMODE, L""},

{DI_TEXT, 0, 8, 0, 8, {}, DIF_SEPARATOR, L""},
{DI_TEXT, 5, 9, 46, 9, {}, 0, Msg::DirSettingsSymlinkText},
{DI_RADIOBUTTON, 5, 10, 46, 10, {}, DIF_GROUP, Msg::SymLinkName},
{DI_RADIOBUTTON, 5, 11, 46, 11, {}, 0, Msg::DirSettingsSymlinkRadio2},
{DI_TEXT, 5, 12, 46, 12, {}, DIF_DISABLE, Msg::DirSettingsSymlinkSizeHint},
{DI_TEXT, 5, 8, 50, 8, {}, 0, Msg::DirSettingsWidthText},
{DI_COMBOBOX, 6, 9, 50, 9, {}, DIF_DROPDOWNLIST | DIF_LISTNOAMPERSAND | DIF_LISTWRAPMODE, L""},

{DI_TEXT, 0, 10, 0, 10, {}, DIF_SEPARATOR, L""},
{DI_TEXT, 5, 11, 50, 11, {}, 0, Msg::DirSettingsSymlinkText},
{DI_RADIOBUTTON, 5, 12, 50, 12, {}, DIF_GROUP, Msg::DirSettingsSymlinkRadio1},
{DI_RADIOBUTTON, 5, 13, 50, 13, {}, 0, Msg::DirSettingsSymlinkRadio2},
{DI_TEXT, 5, 14, 50, 14, {}, DIF_DISABLE, Msg::DirSettingsSymlinkSizeHint},

{DI_TEXT, 0, 13, 0, 13, {}, DIF_SEPARATOR, L""},
{DI_BUTTON, 0, 14, 0, 14, {}, DIF_DEFAULT | DIF_CENTERGROUP, Msg::Ok},
{DI_BUTTON, 0, 14, 0, 14, {}, DIF_CENTERGROUP, Msg::Cancel},
{DI_BUTTON, 0, 14, 0, 14, {}, DIF_CENTERGROUP | DIF_BTNNOCLOSE, Msg::DirSettingsApply},
{DI_TEXT, 0, 15, 0, 15, {}, DIF_SEPARATOR, L""},
{DI_BUTTON, 0, 16, 0, 16, {}, DIF_DEFAULT | DIF_CENTERGROUP, Msg::Ok},
{DI_BUTTON, 0, 16, 0, 16, {}, DIF_CENTERGROUP, Msg::Cancel},
{DI_BUTTON, 0, 16, 0, 16, {}, DIF_CENTERGROUP | DIF_BTNNOCLOSE, Msg::DirSettingsApply},

};
const int dialogsizex = 52;
const int dialogsizey = 17;
const int dialogsizex = 56;
const int dialogsizey = 19;

MakeDialogItemsEx(DirCfgDlgData, DirCfgDlg);

Expand All @@ -479,6 +489,16 @@ void DirectoryNameSettings()
DirCfgDlg[ID_DIRCFG_CHECKBOX_CENTER].Selected = dircfg_data.bCentered;
DirCfgDlg[ID_DIRCFG_CHECKBOX_SURR].Selected = dircfg_data.bSurr;

FarList ColumnWidthComboList;
FarListItem ColumnWidthItems[2]{};

ColumnWidthItems[0].Text = Msg::DirSettingsWidthCombo0;
ColumnWidthItems[1].Text = Msg::DirSettingsWidthCombo1;
ColumnWidthComboList.ItemsNumber = ARRAYSIZE(ColumnWidthItems);
ColumnWidthComboList.Items = ColumnWidthItems;
ColumnWidthItems[Opt.DirNameStyleColumnWidthAlways ? 1 : 0].Flags|= LIF_SELECTED;
DirCfgDlg[ID_DIRCFG_WIDTH_COMBO].ListItems = &ColumnWidthComboList;

if (!dircfg_data.bSurr)
DirCfgDlg[ID_DIRCFG_SURR_COMBO].Flags |= DIF_DISABLE;

Expand All @@ -498,6 +518,8 @@ void DirectoryNameSettings()
Opt.DirNameStyle |= DIRNAME_STYLE_CENTERED * dircfg_data.bCentered;
Opt.DirNameStyle |= DIRNAME_STYLE_SURR_CH * dircfg_data.bSurr;

Opt.DirNameStyleColumnWidthAlways = DirCfgDlg[ID_DIRCFG_WIDTH_COMBO].ListPos;

if (DirCfgDlg[ID_DIRCFG_SYMLINK_RADIO1_TEXT].Selected)
Opt.ShowSymlinkSize = 0;
else if (DirCfgDlg[ID_DIRCFG_SYMLINK_RADIO2_SIZE].Selected)
Expand Down
1 change: 1 addition & 0 deletions far2l/src/cfg/config.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -404,6 +404,7 @@ struct Options
int FilenameMarksInStatusBar;
DWORD MinFilenameIndentation, MaxFilenameIndentation;
DWORD DirNameStyle;
DWORD DirNameStyleColumnWidthAlways;
DWORD ShowSymlinkSize;

int Highlight;
Expand Down
3 changes: 2 additions & 1 deletion far2l/src/mix/panelmix.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,8 @@ void UpdateDefaultColumnTypeWidths( void )
size_t nameindex = Opt.DirNameStyle & 3;

ColumnTypeWidth[SIZE_COLUMN] = ColumnTypeWidth[PHYSICAL_COLUMN] = \
std::max( std::max(DirUpNames[nameindex].Len(), DirNames[nameindex].Len()) + \
std::max(
std::max( std::max(DirUpNames[nameindex].Len(), DirNames[nameindex].Len()), SymLinkNames[nameindex].Len()) + \
((Opt.DirNameStyle & DIRNAME_STYLE_SURR_CH) >> 3), (size_t)6ul );
}

Expand Down
2 changes: 1 addition & 1 deletion far2l/src/panels/flshow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -753,7 +753,7 @@ int FileList::PrepareColumnWidths(unsigned int *ColumnTypes, int *ColumnWidths,
ColumnWidths[I]++;
}
}
else {
else if (Opt.DirNameStyleColumnWidthAlways) {
if (ColumnType == SIZE_COLUMN || ColumnType == PHYSICAL_COLUMN) {
if (ColumnWidths[I] < ColumnTypeWidth[SIZE_COLUMN])
ColumnWidths[I] = ColumnTypeWidth[SIZE_COLUMN];
Expand Down