Revision
103
Author
leonpegg
Date
2007-01-08 05:47:19 -0800 (Mon, 08 Jan 2007)

Log Message

Re-factoring Ide current state old ide files still present

Modified Paths

Added Paths

Diff

Added: trunk/programs/ide/lib/ide-old.class.php (102 => 103)


--- trunk/programs/ide/lib/ide-old.class.php	2007-01-08 11:15:05 UTC (rev 102)
+++ trunk/programs/ide/lib/ide-old.class.php	2007-01-08 13:47:19 UTC (rev 103)
@@ -0,0 +1,313 @@
+<?php
+/**
+ * ide.class.php - Main window for the Callicore development enviroment program
+ *
+ * main window for the application.
+ *
+ * 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/ide
+ * @license      http://www.opensource.org/licenses/gpl-license.php GPL
+ * @since        Php 5.2.0
+ * @package      callicore
+ * @subpackage   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 $last_search;
+	
+	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',
+		),
+		'_Tools' => array(
+			'tools:preferences',
+		),
+		'_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',
+		'project:run',
+		'tools:preferences'
+	);
+
+	/**
+	 * 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',
+		'project:run'
+	);
+	
+	/**
+	 * public function __construct
+	 *
+	 * description
+	 *
+	 * @param type $name about
+	 * @return type about
+	 */
+	public function __construct()
+	{
+		parent::__construct();
+		$this->set_position(Gtk::WIN_POS_CENTER);
+		$this->set_name('ide');
+		$this->set_title('Callicore Development Enviroment');
+		//CC_Wm::add_window($this);
+		$this->notebook = new CC_Ide_notebook();
+		$this->on_new();
+ 		$this->vbox->pack_start($this->notebook);
+		$this->show_all();
+	}
+
+	protected function register_actions(){
+		$actions = CC_Actions::instance();
+		$actions->add_action('tools',
+				array(
+					'type' => 'action',
+					'name' => 'preferences',
+					'label' => 'Preferences',
+					'short-label' => 'Preferences',
+					'tooltip' => 'Preferences',
+					'callback' => array($this, 'on_run'),
+					'image' => 'gtk-properties',
+				)
+		);
+		$actions->add_action('project',
+				array(
+					'type' => 'action',
+					'name' => 'run',
+					'label' => '_Run',
+					'short-label' => '_Run',
+					'tooltip' => 'Run File',
+					'callback' => array($this, 'on_run'),
+					'image' => 'gtk-media-play',
+				)
+		);
+		$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_run(){
+		$this->notebook->run();
+		//CC_Os::run('c:\callicore\php.exe c:\php-release\callicore\run.php ide');
+	}
+	
+	public function on_about(){
+		$about = new GtkAboutDialog();
+		$about->set_authors(array('Leon Pegg'));
+		$about->set_license(file_get_contents(CC::$dir . docs . DS . 'gpl.txt'));
+		$about->set_version('0.2.0-Dev');
+		$about->run();
+	}
+	
+	public function on_new(){
+		$buffer = new GtkSourceBuffer();
+		$this->notebook->append_page($buffer);
+	}
+	
+	public function on_open(){
+		$opendialog = new CC_Ide_fileopendialog(array('PHP' => '*.php'),$this);
+		if ($opendialog->run() == Gtk::RESPONSE_OK) {
+       		$selected_file = $opendialog->get_filename();
+       		$buffer = new GtkSourceBuffer();
+       		$buffer->set_text(file_get_contents($selected_file));
+       		$this->notebook->append_page($buffer,$selected_file);
+    	}
+    	$opendialog->destroy();
+	}
+	
+	public function on_save(){
+		$this->notebook->save();
+	}
+	
+	public function on_help(){
+
+	}
+	
+	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();
+	}
+	
+	public function on_redo(){
+		$this->notebook->redo();
+	}
+
+	public function on_search(){
+		
+	}
+	
+}
+
+# ToDo:-
+# Write CC_Config_XML to alow for better configuration methods
+#  file display settings
+#  convert XML to array structure and retrevable XML node objects
+# preferences dialog
+# php explorer (displaying functions, constants, classes, interfaces)
+# code snippits repo
+# serach/replace (regex, multiline, standard, match case, hexsearch)
+# project manager
+# Indent code (customizable code formater)
+# php manual serach (web or cached local)
+# ini editor text and gui based
+?>
\ No newline at end of file

