]> git.neil.brown.name Git - edlib.git/commitdiff
Rename pane-clear to Draw:clear
authorNeilBrown <neil@brown.name>
Tue, 29 Jun 2021 23:30:58 +0000 (09:30 +1000)
committerNeilBrown <neil@brown.name>
Wed, 30 Jun 2021 11:49:54 +0000 (21:49 +1000)
This is part of making all commands for changing the display start with
Draw:.

- pane-clear is now Draw:clear
- str2 is ignored, str1 has the attributes
- render-present expected "color:" to be followed by a colour, not
  "bg:colour".  This requires the test to be refreshed.
- add some documentation to "DOC/Calls".

Signed-off-by: NeilBrown <neil@brown.name>
DOC/Calls
DOC/lca2016/edlib.md
README.md
display-ncurses.c
lib-messageline.c
lib-renderline.c
lib-view.c
python/display-pygtk.py
python/render-present.py
render-lines.c
tests.d/02-presenter

index 8325e182f9d456278ef0c83b433b5cfb50e76425..b77e8b6f2f3b0898a22ce86c9dda663439c4435b 100644 (file)
--- a/DOC/Calls
+++ b/DOC/Calls
@@ -58,3 +58,18 @@ Known notifications include:
 
 - Keystroke-notify - string is the key name
 - Mouse-event-notify - string is the event name
+
+# Displays
+
+A display pane provides linkage to keyboard/pointer input, and visual output.
+It will generate Keystroke and Mouse-event events for its parent, and expect
+various Draw: event from children.
+
+## Draw:clear
+
+Draw:clear will allocation a display image for the focus pane and clear it.
+"str1" can be attributes for the background, typically a background colour
+such as "bg:cyan". If no attributes are given and there is another pane
+close to the root which has been cleared, the appropriate section of the
+image for that pane is copied it the image for 'focus'.  If ther is no
+image to copy from, the pane is cleared to "bg:white".
index aa4cba9bde108844121ac259aac7a0e7a182fc81..78e3e2cf931df45c67594c2f6aee7ee210e111ab 100644 (file)
@@ -1,6 +1,6 @@
 :H1:center,20,fg:blue,space-above:15,family:sans
 :H2:center,15,fg:darkblue
-:background:color:bg:#b8c5cd,image-stretch:back.jpg,page-local
+:background:color:#b8c5cd,image-stretch:back.jpg,page-local
 :scale:590x200
 :P:left:30,12,family:sans
 :bullet:fg:red,13
index 5859096cdb27b60fb835cc28ed3f40baf2dfb52f..1895170d055a23fb2c1fd02e76a0c5ffd8326cc5 100644 (file)
--- a/README.md
+++ b/README.md
@@ -235,7 +235,7 @@ Displays
 --------
 
 A “display” is just a pane which can create an image somehow, and
-responds to commands like “pane-clear”, “text-display”, and
+responds to commands like “Draw:clear”, “text-display”, and
 “image-display”.  Displays are typically quite close to the root of the
 “pane” tree, but this is not a requirement.
 
index 92a08ba4b853cdd073f21aca88294a2b9e37e861..1ea6c826fa71aacf9e275b04cbb41137b207c4f2 100644 (file)
@@ -696,7 +696,6 @@ static int to_pair(struct display_data *dd safe, int fg, int bg)
        return c->content;
 }
 
