Skip to content

Commit

Permalink
Policies are removed (Policies.DisabledOptions)
Browse files Browse the repository at this point in the history
  • Loading branch information
shmuz committed Nov 26, 2024
1 parent a071d78 commit 6051312
Show file tree
Hide file tree
Showing 9 changed files with 137 additions and 211 deletions.
28 changes: 0 additions & 28 deletions far/far2sdk/farplug-wide.h
Original file line number Diff line number Diff line change
Expand Up @@ -1160,34 +1160,6 @@ enum FAR_MACRO_CONTROL_COMMANDS
MCTL_EXECSTRING = 10,
};

#ifdef FAR_USE_INTERNALS
enum FarPoliciesFlags
{
FFPOL_MAINMENUSYSTEM = 0x00000001,
FFPOL_MAINMENUPANEL = 0x00000002,
FFPOL_MAINMENUINTERFACE = 0x00000004,
FFPOL_MAINMENULANGUAGE = 0x00000008,
FFPOL_MAINMENUPLUGINS = 0x00000010,
FFPOL_MAINMENUDIALOGS = 0x00000020,
FFPOL_MAINMENUCONFIRMATIONS = 0x00000040,
FFPOL_MAINMENUPANELMODE = 0x00000080,
FFPOL_MAINMENUFILEDESCR = 0x00000100,
FFPOL_MAINMENUFOLDERDESCR = 0x00000200,
FFPOL_MAINMENUVIEWER = 0x00000800,
FFPOL_MAINMENUEDITOR = 0x00001000,
FFPOL_MAINMENUCOLORS = 0x00004000,
FFPOL_MAINMENUHILIGHT = 0x00008000,
FFPOL_MAINMENUSAVEPARAMS = 0x00020000,

FFPOL_CREATEMACRO = 0x00040000,
FFPOL_USEPSWITCH = 0x00080000,
FFPOL_PERSONALPATH = 0x00100000,
FFPOL_KILLTASK = 0x00200000,
FFPOL_SHOWHIDDENDRIVES = 0x80000000,
};

#endif // END FAR_USE_INTERNALS