Modified: trunk/programs/ide/lib/ide.class.php (102 => 103)


--- trunk/programs/ide/lib/ide.class.php	2007-01-08 11:15:05 UTC (rev 102)
+++ trunk/programs/ide/lib/ide.class.php	2007-01-08 13:47:19 UTC (rev 103)
@@ -1,313 +1,206 @@
-<?php
-/**
- * ide.class.php - Main window for the Callicore development enviroment program
- *
- * main window for the application.
- *
- * 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/ide
- * @license      http://www.opensource.org/licenses/gpl-license.php GPL
- * @since        Php 5.2.0
- * @package      callicore
- * @subpackage   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 $last_search;
-	
-	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',
-		),
-		'_Tools' => array(
-			'tools:preferences',
-		),
-		'_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',
-		'project:run',
-		'tools:preferences'
-	);
-
-	/**
-	 * 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',
-		'project:run'
-	);
-	
-	/**
-	 * public function __construct
-	 *
-	 * description
-	 *
-	 * @param type $name about
-	 * @return type about
-	 */
-	public function __construct()
-	{
-		parent::__construct();
-		$this->set_position(Gtk::WIN_POS_CENTER);
-		$this->set_name('ide');
-		$this->set_title('Callicore Development Enviroment');
-		CC_Wm::add_window($this);
-		$this->notebook = new CC_Ide_notebook();
-		$this->on_new();
- 		$this->vbox->pack_start($this->notebook);
-		$this->show_all();
-	}
-
-	protected function register_actions(){
-		$actions = CC_Actions::instance();
-		$actions->add_action('tools',
-				array(
-					'type' => 'action',
-					'name' => 'preferences',
-					'label' => 'Preferences',
-					'short-label' => 'Preferences',
-					'tooltip' => 'Preferences',
-					'callback' => array($this, 'on_run'),
-					'image' => 'gtk-properties',
-				)
-		);
-		$actions->add_action('project',
-				array(
-					'type' => 'action',
-					'name' => 'run',
-					'label' => '_Run',
-					'short-label' => '_Run',
-					'tooltip' => 'Run File',
-					'callback' => array($this, 'on_run'),
-					'image' => 'gtk-media-play',
-				)
-		);
-		$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_run(){
-		$this->notebook->run();
-		//CC_Os::run('c:\callicore\php.exe c:\php-release\callicore\run.php ide');
-	}
-	
-	public function on_about(){
-		$about = new GtkAboutDialog();
-		$about->set_authors(array('Leon Pegg'));
-		$about->set_license(file_get_contents(CC::$dir . docs . DS . 'gpl.txt'));
-		$about->set_version('0.2.0-Dev');
-		$about->run();
-	}
-	
-	public function on_new(){
-		$buffer = new GtkSourceBuffer();
-		$this->notebook->append_page($buffer);
-	}
-	
-	public function on_open(){
-		$opendialog = new CC_Ide_fileopendialog(array('PHP' => '*.php'),$this);
-		if ($opendialog->run() == Gtk::RESPONSE_OK) {
-       		$selected_file = $opendialog->get_filename();
-       		$buffer = new GtkSourceBuffer();
-       		$buffer->set_text(file_get_contents($selected_file));
-       		$this->notebook->append_page($buffer,$selected_file);
-    	}
-    	$opendialog->destroy();
-	}
-	
-	public function on_save(){
-		$this->notebook->save();
-	}
-	
-	public function on_help(){
-
-	}
-	
-	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();
-	}
-	
-	public function on_redo(){
-		$this->notebook->redo();
-	}
-
-	public function on_search(){
-		
-	}
-	
-}
-
-# ToDo:-
-# Write CC_Config_XML to alow for better configuration methods
-#  file display settings
-#  convert XML to array structure and retrevable XML node objects
-# preferences dialog
-# php explorer (displaying functions, constants, classes, interfaces)
-# code snippits repo
-# serach/replace (regex, multiline, standard, match case, hexsearch)
-# project manager
-# Indent code (customizable code formater)
-# php manual serach (web or cached local)
-# ini editor text and gui based
+<?php
+
+class CC_Ide extends CC_Main {
+	
+	protected $editor;
+	
+	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',
+		),
+		'_Tools' => array(
+			'tools:preferences',
+		),
+		'_View' => array(
+			//'toolbar:toggle',
+			'view:fullscreen',
+		),
+		'_Help' => array(
+			'help:help',
+			'help:website',
+			'separator',
+			'help:about',
+		),
+	);
+
+	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',
+		'project:run',
+		'tools:preferences'
+	);
+
+	protected $tooldefault = array(
+		'file:new',
+		'file:open',
+		'file:save',
+		'separator',
+		'edit:copy',
+		'edit:cut',
+		'edit:paste',
+		'edit:undo',
+		'edit:redo',
+		'separator',
+		'view:fullscreen',
+		'separator',
+		'project:run'
+	);
+
+	public function __construct()
+	{
+		parent::__construct();
+		$this->set_position(Gtk::WIN_POS_CENTER);
+		$this->set_name('ide');
+		$this->set_title('Callicore Development Enviroment');
+		$this->editor = new CC_Ide_editor();
+ 		$this->vbox->pack_start($this->editor);
+		$this->show_all();
+	}
+	
+		protected function register_actions(){
+		$actions = CC_Actions::instance();
+		$actions->add_action('tools',
+				array(
+					'type' => 'action',
+					'name' => 'preferences',
+					'label' => 'Preferences',
+					'short-label' => 'Preferences',
+					'tooltip' => 'Preferences',
+					//'callback' => array($this, 'on_run'),
+					'image' => 'gtk-properties',
+				)
+		);
+		$actions->add_action('project',
+				array(
+					'type' => 'action',
+					'name' => 'run',
+					'label' => '_Run',
+					'short-label' => '_Run',
+					'tooltip' => 'Run File',
+					//'callback' => array($this, 'on_run'),
+					'image' => 'gtk-media-play',
+				)
+		);
+		$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_help(){
+		
+	}
+	
+	public function on_about(){
+		
+	}
+	
+}
+
 ?>
