ShowHide

Title ShowHide
File Name ShowHide.txt
Description Show & hide interface elements
Author Vochomurka
Parameters Switch, What
Plugins Called win, childwin
Icon
Version 1.0
Updated on 22.06.2009
args f, What
static hwnd = win.handle("c=TTOTAL_CMD")
static TMP = "TMyPanel"
static TMTC = "c=TMyTabControl"
static s = f
static Text, Hand, Temp, Width, LPath, i
static Path = "bdcihslktyre"

if(arg(0) == 1) do
	What = Path
	jump NoQ
endif

if(What != "?")
	jump NoQ

LPath = esc(?+\r+, ?+\+)
Text = "Button Bar\Drive Button Bars\Drive ComboBox\Current Directory\Tab Header\"
Text = Text ++ "Status Bar\Command Line\Function Key Buttons\Folder Tabs\"
Text = Text ++ "Directory History & Hotlist\Breadcrumb Bar\Separate Tree\ALL THE ABOVE"
Hand = replacechars(Text, "\", LPath)
Temp = ifelse(f, "Show", "Hide")
Width = length(Path)

pickstring(Hand, Temp, 3)

if(not _pickedline_)
	quit

Temp = _pickedline_
Text = word(Temp, 0)
Hand = Width + 1

if(Text == Hand)
	quit

What = ""

if(index(Temp, Hand)) do
	What = Path
	jump NoQ
endif

for(i = 1; i <= Text; i++)
	Hand = word(Temp, i)
	What = What ++ select(Path, Hand, Hand)
endfor

@NoQ

if(index(What, "b"))
	ButtonBar()

if(index(What, "d"))
	DriveButtons()

if(index(What, "c"))
	ComboBox()

if(index(What, "i"))
	Directory()

if(index(What, "h"))
	TabHeader()

if(index(What, "s"))
	StatusBar()

if(index(What, "l"))
	CommandLine()

if(index(What, "k"))
	FunctionKey()

if(index(What, "t"))
	Tabs()

if(index(What, "y"))
	HistoryHotList()

if(index(What, "r"))
	Breadcrumb()

if(index(What, "e"))
	SeparateTree()

quit

//------------------------------------------------------------------------
Function ButtonBar
if(s ^^ childwin.handle(hwnd, "TButtonBar"))
		win.sendmessage(hwnd, 0x400+51, 2901, 0)

quit
//------------------------------------------------------------------------
Function DriveButtons
if(s ^^ childwin.handle(hwnd, "TDrivePanel"))
	win.sendmessage(hwnd, 0x400+51, 2902, 0)

quit
//------------------------------------------------------------------------
Function ComboBox
Temp = win.childhandlelist(hwnd, "c=TMyComboBox")
local Counter

for each word LPath in Temp
	Counter += win.visible(LPath)
endfor
if(s ^^ Counter)
	win.sendmessage(hwnd, 0x400+51, 2906, 0)

quit
//------------------------------------------------------------------------
Function Directory
Temp = win.childhandlelist(hwnd, "c=TPathPanel")
LPath = word(Temp, 1)
if(s ^^ win.height(LPath))
	win.sendmessage(hwnd, 0x400+51, 2907, 0)

quit
//------------------------------------------------------------------------
Function TabHeader
Temp = win.childhandlelist(hwnd, "c=THeaderClick")
LPath = word(Temp, 1)
if(s ^^ win.height(LPath))
	win.sendmessage(hwnd, 0x400+51, 2908, 0)

quit
//------------------------------------------------------------------------
Function StatusBar
Temp = win.childhandlelist(hwnd, TMTC)
LPath = word(Temp, 1)
Temp = childwin.handle(LPath, TMP)
if(s ^^ win.height(Temp))
	win.sendmessage(hwnd, 0x400+51, 2909, 0)

quit
//------------------------------------------------------------------------
Function CommandLine

Temp = win.childhandlelist(hwnd, "c=Edit")

if(s ^^ win.visible(Temp))
	win.sendmessage(hwnd, 0x400+51, 2910, 0)

quit
//------------------------------------------------------------------------
Function FunctionKey
Temp = win.childhandlelist(hwnd, "c=TMypanel")

for each word LPath in Temp
	Hand = childwin.handle(LPath, TMP)
	if(not Hand)
		continue

	Text = win.gettext(Hand)
	Path = remove(Text, -1)
	if(validpath(Path))
		break

endfor

Temp = win.childhandlelist(hwnd, "c=Edit")
Hand = win.visible(Temp)
Temp = win.height(LPath) - 25*Hand

if(s ^^ Temp)
	win.sendmessage(hwnd, 0x400+51, 2911, 0)

quit
//------------------------------------------------------------------------
Function Tabs
Temp = win.childhandlelist(hwnd, TMTC)
if(s ^^ Temp)
	win.sendmessage(hwnd, 0x400+51, 2916, 0)

quit
//------------------------------------------------------------------------
Function HistoryHotList
Temp = win.childhandlelist(hwnd, TMTC)
LPath = word(Temp, 1)
Width = win.width(LPath)
Hand = childwin.handle(LPath, "TPathPanel")
Text = win.width(Hand)
Path = win.height(Hand)

if(s ^^ (Text + 2*Path - Path/2 < Width))
	win.sendmessage(hwnd, 0x400+51, 2919, 0)

quit
//------------------------------------------------------------------------
Function Breadcrumb
keys %{f11}
wait.for(100)
Temp = childwin.handle(hwnd, TMP, 1)
Width = win.width(Temp)
if(s ^^ Width)
	win.sendmessage(hwnd, 0x400+51, 2926, 0)

quit
//------------------------------------------------------------------------
Function SeparateTree
Temp = win.childhandlelist(hwnd, "c=TMyListBox")

if(s && (word(Temp, 0) <= 3))
	win.sendmessage(hwnd, 0x400+51, 3201, 0)

if(not s && (word(Temp, 0) == 3))
	win.sendmessage(hwnd, 0x400+51, 3200, 0)

Comments:

Attention! This script does not work in Total Commander 7.5 pb1 and pb2!

Script allows to show and hide elements of the Total Commander interface listed in the table:

Interface element Key
Button bar b
Drive button bars d
Drive combobox c
Current directory i
Tab header (sorting) h
Status bar s
Command line l
Function key buttons k
Folder tabs t
Directory history + hotlist y
Breadcrumb bar r
One separate tree panel e

Various internal commands such as cm_VisButtonbar show and hide interface elements, too. But they act as "binary switches", always changing the current state. For example, if the button bar is shown, the cm_VisButtonbar command hides it; if the button bar is hidden, this command shows it.

Sometimes it is necessary to force showing/hiding some elements. That is, after the command execution some interface element must be shown whether it was shown before or not. So, the script first determines the current show state of each element. For example, if it is shown and the command is "show", the script does nothing.

First script parameter ("Switch") can be 1 (show) or 0 (hide). If second parameter is absent, it means "everything". If you want to show/hide only some elements, you should specify the string containig the corresponding letters according to the table. Order of letters in the string is arbitrary, letters must be lowercase.

Or, you can specify "?" as a second parameter. In this case the script will ask you what interface elements must be shown or hidden. Pick any number of entries and press OK. Or, you can pick "ALL THE ABOVE" - it is similar to the absence of second parameter.

Examples:
Parameters Command
(0)

Hide all interface elements. Result is a "naked" Total Commander with two file panels and menu bar only. It's amazing...

(1, "kc") Show function key buttons and command line. Do not care about other elements
(0, "sby") Hide status bar, history button, hotlist button and breadcrumb bar
(1, "?") Ask what to show


All Scripts Total Commander TotalCmd.net PowerPro