make dialog resizable with Ctrl-dragging
This commit is contained in:
parent
071eb664f8
commit
b38cf98aa1
3 changed files with 33 additions and 7 deletions
|
@ -11,6 +11,7 @@
|
||||||
<name>file-select</name>
|
<name>file-select</name>
|
||||||
<dialog-name>file-select</dialog-name>
|
<dialog-name>file-select</dialog-name>
|
||||||
<layout>vbox</layout>
|
<layout>vbox</layout>
|
||||||
|
<resizable>true</resizable>
|
||||||
<pref-width>450</pref-width>
|
<pref-width>450</pref-width>
|
||||||
|
|
||||||
<group>
|
<group>
|
||||||
|
@ -45,6 +46,7 @@
|
||||||
<input>
|
<input>
|
||||||
<name>dir-input</name>
|
<name>dir-input</name>
|
||||||
<pref-width>442</pref-width>
|
<pref-width>442</pref-width>
|
||||||
|
<halign>fill</halign>
|
||||||
<property>/sim/gui/dialogs/file-select/directory</property>
|
<property>/sim/gui/dialogs/file-select/directory</property>
|
||||||
<live>1</live>
|
<live>1</live>
|
||||||
<binding>
|
<binding>
|
||||||
|
@ -60,7 +62,9 @@
|
||||||
<list>
|
<list>
|
||||||
<name>list</name>
|
<name>list</name>
|
||||||
<halign>fill</halign>
|
<halign>fill</halign>
|
||||||
<pref-height>350</pref-height>
|
<valign>fill</valign>
|
||||||
|
<stretch>true</stretch>
|
||||||
|
<pref-height>300</pref-height>
|
||||||
<property>/sim/gui/dialogs/file-select/selection</property>
|
<property>/sim/gui/dialogs/file-select/selection</property>
|
||||||
<binding>
|
<binding>
|
||||||
<command>dialog-apply</command>
|
<command>dialog-apply</command>
|
||||||
|
@ -78,6 +82,8 @@
|
||||||
<input>
|
<input>
|
||||||
<name>file-input</name>
|
<name>file-input</name>
|
||||||
<pref-width>230</pref-width>
|
<pref-width>230</pref-width>
|
||||||
|
<halign>fill</halign>
|
||||||
|
<stretch>true</stretch>
|
||||||
<property>/sim/gui/dialogs/file-select/selection</property>
|
<property>/sim/gui/dialogs/file-select/selection</property>
|
||||||
<live>1</live>
|
<live>1</live>
|
||||||
<binding>
|
<binding>
|
||||||
|
|
|
@ -4,7 +4,9 @@
|
||||||
<x>-20</x>
|
<x>-20</x>
|
||||||
<y>-20</y>
|
<y>-20</y>
|
||||||
<name>nasal-console</name>
|
<name>nasal-console</name>
|
||||||
|
<dialog-name>nasal-console</dialog-name>
|
||||||
<layout>vbox</layout>
|
<layout>vbox</layout>
|
||||||
|
<resizable>true</resizable>
|
||||||
|
|
||||||
<group>
|
<group>
|
||||||
<layout>hbox</layout>
|
<layout>hbox</layout>
|
||||||
|
@ -34,6 +36,8 @@
|
||||||
<textbox>
|
<textbox>
|
||||||
<name>editfield</name>
|
<name>editfield</name>
|
||||||
<halign>fill</halign>
|
<halign>fill</halign>
|
||||||
|
<valign>fill</valign>
|
||||||
|
<stretch>true</stretch>
|
||||||
<pref-width>450</pref-width>
|
<pref-width>450</pref-width>
|
||||||
<pref-height>200</pref-height>
|
<pref-height>200</pref-height>
|
||||||
<slider>20</slider>
|
<slider>20</slider>
|
||||||
|
@ -89,7 +93,8 @@
|
||||||
|
|
||||||
<button>
|
<button>
|
||||||
<legend>?</legend>
|
<legend>?</legend>
|
||||||
<pref-width>30</pref-width>
|
<pref-width>20</pref-width>
|
||||||
|
<pref-height>20</pref-height>
|
||||||
<binding>
|
<binding>
|
||||||
<command>nasal</command>
|
<command>nasal</command>
|
||||||
<script>help()</script>
|
<script>help()</script>
|
||||||
|
@ -147,13 +152,21 @@
|
||||||
|
|
||||||
<nasal>
|
<nasal>
|
||||||
<open>
|
<open>
|
||||||
|
var self = cmdarg();
|
||||||
var dlg = props.globals.getNode("/sim/gui/dialogs/nasal-console", 1);
|
var dlg = props.globals.getNode("/sim/gui/dialogs/nasal-console", 1);
|
||||||
var kbdctrl = props.globals.getNode("/devices/status/keyboard/ctrl", 1);
|
var kbdctrl = props.globals.getNode("/devices/status/keyboard/ctrl", 1);
|
||||||
var printf = func { print(call(sprintf, arg)) }
|
|
||||||
var edit = dlg.getNode("edit", 1);
|
var edit = dlg.getNode("edit", 1);
|
||||||
if (!contains(globals, "__nasal_console"))
|
if (!contains(globals, "__nasal_console"))
|
||||||
globals["__nasal_console"] = {};
|
globals["__nasal_console"] = {};
|
||||||
|
|
||||||
|
var maxwidth = getprop("/sim/startup/xsize") - 50;
|
||||||
|
var maxheight = getprop("/sim/startup/ysize") - 100;
|
||||||
|
var width = dlg.initNode("width", 450, "INT");
|
||||||
|
var height = dlg.initNode("height", 200, "INT");
|
||||||
|
width.setAttribute("userarchive", 1);
|
||||||
|
height.setAttribute("userarchive", 1);
|
||||||
|
self.getNode("textbox").setValues({ "pref-width": width.getValue(), "pref-height": height.getValue() });
|
||||||
|
|
||||||
var locals = globals["__nasal_console"];
|
var locals = globals["__nasal_console"];
|
||||||
var numtabs = size(dlg.getChildren("code"));
|
var numtabs = size(dlg.getChildren("code"));
|
||||||
if (!numtabs)
|
if (!numtabs)
|
||||||
|
@ -190,7 +203,7 @@
|
||||||
debug.printerror(err);
|
debug.printerror(err);
|
||||||
}
|
}
|
||||||
|
|
||||||
var tabs = cmdarg().getNode("group[1]");
|
var tabs = self.getNode("group[1]");
|
||||||
var select = func(which, init = 0) {
|
var select = func(which, init = 0) {
|
||||||
if (active) { # false in help mode
|
if (active) { # false in help mode
|
||||||
dlg.getNode("active").setIntValue(active);
|
dlg.getNode("active").setIntValue(active);
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
<PropertyList>
|
<PropertyList>
|
||||||
<name>property-browser</name>
|
<name>property-browser</name>
|
||||||
<layout>vbox</layout>
|
<layout>vbox</layout>
|
||||||
|
<resizable>true</resizable>
|
||||||
<default-padding>3</default-padding>
|
<default-padding>3</default-padding>
|
||||||
|
|
||||||
<group>
|
<group>
|
||||||
|
@ -53,8 +54,10 @@
|
||||||
|
|
||||||
<property-list>
|
<property-list>
|
||||||
<name>property-list</name>
|
<name>property-list</name>
|
||||||
<pref-width>450</pref-width>
|
|
||||||
<pref-height>250</pref-height>
|
<pref-height>250</pref-height>
|
||||||
|
<halign>fill</halign>
|
||||||
|
<valign>fill</valign>
|
||||||
|
<stretch>true</stretch>
|
||||||
<property>/sim/gui/dialogs/property-browser/list</property>
|
<property>/sim/gui/dialogs/property-browser/list</property>
|
||||||
<binding>
|
<binding>
|
||||||
<command>dialog-apply</command>
|
<command>dialog-apply</command>
|
||||||
|
@ -75,13 +78,17 @@
|
||||||
<text>
|
<text>
|
||||||
<label>--</label>
|
<label>--</label>
|
||||||
<live>true</live>
|
<live>true</live>
|
||||||
|
<halign>fill</halign>
|
||||||
|
<stretch>true</stretch>
|
||||||
<property>/sim/gui/dialogs/property-browser/label</property>
|
<property>/sim/gui/dialogs/property-browser/label</property>
|
||||||
<pref-width>190</pref-width>
|
<pref-width>170</pref-width>
|
||||||
</text>
|
</text>
|
||||||
|
|
||||||
<input>
|
<input>
|
||||||
<name>input</name>
|
<name>input</name>
|
||||||
<pref-width>190</pref-width>
|
<halign>fill</halign>
|
||||||
|
<stretch>true</stretch>
|
||||||
|
<pref-width>170</pref-width>
|
||||||
<property>/sim/gui/dialogs/property-browser/input</property>
|
<property>/sim/gui/dialogs/property-browser/input</property>
|
||||||
</input>
|
</input>
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue