public Xcls_sourceviewscroll sourceviewscroll;
public Xcls_sourceview sourceview;
public Xcls_buffer buffer;
+ public Xcls_keystate keystate;
public Xcls_search_entry search_entry;
public Xcls_search_results search_results;
public Xcls_nextBtn nextBtn;
// my vars (def)
public Gtk.Widget lastObj;
- public Gtk.CssProvider css;
public Xcls_MainWindow main_window;
- public GtkSource.SearchContext searchcontext;
public int last_error_counter;
public int last_search_end;
+ public GtkSource.SearchContext searchcontext;
public JsRender.JsRender file;
// ctor
this.el.vexpand = true;
new Xcls_notebook( _this );
this.el.append( _this.notebook.el );
-
- // init method
-
- {
-
- this.css = new Gtk.CssProvider();
-
- this.css.load_from_string(
- "#gtkview-view-layout { background-color: #ccc; }"
- );
-
- Gtk.StyleContext.add_provider_for_display(
- this.el.get_display(),
- this.css,
- Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION
- );
-
-
- }
}
// user defined functions
}
var xmlstr = JsRender.NodeToGlade.mungeFile( file);
- var builder = new Gtk.Builder.from_string (xmlstr, xmlstr.length);
+ var builder = new Gtk.Builder();
+ try {
+ if (!builder.add_from_string(xmlstr, xmlstr.length)) {
+ return;
+ }
+ } catch(GLib.Error e) {
+ GLib.debug(e.message);
+ return;
+ }
+
+
var obj = (Gtk.Widget) builder.get_object("w"+ file.tree.oid.to_string());
this.container.el.append(obj);
obj.show();
- GLib.debug("highlight errors");
+ //GLib.debug("highlight errors");
// we should highlight other types of errors..
buf.remove_source_marks (start, end, "WARN");
buf.remove_source_marks (start, end, "DEPR");
this.last_error_counter = file.error_counter ;
- GLib.debug("higjlight has no errors");
+ //GLib.debug("higjlight has no errors");
return;
}
if (this.last_error_counter == file.error_counter) {
this.el.overflow = Gtk.Overflow.VISIBLE;
new Xcls_label_preview( _this );
new Xcls_label_code( _this );
- var child_3 = new Xcls_ScrolledWindow5( _this );
+ var child_3 = new Xcls_ScrolledWindow4( _this );
child_3.ref();
this.el.append_page ( child_3.el , _this.label_preview.el );
- var child_4 = new Xcls_Box8( _this );
+ var child_4 = new Xcls_Box7( _this );
child_4.ref();
this.el.append_page ( child_4.el , _this.label_code.el );
}
// user defined functions
}
- public class Xcls_ScrolledWindow5 : Object
+ public class Xcls_ScrolledWindow4 : Object
{
public Gtk.ScrolledWindow el;
private Xcls_GtkView _this;
// my vars (def)
// ctor
- public Xcls_ScrolledWindow5(Xcls_GtkView _owner )
+ public Xcls_ScrolledWindow4(Xcls_GtkView _owner )
{
_this = _owner;
this.el = new Gtk.ScrolledWindow();
- public class Xcls_Box8 : Object
+ public class Xcls_Box7 : Object
{
public Gtk.Box el;
private Xcls_GtkView _this;
// my vars (def)
// ctor
- public Xcls_Box8(Xcls_GtkView _owner )
+ public Xcls_Box7(Xcls_GtkView _owner )
{
_this = _owner;
this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
// my vars (def)
public bool loading;
- public bool zallow_node_scroll;
public string prop_selected;
- public Gtk.CssProvider css;
public JsRender.Node? node_selected;
// ctor
// my vars (dec)
this.loading = false;
- this.zallow_node_scroll = true;
- this.prop_selected = "";
+ this.prop_selected = "\"\"";
// set gobject values
this.el.name = "gtkview-view";
this.el.editable = false;
this.el.show_line_marks = true;
this.el.show_line_numbers = true;
+ this.el.css_classes = { "code-editor" };
this.el.tab_width = 4;
new Xcls_buffer( _this );
this.el.set_buffer ( _this.buffer.el );
- var child_2 = new Xcls_EventControllerKey12( _this );
- child_2.ref();
- this.el.add_controller( child_2.el );
+ new Xcls_keystate( _this );
+ this.el.add_controller( _this.keystate.el );
+ var child_3 = new Xcls_EventControllerScroll12( _this );
+ child_3.ref();
+ this.el.add_controller( child_3.el );
// init method
{
-
- this.css = new Gtk.CssProvider();
-
- this.css.load_from_string("#gtkview-view { font: 10px monospace ;}");
-
- Gtk.StyleContext.add_provider_for_display(
- this.el.get_display(),
- this.css,
- Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION
- );
-
-
+
this.loading = true;
-
-
+
var attrs = new GtkSource.MarkAttributes();
attrs.set_icon_name ( "process-stop");
attrs.query_tooltip_text.connect(( mark) => {
this.loading = true;
var buf = this.el.get_buffer();
buf.set_text("",0);
- var sbuf = (GtkSource.Buffer) buf;
+
var cpos = buf.cursor_position;
print("BEFORE LOAD cursor = %d\n", cpos);
// user defined functions
}
- public class Xcls_EventControllerKey12 : Object
+ public class Xcls_keystate : Object
{
public Gtk.EventControllerKey el;
private Xcls_GtkView _this;
// my vars (def)
+ public bool is_control;
// ctor
- public Xcls_EventControllerKey12(Xcls_GtkView _owner )
+ public Xcls_keystate(Xcls_GtkView _owner )
{
_this = _owner;
+ _this.keystate = this;
this.el = new Gtk.EventControllerKey();
// my vars (dec)
+ this.is_control = false;
// set gobject values
//listeners
+ this.el.key_released.connect( (keyval, keycode, state) => {
+
+ if (keyval == Gdk.Key.Control_L || keyval == Gdk.Key.Control_R) {
+ this.is_control = false;
+ }
+ });
this.el.key_pressed.connect( (keyval, keycode, state) => {
-
+ if (keyval == Gdk.Key.Control_L || keyval == Gdk.Key.Control_R) {
+ this.is_control = true;
+ }
if (keyval == Gdk.Key.g && (state & Gdk.ModifierType.CONTROL_MASK ) > 0 ) {
GLib.debug("SAVE: ctrl-g pressed");
// user defined functions
}
+ public class Xcls_EventControllerScroll12 : Object
+ {
+ public Gtk.EventControllerScroll el;
+ private Xcls_GtkView _this;
+
+
+ // my vars (def)
+ public double distance;
+
+ // ctor
+ public Xcls_EventControllerScroll12(Xcls_GtkView _owner )
+ {
+ _this = _owner;
+ this.el = new Gtk.EventControllerScroll( Gtk.EventControllerScrollFlags.VERTICAL );
+
+ // my vars (dec)
+ this.distance = 0.0f;
+
+ // set gobject values
+
+ //listeners
+ this.el.scroll.connect( (dx, dy) => {
+ if (!_this.keystate.is_control) {
+ return false;
+ }
+ //GLib.debug("scroll %f", dy);
+
+ this.distance += dy;
+ if (this.distance < -1) {
+ BuilderApplication.settings.editor_font_size ++;
+ this.distance = 0;
+ }
+ if (this.distance > 1) {
+ BuilderApplication.settings.editor_font_size --;
+ this.distance = 0;
+ }
+
+ return true;
+ });
+ }
+
+ // user defined functions
+ }
+
public class Xcls_Box13 : Object
child_1.ref();
this.el.add_controller( child_1.el );
- // init method
-
- this.css = new Gtk.CssProvider();
-
- this.css.load_from_string("
- #gtkview-search-entry { font: 10px monospace ;}"
- );
-
- Gtk.StyleContext.add_provider_for_display(
- this.el.get_display(),
- this.css,
- Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION
- );
-
//listeners
this.el.search_changed.connect( () => {