editor_autoload_settings.cpp 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638
  1. /*************************************************************************/
  2. /* editor_autoload_settings.cpp */
  3. /*************************************************************************/
  4. /* This file is part of: */
  5. /* GODOT ENGINE */
  6. /* https://godotengine.org */
  7. /*************************************************************************/
  8. /* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */
  9. /* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */
  10. /* */
  11. /* Permission is hereby granted, free of charge, to any person obtaining */
  12. /* a copy of this software and associated documentation files (the */
  13. /* "Software"), to deal in the Software without restriction, including */
  14. /* without limitation the rights to use, copy, modify, merge, publish, */
  15. /* distribute, sublicense, and/or sell copies of the Software, and to */
  16. /* permit persons to whom the Software is furnished to do so, subject to */
  17. /* the following conditions: */
  18. /* */
  19. /* The above copyright notice and this permission notice shall be */
  20. /* included in all copies or substantial portions of the Software. */
  21. /* */
  22. /* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
  23. /* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
  24. /* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
  25. /* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
  26. /* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
  27. /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
  28. /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
  29. /*************************************************************************/
  30. #include "editor_autoload_settings.h"
  31. #include "global_constants.h"
  32. #include "globals.h"
  33. #include "editor_node.h"
  34. #define PREVIEW_LIST_MAX_SIZE 10
  35. void EditorAutoloadSettings::_notification(int p_what) {
  36. if (p_what == NOTIFICATION_ENTER_TREE) {
  37. List<String> afn;
  38. ResourceLoader::get_recognized_extensions_for_type("Script", &afn);
  39. ResourceLoader::get_recognized_extensions_for_type("PackedScene", &afn);
  40. EditorFileDialog *file_dialog = autoload_add_path->get_file_dialog();
  41. for (List<String>::Element *E = afn.front(); E; E = E->next()) {
  42. file_dialog->add_filter("*." + E->get());
  43. }
  44. }
  45. }
  46. bool EditorAutoloadSettings::_autoload_name_is_valid(const String &p_name, String *r_error) {
  47. if (!p_name.is_valid_identifier()) {
  48. if (r_error)
  49. *r_error = TTR("Invalid name.") + "\n" + TTR("Valid characters:") + " a-z, A-Z, 0-9 or _";
  50. return false;
  51. }
  52. if (ObjectTypeDB::type_exists(p_name)) {
  53. if (r_error)
  54. *r_error = TTR("Invalid name. Must not collide with an existing engine class name.");
  55. return false;
  56. }
  57. for (int i = 0; i < Variant::VARIANT_MAX; i++) {
  58. if (Variant::get_type_name(Variant::Type(i)) == p_name) {
  59. if (r_error)
  60. *r_error = TTR("Invalid name. Must not collide with an existing buit-in type name.");
  61. return false;
  62. }
  63. }
  64. for (int i = 0; i < GlobalConstants::get_global_constant_count(); i++) {
  65. if (GlobalConstants::get_global_constant_name(i) == p_name) {
  66. if (r_error)
  67. *r_error = TTR("Invalid name. Must not collide with an existing global constant name.");
  68. return false;
  69. }
  70. }
  71. return true;
  72. }
  73. void EditorAutoloadSettings::_autoload_add() {
  74. String name = autoload_add_name->get_text();
  75. String error;
  76. if (!_autoload_name_is_valid(name, &error)) {
  77. EditorNode::get_singleton()->show_warning(error);
  78. return;
  79. }
  80. String path = autoload_add_path->get_line_edit()->get_text();
  81. if (!FileAccess::exists(path)) {
  82. EditorNode::get_singleton()->show_warning(TTR("Invalid Path.") + "\n" + TTR("File does not exist."));
  83. return;
  84. }
  85. if (!path.begins_with("res://")) {
  86. EditorNode::get_singleton()->show_warning(TTR("Invalid Path.") + "\n" + TTR("Not in resource path."));
  87. return;
  88. }
  89. name = "autoload/" + name;
  90. UndoRedo *undo_redo = EditorNode::get_singleton()->get_undo_redo();
  91. undo_redo->create_action(TTR("Add AutoLoad"));
  92. undo_redo->add_do_property(Globals::get_singleton(), name, "*" + path);
  93. undo_redo->add_do_method(Globals::get_singleton(), "set_persisting", name, true);
  94. if (Globals::get_singleton()->has(name)) {
  95. undo_redo->add_undo_property(Globals::get_singleton(), name, Globals::get_singleton()->get(name));
  96. } else {
  97. undo_redo->add_undo_property(Globals::get_singleton(), name, Variant());
  98. }
  99. undo_redo->add_do_method(this, "update_autoload");
  100. undo_redo->add_undo_method(this, "update_autoload");
  101. undo_redo->add_do_method(this, "emit_signal", autoload_changed);
  102. undo_redo->add_undo_method(this, "emit_signal", autoload_changed);
  103. undo_redo->commit_action();
  104. autoload_add_path->get_line_edit()->set_text("");
  105. autoload_add_name->set_text("");
  106. }
  107. void EditorAutoloadSettings::_autoload_selected() {
  108. TreeItem *ti = tree->get_selected();
  109. if (!ti)
  110. return;
  111. selected_autoload = "autoload/" + ti->get_text(0);
  112. }
  113. void EditorAutoloadSettings::_autoload_edited() {
  114. if (updating_autoload)
  115. return;
  116. TreeItem *ti = tree->get_edited();
  117. int column = tree->get_edited_column();
  118. UndoRedo *undo_redo = EditorNode::get_undo_redo();
  119. if (column == 0) {
  120. String name = ti->get_text(0);
  121. String old_name = selected_autoload.get_slice("/", 1);
  122. if (name == old_name)
  123. return;
  124. String error;
  125. if (!_autoload_name_is_valid(name, &error)) {
  126. ti->set_text(0, old_name);
  127. EditorNode::get_singleton()->show_warning(error);
  128. return;
  129. }
  130. if (Globals::get_singleton()->has("autoload/" + name)) {
  131. ti->set_text(0, old_name);
  132. EditorNode::get_singleton()->show_warning(vformat(TTR("Autoload '%s' already exists!"), name));
  133. return;
  134. }
  135. updating_autoload = true;
  136. name = "autoload/" + name;
  137. bool persisting = Globals::get_singleton()->get(selected_autoload);
  138. int order = Globals::get_singleton()->get(selected_autoload);
  139. String path = Globals::get_singleton()->get(selected_autoload);
  140. undo_redo->create_action(TTR("Rename Autoload"));
  141. undo_redo->add_do_property(Globals::get_singleton(), name, path);
  142. undo_redo->add_do_method(Globals::get_singleton(), "set_persisting", name, persisting);
  143. undo_redo->add_do_method(Globals::get_singleton(), "set_order", name, order);
  144. undo_redo->add_do_method(Globals::get_singleton(), "clear", selected_autoload);
  145. undo_redo->add_undo_property(Globals::get_singleton(), selected_autoload, path);
  146. undo_redo->add_undo_method(Globals::get_singleton(), "set_persisting", selected_autoload, persisting);
  147. undo_redo->add_undo_method(Globals::get_singleton(), "set_order", selected_autoload, order);
  148. undo_redo->add_undo_method(Globals::get_singleton(), "clear", name);
  149. undo_redo->add_do_method(this, "update_autoload");
  150. undo_redo->add_undo_method(this, "update_autoload");
  151. undo_redo->add_do_method(this, "emit_signal", autoload_changed);
  152. undo_redo->add_undo_method(this, "emit_signal", autoload_changed);
  153. undo_redo->commit_action();
  154. selected_autoload = name;
  155. } else if (column == 2) {
  156. updating_autoload = true;
  157. bool checked = ti->is_checked(2);
  158. String base = "autoload/" + ti->get_text(0);
  159. int order = Globals::get_singleton()->get_order(base);
  160. String path = Globals::get_singleton()->get(base);
  161. if (path.begins_with("*"))
  162. path = path.substr(1, path.length());
  163. if (checked)
  164. path = "*" + path;
  165. undo_redo->create_action(TTR("Toggle AutoLoad Globals"));
  166. undo_redo->add_do_property(Globals::get_singleton(), base, path);
  167. undo_redo->add_undo_property(Globals::get_singleton(), base, Globals::get_singleton()->get(base));
  168. undo_redo->add_do_method(Globals::get_singleton(), "set_order", base, order);
  169. undo_redo->add_undo_method(Globals::get_singleton(), "set_order", base, order);
  170. undo_redo->add_do_method(this, "update_autoload");
  171. undo_redo->add_undo_method(this, "update_autoload");
  172. undo_redo->add_do_method(this, "emit_signal", autoload_changed);
  173. undo_redo->add_undo_method(this, "emit_signal", autoload_changed);
  174. undo_redo->commit_action();
  175. }
  176. updating_autoload = false;
  177. }
  178. void EditorAutoloadSettings::_autoload_button_pressed(Object *p_item, int p_column, int p_button) {
  179. TreeItem *ti = p_item->cast_to<TreeItem>();
  180. String name = "autoload/" + ti->get_text(0);
  181. UndoRedo *undo_redo = EditorNode::get_undo_redo();
  182. switch (p_button) {
  183. case BUTTON_OPEN: {
  184. _autoload_open(ti->get_text(1));
  185. } break;
  186. case BUTTON_MOVE_UP:
  187. case BUTTON_MOVE_DOWN: {
  188. TreeItem *swap = NULL;
  189. if (p_button == BUTTON_MOVE_UP) {
  190. swap = ti->get_prev();
  191. } else {
  192. swap = ti->get_next();
  193. }
  194. if (!swap)
  195. return;
  196. String swap_name = "autoload/" + swap->get_text(0);
  197. int order = Globals::get_singleton()->get_order(name);
  198. int swap_order = Globals::get_singleton()->get_order(swap_name);
  199. undo_redo->create_action(TTR("Move Autoload"));
  200. undo_redo->add_do_method(Globals::get_singleton(), "set_order", name, swap_order);
  201. undo_redo->add_undo_method(Globals::get_singleton(), "set_order", name, order);
  202. undo_redo->add_do_method(Globals::get_singleton(), "set_order", swap_name, order);
  203. undo_redo->add_undo_method(Globals::get_singleton(), "set_order", swap_name, swap_order);
  204. undo_redo->add_do_method(this, "update_autoload");
  205. undo_redo->add_undo_method(this, "update_autoload");
  206. undo_redo->add_do_method(this, "emit_signal", autoload_changed);
  207. undo_redo->add_undo_method(this, "emit_signal", autoload_changed);
  208. undo_redo->commit_action();
  209. } break;
  210. case BUTTON_DELETE: {
  211. int order = Globals::get_singleton()->get_order(name);
  212. undo_redo->create_action(TTR("Remove Autoload"));
  213. undo_redo->add_do_property(Globals::get_singleton(), name, Variant());
  214. undo_redo->add_undo_property(Globals::get_singleton(), name, Globals::get_singleton()->get(name));
  215. undo_redo->add_undo_method(Globals::get_singleton(), "set_persisting", name, true);
  216. undo_redo->add_undo_method(Globals::get_singleton(), "set_order", order);
  217. undo_redo->add_do_method(this, "update_autoload");
  218. undo_redo->add_undo_method(this, "update_autoload");
  219. undo_redo->add_do_method(this, "emit_signal", autoload_changed);
  220. undo_redo->add_undo_method(this, "emit_signal", autoload_changed);
  221. undo_redo->commit_action();
  222. } break;
  223. }
  224. }
  225. void EditorAutoloadSettings::_autoload_file_callback(const String &p_path) {
  226. autoload_add_name->set_text(p_path.get_file().basename());
  227. }
  228. void EditorAutoloadSettings::_autoload_activated() {
  229. TreeItem *ti = tree->get_selected();
  230. if (!ti)
  231. return;
  232. _autoload_open(ti->get_text(1));
  233. }
  234. void EditorAutoloadSettings::_autoload_open(const String &fpath) {
  235. if (ResourceLoader::get_resource_type(fpath) == "PackedScene") {
  236. EditorNode::get_singleton()->open_request(fpath);
  237. } else {
  238. EditorNode::get_singleton()->load_resource(fpath);
  239. }
  240. ProjectSettings::get_singleton()->hide();
  241. }
  242. void EditorAutoloadSettings::update_autoload() {
  243. if (updating_autoload)
  244. return;
  245. updating_autoload = true;
  246. autoload_cache.clear();
  247. tree->clear();
  248. TreeItem *root = tree->create_item();
  249. List<PropertyInfo> props;
  250. Globals::get_singleton()->get_property_list(&props);
  251. for (List<PropertyInfo>::Element *E = props.front(); E; E = E->next()) {
  252. const PropertyInfo &pi = E->get();
  253. if (!pi.name.begins_with("autoload/"))
  254. continue;
  255. String name = pi.name.get_slice("/", 1);
  256. String path = Globals::get_singleton()->get(pi.name);
  257. if (name.empty())
  258. continue;
  259. AutoLoadInfo info;
  260. info.name = pi.name;
  261. info.order = Globals::get_singleton()->get_order(pi.name);
  262. autoload_cache.push_back(info);
  263. bool global = false;
  264. if (path.begins_with("*")) {
  265. global = true;
  266. path = path.substr(1, path.length());
  267. }
  268. TreeItem *item = tree->create_item(root);
  269. item->set_text(0, name);
  270. item->set_editable(0, true);
  271. item->set_text(1, path);
  272. item->set_selectable(1, true);
  273. item->set_cell_mode(2, TreeItem::CELL_MODE_CHECK);
  274. item->set_editable(2, true);
  275. item->set_text(2, TTR("Enable"));
  276. item->set_checked(2, global);
  277. item->add_button(3, get_icon("FileList", "EditorIcons"), BUTTON_OPEN);
  278. item->add_button(3, get_icon("MoveUp", "EditorIcons"), BUTTON_MOVE_UP);
  279. item->add_button(3, get_icon("MoveDown", "EditorIcons"), BUTTON_MOVE_DOWN);
  280. item->add_button(3, get_icon("Del", "EditorIcons"), BUTTON_DELETE);
  281. item->set_selectable(3, false);
  282. }
  283. updating_autoload = false;
  284. }
  285. Variant EditorAutoloadSettings::get_drag_data_fw(const Point2 &p_point, Control *p_control) {
  286. if (autoload_cache.size() <= 1)
  287. return false;
  288. StringArray autoloads;
  289. TreeItem *next = tree->get_next_selected(NULL);
  290. while (next) {
  291. autoloads.push_back(next->get_text(0));
  292. next = tree->get_next_selected(next);
  293. }
  294. if (autoloads.size() == 0 || autoloads.size() == autoload_cache.size())
  295. return Variant();
  296. VBoxContainer *preview = memnew(VBoxContainer);
  297. int max_size = MIN(PREVIEW_LIST_MAX_SIZE, autoloads.size());
  298. for (int i = 0; i < max_size; i++) {
  299. Label *label = memnew(Label(autoloads[i]));
  300. label->set_self_opacity(Math::lerp(1, 0, float(i) / PREVIEW_LIST_MAX_SIZE));
  301. preview->add_child(label);
  302. }
  303. tree->set_drop_mode_flags(Tree::DROP_MODE_INBETWEEN);
  304. tree->set_drag_preview(preview);
  305. Dictionary drop_data;
  306. drop_data["type"] = "autoload";
  307. drop_data["autoloads"] = autoloads;
  308. return drop_data;
  309. }
  310. bool EditorAutoloadSettings::can_drop_data_fw(const Point2 &p_point, const Variant &p_data, Control *p_control) const {
  311. if (updating_autoload)
  312. return false;
  313. Dictionary drop_data = p_data;
  314. if (!drop_data.has("type"))
  315. return false;
  316. if (drop_data.has("type")) {
  317. TreeItem *ti = tree->get_item_at_pos(p_point);
  318. if (!ti)
  319. return false;
  320. int section = tree->get_drop_section_at_pos(p_point);
  321. if (section < -1)
  322. return false;
  323. return true;
  324. }
  325. return false;
  326. }
  327. void EditorAutoloadSettings::drop_data_fw(const Point2 &p_point, const Variant &p_data, Control *p_control) {
  328. TreeItem *ti = tree->get_item_at_pos(p_point);
  329. if (!ti)
  330. return;
  331. int section = tree->get_drop_section_at_pos(p_point);
  332. if (section < -1)
  333. return;
  334. String name;
  335. bool move_to_back = false;
  336. if (section < 0) {
  337. name = ti->get_text(0);
  338. } else if (ti->get_next()) {
  339. name = ti->get_next()->get_text(0);
  340. } else {
  341. name = ti->get_text(0);
  342. move_to_back = true;
  343. }
  344. int order = Globals::get_singleton()->get_order("autoload/" + name);
  345. AutoLoadInfo aux;
  346. List<AutoLoadInfo>::Element *E = NULL;
  347. if (!move_to_back) {
  348. aux.order = order;
  349. E = autoload_cache.find(aux);
  350. }
  351. Dictionary drop_data = p_data;
  352. StringArray autoloads = drop_data["autoloads"];
  353. Vector<int> orders;
  354. orders.resize(autoload_cache.size());
  355. for (int i = 0; i < autoloads.size(); i++) {
  356. aux.order = Globals::get_singleton()->get_order("autoload/" + autoloads[i]);
  357. List<AutoLoadInfo>::Element *I = autoload_cache.find(aux);
  358. if (move_to_back) {
  359. autoload_cache.move_to_back(I);
  360. } else if (E != I) {
  361. autoload_cache.move_before(I, E);
  362. } else if (E->next()) {
  363. E = E->next();
  364. } else {
  365. break;
  366. }
  367. }
  368. int i = 0;
  369. for (List<AutoLoadInfo>::Element *E = autoload_cache.front(); E; E = E->next()) {
  370. orders[i++] = E->get().order;
  371. }
  372. orders.sort();
  373. UndoRedo *undo_redo = EditorNode::get_undo_redo();
  374. undo_redo->create_action(TTR("Rearrange Autoloads"));
  375. i = 0;
  376. for (List<AutoLoadInfo>::Element *E = autoload_cache.front(); E; E = E->next()) {
  377. undo_redo->add_do_method(Globals::get_singleton(), "set_order", E->get().name, orders[i++]);
  378. undo_redo->add_undo_method(Globals::get_singleton(), "set_order", E->get().name, E->get().order);
  379. }
  380. orders.clear();
  381. undo_redo->add_do_method(this, "update_autoload");
  382. undo_redo->add_undo_method(this, "update_autoload");
  383. undo_redo->add_do_method(this, "emit_signal", autoload_changed);
  384. undo_redo->add_undo_method(this, "emit_signal", autoload_changed);
  385. undo_redo->commit_action();
  386. }
  387. void EditorAutoloadSettings::_bind_methods() {
  388. ObjectTypeDB::bind_method("_autoload_add", &EditorAutoloadSettings::_autoload_add);
  389. ObjectTypeDB::bind_method("_autoload_selected", &EditorAutoloadSettings::_autoload_selected);
  390. ObjectTypeDB::bind_method("_autoload_edited", &EditorAutoloadSettings::_autoload_edited);
  391. ObjectTypeDB::bind_method("_autoload_button_pressed", &EditorAutoloadSettings::_autoload_button_pressed);
  392. ObjectTypeDB::bind_method("_autoload_file_callback", &EditorAutoloadSettings::_autoload_file_callback);
  393. ObjectTypeDB::bind_method("_autoload_activated", &EditorAutoloadSettings::_autoload_activated);
  394. ObjectTypeDB::bind_method("_autoload_open", &EditorAutoloadSettings::_autoload_open);
  395. ObjectTypeDB::bind_method("get_drag_data_fw", &EditorAutoloadSettings::get_drag_data_fw);
  396. ObjectTypeDB::bind_method("can_drop_data_fw", &EditorAutoloadSettings::can_drop_data_fw);
  397. ObjectTypeDB::bind_method("drop_data_fw", &EditorAutoloadSettings::drop_data_fw);
  398. ObjectTypeDB::bind_method("update_autoload", &EditorAutoloadSettings::update_autoload);
  399. ADD_SIGNAL(MethodInfo("autoload_changed"));
  400. }
  401. EditorAutoloadSettings::EditorAutoloadSettings() {
  402. autoload_changed = "autoload_changed";
  403. updating_autoload = false;
  404. selected_autoload = "";
  405. HBoxContainer *hbc = memnew(HBoxContainer);
  406. add_child(hbc);
  407. VBoxContainer *vbc_path = memnew(VBoxContainer);
  408. vbc_path->set_h_size_flags(SIZE_EXPAND_FILL);
  409. autoload_add_path = memnew(EditorLineEditFileChooser);
  410. autoload_add_path->set_h_size_flags(SIZE_EXPAND_FILL);
  411. autoload_add_path->get_file_dialog()->set_mode(EditorFileDialog::MODE_OPEN_FILE);
  412. autoload_add_path->get_file_dialog()->connect("file_selected", this, "_autoload_file_callback");
  413. vbc_path->add_margin_child(TTR("Path:"), autoload_add_path);
  414. hbc->add_child(vbc_path);
  415. VBoxContainer *vbc_name = memnew(VBoxContainer);
  416. vbc_name->set_h_size_flags(SIZE_EXPAND_FILL);
  417. HBoxContainer *hbc_name = memnew(HBoxContainer);
  418. autoload_add_name = memnew(LineEdit);
  419. autoload_add_name->set_h_size_flags(SIZE_EXPAND_FILL);
  420. hbc_name->add_child(autoload_add_name);
  421. Button *add_autoload = memnew(Button);
  422. add_autoload->set_text(TTR("Add"));
  423. hbc_name->add_child(add_autoload);
  424. add_autoload->connect("pressed", this, "_autoload_add");
  425. vbc_name->add_margin_child(TTR("Node Name:"), hbc_name);
  426. hbc->add_child(vbc_name);
  427. tree = memnew(Tree);
  428. tree->set_hide_root(true);
  429. tree->set_select_mode(Tree::SELECT_MULTI);
  430. tree->set_single_select_cell_editing_only_when_already_selected(true);
  431. tree->set_drag_forwarding(this);
  432. tree->set_columns(4);
  433. tree->set_column_titles_visible(true);
  434. tree->set_column_title(0, TTR("Name"));
  435. tree->set_column_expand(0, true);
  436. tree->set_column_min_width(0, 100);
  437. tree->set_column_title(1, TTR("Path"));
  438. tree->set_column_expand(1, true);
  439. tree->set_column_min_width(1, 100);
  440. tree->set_column_title(2, TTR("Singleton"));
  441. tree->set_column_expand(2, false);
  442. tree->set_column_min_width(2, 80);
  443. tree->set_column_expand(3, false);
  444. tree->set_column_min_width(3, 120);
  445. tree->connect("cell_selected", this, "_autoload_selected");
  446. tree->connect("item_edited", this, "_autoload_edited");
  447. tree->connect("button_pressed", this, "_autoload_button_pressed");
  448. tree->connect("item_activated", this, "_autoload_activated");
  449. add_margin_child(TTR("List:"), tree, true);
  450. }