Modified: trunk/programs/ide/lib/ide.class.php (99 => 100)
--- trunk/programs/ide/lib/ide.class.php 2007-01-05 18:18:29 UTC (rev 99)
+++ trunk/programs/ide/lib/ide.class.php 2007-01-05 23:21:42 UTC (rev 100)
@@ -1,19 +1,18 @@
<?php
/**
- * ide.class.php - Main window for the writer program
+ * ide.class.php - Main window for the Callicore development enviroment program
*
- * main window for the application, opens up last used project or creates a new
- * blank project if no "last" is available to use
+ * 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/writer
+ * @link http://callicore.net/desktop/programs/ide
* @license http://www.opensource.org/licenses/gpl-license.php GPL
- * @since Php 5.2.0
+ * @since Php 5.2.0
* @package callicore
- * @subpackage dev_ide
+ * @subpackage ide
* @category lib
* @filesource
*/
@@ -75,7 +74,8 @@
'help:help',
'help:website',
'help:about',
- 'project:run'
+ 'project:run',
+ 'tools:preferences'
);
/**
@@ -95,13 +95,7 @@
'separator',
'view:fullscreen',
'separator',
- 'project:run',
- 'separator',
- 'file:quit',
- 'expander',
- 'help:website',
- 'help:help',
- 'help:about'
+ 'project:run'
);
/**
@@ -120,14 +114,13 @@
$this->set_title('Callicore Development Enviroment');
CC_Wm::add_window($this);
$this->notebook = new CC_Ide_notebook();
- $this->notebook->new_file();
+ $this->on_new();
$this->vbox->pack_start($this->notebook);
$this->show_all();
}
protected function register_actions(){
$actions = CC_Actions::instance();
- //tools:preferences;
$actions->add_action('tools',
array(
'type' => 'action',
@@ -254,15 +247,17 @@
}
public function on_new(){
- $this->notebook->new_file();
- $this->notebook->show_all();
+ $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();
- $this->notebook->open_file($selected_file);
+ $buffer = new GtkSourceBuffer();
+ $buffer->set_text(file_get_contents($selected_file));
+ $this->notebook->append_page($buffer,$selected_file);
}
$opendialog->destroy();
}
@@ -297,9 +292,13 @@
}
-# ToDo
-# Add Callicore Project template
-# Add code completion
-# Add Debug function
+# ToDo:-
+# 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)
?>
\ No newline at end of file
Modified: trunk/programs/ide/lib/ide_notebook.class.php (99 => 100)
--- trunk/programs/ide/lib/ide_notebook.class.php 2007-01-05 18:18:29 UTC (rev 99)
+++ trunk/programs/ide/lib/ide_notebook.class.php 2007-01-05 23:21:42 UTC (rev 100)
@@ -23,74 +23,34 @@
$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 new_file(){
+
+ public function append_page($buffer, $filename = null){
self::$count++;
$view = new GtkScrolledWindow();
- $lang_mgr = new GtkSourceLanguagesManager();
- # removed lang_mgr to cant seem to get it working since using new builds
- //$lang = $lang_mgr->get_language_from_mime_type("text/x-php");
- //$buffer = GtkSourceBuffer::new_with_language($lang);
- $buffer = new GtkSourceBuffer();
$source = GtkSourceView::new_with_buffer($buffer);
$source->set_show_line_numbers(1);
$buffer->set_highlight(1);
$view->add($source);
$hbox = new GtkHBox();
$button = new GtkButton('X');
- $label = new GtkLabel('untitled-'.self::$count);
+ if ($filename == null) {
+ $label = new GtkLabel('untitled-'.self::$count);
+ }else{
+ $label = new GtkLabel(basename($filename));
+ }
$hbox->pack_start($label);
$hbox->pack_start($button);
$label->show();
$button->show();
- $id = $this->append_page($view,$hbox);
+ $id = parent::append_page($view,$hbox);
$view->set_data('tab_id',self::$count);
- $view->set_data('filename',null);
+ $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 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);
- }
- public function open_file($filename){
- if (file_exists($filename)) {
- self::$count++;
- $view = new GtkScrolledWindow();
- $lang_mgr = new GtkSourceLanguagesManager();
- # removed lang_mgr to cant seem to get it working since using new builds
- //$lang = $lang_mgr->get_language_from_mime_type("text/x-php");
- //$buffer = GtkSourceBuffer::new_with_language($lang);
- $buffer = new GtkSourceBuffer();
- $source = GtkSourceView::new_with_buffer($buffer);
- $source->set_show_line_numbers(1);
- $buffer->set_highlight(1);
- $buffer->set_text(file_get_contents($filename));
- $view->add($source);
- $hbox = new GtkHBox();
- $button = new GtkButton('X');
- $label = new GtkLabel(basename($filename));
- $hbox->pack_start($label);
- $hbox->pack_start($button);
- $label->show();
- $button->show();
- $id = $this->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 copy(){
$cb = GtkClipboard::get(Gdk::atom_intern('CLIPBOARD', false));
$child = $this->get_nth_page($this->get_current_page());
@@ -109,8 +69,7 @@
$cb = GtkClipboard::get(Gdk::atom_intern('CLIPBOARD', false));
$child = $this->get_nth_page($this->get_current_page());
$id = $child->get_data('tab_id');
- // need to remove nasty @ error suppresion
- $iter = @$this->buffers[$id]->get_iter_at_mark($this->buffers[$id]->get_mark('cursor'));
+ $iter = $this->buffers[$id]->get_iter_at_mark($this->buffers[$id]->get_insert());
$this->buffers[$id]->paste_clipboard($cb,$iter,true);
}
@@ -144,14 +103,25 @@
}
public function run(){
- // RUN FUNCTION NOT COMPLETE YET
+ // run not complete
}
+
public function on_drop($widget, $context, $x, $y, $data, $info, $time){
echo $data->data;
$file = explode("\r\n",$data->data);
- $this->open_file($file[0]);
+ $buffer->set_text(file_get_contents($file[0]));
+ $this->append_page($buffer,$file[0]);
+ //$this->open_file($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);
+ }
}