View Issue Details

IDProjectCategoryView StatusLast Update
0003135Far ManagerPlugins API.VMenupublic2016-07-17 21:20
ReporterJouriM Assigned To 
PrioritynormalSeveritytrivialReproducibilityalways
Status newResolutionopen 
Product Version3.0 
Summary0003135: Предлагаю добавить в меню far.Menu() возможность выделять цветом часть строки
DescriptionСобственно сабж, что позволит значительно увеличить "визуальность" отображаемой информации минимальными телоддвижениями.
Возможность реализуется приложенным патчем, который использует уже существующий в ФАРе внутренний механизм выделения
Для выделения используются символы \n \r в тесте меню
В связи с теоретической, но возможной осмысленностью их использования в тексте меню символ разделителя можно заменить на другой
Например на \b
Additional InformationДля теста прикладываю скрипт, который выводит меню с информацией по текущему диалогу с раскраской:
local function _p(f,...) return string.format(f,...) end
local function iif(e,v1,v2) if e ~= nil and e == true then return v1; else return v2; end end
local function _m(...) v,n = far.Show("{TERMINATE SCRIPT}", ...) if v ~= nil and n == 1 then _FAKECALL() end end

local types = { [0]="Label"; [3]="Border"; [4]="Edit"; [5]="EditPwd", [  6]="EditFix",[  7]="Button",[  8]="CheckBox",[  9]="Radio",[ 10]="Combo",[ 11]="List",[255]="Custom" ,
  str = function(ts,t) local v=ts[t]; return iif(v~=nil,_p("%-8s",v),_p("Unk: \n%-3d\n",t)) end
}

local m = { count=1,
  add     = function(this,t,...) this[ this.count ] = { idx = this.count, text = string.format(t,...) }; this.count = this.count+1; return this.count-1 end,
  addsep  = function(this,t) this[ this.count ] = { idx = this.count, text = t, separator=true }; this.count = this.count+1; return this.count-1 end,
  show    = function(this,t,b) if this.count > 1 then this[this.count]=nil; return far.Menu( iif(t,t,{Title="Menu"}), this, b ) else return nil,nil; end end,
  foreach = function(this,cb) for n=1,this.count-1 do if cb(this,this[n]) == false then return end end end,
  clear   = function(this) for n=#this,1,-1 do table.remove(this) end this.count = 1; end,
_=0}

Macro {
  area="Shell Editor Viewer Other Menu Dialog MainMenu UserMenu Disks"; key="CtrlShift/"; description="Display current dialog ID"; flags="";
  action = function()
  while 1 do
    m:clear()
    m:add( "   Id: \n%s\n",Dlg.Id )
    m:add( "Owner: \n%s\n",Dlg.Owner )
    m:add( "Count: \n%d\n",Dlg.ItemCount )
    m:addsep( "Items" )

    for n=1,Dlg.ItemCount do
      m:add( "%3d¦%s¦%s", n, types:str(Dlg.GetValue(n,1)), Dlg.GetValue(n,10) )
    end

    if m:show( {Title="Dialog info"} ) == nil then exit(); end
  end
  end
}
TagsNo tags attached.
Build

Activities

JouriM

2015-12-17 22:29

reporter  

menu-hilight.zip (2,211 bytes)

shmuel

2015-12-18 11:46

developer   bugnote:0014146

Неплохо бы отформатировать скрипт в "Additional Information", т.к. он совершенно нечитаемый. Или приложить его отдельным файлом.

JouriM

2015-12-19 07:09

reporter  

menu-h-test.zip (433 bytes)

JouriM

2015-12-19 07:09

reporter   bugnote:0014148

Ого его втаращило...
Как отредактировать я не нашел
Приложил отдельным файлом простенький вариант вместо того.

Issue History

Date Modified Username Field Change
2015-12-17 22:29 JouriM New Issue
2015-12-17 22:29 JouriM File Added: menu-hilight.zip
2015-12-18 11:46 shmuel Note Added: 0014146
2015-12-19 07:09 JouriM File Added: menu-h-test.zip
2015-12-19 07:09 JouriM Note Added: 0014148