/** * Para o video * * @name stop */ public function stop() { // Verifica se está em execução if ($this->video_state != -1) { // Remve o timeout Gtk::timeout_remove($this->video_changed_timeout); $this->video_changed_timeout = NULL; // Adiciona o comando ao pipe $this->__command("stop"); // Fecha o pipe $this->pipe->terminate(); // Muda o estado do video $this->video_state = -1; } }
/** * Para a captura (atualização) dos frames * * @name stop() */ public function stop() { Gtk::timeout_remove($this->resTimer); $this->resTimer = NULL; }
function readSVG($file) { global $fields, $config, $timerSpin, $_navName, $_navIndex, $_btnNav, $fileList, $_btnNavRefresh, $i18n; if (is_dir($file)) { setTopBar($i18n->_('loadProblemsDir', basename($file)), Gtk::STOCK_DIALOG_WARNING); return; } if (!file_exists($file)) { setTopBar($i18n->_('loadProblems', basename($file)), Gtk::STOCK_DIALOG_WARNING); return; } resetFields(); $_btnNavRefresh->set_sensitive(true); // Enable refresh button with first (and every other) reading file // Set navigation bar - it's done everytime file is loading to refresh directory, which could change meanwhile $fileList['directory'] = dirname($file); $fileList['currentFile'] = $file; $fileList['globFix'] = strtr($fileList['directory'], ['[' => '[[]', ']' => '[]]']); $fileList['list'] = glob($fileList['globFix'] . DIRECTORY_SEPARATOR . "*.[Ss][Vv][Gg]"); $fileList['total'] = count($fileList['list']); $fileList['current'] = intval(array_search($file, $fileList['list'])) + 1; $fileList['isLast'] = $fileList['current'] === $fileList['total']; $fileList['isFirst'] = $fileList['current'] === 1; // As index is set during loading, the destination files for nav buttons are set same time, to avoid weird behavior on directory change if (!$fileList['isFirst']) { $fileList['nav'][-2] = $fileList['list'][0]; $fileList['nav'][-1] = $fileList['list'][$fileList['current'] - 2]; } if (!$fileList['isLast']) { $fileList['nav'][1] = $fileList['list'][$fileList['current']]; $fileList['nav'][2] = $fileList['list'][$fileList['total'] - 1]; } // For now navigation buttons don't loop, so turn off unusable and on usable $_btnNav[-2]->set_sensitive(!$fileList['isFirst']); $_btnNav[-1]->set_sensitive(!$fileList['isFirst']); $_btnNav[1]->set_sensitive(!$fileList['isLast']); $_btnNav[2]->set_sensitive(!$fileList['isLast']); gtSetText($_navName, basename($file)); gtSetText($_navIndex, $fileList['current'] . '/' . $fileList['total']); // That's to be changed, as SVG with embedded raster files aren't recognized as image/svg+xml if (mime_content_type($file) === 'image/svg+xml') { $fileList['properSVG'] = true; if ($config['displayPreview']) { // display preview only when it's visible, so people without Inkscape won't get errors // Generate preview $outputFile = $config['tempDirectory'] . DIRECTORY_SEPARATOR . uniqid('preview', true) . '.png'; $previewArea = ['page', 'drawing']; $cmdPreview = '--export-area-' . $previewArea[$config['previewArea']]; if (!empty($timerSpin)) { Gtk::timeout_remove($timerSpin); } // needed for navigating to other file before preview is done $timerSpin = Gtk::timeout_add(250, 'timerSpin', $outputFile); // checking for Inkscape preview to be done spinnerToggle(true); // This command runs asynchronously two synchronous commands, so _after_ Inkscape is done it // creates an empty file, so app would know when file is ready. $asynchFix = detectOS(HK_OS_WINDOWS) ? "& type nul >>\"{$outputFile}.nul\"" : "&& touch \"{$outputFile}.nul\""; execQuiet("\"{$config['inkscapePath']}\" --file=\"{$file}\" -w=200 {$cmdPreview} --export-png=\"{$outputFile}\" {$asynchFix}", true); } // Get SVG metadata $meta = getSVGMetadata($file); if (!$meta) { // Parsing metadata error setTopBar(sprintf(_('%s metadata not found'), basename($file)), Gtk::STOCK_CAPS_LOCK_WARNING); return; } // Parsing metadata ok foreach ($fields as $id) { gtSetText("_entry{$id}", $meta[$id]); } setTopBar(sprintf(_('%s parsed'), basename($file)), Gtk::STOCK_APPLY); } else { // Not SVG file $fileList['properSVG'] = false; setTopBar($i18n->_('loadIncorrectSVG', basename($file)), Gtk::STOCK_DIALOG_WARNING); } $fileList['loadedFile'] = true; }