Modified: desktop/trunk/programs/ide/lib/ide.class.php (79 => 80)
--- desktop/trunk/programs/ide/lib/ide.class.php 2006-12-27 17:15:33 UTC (rev 79)
+++ desktop/trunk/programs/ide/lib/ide.class.php 2006-12-27 17:16:09 UTC (rev 80)
@@ -72,7 +72,8 @@
'view:fullscreen',
'help:help',
'help:website',
- 'help:about'
+ 'help:about',
+ 'project:run'
);
/**
@@ -92,6 +93,8 @@
'separator',
'view:fullscreen',
'separator',
+ 'project:run',
+ 'separator',
'file:quit',
'expander',
'help:website',
@@ -121,7 +124,18 @@
protected function register_actions(){
$actions = CC_Actions::instance();
-
+ 'project:run';
+ $actions->add_action('project',
+ array(
+ 'type' => 'action',
+ 'name' => 'run',
+ 'label' => '_Run',
+ 'short-label' => '_Run',
+ 'tooltip' => 'Run File',
+ 'callback' => array($this, 'on_run'),
+ 'image' => 'gtk-run',
+ )
+ );
$actions->add_action('file',
array(
'type' => 'action',
@@ -213,6 +227,10 @@
return parent::register_actions();
}
+ public function on_run(){
+ $this->notebook->run();
+ }
+
public function on_about(){
echo "show_about\n";
}
@@ -224,6 +242,14 @@
public function on_open(){
echo "open file\n";
+ $opendialog = new CC_Ide_fileopendialog(array('PHP' => '*.php'));
+ if ($opendialog->run() == Gtk::RESPONSE_OK) {
+ $selected_file = $opendialog->get_filename(); // get the selected filename
+ echo "selected_file = $selected_file\n";
+ $this->notebook->open_file($selected_file);
+ $this->notebook->show_all();
+ }
+ $opendialog->destroy();
}
public function on_save(){
Modified: desktop/trunk/programs/ide/lib/ide_notebook.class.php (79 => 80)
--- desktop/trunk/programs/ide/lib/ide_notebook.class.php 2006-12-27 17:15:33 UTC (rev 79)
+++ desktop/trunk/programs/ide/lib/ide_notebook.class.php 2006-12-27 17:16:09 UTC (rev 80)
@@ -27,6 +27,7 @@
public function open_file($filename){
if (file_exists($filename)) {
+ echo "file exists $filename\n";
$view = new GtkScrolledWindow();
$lang_mgr = new GtkSourceLanguagesManager();
$lang = $lang_mgr->get_language_from_mime_type("text/x-php");
@@ -78,6 +79,13 @@
$this->buffers[$id]->redo();
}
}
+
+ public function run(){
+ //$id = $this->get_current_page();
+ //$code = $this->buffers[$id]->get_text($this->buffers[$id]->get_start_iter(),$this->buffers[$id]->get_end_iter());
+ //$sandbox = new Runkit_Sandbox();
+ //$sandbox->eval($code);
+ }
}