home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World 2008 September
/
PCWorld_2008-09_cd.bin
/
komunikace
/
kmeleon
/
K-Meleon1.1.3en-US.exe
/
macros
/
mru.kmm
< prev
next >
Wrap
Text File
|
2007-05-04
|
3KB
|
85 lines
# K-Meleon Macros (http://kmeleon.sourceforge.net/wiki/index.php?id=MacroLanguage)
# ---------- Undo Last Closed (MRU) --------------------------------------------------------------------------------
#
# Dependencies : main.kmm ($_kLayers/$_kLayers_IsDetach, OpenURL)
# Resources : -
# Preferences : kmeleon.plugins.macros.MRU.max
# kmeleon.plugins.macros.MRU.[0,...,max-1]
#
# ------------------------------------------------------------------------------------------------------------------
MRU_Clear{
$__m=getpref(INT,$_MRU_Max); $_i=0; while($_i<$__m) &_MRU_Expunge;
}
MRU_OpenLastClosed{
menugrayed=(getpref(STRING,$_MRU_Pref."0")=="");
$OpenURL=getpref(STRING,$_MRU_Pref."0");
index($OpenURL,"\t")>0?pluginmsg(layers,AddLayersToWindow,$OpenURL):&OpenURL_InNew;
$__m=getpref(INT,$_MRU_Max);
delpref($_MRU_Pref."0"); $_i=0; while($_i<$__m) &_MRU_ShiftUp; delpref($_MRU_Pref.$__m-1);
}
# ----- PRIVATE
$_MRU_Open="";
$_MRU_Pref=$macroPrefBranch."MRU.";
$_MRU_Max=$_MRU_Pref."max";
$_MRU_Cnt=0;
_MRU_Expunge{
delpref($_MRU_Pref.$_i); $_i=$_i+1;
}
_MRU_SavePage{
$_MRU_Cnt?0:&_MRU_Save; $_MRU_Cnt?($_MRU_Cnt=$_MRU_Cnt==1?0:$_MRU_Cnt-1):0;
}
_MRU_Save{
$_j=index($URL,"about:")+index($URL,"chrome://")+index($URL,"wyciwyg://"); $_j=$_j>-3?-1:getpref(INT,$_MRU_Max)-1;
while($_j>0) &_MRU_ShiftDown; $_j==0?setpref(STRING,$_MRU_Pref."0",$URL):0;
}
_MRU_SaveGroup{
$_j=getpref(INT,$_MRU_Max)-1; while($_j>0) &_MRU_ShiftDown;
setpref(STRING,$_MRU_Pref."0",pluginmsgex(layers,GetLayersInWindow,"",STRING));
}
_MRU_ShiftDown{
$__data=getpref(STRING,$_MRU_Pref.$_j-1);
$__data==""?delpref($_MRU_Pref.$_j):setpref(STRING,$_MRU_Pref.$_j,$__data); $_j=$_j-1;
}
_MRU_ShiftUp{
$__data=getpref(STRING,$_MRU_Pref.$_i+1);
$__data==""?delpref($_MRU_Pref.$_i):setpref(STRING,$_MRU_Pref.$_i,$__data); $_i=$_i+1;
}
# Menu Integration
_MRU_BuildMenu{
# file menu
setmenu(OpenSave,macro,"&Undo Last Closed",MRU_OpenLastClosed,ID_FILE_SAVE_AS);
# context menus
$kLayers==true?setmenu(LayerButtonPopup,macro,"&Undo Last Closed",MRU_OpenLastClosed,NavLayer):0;
}
_MRU_SetAccels{
setaccel("CTRL ALT Z","macros(MRU_OpenLastClosed)");
}
$OnInit=$OnInit."_MRU_SetAccels;_MRU_BuildMenu;";
# Event Handling
_MRU_OnCloseGroup{
$_MRU_Cnt=pluginmsgex(layers,NumberOfLayersInWindow,"",INT); &_MRU_SaveGroup;
}
_MRU_OnCloseWindow{
$_kLayers_IsDetach==true?0:&_MRU_SavePage;
}
_MRU_SetDefaults{
$__m=getpref(INT,$_MRU_Max); $__m==0?setpref(INT,$_MRU_Max,5):0;
$OnCloseGroup=$OnCloseGroup."_MRU_OnCloseGroup;";
$OnCloseWindow=$OnCloseWindow."_MRU_OnCloseWindow;";
$OnQuit=$OnQuit."MRU_Clear;";
}
$OnStartup=$OnStartup."_MRU_SetDefaults;MRU_Clear;";
# ------------------------------------------------------------------------------------------------------------------
$macroModules=$macroModules."MRU;";