Modified: trunk/lib/toolbar.class.php (108 => 109)
--- trunk/lib/toolbar.class.php 2007-01-11 20:30:30 UTC (rev 108)
+++ trunk/lib/toolbar.class.php 2007-01-11 20:41:58 UTC (rev 109)
@@ -867,6 +867,63 @@
* @return void
*/
protected function create_pixbuf($group, $action)
+{
+
+ // default icon width/height
+ list($icon_width, $icon_height) = Gtk::icon_size_lookup($this->get_icon_size());
+
+$temp = new GtkWindow();
+
+ // create toolbar widget and show in window
+ $temp->add($tool = new GtkToolbar());
+ $tool->set_toolbar_style($this->get_toolbar_style());
+ $tool->set_icon_size($this->get_icon_size());
+ // create widget
+ if ($action === 'separator')
+ {
+ $widget = new GtkSeparatorToolItem();
+ }
+ elseif ($action === 'space')
+ {
+ $widget = new GtkSeparatorToolItem();
+ $widget->set_draw(false);
+ }
+ elseif ($action === 'expander')
+ {
+ $widget = new GtkSeparatorToolItem();
+ $widget->set_expand(true);
+ $widget->set_draw(false);
+ }
+ else
+ {
+ $widget = CC_Actions::instance()->create_tool_item($group, $action);
+ }
+
+$temp->realize();
+$tool->show_all();
+$tool->realize();
+$tool->map();
+
+$temp->set_default_size($icon_width, $icon_height);
+list($icon_width, $icon_height) = $temp->get_size();
+$temp->size_request();
+$visual = $tool->window->get_visual();
+$pixmap = new GdkPixmap(null, $icon_width, $icon_height, $visual->depth);
+$pixmap->set_colormap($temp->get_colormap());
+
+$temp->ensure_style();
+
+$this->fake_expose_widget($temp, $pixmap);
+$this->fake_expose_widget($tool, $pixmap);
+$this->fake_expose_widget($widget, $pixmap);
+
+$pixbuf = new GdkPixbuf(Gdk::COLORSPACE_RGB, TRUE, 8, $icon_width, $icon_height);
+$pixbuf->get_from_drawable($pixmap, $pixmap->get_colormap(),
+ 0, 0, 0, 0, $icon_width, $icon_height);
+$temp->destroy();
+ return $pixbuf;
+}
+ /*function create_pixbuf($group, $action)
{
// create temporary window
$temp = new GtkWindow();
@@ -914,6 +971,24 @@
0, 0, 0, 0, $width, $height);
$temp->destroy();
return $pixbuf;
- }
+ }*/
+
+ function fake_expose_widget( GtkWidget $widget, GdkPixmap &$pixmap = null){
+ //GdkWindow *tmp_window;
+ //GdkEventExpose event;
+
+ $event = new GdkEvent(GDK::EXPOSE); //event.type = GDK_EXPOSE;
+ $event->window = $pixmap; //event.window = pixmap;
+ $event->send_event = false; //event.send_event = FALSE;
+ $event->area = $widget->allocation; //event.area = widget->allocation;
+ $event->region = null; //event.region = NULL;
+ $event->count = 0; //event.count = 0;
+
+ $tmp_window = $widget->window; //tmp_window = widget->window;
+ $widget->window = $pixmap; //widget->window = pixmap;
+ $widget->realize();
+ $widget->send_expose($event); //gtk_widget_send_expose (widget, (GdkEvent *) &event);
+ $widget->window = $tmp_window; //widget->window = tmp_window;
}
+}
?>
\ No newline at end of file
Modified: trunk/programs/ide/lib/ide.class.php (108 => 109)
--- trunk/programs/ide/lib/ide.class.php 2007-01-11 20:30:30 UTC (rev 108)
+++ trunk/programs/ide/lib/ide.class.php 2007-01-11 20:41:58 UTC (rev 109)
@@ -3,6 +3,10 @@
class CC_Ide extends CC_Main {
protected $editor;
+ protected $pane_top;
+ protected $pane_bottom;
+ protected $pane_left;
+ protected $pane_right;
protected $menubar = array(
'_File' => array(
@@ -24,6 +28,10 @@
'_View' => array(
//'toolbar:toggle',
'view:fullscreen',
+ 'view:top_pane',
+ 'view:bottom_pane',
+ 'view:left_pane',
+ 'view:right_pane',
),
'_Help' => array(
'help:help',
@@ -31,6 +39,8 @@
'separator',
'help:about',
),
+ '_Plugins' => array(
+ ),
);
protected $tooloptions = array(
@@ -47,7 +57,6 @@
'help:help',
'help:website',
'help:about',
- 'project:run',
'tools:preferences'
);
@@ -63,8 +72,6 @@
'edit:redo',
'separator',
'view:fullscreen',
- 'separator',
- 'project:run'
);
public function __construct()
@@ -72,13 +79,39 @@
parent::__construct();
$this->set_position(Gtk::WIN_POS_CENTER);
$this->set_name('ide');
+ CC_Wm::add_window($this);
$this->set_title('Callicore Development Enviroment');
$this->editor = new CC_Ide_editor();
- $this->vbox->pack_start($this->editor);
+ $vpaned1 = new GtkVPaned();
+ $vpaned2 = new GtkVPaned();
+ $hpaned1 = new GtkHPaned();
+ $hpaned2 = new GtkHPaned();
+ $vpaned1->pack1($vpaned2);
+ $vpaned2->pack2($hpaned1);
+ $hpaned1->pack2($hpaned2);
+ $this->pane_top = new GtkNoteBook();
+ //$this->pane_top->append_page(new GtkLabel('Top'));
+ $this->pane_bottom = new GtkNoteBook();
+ //$this->pane_bottom->append_page(new GtkLabel('bottom'));
+ $this->pane_left = new GtkNoteBook();
+ //$this->pane_left->append_page(new GtkLabel('Left'));
+ $this->pane_right = new GtkNoteBook();
+ //$this->pane_right->append_page(new GtkLabel('Right'));
+ $hpaned1->pack1($this->pane_left);
+ $vpaned1->pack2($this->pane_bottom);
+ $vpaned2->pack1($this->pane_top);
+ //$hpaned1->pack2(new GtkLabel('hpaned1 pack2'));
+ $hpaned2->pack1($this->editor);
+ $hpaned2->pack2($this->pane_right);
+ $this->vbox->pack_start($vpaned1);
$this->show_all();
+ $this->pane_top->hide_all();
+ $this->pane_bottom->hide_all();
+ $this->pane_left->hide_all();
+ $this->pane_right->hide_all();
}
- protected function register_actions(){
+ protected function register_actions(){
$actions = CC_Actions::instance();
$actions->add_action('tools',
array(
@@ -102,6 +135,50 @@
'image' => 'gtk-media-play',
)
);
+ $actions->add_action('view',
+ array(
+ 'type' => 'action',
+ 'name' => 'top_pane',
+ 'label' => 'Top pane',
+ 'short-label' => 'Top pane',
+ 'tooltip' => 'Top pane',
+ 'callback' => array($this, 'on_top_pane'),
+ 'image' => 'cc-view-top',
+ )
+ );
+ $actions->add_action('view',
+ array(
+ 'type' => 'action',
+ 'name' => 'bottom_pane',
+ 'label' => 'Bottom pane',
+ 'short-label' => 'Bottom pane',
+ 'tooltip' => 'Bottom pane',
+ 'callback' => array($this, 'on_bottom_pane'),
+ 'image' => 'cc-view-bottom',
+ )
+ );
+ $actions->add_action('view',
+ array(
+ 'type' => 'action',
+ 'name' => 'left_pane',
+ 'label' => 'Left pane',
+ 'short-label' => 'Left pane',
+ 'tooltip' => 'Left pane',
+ 'callback' => array($this, 'on_left_pane'),
+ 'image' => 'cc-view-left',
+ )
+ );
+ $actions->add_action('view',
+ array(
+ 'type' => 'action',
+ 'name' => 'right_pane',
+ 'label' => 'Right pane',
+ 'short-label' => 'Right pane',
+ 'tooltip' => 'Right pane',
+ 'callback' => array($this, 'on_right_pane'),
+ 'image' => 'cc-view-right',
+ )
+ );
$actions->add_action('file',
array(
'type' => 'action',
@@ -131,7 +208,7 @@
'label' => '_New',
'short-label' => '_New',
'tooltip' => 'New File',
- //'callback' => array($this, 'on_new'),
+ 'callback' => array($this, 'on_new'),
'image' => 'gtk-new',
)
);
@@ -201,6 +278,42 @@
}
+ public function on_new(){
+ $this->editor->new_document();
+ }
+
+ public function on_top_pane(){
+ if ($this->pane_top->is_visible()) {
+ $this->pane_top->hide_all();
+ }else{
+ $this->pane_top->show_all();
+ }
+ }
+
+ public function on_bottom_pane(){
+ if ($this->pane_bottom->is_visible()) {
+ $this->pane_bottom->hide_all();
+ }else{
+ $this->pane_bottom->show_all();
+ }
+ }
+
+ public function on_left_pane(){
+ if ($this->pane_left->is_visible()) {
+ $this->pane_left->hide_all();
+ }else{
+ $this->pane_left->show_all();
+ }
+ }
+
+ public function on_right_pane(){
+ if ($this->pane_right->is_visible()) {
+ $this->pane_right->hide_all();
+ }else{
+ $this->pane_right->show_all();
+ }
+ }
+
}
?>
\ No newline at end of file
Deleted: trunk/programs/ide/lib/ide_source.php (108 => 109)
--- trunk/programs/ide/lib/ide_source.php 2007-01-11 20:30:30 UTC (rev 108)
+++ trunk/programs/ide/lib/ide_source.php 2007-01-11 20:41:58 UTC (rev 109)
@@ -1,91 +0,0 @@
-<?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