Modified: trunk/programs/ide/lib/ide.class.php (90 => 91)
--- trunk/programs/ide/lib/ide.class.php 2007-01-05 14:37:06 UTC (rev 90)
+++ trunk/programs/ide/lib/ide.class.php 2007-01-05 15:29:03 UTC (rev 91)
@@ -1,6 +1,6 @@
<?php
/**
- * writer.class.php - Main window for the writer program
+ * ide.class.php - Main window for the writer program
*
* main window for the application, opens up last used project or creates a new
* blank project if no "last" is available to use
@@ -11,8 +11,7 @@
* @copyright Leon Pegg (c)2006
* @link http://callicore.net/desktop/programs/writer
* @license http://www.opensource.org/licenses/gpl-license.php GPL
- * @version $Id: writer.class.php 66 2006-12-10 22:02:36Z emsmith $
- * @since Php 5.2.0
+ * @since Php 5.2.0
* @package callicore
* @subpackage dev_ide
* @category lib
@@ -129,7 +128,6 @@
protected function register_actions(){
$actions = CC_Actions::instance();
- 'project:run';
$actions->add_action('project',
array(
'type' => 'action',
@@ -257,6 +255,7 @@
}
public function on_save(){
+ $this->notebook->save();
echo "save file\n";
}
Modified: trunk/programs/ide/lib/ide_notebook.class.php (90 => 91)
--- trunk/programs/ide/lib/ide_notebook.class.php 2007-01-05 14:37:06 UTC (rev 90)
+++ trunk/programs/ide/lib/ide_notebook.class.php 2007-01-05 15:29:03 UTC (rev 91)
@@ -37,6 +37,7 @@
$button->show();
$id = $this->append_page($view,$hbox);
$view->set_data('tab_id',self::$count);
+ $view->set_data('filename',null);
$button->connect('clicked', array($this,'tab_close'),$view);
$this->buffers[self::$count] = $buffer;
$this->show_all();
@@ -78,6 +79,7 @@
$id = $this->append_page($view,$hbox);
//$button->set_data('tab_id',self::$count);
$view->set_data('tab_id',self::$count);
+ $view->set_data('filename',$filename);
$button->connect('clicked', array($this,'tab_close'),$view);
$this->buffers[self::$count] = $buffer;
$this->show_all();
@@ -124,6 +126,19 @@
}
}
+ public function save(){
+ $id = $this->get_current_page();
+ if ($id !== -1){
+ $child = $this->get_nth_page($this->get_current_page());
+ $filename = $child->get_data('filename');
+ $tab_id = $child->get_data('tab_id');
+ if ($filename !== null) {
+ $buffer = $this->buffers[$tab_id];
+ file_put_contents($filename,$buffer->get_text($buffer->get_start_iter(),$buffer->get_end_iter()));
+ }
+ }
+ }
+
public function run(){
// RUN FUNCTION NOT COMPLETE YET
}