*****************************************************************
***              ContextMenu AkelPad plugin v17.6             ***
*****************************************************************

2007-2017   aka Instructor (Shengalts@mail.ru)


***  ***

       
, MDI ,    .

:
-          
   Ctrl       .
-        Win95.


***  ***

ContextMenu::Main
 .

ContextMenu::Show
  .


***  ***

:
  %f  
  %d   
  %a  AkelPad'
  %m   (handle)
  %i   
  %u URL  (   " ")
  %%  %
  % %

:
  # 
  ; 

  :
  SEPARATOR
      .
  SEPARATOR1
    ,   SEPARATOR, :
    -    SEPARATOR1 ,     SEPARATOR1;
    -   SEPARATOR1      ,    .
  EXPLORER
     .
  FAVOURITES
      .
  RECENTFILES
      .
  LANGUAGES
      .
  OPENCODEPAGES
        .
  SAVECODEPAGES
        .
  MDIDOCUMENTS
     MDI  (   " "   MDI).
  CLEAR
      (   " ").
  INCLUDE(" ")
    " "
         " ContextMenu::Show".
    INCLUDE("SYNTAXTHEME")
         "SYNTAXTHEME"  " ContextMenu::Show".
  SET([,  ])
        (   ).   :
      SET(1)
          ,    SDI.
      SET(2)
          ,    MDI.
      SET(4)
          ,    PMDI.
      SET(8)
             ,    .
      SET(16)
              (: ,  Menu(),   INCLUDE).
         SET(16)     ,  UNSET(16)   .
      SET(32, "%a\AkelFiles\Plugs\Scripts.dll")
          ,   "Scripts.dll" .
      SET(64, If(""[, , ]))
          ,     .
          ""
              :
            -  :
              +, -, *, /, %, &, |, ^.
            -  :
              >, <, ==, !=, >=, <=, &&, ||, x?y:z.
            - :
              /**/
            - :
              SendMain(nMessage, wParam, lParam)
                nMessage
                  ,     .
                wParam
                   .
                lParam
                   .
              SendEdit(nMessage, wParam, lParam)
                nMessage
                  ,     .
                wParam
                   .
                lParam
                   .
              Call("::"[,  ])
                -   ,        &nResult. &nResult    ,        .
                  SET(64, If(`Call("Coder::CodeFold", 1, &nResult)`)
                      ,    CodeFold.
                -   ,      2  4,         AkelPad.ScriptExitCode.
                  SET(64, If(`Call("Scripts::Main", 4, "EvalCmd.js", 'if (AkelPad.GetEditFile(0)) AkelPad.ScriptExitCode(1);')`)
                      ,     .
                -    Scripts  .
                  SET(64, If(`AkelPad.Constants._X64 == 1`))
                      ,     x64.
          
             ,    -  (  ).
          
             ,    -  ( ).
        SET(64, If(`SendMain(1222 /*AKD_GETMAININFO*/, 5 /*MI_SAVESETTINGS*/, 0) == 2 /*SS_INI*/`))
            ,     ini .
      SET(128, If(""[, , ]))
           .
          ""
            .  SET(64).
          
            0x0 //IFS_NORMAL     .
            0x1 //IFS_CHECKED     .
            0x2 //IFS_GRAYED    ,  .
            0x4 //IFS_DISABLED   .
          
            0x0 //IFS_NORMAL     .
            0x1 //IFS_CHECKED     .
            0x2 //IFS_GRAYED    ,  .
            0x4 //IFS_DISABLED   .
        SET(128, If("SendMain(1223 /*AKD_GETFRAMEINFO*/, 69 /*FI_CARETOPTIONS*/, 0) & 0x2 /*CO_CARETVERTLINE*/", 0x1, 0x0))
             ,    .
        SET(128, If(`Call("Scripts::Main", 5, "SearchReplace.js", 2 /*SH_THISSCRIPT*/, &nResult)`, 0x1, 0x0))
            ,    SearchReplace.js.
        SET(128, If(`AkelPad.IsPluginRunning("Coder::HighLight")`, 0x1, 0x0))
            ,   Coder::HighLight.
  UNSET()
       . .   SET().

  :
  [-]"[  ]" [Command() | Call() | +Call() | Exec() | OpenFile() | SaveFile() | Font() | Recode() | Insert() | Link() | Favourites() | Menu()] [Icon()]

  [-]"[  ]"
    "  "
        .
    -"  "
         ,     -    
      ( ,  ).
    ""
          ,     Command(),  
        ,     Command().

    Command([, ])
      Command(4162)
              4162.     
             "  ...".
           : . AkelHelp-Rus.htm  AkelDLL.h    .
    Call("::"[,  ])
      Call("Scripts::Main")
           Scripts   Main.
    +Call("::"[,  ])
      +Call("LineBoard::Main")
           LineBoard   Main.     
         .
    Exec(" "[, " "][, ][, ])
      " "
         .
      " "
         .   "".
      
          . 1 - , 0 -   ( ).
       (  ):
        0  .
        1    ( ).
        2  .
        3  .
        6 ,   .
        9   .
        :     .
      Exec("notepad.exe")
          .
      Exec(`notepad.exe`)
          .
      Exec('notepad.exe')
          .
      Exec('%windir%\notepad.exe')
          .
      Exec(`rundll32.exe shell32,ShellExec_RunDLL "%f"`, "%d")
                Windows.
    OpenFile(""[, ][, BOM])
      ""
          .
      
         .  -1   ,    .
      BOM
         BOM .  -1   ,    .
      OpenFile("C:\File.txt", 65001, -1)
             UTF-8.
    SaveFile(""[, ][, BOM])
      ""
             .
      
         .  -1   ,    .
      BOM
         BOM . 1 - , 0 - , -1    -   BOM.
      SaveFile("C:\File.txt", 65001, 0)
             UTF-8  BOM.
    Font("", , )
      ""
         , , "Courier".  ,  "".
       (  ):
        0  .
        1   .
        2   .
        3   .
        4    .
      
         .  ,  0.
      Font("Courier", 4, 10)
            Courier   10 pt.
    Recode(, )
      
         .  -1,    .
      
         .  -1,    .
      Recode(1251, 866)
             1251  866.
    Insert(""[, Esc-])
      ""
         .
      Esc-:
        0  ""   Esc- ( ).
        1  ""  Esc-.   
            /  ,  :
           "\s" -       ;
           "\|" -       .
      Insert(" ")
             .
      Insert("<B>\s</B>", 1)
              .
      Insert("\[0031 0032 0033]", 1)
            "123".
    Link()
      Link(1)
            (   " ").
      Link(2)
           (   " ").
      Link(3)
           (   " ").
      Link(4)
           (   " ").
      Link(5)
               (   " ").
      Link(6)
           (   " ").
    Favourites()
      Favourites(1)
              ( ).
      Favourites(2)
              ( ).
      Favourites(3)
            .
      Favourites(4)
             .
    Menu(" ")
      " "
           " ContextMenu::Show".
      Menu("SYNTAXTHEME")
           "SYNTAXTHEME"  " ContextMenu::Show".

    Icon([""][, ])
      Icon("Shell32.dll", 47)
            Shell32.dll   47.
      Icon("%a\AkelFiles\Plugs\Explorer.dll")
            Explorer.dll   0.
      Icon("%a\AkelFiles\Plugs\Toolbar\MyIcon.ico")
            MyIcon.ico.
      Icon(12)
            ContextMenu.dll   12.

:
  " " Command(4182)
  "" Command(4182)
  " " Call("Format::LineSortStrAsc")
  -" " Call("Scripts::Main", 1, "SpellCheck.js", "")
  " " +Call("Coder::Highlight")
  " " Exec("regedit.exe") Icon("regedit.exe")

 :
  "[ ]" [Index() | Break() | Icon()]
  {
  }

  "[ ]"
    " "
       .

    Index()
      Index(-1)
               ,    ,       .
    Break()
      Break(-1)
        ,   Index(),        .
    Icon([""][, ])
      Icon(0)
        .     .  Icon()      .

:
  "&" Index(-1)
  {
    "  Windows-1251	Alt+W" Command(4122)
    "  DOS-866	Alt+D" Command(4123)
    "  8- 	Alt+K" Command(4124)
    "  UTF-16LE ()	Alt+L" Command(4125)
    "  UTF-16BE	Alt+B" Command(4126)
    "  UTF-8	Alt+U" Command(4127)
    SEPARATOR
    "& " Icon("%a\AkelFiles\Plugs\ToolBar.dll", 36)
    {
      OPENCODEPAGES
    }
    SEPARATOR
    "  Windows-1251	Shift+Alt+W" Command(4131)
    "  DOS-866	Shift+Alt+D" Command(4132)
    "  8-	Shift+Alt+K" Command(4133)
    "  UTF-16LE ()	Shift+Alt+L" Command(4134)
    "  UTF-16BE	Shift+Alt+B" Command(4135)
    "  UTF-8	Shift+Alt+U" Command(4136)
    "  UTF-8 (& BOM)" Command(4137)
    SEPARATOR
    "& " Icon("%a\AkelFiles\Plugs\ToolBar.dll", 5)
    {
      SAVECODEPAGES
    }
    SEPARATOR
    " 	Alt+F5" Command(4121)
  }


***   ContextMenu::Main ***

Call("ContextMenu::Main", 1, INDEX, "STRING")
  :
    1
          .
    INDEX
         (  0).
    STRING
          (  "").

Call("ContextMenu::Main", 2, OPERATION)
  :
    2
           .
    OPERATION
       . .   Favourites().

Call("ContextMenu::Main", 10)
  :
    10
      /   .


***   ContextMenu::Show ***

Call("ContextMenu::Show", 1, "X", "Y", INDEX, "SUBMENU", *MENUHEIGHT)
  :
    1
           .
    "X"
      X     (  "-1").
    "Y"
      Y     (  "-1").
    INDEX
          .  -1,    ( ).
    "SUBMENU"
           . INDEX    -1.
    *MENUHEIGHT
        ,    .  ,    .
  :
    -  X  Y  "-1",        .
    -  X  Y  "-2",        .
    -  X  Y  "-3",        .
    -  X  Y  "-4",        .
    -  X  Y  "-5",      .
    -  X  Y  "-6",    .
    -     INDEX  0,   1  ..

Call("ContextMenu::Show", 2, "X", "Y")
  :
    2
           .
    "X"
      X     (  "-1").
    "Y"
      Y     (  "-1").
  :
    -  X  Y  "-1",        .
    -  X  Y  "-2",        .
    -  X  Y  "-3",        .
    -  X  Y  "-4",        .
    -  X  Y  "-5",      .
    -  X  Y  "-6",    .