\ No newline at end of file

Added: trunk/programs/ide/lib/ide_editor.php (102 => 103)


--- trunk/programs/ide/lib/ide_editor.php	2007-01-08 11:15:05 UTC (rev 102)
+++ trunk/programs/ide/lib/ide_editor.php	2007-01-08 13:47:19 UTC (rev 103)
@@ -0,0 +1,7 @@
+<?php
+
+class ide_editor extends CC_Ide_notebook {
+	
+}
+
+?>
\ No newline at end of file

Added: trunk/programs/ide/lib/ide_notebook-old.class.php (102 => 103)


--- trunk/programs/ide/lib/ide_notebook-old.class.php	2007-01-08 11:15:05 UTC (rev 102)
+++ trunk/programs/ide/lib/ide_notebook-old.class.php	2007-01-08 13:47:19 UTC (rev 103)
@@ -0,0 +1,196 @@
+<?php
+/**
+ * ide_notebook.class.php - Tabed GtkSourceView Wrapper widget
+ *
+ * handels ide fetures copy, cut, paste, undo, redo, open/newand save
+ * manages GtkSourceView and GtkSourceBuffer properys 
+ *  auto intdent
+ *  space instead of tab
+ *  show line numbers
+ *  smart home end
+ *  tab width
+ *  bracket highlight
+ *  syntax highlight
+ * supports ondrop file open
+ *
+ * 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/ide
+ * @license      http://www.opensource.org/licenses/gpl-license.php GPL
+ * @since        Php 5.2.0
+ * @package      callicore
+ * @subpackage   ide
+ * @category     lib
+ * @filesource
+ * @todo         fix save label issue
+ */
+
+class CC_Ide_notebook extends GtkNotebook {
+
+	protected $buffers = array();
+	static $count = 0;
+
+	public function __construct(){
+		parent::__construct();
+		$this->set_scrollable(true);
+		$config = CC_Config::instance();
+		if ($config->tab_pos !== null) {
+			switch ($config->tab_pos){
+				case 'POS_TOP': $this->set_tab_pos(Gtk::POS_TOP); break;
+				case 'POS_BOTTOM': $this->set_tab_pos(Gtk::POS_BOTTOM); break;
+				case 'POS_LEFT': $this->set_tab_pos(Gtk::POS_LEFT); break;
+				case 'POS_RIGHT': $this->set_tab_pos(Gtk::POS_RIGHT); break;
+			}
+		}else{
+			$this->set_tab_pos(Gtk::POS_BOTTOM);
+			$config->tab_pos = 'POS_BOTTOM';
+		}
+		$this->connect('drag-data-received', array($this, 'on_drop'));
+        $this->drag_dest_set(Gtk::DEST_DEFAULT_DROP, array(array('text/uri-list', 0, 0)), Gdk::ACTION_COPY | Gdk::ACTION_MOVE);
+	}
+	
+	public function append_page($buffer, $filename = null){
+		self::$count++;
+		$view = new GtkScrolledWindow();
+		$source = GtkSourceView::new_with_buffer($buffer);
+		$source->set_show_line_numbers(1);
+		$source->set_auto_indent(1);
+		$source->set_highlight_current_line(1);
+		$buffer->set_highlight(1);
+		$buffer->set_check_brackets(1);
+		$view->add($source);
+		$hbox = new GtkHBox();
+		$button = new GtkButton('X');
+		if ($filename == null) {
+			$label = new GtkLabel('untitled-'.self::$count);
+			$label->set_data('filename','untitled-'.self::$count);
+		}else{
+			$label = new GtkLabel(basename($filename));
+			$label->set_data('filename',basename($filename));
+		}
+		$buffer->set_modified(false);
+		$buffer->connect('modified-changed',array($this,'on_modified'),$label);
+		$hbox->pack_start($label);
+		$hbox->pack_start($button);
+		$label->show();
+		$button->show();
+		$id = parent::append_page($view,$hbox);
+		$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();
+		$this->set_current_page($id);
+	}
+	
+	public function get_current_buffer(){
+		$page_id = parent::get_current_page();
+		if ($page_id !== -1){
+			$child = $this->get_nth_page($page_id);
+			$id = $child->get_data('tab_id');
+			return $this->buffers[$id];
+		}
+		return false;
+	}
+	
+	public function get_current_page(){
+		return $this->get_nth_page(parent::get_current_page());
+	}
+	
+	public function &get_current_label(){
+		$child = $this->get_current_page();
+		$tab_label = $this->get_tab_label($child);
+		$tab = $tab_label->get_children();
+		return $tab[0];
+	}
+	
+	public function on_modified($widget, $label){
+		$text = $label->get_data('filename');
+		$text .= ' *';
+		$label->set_text($text);
+	}
+	
+	public function copy(){
+		$cb = GtkClipboard::get(Gdk::atom_intern('CLIPBOARD', false));
+		$child = $this->get_nth_page(parent::get_current_page());
+		$id = $child->get_data('tab_id');
+		$this->buffers[$id]->copy_clipboard($cb);
+	}
+	
+	public function cut(){
+		$cb = GtkClipboard::get(Gdk::atom_intern('CLIPBOARD', false));
+		$child = $this->get_nth_page(parent::get_current_page());
+		$id = $child->get_data('tab_id');
+		$this->buffers[$id]->cut_clipboard($cb,true);
+	}
+	
+	public function paste(){
+		$cb = GtkClipboard::get(Gdk::atom_intern('CLIPBOARD', false));
+		$child = $this->get_nth_page(parent::get_current_page());
+		$id = $child->get_data('tab_id');
+		$iter = $this->buffers[$id]->get_iter_at_mark($this->buffers[$id]->get_insert());
+		$this->buffers[$id]->paste_clipboard($cb,$iter,true);
+	}
+	
+	public function undo(){
+		$child = $this->get_nth_page(parent::get_current_page());
+		$id = $child->get_data('tab_id');
+		if ($this->buffers[$id]->can_undo()) {
+			$this->buffers[$id]->undo();
+		}
+	}
+	
+	public function redo(){
+		$child = $this->get_nth_page(parent::get_current_page());
+		$id = $child->get_data('tab_id');
+		if ($this->buffers[$id]->can_redo()) {
+			$this->buffers[$id]->redo();
+		}
+	}
+	
+	public function save(){
+		$id = parent::get_current_page();
+		if ($id !== -1){
+			$child = $this->get_nth_page(parent::get_current_page());
+			$tab_label = $this->get_tab_label($child);
+			$tab = $tab_label->get_children();
+			$label = $this->get_current_label();
+			//echo $label;
+			$label->set_label($label->get_data('filename'));
+			$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 not complete
+	}
+
+	public function search($sting,$options = array()){
+		
+	}
+	
+	public function on_drop($widget, $context, $x, $y, $data, $info, $time){
+		echo $data->data;
+    	$file = explode("\r\n",$data->data);
+    	$buffer->set_text(file_get_contents($file[0]));
+       	$this->append_page($buffer,$file[0]);
+    }
+    
+   	public function tab_close($button, $view){
+		$id = $view->get_data('tab_id');
+		$this->buffers[$id] = null;
+		unset($this->buffers[$id]);
+		$id = $this->page_num($view);
+		$this->remove_page($id);
+	}
+
+}
+
+?>
\ No newline at end of file

Modified: trunk/programs/ide/lib/ide_notebook.class.php (102 => 103)


--- trunk/programs/ide/lib/ide_notebook.class.php	2007-01-08 11:15:05 UTC (rev 102)
+++ trunk/programs/ide/lib/ide_notebook.class.php	2007-01-08 13:47:19 UTC (rev 103)
@@ -1,196 +1,49 @@
-<?php
-/**
- * ide_notebook.class.php - Tabed GtkSourceView Wrapper widget
- *
- * handels ide fetures copy, cut, paste, undo, redo, open/newand save
- * manages GtkSourceView and GtkSourceBuffer properys 
- *  auto intdent
- *  space instead of tab
- *  show line numbers
- *  smart home end
- *  tab width
- *  bracket highlight
- *  syntax highlight
- * supports ondrop file open
- *
- * 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/ide
- * @license      http://www.opensource.org/licenses/gpl-license.php GPL
- * @since        Php 5.2.0
- * @package      callicore
- * @subpackage   ide
- * @category     lib
- * @filesource
- * @todo         fix save label issue
- */
-
-class CC_Ide_notebook extends GtkNotebook {
-
-	protected $buffers = array();
-	static $count = 0;
-
-	public function __construct(){
-		parent::__construct();
-		$this->set_scrollable(true);
-		$config = CC_Config::instance();
-		if ($config->tab_pos !== null) {
-			switch ($config->tab_pos){
-				case 'POS_TOP': $this->set_tab_pos(Gtk::POS_TOP); break;
-				case 'POS_BOTTOM': $this->set_tab_pos(Gtk::POS_BOTTOM); break;
-				case 'POS_LEFT': $this->set_tab_pos(Gtk::POS_LEFT); break;
-				case 'POS_RIGHT': $this->set_tab_pos(Gtk::POS_RIGHT); break;
-			}
-		}else{
-			$this->set_tab_pos(Gtk::POS_BOTTOM);
-			$config->tab_pos = 'POS_BOTTOM';
-		}
-		$this->connect('drag-data-received', array($this, 'on_drop'));
-        $this->drag_dest_set(Gtk::DEST_DEFAULT_DROP, array(array('text/uri-list', 0, 0)), Gdk::ACTION_COPY | Gdk::ACTION_MOVE);
-	}
-	
-	public function append_page($buffer, $filename = null){
-		self::$count++;
-		$view = new GtkScrolledWindow();
-		$source = GtkSourceView::new_with_buffer($buffer);
-		$source->set_show_line_numbers(1);
-		$source->set_auto_indent(1);
-		$source->set_highlight_current_line(1);
-		$buffer->set_highlight(1);
-		$buffer->set_check_brackets(1);
-		$view->add($source);
-		$hbox = new GtkHBox();
-		$button = new GtkButton('X');
-		if ($filename == null) {
-			$label = new GtkLabel('untitled-'.self::$count);
-			$label->set_data('filename','untitled-'.self::$count);
-		}else{
-			$label = new GtkLabel(basename($filename));
-			$label->set_data('filename',basename($filename));
-		}
-		$buffer->set_modified(false);
-		$buffer->connect('modified-changed',array($this,'on_modified'),$label);
-		$hbox->pack_start($label);
-		$hbox->pack_start($button);
-		$label->show();
-		$button->show();
-		$id = parent::append_page($view,$hbox);
-		$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();
-		$this->set_current_page($id);
-	}
-	
-	public function get_current_buffer(){
-		$page_id = parent::get_current_page();
-		if ($page_id !== -1){
-			$child = $this->get_nth_page($page_id);
-			$id = $child->get_data('tab_id');
-			return $this->buffers[$id];
-		}
-		return false;
-	}
-	
-	public function get_current_page(){
-		return $this->get_nth_page(parent::get_current_page());
-	}
-	
-	public function &get_current_label(){
-		$child = $this->get_current_page();
-		$tab_label = $this->get_tab_label($child);
-		$tab = $tab_label->get_children();
-		return $tab[0];
-	}
-	
-	public function on_modified($widget, $label){
-		$text = $label->get_data('filename');
-		$text .= ' *';
-		$label->set_text($text);
-	}
-	
-	public function copy(){
-		$cb = GtkClipboard::get(Gdk::atom_intern('CLIPBOARD', false));
-		$child = $this->get_nth_page(parent::get_current_page());
-		$id = $child->get_data('tab_id');
-		$this->buffers[$id]->copy_clipboard($cb);
-	}
-	
-	public function cut(){
-		$cb = GtkClipboard::get(Gdk::atom_intern('CLIPBOARD', false));
-		$child = $this->get_nth_page(parent::get_current_page());
-		$id = $child->get_data('tab_id');
-		$this->buffers[$id]->cut_clipboard($cb,true);
-	}
-	
-	public function paste(){
-		$cb = GtkClipboard::get(Gdk::atom_intern('CLIPBOARD', false));
-		$child = $this->get_nth_page(parent::get_current_page());
-		$id = $child->get_data('tab_id');
-		$iter = $this->buffers[$id]->get_iter_at_mark($this->buffers[$id]->get_insert());
-		$this->buffers[$id]->paste_clipboard($cb,$iter,true);
-	}
-	
-	public function undo(){
-		$child = $this->get_nth_page(parent::get_current_page());
-		$id = $child->get_data('tab_id');
-		if ($this->buffers[$id]->can_undo()) {
-			$this->buffers[$id]->undo();
-		}
-	}
-	
-	public function redo(){
-		$child = $this->get_nth_page(parent::get_current_page());
-		$id = $child->get_data('tab_id');
-		if ($this->buffers[$id]->can_redo()) {
-			$this->buffers[$id]->redo();
-		}
-	}
-	
-	public function save(){
-		$id = parent::get_current_page();
-		if ($id !== -1){
-			$child = $this->get_nth_page(parent::get_current_page());
-			$tab_label = $this->get_tab_label($child);
-			$tab = $tab_label->get_children();
-			$label = $this->get_current_label();
-			//echo $label;
-			$label->set_label($label->get_data('filename'));
-			$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 not complete
-	}
-
-	public function search($sting,$options = array()){
-		
-	}
-	
-	public function on_drop($widget, $context, $x, $y, $data, $info, $time){
-		echo $data->data;
-    	$file = explode("\r\n",$data->data);
-    	$buffer->set_text(file_get_contents($file[0]));
-       	$this->append_page($buffer,$file[0]);
-    }
-    
-   	public function tab_close($button, $view){
-		$id = $view->get_data('tab_id');
-		$this->buffers[$id] = null;
-		unset($this->buffers[$id]);
-		$id = $this->page_num($view);
-		$this->remove_page($id);
-	}
-
-}
-
+<?php
+
+class CC_Ide_notebook extends GtkNotebook {
+	
+	public function __construct(){
+		parent::__construct();
+		$this->set_scrollable(true);
+	}
+	
+	public function append_page($child, $label, $has_close = true){
+		$tab = new GtkHBox();
+		if ($has_close) {
+			$button = new GtkButton('X');
+			$tab->pack_start($label);
+			$tab->pack_start($button);
+			$button->connect_simple('clicked', array($this,'close_page'),$child);
+		}else{
+			$tab->pack_start($label);
+		}
+		$this->show_all();
+		return parent::append_page($child,$tab);
+	}
+	
+	public function close_page($child){
+		$id = $this->page_num($child);
+		$this->remove_page($id);
+	}
+	
+	public function get_current_page(){
+		return $this->get_nth_page(parent::get_current_page());
+	}
+	
+	public function get_current_page_id(){
+		return parent::get_current_page();
+	}
+	
+	public function get_tab_label($child){
+		$tab = $this->get_tab_label($child);
+		$tab_label = $tab->get_children();
+		return $tab_label[0];
+	}
+	
+	public function get_current_tab_label(){
+		return $this->get_tab_label($this->get_current_page());
+	}
+	
+}
+
 ?>
\ No newline at end of file

Added: trunk/programs/ide/lib/ide_source.php (102 => 103)


--- trunk/programs/ide/lib/ide_source.php	2007-01-08 11:15:05 UTC (rev 102)
+++ trunk/programs/ide/lib/ide_source.php	2007-01-08 13:47:19 UTC (rev 103)
@@ -0,0 +1,91 @@
+<?php
+
+class CC_Ide_source extends GtkSourceView {
+	
+	protected $buffer;
+	
+	public function __construct(){
+		parent::__construct();
+		$this->buffer = new GtkSourceBuffer();
+		$this->set_buffer($this->buffer);
+	}
+		
+	public function get_modified(){
+		return $this->buffer->get_modified();
+	}
+	
+	public function get_highlight(){
+		return $this->buffer->get_highlight();
+	}
+	
+	public function get_check_brackets(){
+		return $this->buffer->get_check_brackets();
+	}
+	
+	public function get_text(){
+		return $this->buffer->get_text($this->buffer->get_start_iter(),$this->buffer->get_end_iter());
+	}
+	
+	public function set_text($text){
+		return $this->buffer->set_text($text);
+	}
+	
+	public function set_modified($setting){
+		return $this->buffer->set_modified($setting);
+	}
+	
+	public function set_highlight($setting){
+		return $this->buffer->set_highlight($setting);
+	}
+	
+	public function set_check_brackets($setting){
+		return $this->buffer->set_check_brackets($setting);
+	}
+	
+	public function copy(){
+		$clipboard = GtkClipboard::get(Gdk::atom_intern('CLIPBOARD', false));
+		$this->buffer->copy_clipboard($clipboard);
+	}
+	
+	public function cut(){
+		$clipboard = GtkClipboard::get(Gdk::atom_intern('CLIPBOARD', false));
+		$this->buffer->cut_clipboard($clipboard,true);
+	}
+	
+	public function paste(){
+		$clipboard = GtkClipboard::get(Gdk::atom_intern('CLIPBOARD', false));
+		$iter = $this->buffer->get_iter_at_mark($this->buffer->get_insert());
+		$this->buffer->paste_clipboard($clipboard,$iter,true);
+	}
+	
+	public function undo(){
+		if ($this->buffer->can_undo()) {
+			$this->buffer->undo();
+		}
+	}
+	
+	public function redo(){
+		if ($this->buffer->can_redo()) {
+			$this->buffer->redo();
+		}
+	}
+	
+	public function buffer_connect_simple(){
+		return call_user_method_array('connect_simple',$this->buffer,func_get_args());
+	}
+	
+	public function buffer_connect_simple_after(){
+		return call_user_method_array('connect_simple_after',$this->buffer,func_get_args());
+	}
+	
+	public function buffer_connect(){
+		return call_user_method_array('connect',$this->buffer,func_get_args());
+	}
+	
+	public function buffer_connect_after(){
+		return call_user_method_array('connect_after',$this->buffer,func_get_args());
+	}
+	
+}
+
+?>
\ No newline at end of file