Skip to content

Commit

Permalink
Merge branch 'development'
Browse files Browse the repository at this point in the history
  • Loading branch information
silentdeath76 committed Oct 25, 2022
2 parents df1355b + f6d7bf2 commit f37f4c0
Show file tree
Hide file tree
Showing 24 changed files with 482 additions and 131 deletions.
Binary file added src/.data/img/ui/code-tab.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/.data/img/ui/empty.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 6 additions & 6 deletions src/.data/web/dark.css
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
body {
padding: 0px;
margin: 0px;
background-color: #222222 !important;
background-color: #313131 !important;
margin-right: 5px;
}

Expand All @@ -12,7 +12,7 @@ pre {
}

/* desert scheme ported from vim to google prettify */
pre.prettyprint { display: block; background-color: #222222 !important; }
pre.prettyprint { display: block; background-color: #313131 !important; }
pre .nocode { background-color: none; color: #FFF !important; }
pre .str { color: #ffa0a0 !important; } /* string - pink */
pre .kwd { color: #f0e68c !important; font-weight: bold }
Expand Down Expand Up @@ -55,11 +55,11 @@ ul {
li.L0, li.L1, li.L2, li.L3, li.L4,
li.L5, li.L6, li.L7, li.L8, li.L9 {
list-style-type: decimal !important;
background-color: #222222 !important;
background-color: #313131 !important;
user-select: none !important;
}


::-webkit-scrollbar-corner { background: #222222 !important; }
::-moz-selection { background: #222222 !important; }
::selection { background: #222222 !important; }
::-webkit-scrollbar-corner { background: #313131 !important; }
::-moz-selection { background: #313131 !important; }
::selection { background: #313131 !important; }
12 changes: 6 additions & 6 deletions src/.data/web/light.css
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
body {
padding: 0px;
margin: 0px;
background-color: #f0f0f0 !important;
background-color: #FFFFFF !important;
margin-right: 5px;
}

Expand All @@ -12,7 +12,7 @@ pre {
}

/* desert scheme ported from vim to google prettify */
pre.prettyprint { display: block; background-color: #f0f0f0 !important; }
pre.prettyprint { display: block; background-color: #FFFFFF !important; }
pre .nocode { background-color: none; color: #000 !important; }
pre .str { color: #925959 !important; } /* string - pink */
pre .kwd { color: #7f7948 !important; font-weight: bold }
Expand Down Expand Up @@ -55,11 +55,11 @@ ul {
li.L0, li.L1, li.L2, li.L3, li.L4,
li.L5, li.L6, li.L7, li.L8, li.L9 {
list-style-type: decimal !important;
background-color: #f0f0f0 !important;
background-color: #FFFFFF !important;
user-select: none !important;
}


::-webkit-scrollbar-corner { background: #f0f0f0 !important; }
::-moz-selection { background: #f0f0f0 !important; }
::selection { background: #f0f0f0 !important; }
::-webkit-scrollbar-corner { background: #FFFFFF !important; }
::-moz-selection { background: #F2F2F2 !important; }
::selection { background: #F2F2F2 !important; }
11 changes: 5 additions & 6 deletions src/.data/web/nord.css
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
body {
padding: 0px;
margin: 0px;
background-color: #232935 !important;
background-color: #202631 !important;
margin-right: 5px;
}

Expand All @@ -12,7 +12,7 @@ pre {
}

/* desert scheme ported from vim to google prettify */
pre.prettyprint { display: block; background-color: #232935 !important; }
pre.prettyprint { display: block; background-color: #202631 !important; }
pre .nocode { background-color: none; color: #000 !important; }
pre .str { color: #ffa0a0 !important; } /* string - pink */
pre .kwd { color: #f0e68c !important; font-weight: bold }
Expand Down Expand Up @@ -55,11 +55,10 @@ ul {
li.L0, li.L1, li.L2, li.L3, li.L4,
li.L5, li.L6, li.L7, li.L8, li.L9 {
list-style-type: decimal !important;
background-color: #232935 !important;
user-select: none !important;
}


::-webkit-scrollbar-corner { background: #232935 !important;}
::-moz-selection { background: #697080 !important; }
::selection { background: #697080 !important; }
::-webkit-scrollbar-corner { background: #202631 !important; }
::-moz-selection { background: #282e38 !important; }
::selection { background: #282e38 !important; }
2 changes: 1 addition & 1 deletion src/.theme/tab-pane.fx.css
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@

.tab-pane .tab-header-area .tab {
-fx-font-size: 1.05em;
-fx-padding: 4;
-fx-padding: 4 8 4 4 !important;
-fx-background-insets: 0 0 0 0;
}

Expand Down
31 changes: 19 additions & 12 deletions src/app/Dependency.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@ class Dependency
const DEFAULT_DEPENDENCY_PATH = '\DevelNextLibrary\bundles\\';
const DEPENDENCY_ICON_PATH = '.data/img/develnext/bundle/';

/**
* @var ObjectStorage
*/
private $imageCache;

public function getDependencys (ZipFile $zip) {
app()->form("MainForm")->flowPane->children->clear();

Expand Down Expand Up @@ -91,7 +96,6 @@ public function getDependencys (ZipFile $zip) {
}

foreach ($sort as $l) {
$c = 0;
foreach ($l as $panel) {
try {
app()->form("MainForm")->flowPane->children->add($panel["panel"]);
Expand Down Expand Up @@ -131,7 +135,7 @@ public function makeUi ($image, $name) {
$width = 10;
$height = 10;

$panel->add($link = new UXScrollPane); /// UXImageView(new UXImage('res://.data/img/ui/external-link-16.png', $width, $height)));
$panel->add($link = new UXScrollPane);
$link->classes->add("link");
$link->cursor = 'HAND';
$link->maxWidth = $width;
Expand All @@ -144,14 +148,6 @@ public function makeUi ($image, $name) {
open($url);
}
});
$link->on("mouseEnter", function () use ($link, $width, $height) {
static $image = new UXImage('res://.data/img/ui/external-link-16 hover.png', $width, $height);
$link->image = $image;
});
$link->on("mouseExit", function () use ($link, $width, $height) {
static $image = new UXImage('res://.data/img/ui/external-link-16.png', $width, $height);;
$link->image = $image;
});
}

return $panel;
Expand Down Expand Up @@ -179,7 +175,7 @@ private function getLink($name) {
case 'ZIP': return false;
}

Logger::info($name);
Logger::info("Unknown dependency: " . $name);

return false;
}
Expand Down Expand Up @@ -216,9 +212,18 @@ public function getIcon ($bundleName) {
}

/**
* Иконки пользовательских пакетов, елси они были устанволенны в студии
* Иконки пользовательских пакетов, елси они были установленны в студии
*/
public function getBundleIcon ($bundleName) {

if (!($this->imageCache instanceof ObjectStorage)) {
$this->imageCache = new ObjectStorage();
}

if ($this->imageCache->exists($bundleName)) {
return $this->imageCache->get($bundleName);
}

$extensions = [];
$path = System::getProperty('user.home') . self::DEFAULT_DEPENDENCY_PATH;

Expand All @@ -235,6 +240,8 @@ public function getBundleIcon ($bundleName) {
$image = new UXImage($stream);
});

$this->imageCache->set($bundleName, $image);

return $image;
}
}
Expand Down
28 changes: 18 additions & 10 deletions src/app/FSTreeProvider.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<?php
namespace app;

use Exception;
use framework;
use php\compress\ZipFile;
use std;
Expand Down Expand Up @@ -65,10 +66,7 @@ public function getZipByNode (UXTreeItem $item) {
$fs = new StandartFileSystem();
$filePath = $this->selectedDirectory . $fs->getAbsolutePath($item);

if ($fs->isFile($filePath)) {

// show by explorer
} else {
if (!$fs->isFile($filePath)) {
if (!$fs->isDirectory($filePath)) {
list($fsPath, $zipPath) = $this->getPaths($filePath);

Expand Down Expand Up @@ -104,7 +102,20 @@ public function getFileInfo (UXTreeItem $item) {
call_user_func_array($this->events["onFileSystem"], [$fs, $filePath]);
} else { // если выбранный елемент является файлом в zip архиве
list($fsPath, $zipPath) = $this->getPaths($filePath);
call_user_func_array($this->events["onZipFileSystem"], [$this->zipFiles[$fsPath], $zipPath, $fsPath]);

try {
if (!($this->zipFiles[$fsPath] instanceof ZipFileSystem)) {
$message = sprintf("Instance: %s ZipPath: %s FsPath: %s", get_class($this->zipFiles[$fsPath]) ?: "null", $zipPath, $fsPath);
app()->form("MainForm")->logger->console("Error is incorrect instance type", LoggerReporter::ERROR)->show();
app()->form("MainForm")->logger->discord($message, LoggerReporter::WARNING)->send();
return;
}

call_user_func_array($this->events["onZipFileSystem"], [$this->zipFiles[$fsPath], $zipPath, $fsPath]);
} catch (Exception $ex) {
app()->form("MainForm")->logger->console($ex->getMessage(), LoggerReporter::ERROR)->show();
app()->form("MainForm")->logger->discord($ex->getMessage(), LoggerReporter::ERROR)->send();
}
}

if (isset($fsPath)) {
Expand Down Expand Up @@ -153,7 +164,6 @@ public function getPaths ($filePath) {
}

$zipPath = substr($zipPath, 0, -1);
// var_dump($fsPath);

$zipPath = str_replace('\\', '/', $zipPath);

Expand Down Expand Up @@ -218,9 +228,7 @@ protected function applyIcon ($item, $path) {
throw new IllegalArgumentException('$item must be instance UXTreeItem or UXLabel');
}

$item->graphic = new UXImageView(new UXImage($file));
$item->graphic->width = 20;
$item->graphic->height = 20;
$item->graphic = new UXImageView(new UXImage($file, 20, 20));
}

protected function createTreeItemOfZip (UXTreeItem $root, $stat) {
Expand Down Expand Up @@ -251,7 +259,7 @@ protected function createTreeItem (UXTreeItem $root, $items) {
}


$this->applyIcon($root, $value);
$this->applyIcon($root, $value);
}

public function backTrace(UXTreeItem $item, $path = null) {
Expand Down
33 changes: 30 additions & 3 deletions src/app/events/MainMenuEvents.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<?php
namespace app\events;

use std;
use Exception;
use gui;

Expand All @@ -14,7 +15,7 @@ public function selectedFolder () {
app()->form("MainForm")->projectDir = $path;

try {
app()->form("MainForm")->reg->add('ProjectDirectory', $path);
app()->form("MainForm")->ini->set('ProjectDirectory', $path);
} catch (Exception $ex) {
app()->form("MainForm")->errorAlert($ex);
}
Expand All @@ -28,7 +29,33 @@ public function selectedFolder () {
}
}

public function changeTheme () {

public function changeTheme ($ev, $menu, $themeList) {
foreach ($menu->items as $menuItem) {
$name = array_search($themeList, $menuItem->graphic->text, false);

if ($ev->sender === $menuItem->graphic) {
app()->form("MainForm")->ini->set('theme', $name);
app()->form("MainForm")->data('theme', $name);

try {
app()->form("MainForm")->browser->engine->userStyleSheetLocation = new ResourceStream('/.data/web/' . $name . '.css')->toExternalForm();
} catch (Exception $ex) {
app()->form("MainForm")->errorAlert($ex);
}

$menuItem->graphic->enabled = false;

app()->form("MainForm")->addStylesheet('.theme/' . $name . '.theme.fx.css');

continue;
}

$menuItem->graphic->enabled = true;
$menuItem->graphic->selected = false;

if (app()->form("MainForm")->hasStylesheet('.theme/' . $name . '.theme.fx.css')) {
app()->form("MainForm")->removeStylesheet('.theme/' . $name . '.theme.fx.css');
}
}
}
}
3 changes: 3 additions & 0 deletions src/app/fileSystem/AbstractFileSystem.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@

abstract class AbstractFileSystem
{
const DATE_FORMAT = 'dd/MM/YYYY HH:mm:ss';


/**
* Дата создания файла
* @param $path
Expand Down
4 changes: 2 additions & 2 deletions src/app/fileSystem/StandartFileSystem.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@ class StandartFileSystem extends AbstractFileSystem
* Дата создания файла
*/
public function createdAt($path) {
return new Time(filectime($path) * 1000)->toString('dd/MM/YYYY HH:mm:ss');
return new Time(filectime($path) * 1000)->toString(AbstractFileSystem::DATE_FORMAT);
}

/**
* Дата модификации файла
*/
public function modifiedAt($path) {
return new Time(filemtime($path) * 1000)->toString('dd/MM/YYYY HH:mm:ss');
return new Time(filemtime($path) * 1000)->toString(AbstractFileSystem::DATE_FORMAT);
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/app/fileSystem/ZipFileSystem.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public function createdAt($path) {
$path = $this->normalizePath($path, $this->zip);

if ($this->zip->has($path)) {
return new Time($this->zip->stat($path)["time"])->toString('dd/MM/YYYY HH:mm:ss');
return new Time($this->zip->stat($path)["time"])->toString(AbstractFileSystem::DATE_FORMAT);
}
}

Expand Down
Loading

0 comments on commit f37f4c0

Please sign in to comment.