From 253d4240109638e1f871f7cd74351a3f02d216e2 Mon Sep 17 00:00:00 2001 From: dim-s Date: Sat, 11 Mar 2017 11:24:55 +0300 Subject: [PATCH] Update 16.5 --- develnext/src/ide/editors/FormEditor.php | 5 +++ .../GuiFrameworkProjectBehaviour.php | 32 +++++++++++++++---- .../behaviours/PhpProjectBehaviour.php | 6 ++++ 3 files changed, 37 insertions(+), 6 deletions(-) diff --git a/develnext/src/ide/editors/FormEditor.php b/develnext/src/ide/editors/FormEditor.php index 725e2255..07ca4730 100644 --- a/develnext/src/ide/editors/FormEditor.php +++ b/develnext/src/ide/editors/FormEditor.php @@ -1937,6 +1937,11 @@ protected function makeDesigner($fullArea = false) protected function makeContextMenu() { $this->contextMenu = new ContextMenu($this, $this->format->getContextCommands()); + $this->contextMenu->addSeparator(); + $this->contextMenu->addCommand(AbstractCommand::makeWithText('События объекта', null, function () { + $this->eventListPane->showEventMenu(true, $this->designer->pickedNode); + })); + $this->contextMenu->setFilter(function () { return $this->layout->focused || $this->contextMenu->getRoot()->visible || $this->layout->findFocusedNode(); }); diff --git a/develnext/src/ide/project/behaviours/GuiFrameworkProjectBehaviour.php b/develnext/src/ide/project/behaviours/GuiFrameworkProjectBehaviour.php index 6316675b..7ea8ba6a 100644 --- a/develnext/src/ide/project/behaviours/GuiFrameworkProjectBehaviour.php +++ b/develnext/src/ide/project/behaviours/GuiFrameworkProjectBehaviour.php @@ -49,6 +49,8 @@ use ide\utils\FileUtils; use ide\utils\Json; use php\gui\event\UXEvent; +use php\gui\framework\AbstractForm; +use php\gui\framework\AbstractModule; use php\gui\layout\UXHBox; use php\gui\layout\UXVBox; use php\gui\UXApplication; @@ -855,9 +857,18 @@ public function createModule($name) $template = new PhpClassFileTemplate($name, 'AbstractModule'); $template->setNamespace("{$this->project->getPackageName()}\\modules"); - $template->setImports([ - "std, gui, framework, {$this->project->getPackageName()}" - ]); + + $php = PhpProjectBehaviour::get(); + + if ($php && $php->getImportType() == 'package') { + $template->setImports([ + "std, gui, framework, {$this->project->getPackageName()}" + ]); + } else { + $template->setImports([ + AbstractModule::class + ]); + } $file = $this->project->createFile("src/{$this->project->getPackageName()}/modules/$name.php", $template); @@ -1012,9 +1023,18 @@ public function createForm($name, $namespace = null) $template = new PhpClassFileTemplate($name, 'AbstractForm'); $template->setNamespace($namespace); - $template->setImports([ - "std, gui, framework, {$this->project->getPackageName()}" - ]); + + $php = PhpProjectBehaviour::get(); + + if ($php && $php->getImportType() == 'package') { + $template->setImports([ + "std, gui, framework, {$this->project->getPackageName()}" + ]); + } else { + $template->setImports([ + AbstractForm::class + ]); + } $sources = $this->project->createFile($this->project->getAbsoluteFile("$file.php"), $template); $sources->applyTemplate($template); diff --git a/develnext/src/ide/project/behaviours/PhpProjectBehaviour.php b/develnext/src/ide/project/behaviours/PhpProjectBehaviour.php index 3479337d..3236722e 100644 --- a/develnext/src/ide/project/behaviours/PhpProjectBehaviour.php +++ b/develnext/src/ide/project/behaviours/PhpProjectBehaviour.php @@ -570,6 +570,12 @@ public function doMakeSettings(CommonProjectControlPane $editor) $importTitle = new UXLabel('Метод импортирования классов:'); $importTypeSelect = new UXComboBox(self::$importTypes); + $importTypeSelect->on('action', function () { + uiLater(function () { + $this->setImportType(arr::keys(static::$importTypes)[$this->uiImportTypesSelect->selectedIndex]); + }); + }); + $this->uiImportTypesSelect = $importTypeSelect; $importTypeSelect->padding = 5;