Hi,
It required some tweaking, some educated guesses ...
The code below will toggle all off with the variable
visible set to
false
But the problem is that it doesn't record what was visible or not.
It is kinda flying blind, hiding or showing everything (GP, GY, GB, GF, GV, GL, GC).
GM and GS are not turned on/off.
Code: Select all
var visible = false;
var appWin = RMainWindowQt.getMainWindow();
var dock;
var ga;
// Property Editor (GP):
// Functional copy of PropertyEditor.prototype.beginEvent:
dock = appWin.findChild("PropertyEditorDock");
if (!isNull(dock)) {
dock.visible = visible;
if (dock.visible) dock.raise();
// Functional copy of PropertyEditor.prototype.finishEvent:
ga = RGuiAction.getByScriptFile("scripts/Widgets/PropertyEditor/PropertyEditor.js")
ga.setChecked(visible);
}
else {
EAction.handleUserWarning("PropertyEditorDock not found");
}
// Layer List (GY):
// Non functional copy of LayerList.prototype.beginEvent:
// # Issue # Probably functional in QCAD CE
// QCAD Pro: Layer List (GY):
// Educated guess for beginEvent:
dock = appWin.findChild("LayerListProDock");
if (!isNull(dock)) {
dock.visible = visible;
if (dock.visible) dock.raise();
// Educated guess for finishEvent:
ga = RGuiAction.getByScriptFile("scripts/Pro/Widgets/LayerListPro/LayerListPro.js");
ga.setChecked(visible);
}
else {
EAction.handleUserWarning("LayerListProDock not found");
}
// Block List (GB):
// Functional copy of BlockList.prototype.beginEvent:
dock = appWin.findChild("BlockListDock");
if (!isNull(dock)) {
dock.visible = visible;
if (dock.visible) dock.raise();
// Functional copy of BlockList.prototype.finishEvent:
ga = RGuiAction.getByScriptFile("scripts/Widgets/BlockList/BlockList.js");
ga.setChecked(visible);
}
else {
EAction.handleUserWarning("BlockListDock not found");
}
// QCAD Pro: Selection Filter (GF):
// Educated guess for beginEvent:
dock = appWin.findChild("SelectionFilterDock");
if (!isNull(dock)) {
dock.visible = visible;
if (dock.visible) dock.raise();
// Educated guess for finishEvent:
ga = RGuiAction.getByScriptFile("scripts/Pro/Widgets/SelectionFilter/SelectionFilter.js");
ga.setChecked(visible);
}
else {
EAction.handleUserWarning("SelectionFilterDock not found");
}
// QCAD Pro: View List (GV):
// Educated guess for beginEvent:
dock = appWin.findChild("ViewListDock");
if (!isNull(dock)) {
dock.visible = visible;
if (dock.visible) dock.raise();
// Educated guess for finishEvent:
ga = RGuiAction.getByScriptFile("scripts/Pro/Widgets/ViewList/ViewList.js");
ga.setChecked(visible);
}
else {
EAction.handleUserWarning("ViewListDock not found");
}
// QCAD Pro: Library Browser (GL):
// Educated guess for beginEvent:
dock = appWin.findChild("LibraryBrowserDock");
if (!isNull(dock)) {
dock.visible = visible;
if (dock.visible) dock.raise();
// Educated guess for finishEvent:
ga = RGuiAction.getByScriptFile("scripts/Pro/Widgets/LibraryBrowser/LibraryBrowser.js");
// Try non-Pro for older installations:
if (isNull(ga)) {
ga = RGuiAction.getByScriptFile("scripts/Widgets/LibraryBrowser/LibraryBrowser.js");
}
ga.setChecked(visible);
}
else {
EAction.handleUserWarning("LibraryBrowserDock not found");
}
// QCAD Pro: ClipBoard Display (GC):
// Educated guess for beginEvent:
dock = appWin.findChild("ClipboardDisplayDock");
if (!isNull(dock)) {
dock.visible = visible;
if (dock.visible) dock.raise();
// Educated guess for finishEvent:
ga = RGuiAction.getByScriptFile("scripts/Pro/Widgets/ClipboardDisplay/ClipboardDisplay.js");
ga.setChecked(visible);
}
else {
EAction.handleUserWarning("ClipboardDisplayDock not found");
}
# EDIT #
Figured out the methods for the CAD Toolbar and the Tool Matrix:
Code: Select all
var appWin = EAction.getMainWindow();
var tb;
var dock;
// CAD Toolbar:
tb = appWin.findChild("CadQToolBar");
if (!isNull(tb)) {
tb.visible = true;
}
else {
EAction.handleUserWarning("CadQToolBar not found");
}
// Tool Matrix:
dock = appWin.findChild("ToolMatrixDock");
if (!isNull(dock)) {
dock.visible = true;
}
else {
EAction.handleUserWarning("ToolMatrixDock not found");
}
Now it is the question of including the code in 2 QCAD Addons with a proper keyboard shortcut ...
Perhaps hiding all but only showing GP, GL, GY and GB ...
GA ...
Active or
GD ...
Display and
GO ...
Off are seemingly still available.
That can really be based on something minimal:
https://github.com/qcad/qcad/blob/maste ... Minimal.js
The functional part must be included in the
beginEvent.
In the
init section we need to include:
Code: Select all
action.setDefaultShortcut(new QKeySequence("g,o"));
Some higher
sortorder may be in order.
Regards,
CVH