seed r236 - trunk/examples/ide
- From: hortont svn gnome org
- To: svn-commits-list gnome org
- Subject: seed r236 - trunk/examples/ide
- Date: Tue, 11 Nov 2008 07:36:16 +0000 (UTC)
Author: hortont
Date: Tue Nov 11 07:36:16 2008
New Revision: 236
URL: http://svn.gnome.org/viewvc/seed?rev=236&view=rev
Log:
IDE update + cleanup
Modified:
trunk/examples/ide/ide-actions.js
trunk/examples/ide/ide-sourceview.js
trunk/examples/ide/ide-tabheader.js
trunk/examples/ide/ide-tabview.js
trunk/examples/ide/main.js
Modified: trunk/examples/ide/ide-actions.js
==============================================================================
--- trunk/examples/ide/ide-actions.js (original)
+++ trunk/examples/ide/ide-actions.js Tue Nov 11 07:36:16 2008
@@ -1,6 +1,6 @@
function new_file()
{
- tab_view.create_tab("");
+ window.tab_view.create_tab("");
}
function open_file()
@@ -18,7 +18,7 @@
if(current_tab().source_view.filename == "" && !current_tab().source_view.edited)
current_tab().source_view.load(file_chooser.get_filename());
else
- tab_view.create_tab(file_chooser.get_filename());
+ window.tab_view.create_tab(file_chooser.get_filename());
}
file_chooser.destroy();
@@ -56,7 +56,7 @@
function close_tab()
{
- tab_view.close_tab(null);
+ window.tab_view.close_tab(null);
}
function fortune()
@@ -64,12 +64,11 @@
}
-function init_ide_actions()
+function init_actions()
{
actions = new Gtk.ActionGroup({name:"toolbar"});
accels = new Gtk.AccelGroup();
- window.add_accel_group(accels);
var new_action = new Gtk.Action({name:"new", label:"New",
tooltip:"New File", stock_id:"gtk-new"});
@@ -122,4 +121,6 @@
actions.add_action_with_accel(fortune_action, "<Control><Alt>f");
fortune_action.connect_accelerator();
fortune_action.signal.activate.connect(fortune);
+
+ return accels;
}
Modified: trunk/examples/ide/ide-sourceview.js
==============================================================================
--- trunk/examples/ide/ide-sourceview.js (original)
+++ trunk/examples/ide/ide-sourceview.js Tue Nov 11 07:36:16 2008
@@ -13,6 +13,8 @@
tab.header.label.label = shortfilename;
else
tab.header.label.label = "Untitled";
+
+ this.get_toplevel().update_window_title(this.tab);
}
prototype.load = function(new_filename)
@@ -60,7 +62,6 @@
if(file_chooser.run() == Gtk.ResponseType.accept)
{
this.update_filename(file_chooser.get_filename(), current_tab());
- update_window(file_chooser.get_filename());
}
file_chooser.destroy();
Modified: trunk/examples/ide/ide-tabheader.js
==============================================================================
--- trunk/examples/ide/ide-tabheader.js (original)
+++ trunk/examples/ide/ide-tabheader.js Tue Nov 11 07:36:16 2008
@@ -3,10 +3,7 @@
name: "IDETabHeader",
class_init: function(klass, prototype)
{
- prototype.set_tab = function (tab)
- {
- this.close_button.signal.clicked.connect(tab_view.close_tab, tab);
- }
+
},
instance_init: function(klass)
{
Modified: trunk/examples/ide/ide-tabview.js
==============================================================================
--- trunk/examples/ide/ide-tabview.js (original)
+++ trunk/examples/ide/ide-tabview.js Tue Nov 11 07:36:16 2008
@@ -8,15 +8,14 @@
var tab = new IDETab();
tab.header = new IDETabHeader();
- tab.header.set_tab(tab);
- tab.source_view.load(filename);
+ tab.header.close_button.signal.clicked.connect(this.close_tab, tab);
this.append_page(tab, tab.header);
this.set_tab_reorderable(tab, true);
- this.page = this.get_n_pages() - 1;
+ tab.source_view.load(filename);
- this.update_page(this, null, this.page);
+ this.page = this.get_n_pages() - 1;
}
prototype.close_tab = function (button)
@@ -25,6 +24,8 @@
if(button == null)
tab_closing = current_tab();
+
+ var tab_view = tab_closing.parent;
if(tab_closing.source_view.edited)
{
@@ -42,27 +43,36 @@
prototype.force_close_current_tab = function ()
{
+ var tab_view = current_tab().parent;
+ // TODO: fold this and the above together, somehow
tab_view.remove_page(tab_view.page_num(current_tab()));
if(tab_view.get_n_pages() == 0)
tab_view.create_tab("");
}
- prototype.update_page = function (notebook, page, n)
+ prototype.update_page = function (tab_view, page, n)
{
- var my_page = notebook.get_nth_page(n);
- update_window(my_page.source_view.filename);
- my_page.source_view.update_undo_state(my_page.source_view);
+ var tab = tab_view.get_nth_page(n);
- if(my_page.message_area.visible)
- my_page.disable();
+ tab_view.get_toplevel().update_window_title(tab);
+
+ tab.source_view.update_undo_state(tab.source_view);
+
+ if(tab.message_area.visible)
+ tab.disable();
else
- my_page.enable();
+ tab.enable();
+ }
+
+ prototype.connect_signals = function (tab_view)
+ {
+ tab_view.signal.switch_page.connect(tab_view.update_page);
}
},
instance_init: function(klass)
{
- this.signal.switch_page.connect(this.update_page);
+ this.signal.hierarchy_changed.connect(this.connect_signals)
this.show();
}};
Modified: trunk/examples/ide/main.js
==============================================================================
--- trunk/examples/ide/main.js (original)
+++ trunk/examples/ide/main.js Tue Nov 11 07:36:16 2008
@@ -11,6 +11,7 @@
Gtk.init(null, null);
GConf.init(null, null);
+Seed.include("ide-window.js");
Seed.include("ide-actions.js");
Seed.include("ide-sourceview.js");
Seed.include("ide-tab.js");
@@ -19,39 +20,11 @@
Seed.include("ide-toolbar.js");
Seed.include("ide-messagearea.js");
-// TODO: put this in a subclass of the window and give it a tab (read it out of the header)
-function update_window(new_filename)
-{
- var shortfilename = new_filename.split("/").slice(-1);
-
- if(new_filename != "")
- window.title = "Seed IDE - " + shortfilename;
- else
- window.title = "Seed IDE";
-}
-
function current_tab()
{
- return tab_view.get_nth_page(tab_view.page);
+ return window.tab_view.get_nth_page(window.tab_view.page);
}
-var window = new Gtk.Window();
-window.resize(700, 700);
-window.signal.hide.connect(Gtk.main_quit);
-
-init_ide_actions();
-
-var toolbar = new IDEToolbar();
-
-var tab_view = new IDETabView();
-tab_view.create_tab("../ls.js");
-
-var vbox = new Gtk.VBox();
-vbox.pack_start(toolbar);
-vbox.pack_start(tab_view, true, true);
-vbox.show();
-
-window.add(vbox);
-window.show();
+window = new IDEWindow();
Gtk.main();
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]