Skip to content

Commit

Permalink
Misc changes from far2l
Browse files Browse the repository at this point in the history
  • Loading branch information
shmuz committed Dec 2, 2024
1 parent 99e3292 commit 5a1b2df
Show file tree
Hide file tree
Showing 9 changed files with 170 additions and 142 deletions.
9 changes: 8 additions & 1 deletion far/far2sdk/fardlgbuilderbase.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -216,8 +216,15 @@ class DialogBuilderBase
case DI_TEXT:
return TextWidth(Item);

case DI_DOUBLEBOX: // text in dialog title
{
int Width = TextWidth(Item);
return (Width ? Width + 2 : 0);
}

case DI_CHECKBOX:
case DI_RADIOBUTTON:
case DI_BUTTON:
return TextWidth(Item) + 4;

case DI_EDIT:
Expand Down Expand Up @@ -250,7 +257,7 @@ class DialogBuilderBase

int MaxTextWidth()
{
int MaxWidth = 0;
int MaxWidth = ItemWidth(DialogItems [0]); // text in dialog title
for(int i=1; i<DialogItemsCount; i++)
{
if (DialogItems [i].X1 == SECOND_COLUMN) continue;
Expand Down
2 changes: 0 additions & 2 deletions far/src/cfg/ConfigRW.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
#include <assert.h>
#include <errno.h>

#define CONFIG_INI "settings/config.ini"

static bool IsSectionOrSubsection(const std::string &haystack, const char *needle)
{
size_t l = strlen(needle);
Expand Down
4 changes: 3 additions & 1 deletion far/src/cfg/ConfigRW.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

#include "FARString.hpp"

#define CONFIG_INI "settings/config.ini"

class ConfigSection
{
protected:
Expand All @@ -24,7 +26,7 @@ class ConfigReader : public ConfigSection
std::unique_ptr<KeyFileValues> _empty_values;
KeyFileReadHelper *_selected_kfh = nullptr;
const KeyFileValues *_selected_section_values = nullptr;
bool _has_section;
bool _has_section = false;

virtual void OnSectionSelected();

Expand Down
2 changes: 2 additions & 0 deletions far/src/cfg/config.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -579,6 +579,8 @@ struct Options
FARString strTimeSeparator;
FARString strDecimalSeparator;

bool IsFirstStart;

BOOL WindowMode;
std::vector<std::wstring> CmdLineStrings;
};
Expand Down
15 changes: 8 additions & 7 deletions far/src/delete.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,7 @@ void ShellDelete(Panel *SrcPanel,int Wipe)

while (SrcPanel->GetSelNameCompat(&strSelName,FileAttr) && !Cancel)
{
ItemsCount++;
if (!(FileAttr&FILE_ATTRIBUTE_REPARSE_POINT))
{
if (FileAttr&FILE_ATTRIBUTE_DIRECTORY)
Expand All @@ -309,17 +310,13 @@ void ShellDelete(Panel *SrcPanel,int Wipe)

if (GetDirInfo(nullptr,strSelName,CurrentDirCount,CurrentFileCount,FileSize,PhysicalSize,ClusterSize,-1,nullptr,0)>0)
{
ItemsCount+=CurrentFileCount+CurrentDirCount+1;
ItemsCount += CurrentFileCount + CurrentDirCount;
}
else
{
Cancel=true;
}
}
else
{
ItemsCount++;
}
}
}
}
Expand Down Expand Up @@ -347,7 +344,11 @@ void ShellDelete(Panel *SrcPanel,int Wipe)
break;
}

ShellDeleteMsg(strSelName,Wipe,Opt.DelOpt.DelShowTotal?(ItemsCount?(ProcessedItems*100/ItemsCount):0):-1);
int percent = -1;
if (Opt.DelOpt.DelShowTotal) {
percent = ItemsCount ? ToPercent64(ProcessedItems, ItemsCount) : 0;
}
ShellDeleteMsg(strSelName, Wipe, percent);
}

if (FileAttr & FILE_ATTRIBUTE_DIRECTORY)
Expand Down Expand Up @@ -589,7 +590,7 @@ void ShellDeleteMsg(const wchar_t *Name,int Wipe,int Percent)
FARString strProgress;
size_t Width=52;

if (Percent!=-1)
if (Percent > -1)
{
size_t Length=Width-5; // -5 под проценты
wchar_t *Progress=strProgress.GetBuffer(Length);
Expand Down
Loading

0 comments on commit 5a1b2df

Please sign in to comment.