Skip to content
This repository has been archived by the owner on Jun 18, 2023. It is now read-only.

Commit

Permalink
增加ALMRUN_SYS内部变量,值为x86或x64
Browse files Browse the repository at this point in the history
  • Loading branch information
chenall committed Sep 16, 2014
1 parent 59b6c54 commit e559031
Show file tree
Hide file tree
Showing 15 changed files with 83 additions and 47 deletions.
6 changes: 5 additions & 1 deletion bin/config/sample/common.lua
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,11 @@ addCommand { key = "Alt+Shift+R", cmd = function()
end
DisableToggleMerryKey = not DisableToggleMerryKey
end }
--关闭当前窗口

--重新加载配置文件
addCommand{name="ReConfig",desc="重新加载配置文件",cmd = ReConfig}

--关闭当前窗口ss
--addCommand{ key = 'A-Q', cmd = function()
-- closeWindow(getForegroundWindow())
--end }
Expand Down
33 changes: 11 additions & 22 deletions bin/config/sample/plugins.lua
Original file line number Diff line number Diff line change
@@ -1,29 +1,18 @@
-- RegisterPlugin('command',{name='LUA',func = function(commandName,...)
-- local t_command = {name="执行LUA命令:"..commandName,desc="ALMRun 插件示范",order=1000}
-- if commandName:len() > 1 then
-- t_command.cmd = function(arg)
-- MessageBox(loadstring("return "..commandName)(arg))
-- end
-- end
-- return t_command
-- end})
RegisterPlugin('command',{name='LUA',func = function(commandName,...)
local t_command = {name="执行LUA命令:"..commandName,desc="ALMRun 插件示范",order=1000}
if commandName:len() > 1 then
t_command.cmd = function(arg)
MessageBox(loadstring("return "..commandName)(arg))
end
end
return t_command
end})

--order值为负数,使得这个命令的优先级比较低,也就是保持这个命令在列表尾部
RegisterPlugin('command',{func=function(commandName,...)
return {name="Run "..commandName,desc="ALMRun 运行插件",cmd = commandName,order=-1}
end})
--重新加载配置文件
RegisterPlugin('command',{name='RECONFIG',func=function(commandName,...)
return {name="ReConfig"..commandName,desc="重新加载配置文件",cmd = function(arg) ReConfig() end,order=1000}
end})
--计算器插件示范,返回多个命令,通过order值对命令进行排序,值高的排前面
RegisterPlugin('command',{name="tttttt",func=function(commandName,...)
local t_command = {}
table.insert(t_command,{name=string.format("ttttt: %s",commandName),desc="计算器插件",order=1099});
--require("alien") --1.加载alien
--libc = alien.load("Everything32.dll")
return t_command
end})

