Added: desktop/trunk/programs/ide/lib/ide.class.php (77 => 78)
--- desktop/trunk/programs/ide/lib/ide.class.php 2006-12-20 15:45:25 UTC (rev 77)
+++ desktop/trunk/programs/ide/lib/ide.class.php 2006-12-20 15:47:33 UTC (rev 78)
@@ -0,0 +1,266 @@
+<?php
+/**
+ * writer.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
+ *
+ * This is released under the GPL, see docs/gpl.txt for details
+ *
+ * @author Leon Pegg <leon@btarchives.com>
+ * @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
+ * @package callicore
+ * @subpackage dev_ide
+ * @category lib
+ * @filesource
+ */
+
+/**
+ * CC_Dev_ide - checks settings and manages common properties
+ *
+ * Basically a wrapper class for the application
+ */
+class CC_Ide extends CC_Main
+{
+
+ protected $notebook;
+
+ protected $menubar = array(
+ '_File' => array(
+ 'file:new',
+ 'file:open',
+ 'file:save',
+ 'file:quit',
+ ),
+ '_Edit' => array(
+ 'edit:copy',
+ 'edit:cut',
+ 'edit:paste',
+ 'edit:undo',
+ 'edit:redo',
+ ),
+ '_View' => array(
+ //'toolbar:toggle',
+ 'view:fullscreen',
+ ),
+ '_Help' => array(
+ 'help:help',
+ 'help:website',
+ 'separator',
+ 'help:about',
+ ),
+ );
+
+ /**
+ * options available for toolbar
+ * @var $tooloptions array
+ */
+ protected $tooloptions = array(
+ 'file:new',
+ 'file:open',
+ 'file:save',
+ 'file:quit',
+ 'edit:copy',
+ 'edit:cut',
+ 'edit:paste',
+ 'edit:undo',
+ 'edit:redo',
+ 'view:fullscreen',
+ 'help:help',
+ 'help:website',
+ 'help:about'
+ );
+
+ /**
+ * default toolbar layout
+ * @var $tooldefault array
+ */
+ protected $tooldefault = array(
+ 'file:new',
+ 'file:open',
+ 'file:save',
+ 'separator',
+ 'edit:copy',
+ 'edit:cut',
+ 'edit:paste',
+ 'edit:undo',
+ 'edit:redo',
+ 'separator',
+ 'view:fullscreen',
+ 'separator',
+ 'file:quit',
+ 'expander',
+ 'help:website',
+ 'help:help',
+ 'help:about'
+ );
+
+ /**
+ * public function __construct
+ *
+ * description
+ *
+ * @param type $name about
+ * @return type about
+ */
+ public function __construct()
+ {
+ parent::__construct();
+ $this->set_name('ide');
+ $this->set_title('Callicore Development Enviroment');
+ CC_Wm::add_window($this);
+ $this->notebook = new CC_Ide_notebook();
+ $this->notebook->new_file();
+ $this->vbox->pack_start($this->notebook);
+ $this->show_all();
+ }
+
+ protected function register_actions(){
+ $actions = CC_Actions::instance();
+
+ $actions->add_action('file',
+ array(
+ 'type' => 'action',
+ 'name' => 'open',
+ 'label' => '_Open',
+ 'short-label' => '_Open',
+ 'tooltip' => 'Open File',
+ 'callback' => array($this, 'on_open'),
+ 'image' => 'gtk-open',
+ )
+ );
+ $actions->add_action('file',
+ array(
+ 'type' => 'action',
+ 'name' => 'save',
+ 'label' => '_Save',
+ 'short-label' => '_Save',
+ 'tooltip' => 'Save File',
+ 'callback' => array($this, 'on_save'),
+ 'image' => 'gtk-save',
+ )
+ );
+ $actions->add_action('file',
+ array(
+ 'type' => 'action',
+ 'name' => 'new',
+ 'label' => '_New',
+ 'short-label' => '_New',
+ 'tooltip' => 'New File',
+ 'callback' => array($this, 'on_new'),
+ 'image' => 'gtk-new',
+ )
+ );
+ $actions->add_action('edit',
+ array(
+ 'type' => 'action',
+ 'name' => 'copy',
+ 'label' => 'Copy',
+ 'short-label' => 'Copy',
+ 'tooltip' => 'Copy',
+ 'callback' => array($this, 'on_copy'),
+ 'image' => 'gtk-copy',
+ )
+ );
+ $actions->add_action('edit',
+ array(
+ 'type' => 'action',
+ 'name' => 'cut',
+ 'label' => 'Cut',
+ 'short-label' => 'Cut',
+ 'tooltip' => 'Cut',
+ 'callback' => array($this, 'on_cut'),
+ 'image' => 'gtk-cut',
+ )
+ );
+ $actions->add_action('edit',
+ array(
+ 'type' => 'action',
+ 'name' => 'paste',
+ 'label' => 'Paste',
+ 'short-label' => 'Paste',
+ 'tooltip' => 'Paste',
+ 'callback' => array($this, 'on_paste'),
+ 'image' => 'gtk-paste',
+ )
+ );
+ $actions->add_action('edit',
+ array(
+ 'type' => 'action',
+ 'name' => 'undo',
+ 'label' => 'Undo',
+ 'short-label' => 'Undo',
+ 'tooltip' => 'Undo',
+ 'callback' => array($this, 'on_undo'),
+ 'image' => 'gtk-undo',
+ )
+ );
+ $actions->add_action('edit',
+ array(
+ 'type' => 'action',
+ 'name' => 'redo',
+ 'label' => 'Redo',
+ 'short-label' => 'Redo',
+ 'tooltip' => 'Redo',
+ 'callback' => array($this, 'on_redo'),
+ 'image' => 'gtk-redo',
+ )
+ );
+ return parent::register_actions();
+ }
+
+ public function on_about(){
+ echo "show_about\n";
+ }
+
+ public function on_new(){
+ $this->notebook->new_file();
+ $this->notebook->show_all();
+ }
+
+ public function on_open(){
+ echo "open file\n";
+ }
+
+ public function on_save(){
+ echo "save file\n";
+ }
+
+ public function on_help(){
+ echo "show help\n";
+ }
+
+ public function on_copy(){
+ $this->notebook->copy();
+ }
+
+ public function on_cut(){
+ $this->notebook->cut();
+ }
+
+ public function on_paste(){
+ $this->notebook->paste();
+ }
+
+ public function on_undo(){
+ $this->notebook->undo();
+ //echo "undo change\n";
+ }
+
+ public function on_redo(){
+ $this->notebook->redo();
+ //echo "redo change\n";
+ }
+
+}
+
+# ToDo
+# Add Callicore Project template
+# Add code completion
+# Add Debug function
+
+?>
\ No newline at end of file