enum FarSystemSettings
{
FSS_DELETETORECYCLEBIN = 0x00000002,
Expand Down
8 changes: 0 additions & 8 deletions far/src/cfg/ConfigOpt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,6 @@ static const char NSecPanelTree[]="Panel/Tree";
static const char NSecLayout[]="Layout";
static const char NSecDescriptions[]="Descriptions";
static const char NSecMacros[]="Macros";
static const char NSecPolicies[]="Policies";
static const char NSecSavedHistory[]="SavedHistory";
static const char NSecSavedViewHistory[]="SavedViewHistory";
static const char NSecSavedFolderHistory[]="SavedFolderHistory";
Expand Down Expand Up @@ -444,10 +443,6 @@ static struct FARConfig
{1, NSecMacros, "KeyRecordCtrlDot", &Opt.Macro.strKeyMacroCtrlDot, szCtrlDot},
{1, NSecMacros, "KeyRecordCtrlShiftDot", &Opt.Macro.strKeyMacroCtrlShiftDot, szCtrlShiftDot},

{0, NSecPolicies, "ShowHiddenDrives", &Opt.Policies.ShowHiddenDrives, 1, REG_BOOLEAN},
{0, NSecPolicies, "DisabledOptions", &Opt.Policies.DisabledOptions, 0},


{0, NSecSystem, "ExcludeCmdHistory", &Opt.ExcludeCmdHistory, 0}, //AN

{1, NSecCodePages, "CPMenuMode", &Opt.CPMenuMode, 0, REG_BOOLEAN},
Expand Down Expand Up @@ -766,9 +761,6 @@ void ConfigOptAssertLoaded()

void ConfigOptSave(bool Ask)
{
if (Opt.Policies.DisabledOptions&0x20000) // Bit 17 - Сохранить параметры
return;

if (Ask && Message(0,2,Msg::SaveSetupTitle,Msg::SaveSetupAsk1,Msg::SaveSetupAsk2,Msg::SaveSetup,Msg::Cancel))
return;

Expand Down
8 changes: 0 additions & 8 deletions far/src/cfg/config.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -247,13 +247,6 @@ struct ViewerOptions
int SearchRegexp;
};

// "Полиция"
struct PoliciesOptions
{
int DisabledOptions; // разрешенность меню конфигурации
int ShowHiddenDrives; // показывать скрытые логические диски
};

struct DialogsOptions
{
int EditBlock; // Постоянные блоки в строках ввода
Expand Down Expand Up @@ -568,7 +561,6 @@ struct Options
DialogsOptions Dialogs;
VMenuOptions VMenu;
CommandLineOptions CmdLine;
PoliciesOptions Policies;
MacroOptions Macro;

int FindCodePage;
Expand Down
2 changes: 1 addition & 1 deletion far/src/macro/macroapi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ static Frame* GetTopModal()

Panel* SelectPanel(int Type)
{
if (CtrlObject && CtrlObject->Cp()) {
if (CtrlObject->Cp()) {
Panel* ActivePanel = CtrlObject->Cp()->ActivePanel;
if (ActivePanel) {
switch(Type) {
Expand Down
32 changes: 13 additions & 19 deletions far/src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -513,29 +513,23 @@ int FarAppMain(int argc, char **argv)
Opt.SmallIcon=TRUE;
break;

case L'X':
fprintf(stderr, "Unsupported in far2m\n");
break;

case L'P':
if (!(Opt.Policies.DisabledOptions & FFPOL_USEPSWITCH)) {
bCustomPlugins = true;
if (arg_w[2])
bCustomPlugins = true;
if (arg_w[2])
{
UserDefinedList Udl(ULF_UNIQUE | ULF_CASESENSITIVE, L':', 0);
if (Udl.Set(arg_w.data() + 2))
{
UserDefinedList Udl(ULF_UNIQUE | ULF_CASESENSITIVE, L':', 0);
if (Udl.Set(arg_w.data() + 2))
for (size_t i=0; i < Udl.Size(); i++)
{
for (size_t i=0; i < Udl.Size(); i++)
{
FARString path = Udl.Get(i);
apiExpandEnvironmentStrings(path, path);
// Unquote(path);
ConvertNameToFull(path, path);
if (!Opt.LoadPlug.strCustomPluginsPath.IsEmpty()) {
Opt.LoadPlug.strCustomPluginsPath += L':';
}
Opt.LoadPlug.strCustomPluginsPath += path;
FARString path = Udl.Get(i);
apiExpandEnvironmentStrings(path, path);
// Unquote(path);
ConvertNameToFull(path, path);
if (!Opt.LoadPlug.strCustomPluginsPath.IsEmpty()) {
Opt.LoadPlug.strCustomPluginsPath += L':';
}
Opt.LoadPlug.strCustomPluginsPath += path;
}
}
}
Expand Down
11 changes: 0 additions & 11 deletions far/src/options.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -342,17 +342,6 @@ void ShellOptions(int LastCommand,MOUSE_EVENT_RECORD *MouseEvent)
static int LastHItem=-1,LastVItem=0;
int HItem,VItem;

if (Opt.Policies.DisabledOptions)
{
for (size_t I = 0; I < ARRAYSIZE(OptionsMenu); ++I)
{
if (I >= MENU_OPTIONS_CONFIRMATIONS)
OptionsMenu[I].SetGrayed((Opt.Policies.DisabledOptions >> (I-1)) & 1);
else
OptionsMenu[I].SetGrayed((Opt.Policies.DisabledOptions >> I) & 1);
}
}

SetLeftRightMenuChecks(LeftMenu, true);
SetLeftRightMenuChecks(RightMenu, false);
// Навигация по меню
Expand Down
4 changes: 0 additions & 4 deletions far/src/plug/plugapi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -645,10 +645,6 @@ static INT_PTR WINAPI FarAdvControlSynched(INT_PTR ModuleNumber, int Command, vo

return Options;
}
case ACTL_GETPOLICIES: {
return Opt.Policies.DisabledOptions
| (Opt.Policies.ShowHiddenDrives ? FFPOL_SHOWHIDDENDRIVES : 0);
}
case ACTL_REDRAWALL: {
auto Area = CtrlObject->Macro.GetArea();
int Ret = FrameManager->ProcessKey(KEY_CONSOLE_BUFFER_RESIZE);
Expand Down
Loading

0 comments on commit 6051312

Please sign in to comment.