]> git.neil.brown.name Git - edlib.git/commitdiff
devel
authorNeilBrown <neil@brown.name>
Wed, 3 Feb 2016 19:54:33 +0000 (06:54 +1100)
committerNeilBrown <neil@brown.name>
Wed, 3 Feb 2016 19:54:33 +0000 (06:54 +1100)
edlib.c
lang-python.c
python/display-pygtk.py
python/render-present.py
render-lines.c

diff --git a/edlib.c b/edlib.c
index f513a8658efeefd980761a32d80fc729e1b30cf0..cac22cfbf17d79149d6eea7dc4b8277998a3f16d 100644 (file)
--- a/edlib.c
+++ b/edlib.c
 #include "core.h"
 
 static char WelcomeText[] =
-       ":H1:center,bg:green\n"
-       "\n"
-       "# heading\n"
-       "line\n"
        "\n"
        "Welcome to 'edlib' - the beginning of what one day might be an editor\n"
        "\n"
-       "Current functionality includes:\n"
+       "Current functionality includes:\n"
        "  splitting and closing windows (C-x 0,1,2,3)\n"
        "  Resize current window (C-x },{,^)\n"
        "  Move among windows (C-x o,O  or mouse click)\n"
@@ -116,7 +112,7 @@ int main(int argc, char *argv[])
                key_handle(&ci);
 
                /* New window.. */
-               if (gtk)  {
+               if (gtk && 0)  {
                        memset(&ci, 0, sizeof(ci));
                        ci.home = ci.focus = vroot;
                        ci.key = "display-pygtk";
index a7445c55c677e37df4b868d9f0244fd29dff0582..1d06a8731cae3750ebcc12e9089ad0526c04b875 100644 (file)
@@ -649,7 +649,7 @@ static PyObject *Pane_get_item(Pane *self, PyObject *key)
                return NULL;
        }
        k = PyString_AsString(key);
-       v = attr_get_str(self->pane->attrs, k, -1);
+       v = pane_attr_get(self->pane, k);
        if (v)
                return Py_BuildValue("s", v);
        Py_INCREF(Py_None);
index 3847a750dec5b909107833dd58a4df4466d04fc1..c5b4cb408fc066ed168dff898af6bfdd1c6976e1 100644 (file)
@@ -46,6 +46,8 @@ class EdDisplay(gtk.Window):
             self.pane['scale'] = "%d"%(int(self.pane['scale']) * 100/105)
             return 1
         if key == "M-Chr-=" or key == "M-Chr-+":
+            if self.pane['scale'] is None:
+                self.pane['scale'] = "1000"
             self.pane['scale'] = "%d"%(int(self.pane['scale']) * 105/100)
             return 1
 
index bd25ee87bb9c6723943925ab7bacdd56476a8f63..5e18585e495bb74657d3de2c968310e158273b21 100644 (file)
@@ -421,6 +421,14 @@ class PresenterPane(edlib.Pane):
             v = ""
         return v
 
+    def pathto(self, f):
+        if f[0] == '/':
+            return f
+        path = self['filename']
+        if not path:
+            return f
+        return os.path.dirname(path)+'/'+f
+
     def handle(self, key, **a):
         if key == "Present-BG":
             cmds = a['str'].split(',')
@@ -429,14 +437,18 @@ class PresenterPane(edlib.Pane):
                 if c[:6] == 'color:':
                     f.call('pane-clear', c[6:])
                 if c[:14] == "image-stretch:":
-                    f.call('image-stretch-display', self.w, self.h, c[14:], (0,0))
+                    f.call('image-stretch-display', self.w, self.h, self.pathto(c[14:]), (0,0))
                 if c[:6] == "image:":
-                    f.call('image-display', self.w, self.h, c[6:], (0,0))
+                    f.call('image-display', self.w, self.h, self.pathto(c[6:]), (0,0))
                 if c[:8] == "overlay:":
-                    f.call('image-display', self.w/6, self.h*3/4, c[8:], (self.w*5/6, self.h/4))
+                    f.call('image-display', self.w/6, self.h*3/4, self.pathto(c[8:]), (self.w*5/6, self.h/4))
+                if c[:9] == "overlayC:":
+                    f.call('image-display', self.w/6, self.h*3/4, self.pathto(c[9:]), (self.w*5/12, self.h/8))
                 if c == "page-local":
                     page = self.find_pages(a['mark'])
-                    cm = self.get_local_attr(a['mark'], "background", page)
+                    self.clean_lines(page)
+                    self.mark_lines(page)
+                    cm = self.get_local_attr(a['mark'], "background", a['mark'])
                     if cm:
                         cmds.extend(cm.split(','))
             return 1
@@ -531,7 +543,7 @@ class PresenterPane(edlib.Pane):
                             c = -1
                         line = line[c+1:]
 
-                    cb("callback", self, "<image:"+line+",width:%d,height:%d>"%(width,height))
+                    cb("callback", self, "<image:"+self.pathto(line)+",width:%d,height:%d>"%(width,height))
                     return 1
 
                 line = re.sub("\*([A-Za-z0-9][^*<]*)\*", "<italic>\\1</>", line)
index 28a892fd88acaf088c0e2d60c0581ed9dd7a08a4..ea943a1c0200394e6611e625286adbbd73cf63fd 100644 (file)
@@ -863,6 +863,7 @@ static void render(struct mark *pm, struct pane *p)
                hide_cursor = 1;
 
 restart:
+       m = vmark_first(p, rl->typenum);
        y = 0;
        bg = pane_attr_get(p, "background");
        if (bg && strncmp(bg, "color:", 6) == 0) {
@@ -882,7 +883,7 @@ restart:
                a = strchr(f, ':');
                if (a)
                        *a++ = 0;
-               call5(f, p, 0, pm, a, 0);
+               call5(f, p, 0, m, a, 0);
                free(f);
        } else
                pane_clear(p, NULL);
@@ -892,7 +893,6 @@ restart:
                rl->header_lines = y;
        }
        y -= rl->skip_lines;
-       m = vmark_first(p, rl->typenum);
 
        p->cx = p->cy = -1;
        rl->cursor_line = 0;