-
 static int cvt_attrs(struct pane *p safe, struct pane *home safe,
                     const char *attrs)
 {
@@ -821,7 +820,7 @@ static PANEL * safe pane_panel(struct pane *p safe, struct pane *home)
 DEF_CMD(nc_clear)
 {
        struct pane *p = ci->home;
-       int attr = cvt_attrs(ci->focus, p, ci->str2?:ci->str);
+       int attr = cvt_attrs(ci->focus, p, ci->str);
        PANEL *panel;
        WINDOW *win;
        int w, h;
@@ -1379,7 +1378,7 @@ void edlib_init(struct pane *ed safe)
        key_add(nc_map, "Display:external-viewer", &nc_external_viewer);
        key_add(nc_map, "Close", &nc_close);
        key_add(nc_map, "Free", &edlib_do_free);
-       key_add(nc_map, "pane-clear", &nc_clear);
+       key_add(nc_map, "Draw:clear", &nc_clear);
        key_add(nc_map, "text-size", &nc_text_size);
        key_add(nc_map, "Draw:text", &nc_draw_text);
        key_add(nc_map, "Refresh:size", &nc_refresh_size);
index 1ef99c6ebc1a4e52caf789b6714e65590da52561..f21fd2f5d7a7d12bfc9e54d807a51198b6c0b823 100644 (file)
@@ -189,7 +189,7 @@ DEF_CMD(messageline_line_refresh)
 {
        struct mlinfo *mli = ci->home->data;
 
-       call("pane-clear", mli->line, 0, NULL, "bg:white");
+       call("Draw:clear", mli->line, 0, NULL, "bg:white");
        if (mli->message && !mli->modal &&
            time(NULL) >= mli->last_message + 30) {
                free(mli->message);
index 6a7a43f683d15bad162ac5ed615c476e3f5dba23..661215f31d901b95817b266b263d2af835712f0e 100644 (file)
@@ -507,7 +507,7 @@ DEF_CMD(renderline)
        start = line_start = line;
 
        if (dodraw)
-               home_call(focus, "pane-clear", p);
+               home_call(focus, "Draw:clear", p);
 
        if (strncmp(line, "<image:",7) == 0) {
                /* For now an <image> must be on a line by itself.
index a34f4fd8000015e07d3a88423435515211d51176..d1c08f0fa74b43e82d8fe0be86e73b019dc32d00 100644 (file)
@@ -166,7 +166,7 @@ DEF_CMD(view_refresh)
        if (vd->line_height <= 0)
                return 1;
 
-       call("pane-clear", p);
+       call("Draw:clear", p);
        pm = call_ret(mark, "doc:point", ci->focus);
        status = pane_attr_get(ci->focus, "status-line");
        if (!status)
index 91ea781f66adeaed612c1c420468234b3f6f01fd..04d1e139ce808113cc5ec66c224695595cac788f 100644 (file)
@@ -100,11 +100,9 @@ class EdDisplay(edlib.Pane):
         self.win.destroy()
         return True
 
-    def handle_clear(self, key, focus, str, str2, **a):
-        "handle:pane-clear"
-        attr = str2
-        if attr is None:
-            attr = str
+    def handle_clear(self, key, focus, str1, **a):
+        "handle:Draw:clear"
+        attr = str1
         if attr is not None:
             fg, bg, ul = self.get_colours(attr)
         else:
index 49069d9faf067c63b403efa06dff3f86740aee51..e7a001a3ad0052e6535a996876b625eda2940fc2 100644 (file)
@@ -452,7 +452,7 @@ class PresenterPane(edlib.Pane):
         for c in cmds:
             rv = None
             if c[:6] == 'color:':
-                rv = focus.call('pane-clear', c[6:])
+                rv = focus.call('Draw:clear', 'bg:' + c[6:])
             if c[:14] == "image-stretch:":
                 rv = focus.call('Draw:image', 1, "file:" + self.pathto(c[14:]))
             if c[:6] == "image:":
index 55332803b08cffd64c772ce6ee92ade649c28169..f58125c87da2e1b1c91a63ff9eff5ed0026b655a 100644 (file)
@@ -750,23 +750,23 @@ static int render(struct mark *pm, struct pane *p safe,
        m = vmark_first(focus, rl->typenum, p);
        s = pane_attr_get(focus, "background");
        if (s && strncmp(s, "call:", 5) == 0) {
-               home_call(focus, "pane-clear", p);
+               home_call(focus, "Draw:clear", p);
                home_call(focus, s+5, p, 0, m);
        } else if (rl->background_drawn)
                ;
        else if (!s)
-               home_call(focus, "pane-clear", p);
+               home_call(focus, "Draw:clear", p);
        else if (strncmp(s, "color:", 6) == 0) {
                char *a = strdup(s);
                strcpy(a, "bg:");
                strcpy(a+3, s+6);
-               home_call(focus, "pane-clear", p, 0, NULL, a);
+               home_call(focus, "Draw:clear", p, 0, NULL, a);
                free(a);
        } else if (strncmp(s, "image:", 6) == 0) {
-               home_call(focus, "pane-clear", p);
+               home_call(focus, "Draw:clear", p);
                home_call(focus, "Draw:image", p, 1, NULL, s+6);
        } else
-               home_call(focus, "pane-clear", p);
+               home_call(focus, "Draw:clear", p);
        rl->background_drawn = True;
 
        if (rl->header && vmark_is_valid(rl->header)) {
@@ -832,7 +832,7 @@ static int render(struct mark *pm, struct pane *p safe,
                                    p->h - lineheight,
                                    mwidth, lineheight);
 
-                       home_call(focus, "pane-clear", cp);
+                       home_call(focus, "Draw:clear", cp);
                        home_call(focus, "Draw:text", cp, 0, NULL, " ",
                                  scale.x, NULL, "",
                                  0, lineheight-1);
index cc96bfa062a521e003f3b5f03d6aa9a40656c62f..f317e2c4df660fd8558838f155722d2dacccd2e8 100644 (file)
@@ -98,41 +98,35 @@ Display 80,30 CC1C1CC11C196E098C07D2CFC7D38A1C 56,3
 Key "-o"
 Display 80,30 1F8AF2793311FE2F2A762DBD463488EE 57,3
 Key "-r"
-Display 80,30 30A8DFB0C9FB61828F3FF5A3DE98871C 58,3
+Display 80,30 6A84ED88C9ACDA55ACD36CD54B53C540 58,3
 Key "-:"
-Display 80,30 A085A0961D482C14311C5E640FF33791 59,3
-Key "-b"
-Display 80,30 813CB8FA09176AD0CE6FDACEFDAF688C 60,3
-Key "-g"
-Display 80,30 C93D29F41B64EA3E87596A05A00A2351 61,3
-Key "-:"
-Display 80,30 41C2B28A8592D97BC8B14AD6B421ED1C 62,3
+Display 80,30 51C597208DD4A414A4AFE2A1A5094129 59,3
 Key "-#"
-Display 80,30 0524ABBAF533D051EB2D029D913763B4 63,3
+Display 80,30 F36F71AD9F7D2FDC7DCB42599CADC86F 60,3
 Key "-b"
-Display 80,30 87A17646A8AF6411C97F0C28CF05AFBB 64,3
+Display 80,30 903ACDE9CBFDBAB086B1AE2305B4EB3F 61,3
 Key "-8"
-Display 80,30 3CCA2F0D775454090D5DB4F3033E0917 65,3
+Display 80,30 D2A407FA26421CB84B0CDA4F5D2ED41E 62,3
 Key "-c"
-Display 80,30 30E3508BCB280906C39D0BFF779AE1C1 66,3
+Display 80,30 54BFC3BF5B34D5BF104BEDE0C794AFA4 63,3
 Key "-5"
-Display 80,30 41856E5E7D1DFE48B484349F0D94DEB5 67,3
+Display 80,30 261A5D3E821E9932712037845C1B2EF7 64,3
 Key "-c"
-Display 80,30 4803008525418FB5A3B7D06C28DCFF5D 68,3
+Display 80,30 96F6C9544F88E9AD92D14E2AA9AC6A48 65,3
 Key "-d"
-Display 80,30 EE07419E01C92BCD8BB8EFFB1B2D068C 69,3
+Display 80,30 F22DB0A00EB5553F6CB8ADF7B3530F6B 66,3
 Key "-,"
-Display 80,30 02066CCB40E54A15F08788C573F7519C 70,3
+Display 80,30 E88E2D6B962F3C862E310093B28D557A 67,3
 Key ":C-D"
-Display 80,30 0DCB42F5714FFCA4CCB1F375AFF80F82 70,3
+Display 80,30 D294FC7BA1202D06CFB6AD98B1CD5F2B 67,3
 Key ":A-<"
-Display 80,30 69A2BF53E432DC83E816B4867246A290 41,0
+Display 80,30 F2E0F92EF33DA2A3E6B5E7C963F90BB8 41,0
 Key ":C-X"
-Display 80,30 EDFD4E1A58B100A708F273891DCE96E2 41,0
+Display 80,30 27D83ACE9F983650D3D30283B1D9A003 41,0
 Key ":C-S"
-Display 80,30 46A7BDEAA04E8EA976CFA91D605BDEAE 41,0
+Display 80,30 6A0EA60D8101143E81B030368AA1A1C7 41,0
 Key ":C-V"
-Display 80,30 D9822F1B9927F09A99B739D3CDF3E949 41,14
+Display 80,30 90808C66D076F7F6A9C135962F137EAE 41,14
 Key ":C-V"
 Display 80,30 08FE57104D15702DB7F960C95B5843B8 41,23
 Key ":C-V"
@@ -176,9 +170,9 @@ Display 80,30 49AE523E91063113DD9CD224B8EC1E7C 41,6
 Key "-o"
 Display 80,30 8139E6415E6BA8ED807322973A462EC3 41,6
 Key ":A-<"
-Display 80,30 97483E8ED6548D02F1CC29EB20FA29F5 41,0
+Display 80,30 F6EFCA04AF03776EAE8DC828399BC4A6 41,0
 Key ":C-V"
-Display 80,30 FA6B6E9FBB2EDDCB022719C49FD2E4BF 41,14
+Display 80,30 0F80582BA5B1C2721F931D0657AF4D38 41,14
 Key ":C-V"
 Display 80,30 9BA759D549D1BCABD2E898BC8BF3949F 41,23
 Key ":C-S"