123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135 |
- function ProjectModuleDependList::onAdd(%this)
- {
- %this.startListening(ThemeManager);
- }
- function ProjectModuleDependList::onThemeChange(%this, %theme)
- {
- if(isObject(%this.activeModule))
- {
- %this.show(%this.activeModule);
- }
- }
- function ProjectModuleDependList::show(%this, %module)
- {
- %this.activeModule = %module;
- %this.clearItems();
- for(%i = 0; %i < %module.getdependencyCount(); %i++)
- {
- %dep = %module.getDependency(%i);
- %name = getWord(%dep, 0);
- %version = getWord(%dep, 1);
- if(%version $= "*" || %version $= "0")
- {
- %version = "Latest";
- }
- %this.addDependItem(%name, %version);
- }
- if(!%module.Synchronized)
- {
- %this.addAddButton();
- }
- }
- function ProjectModuleDependList::hide(%this)
- {
- %this.activeModule = 0;
- %this.clearItems();
- }
- function ProjectModuleDependList::clearItems(%this)
- {
- for(%i = %this.getCount() - 1; %i >= 0; %i--)
- {
- %item = %this.getObject(%i);
- %item.delete();
- }
- }
- function ProjectModuleDependList::addDependItem(%this, %name, %version)
- {
- %width = getWord(%this.extent, 0) - 6;
- %text = new GuiControl()
- {
- HorizSizing="width";
- Position = "3 0";
- Extent = %width SPC "26";
- Text = %name @ ":" @ %version;
- Align = "Left";
- VAlign = "Middle";
- };
- ThemeManager.setProfile(%text, "subListProfile");
- %this.add(%text);
- }
- function ProjectModuleDependList::addAddButton(%this)
- {
- %width = 140;
- %addButton = new GuiButtonCtrl()
- {
- Class="ProjectModuleDependButton";
- ButtonEvent = "AddDepend";
- ButtonData = "";
- HorizSizing="right";
- Position = "3 0";
- Extent = %width SPC "26";
- MinExtent = %width SPC "26";
- Text = "+Add Dependency";
- Align = "Center";
- VAlign = "Middle";
- TextExtend = 1;
- };
- ThemeManager.setProfile(%addButton, "subListProfile");
- %this.add(%addButton);
- %this.startListening(%addButton);
- }
- function ProjectModuleDependButton::onClick(%this)
- {
- %this.postEvent(%this.buttonEvent, %this.buttonData);
- }
- function ProjectModuleDependList::onAddDepend(%this)
- {
- %width = 500;
- %height = 190;
- %dialog = new GuiControl()
- {
- class = "NewDependencyDialog";
- superclass = "EditorDialog";
- dialogSize = (%width + 8) SPC (%height + 8);
- dialogCanClose = true;
- dialogText = "New Dependency";
- };
- %dialog.init(%width, %height);
- %this.startListening(%dialog);
- Canvas.pushDialog(%dialog);
- }
- function ProjectModuleDependList::onDependencyAdded(%this, %data)
- {
- %this.activeModule.addDependency(%data.module, %data.version);
- %this.activeModule.save();
- %this.show(%this.activeModule);
- }
- function ProjectModuleDependList::onRemoveDepend(%this, %data)
- {
- }
- function ProjectModuleDependList::onDialogClosed(%this, %dialog)
- {
- %this.dialog = %dialog;
- %this.schedule(100, "deleteDialog");
- }
- function ProjectModuleDependList::deleteDialog(%this)
- {
- %this.dialog.delete();
- }
|