Menus file accept comment line

Menus file accept comment line

Postby luowy » Tue Jun 09, 2020 6:29 am

Rsrc/Menus.odc file does not accept comment lines, it's inconvenient when we customize the menu;
they are menu configuration files actually. in linux ,the configuration file accepts comments :
Code: Select all
# comments here

a small patch has made to accept comment line,StdMemuTool.Scan
Code: Select all
   PROCEDURE Scan (VAR s: TextMappers.Scanner);
      VAR ch: CHAR; pos: INTEGER; opts: SET;
   BEGIN
      s.Scan;
      IF s.type = string THEN
         pos := s.rider.Pos() - 1;
         IF ~s.rider.eot THEN DEC(pos) END;
         s.rider.SetPos(pos); s.rider.ReadChar(ch); s.rider.Read;
         IF ch # '"' THEN s.type := keyword END
      ELSIF (s.type = char)&(s.char = '#') THEN
         opts := s.opts;
         s.SetOpts(opts + {TextMappers.returnCtrlChars});
         REPEAT s.Scan(); UNTIL (s.type = TextMappers.line) OR (s.type = TextMappers.eot);
         s.SetOpts(opts);
         Scan(s);
      END
   END Scan;

after patching, you can comment out any menus you dont want, and restore them easily;
Code: Select all
   "&Documentation"   ""   "DevReferences.ShowDocu"   "TextCmds.SelectionGuard"
#"De&pendencies"   ""   "DevDependencies.Deposit;StdCmds.Open"   "TextCmds.SelectionGuard"

luowy
luowy
 
Posts: 216
Joined: Mon Oct 20, 2014 12:52 pm

Re: Menus file accept comment line

Postby Robert » Tue Jun 09, 2020 7:33 am

I think this would be a useful feature.

Two other comments:

1 - Is it easy to add attributes to menu entries? In particular I would like to use color.

2 - The last menu entry in the Windows menu is
Code: Select all
   SEPARATOR
   "*"   ""   "HostMenus.WindowList"   ""
where the procedure WindowList is
Code: Select all
   PROCEDURE WindowList*;
   BEGIN
      HALT(127)
   END WindowList;
Is this mechanism explained anywhere? I would like to do something similar in my own menus.
User avatar
Robert
 
Posts: 1016
Joined: Sat Sep 28, 2013 11:04 am
Location: Edinburgh, Scotland

Re: Menus file accept comment line

Postby luowy » Tue Jun 09, 2020 3:46 pm

1, no, had to subclass some window;

2,"HostMenus.WindowList" ,it's only a flag, indicate this popup menu will append MDI sub window list;
the work is done by the default procedure of MDI client window;

in HostMenus.InitMenus, UpdateMenus
Code: Select all
res := WinApi.SendMessageW(HostWindows.client, WinApi.WM_MDISETMENU, menuBar, winMenu);

"winMenu" is the popup menu which the MDI window list will append to;
luowy
 
Posts: 216
Joined: Mon Oct 20, 2014 12:52 pm

Re: Menus file accept comment line

Postby Robert » Fri Jun 12, 2020 9:02 pm

Does anyone else have an opinion about whether it is worth adding this feature?
User avatar
Robert
 
Posts: 1016
Joined: Sat Sep 28, 2013 11:04 am
Location: Edinburgh, Scotland


Return to Features

Who is online

Users browsing this forum: No registered users and 1 guest

cron