--计算器插件示范,返回多个命令,通过order值对命令进行排序,值高的排前面
RegisterPlugin('command',{name="CAL",func=function(commandName,...)
local t_command = {}
Expand Down Expand Up @@ -59,7 +48,7 @@ RegisterPlugin('command',{name="EV",func=function(commandName,...)
table.insert(t_command,{name=pre..v["NAME"],desc=v["PATH"],order=1090,cmd = 'Explorer /select, "'..v["FULL_PATH"]..'"'})
end
else
table.insert(t_command,{name=string.format("查找文件: %s",commandName),desc="",order=1099});
table.insert(t_command,{name="用Everything查找文件",desc="用Everything查找文件",order=1099});
end
return t_command
end})
Expand Down
3 changes: 3 additions & 0 deletions bin/skin/skin.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ listmargin ;;
;�б��򱳾�ͼƬ,Ĭ��skin_name_listbg.png/jpg/bmp
listpicture ;;�б���ı���ͼƬ,�����������listbackcolor����Ч.

LIST_BORDER_STYLE=0 //�б���߿���ʽ����
LIST_BORDER_WIDTH=1 //�б���߿����

listbackcolor=#ff0000 ;;�б����ֵı���ɫ
listtextcolor=#ff0000 ;;�б����ֵ�ǰ��ɫ
listfocusbgcolor=#ff0000 ;;��ǰѡ����ı�����ɫ
Expand Down
1 change: 1 addition & 0 deletions doc/config_api.md
Original file line number Diff line number Diff line change
Expand Up @@ -533,6 +533,7 @@ ALMRun 已有的事件如下:
Other 其它说明
==========
1. 内置环境变量
* ALMRUN_SYS 操作系统类型,值为x86或x64
* ALMRUN_HOME (ALMRUN程序所在目录)
* ALMRUN_DRIVE (ALMRUN程序所在磁盘比如C:)
* ALMRUN_ROOT (ALMRUN默认根目录,可用config和ROOT参数修改)
Expand Down
7 changes: 7 additions & 0 deletions doc/update.log
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
### [v1.2.0.67](https://github.com/chenall/ALMRun/archive/v1.2.0.67_BIN.zip)
一些代码调整,整合ojeo的代码,增加两个新的插件命令EV和doc.

### [v1.2.0.66](https://github.com/chenall/ALMRun/archive/v1.2.0.66_BIN.zip)
2014-08-13 修正列表框数字序列顺序显示错误的问题.
2014-08-14 界面列表框边框调整.

### [2014-08-07 v1.2.0.65]
1. 主界面右键菜单调整.

Expand Down
6 changes: 3 additions & 3 deletions src/ALMRunVersion.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#ifndef _ALMRUN_VERSION_H_
#define _ALMRUN_VERSION_H_
#define VERSION_INT 1,2,0,65
#define VERSION_STR "1,2,0,65"
#define VERSION_DATE "2014/08/07"
#define VERSION_INT 1,2,0,67
#define VERSION_STR "1,2,0,67"
#define VERSION_DATE "2014/09/16"
#endif
19 changes: 19 additions & 0 deletions src/MerryApp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,24 @@

IMPLEMENT_APP(MerryApp)

#ifdef __WXMSW__
BOOL IsX64()
{
typedef void (WINAPI *PGNSI)(LPSYSTEM_INFO);
BOOL bX64 = FALSE;
SYSTEM_INFO si;
PGNSI pGNSI;
ZeroMemory(&si, sizeof(SYSTEM_INFO));
pGNSI = (PGNSI) GetProcAddress(GetModuleHandle(_T("kernel32.dll")), "GetNativeSystemInfo");
if(NULL != pGNSI)
pGNSI(&si);
else
GetSystemInfo(&si);
if(si.wProcessorArchitecture==PROCESSOR_ARCHITECTURE_AMD64 )
bX64 = true;
return bX64;
}
#endif
bool MerryApp::OnInit()
{
const wxString name = wxString::Format("ALMRun-%s", wxGetUserId().c_str());
Expand Down Expand Up @@ -67,6 +85,7 @@ bool MerryApp::OnInit()
::wxSetEnv(wxT("ALMRUN_DRIVE"),volume.c_str());
}
::wxSetWorkingDirectory(pathTmp);
::wxSetEnv(wxT("ALMRUN_SYS"),IsX64()?"x64":"x86");
//pathTmp.Clear();
//volume.Clear();
#endif
Expand Down
1 change: 1 addition & 0 deletions src/MerryFrame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ wxFrame(NULL, wxID_ANY,ALMRUN_DEFAULT_TITLE, wxDefaultPosition, wxDefaultSize, w
skin = new SkinConfig();
if (skin->get(SHOW_WINDOW))
this->SetWindowStyleFlag(wxCLOSE_BOX | wxCAPTION);// | wxBORDER_NONE);

this->SetClientSize(skin->get(MAIN_WIDTH),skin->get(MAIN_HEIGHT));
wxFont font = this->GetFont();

Expand Down
43 changes: 24 additions & 19 deletions src/MerryListBoxPanel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,15 +46,16 @@ MerryListBoxPanel::MerryListBoxPanel(wxWindow* parent):
this->SetOwnFont(font);
}

border_width = skin->get(LIST_BORDER_WIDTH);
item_height = skin->get(LIST_ITEM_HEIGHT);
item_width = skin->get(LIST_BOX_WIDTH);
item_width = skin->get(LIST_BOX_WIDTH) - border_width * 2;
list_fmt = skin->get(LIST_FMT);
int left = skin->get(LIST_BOX_LEFT);

for (int i=0; i<=MERRY_DEFAULT_LIST_BOX_ITEM_MAX_NUM; ++i)
{
m_items[i].x = 0;
m_items[i].y = item_height * i;
m_items[i].x = border_width;
m_items[i].y = item_height * i + border_width;
m_items[i].width = item_width;
m_items[i].height = item_height;
}
Expand Down Expand Up @@ -328,23 +329,31 @@ void MerryListBoxPanel::OnPaintEvent(wxPaintEvent& e)
void MerryListBoxPanel::DrawBorder(MerryPaintDC& dc) const
{
wxPoint p[4];
p[0].x = 0;
p[0].y = 0;
if (!border_width)
return;
int bw = border_width/2;
if (!bw)
++bw;
p[0].x = bw;
p[0].y = bw;

p[1].x = this->GetClientSize().x - 2;
p[1].y = 0;
p[1].x = this->GetClientSize().x - bw;
p[1].y = bw;

p[2].x = 0;
p[2].y = this->GetClientSize().y - 2;
p[2].x = bw;
p[2].y = this->GetClientSize().y - bw;

p[3].x = p[1].x;
p[3].y = p[2].y;

dc.SetPen(wxPen(skin->get(WINDOW_COLOR),2,wxPENSTYLE_SOLID));
p[4].y = p[2].y - item_height - border_width;
dc.SetPen(wxPen(skin->get(WINDOW_COLOR),border_width,skin->get(LIST_BORDER_STYLE)));
dc.DrawLine(p[0],p[1]);
dc.DrawLine(p[0],p[2]);
dc.DrawLine(p[1],p[3]);
dc.DrawLine(p[2],p[3]);

if (g_config->get(ShowCommandLine))
dc.DrawLine(bw,p[4].y,p[1].x,p[4].y);
}

void MerryListBoxPanel::DrawBackground(MerryPaintDC& dc) const
Expand Down Expand Up @@ -376,8 +385,6 @@ void MerryListBoxPanel::DrawItem(MerryPaintDC& dc,size_t item)
if (!command)
return;

int i = (g_config->get(IndexFrom0to9))?item:(item==9?0:item+1);

wxString fmt = skin->get(LIST_FMT);
wxString label = "";
for(size_t i=0;i<fmt.size();++i)
Expand All @@ -390,7 +397,7 @@ void MerryListBoxPanel::DrawItem(MerryPaintDC& dc,size_t item)
switch(c)
{
case '$':
label += wxString::Format("%*d",skin->get(LISTFMT_NUM_MAX),item);
label += wxString::Format("%*d",skin->get(LISTFMT_NUM_MAX),g_config->get(IndexFrom0to9)?item:(item+1)%10);
break;
case 'i':
label +=wxString::Format("%*d",skin->get(LISTFMT_ID_MAX),command->GetCommandID());
Expand Down Expand Up @@ -467,9 +474,7 @@ void MerryListBoxPanel::DrawItems(MerryPaintDC& dc)
dc.SetFont(font);
dc.SetBackgroundMode(wxPENSTYLE_TRANSPARENT);
dc.SetTextForeground(skin->get(TEXT_COLOR));
rect.x += 4;
rect.y += 8;
rect.width -= 8;
rect.y += border_width;
dc.DrawRectangle(rect);
dc.DrawLabel(title,rect,wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL);
}
Expand All @@ -491,9 +496,9 @@ void MerryListBoxPanel::SetHeight(int height)
int MerryListBoxPanel::CalcHeight() const
{
const int ITEM_NUM = this->GetVisibleItemNum();
int height = ITEM_NUM * item_height + 4;
int height = ITEM_NUM * item_height + border_width * 2;
if (g_config->get(ShowCommandLine))
height += item_height + 12;
height += item_height + border_width;
return height;
}

Expand Down
1 change: 1 addition & 0 deletions src/MerryListBoxPanel.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ class MerryListBoxPanel : public wxPanel
int m_selectionCommandIndex;
int item_height;
int item_width;
int border_width;
wxMenu* menu;

wxRect m_items[MERRY_DEFAULT_LIST_BOX_ITEM_MAX_NUM+1];
Expand Down
8 changes: 6 additions & 2 deletions src/SkinConfig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ SkinConfig::SkinConfig()
config[LISTFMT_ID_MAX] = 5;
config[LISTFMT_NUM_MAX] = 2;
config[TITLE_ALIGN] = -1;
config[LIST_BORDER_STYLE] = 0;
config[LIST_BORDER_WIDTH] = 1;
//default custom config;
custom[DEFAULT_TITLE] =wxT("ALMRun");
custom[LIST_FMT] = "$$. $N";
Expand Down Expand Up @@ -80,7 +82,7 @@ SkinConfig::SkinConfig()
if (config[MAIN_WIDTH] == 0)
config[MAIN_WIDTH] = img.GetWidth()+1;
if (config[MAIN_HEIGHT] == 0)
config[MAIN_HEIGHT] = img.GetHeight()+2;
config[MAIN_HEIGHT] = img.GetHeight()+1;
if (config[EDIT_CTRL_TOP] == 0)
config[EDIT_CTRL_TOP] = (img.GetHeight() - config[FONT_SIZE])/2 - 2;
if (config[EDIT_CTRL_LEFT] == 0)
Expand All @@ -98,14 +100,16 @@ SkinConfig::SkinConfig()

if (config[LIST_BOX_WIDTH] <=0 )
config[LIST_BOX_WIDTH] = config[MAIN_WIDTH] - config[LIST_BOX_LEFT];

config[LIST_BORDER_STYLE] += 100;
};

void SkinConfig::read_config()
{
const char* skin_cfg_str[]={"SHOWWINDOW",
"fontsize","fontbold",
"editleft","edittop","editwidth","editheight",
"listtop","listwidth","listleft","listfontsize","listmargin","LISTFMT_NAME_MAX","LISTFMT_DESC_MAX","LISTFMT_KEY_MAX","LISTFMT_CMD_MAX", "LISTFMT_ID_MAX","LISTFMT_NUM_MAX",
"listtop","listwidth","listleft","listfontsize","LIST_BORDER_STYLE","LIST_BORDER_WIDTH","listmargin","LISTFMT_NAME_MAX","LISTFMT_DESC_MAX","LISTFMT_KEY_MAX","LISTFMT_CMD_MAX", "LISTFMT_ID_MAX","LISTFMT_NUM_MAX",
"titleleft","titletop","titlewidth","titleheight"};
const char* skin_color_str[]={"TEXTCOLOR","TEXTBACKCOLOR","WINDOWCOLOR","LISTFOCUSBGCOLOR","listfocustextcolor","LISTBACKCOLOR","LISTTEXTCOLOR","LISTTITLECOLOR","titletextcolor","BUTTONARROWCOLOR","BUTTONOUTLINECOLOR","BUTTONFILLCOLOR"};
wxString Home;
Expand Down
2 changes: 2 additions & 0 deletions src/SkinConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ typedef enum _skin_config
LIST_BOX_WIDTH,
LIST_BOX_LEFT,
LIST_FONT_SIZE,
LIST_BORDER_STYLE,
LIST_BORDER_WIDTH,
LIST_ITEM_MARGIN,

LISTFMT_NAME_MAX,
Expand Down
Binary file modified third_party/Everything-SDK/lib/Everything.lib
Binary file not shown.
Binary file removed third_party/Everything-SDK/lib/Everything32.lib
Binary file not shown.
Binary file removed third_party/Everything-SDK/lib/Everything64.lib
Binary file not shown.

0 comments on commit e559031

Please sign in to comment.